:root {
  --bg: #f5f7f7;
  --surface: #ffffff;
  --surface-soft: #edf5f4;
  --line: #d9e2e1;
  --line-strong: #c5d2d0;
  --text: #1f2b2f;
  --muted: #657477;
  --muted-2: #8b999b;
  --teal: #087b8f;
  --teal-dark: #075c6b;
  --green: #52a565;
  --green-soft: #e5f3e8;
  --amber: #f19532;
  --red: #e05c52;
  --dark: #0d1417;
  --dark-2: #172126;
  --shadow: 0 12px 30px rgba(15, 40, 45, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 15px;
  letter-spacing: 0;
  overflow-x: hidden;
}

body.portal-active {
  overflow: hidden;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

input {
  min-width: 0;
}

.auth-portal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: block;
  overflow-y: auto;
  padding: 24px;
  background: #061014;
  color: #f3fbfc;
}

.auth-portal[hidden] {
  display: none;
}

#portalCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.auth-portal::after {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(6, 16, 20, 0.92), rgba(6, 16, 20, 0.55) 54%, rgba(6, 16, 20, 0.88)),
    repeating-linear-gradient(90deg, rgba(119, 232, 242, 0.08) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(0deg, rgba(119, 232, 242, 0.06) 0 1px, transparent 1px 88px);
  pointer-events: none;
}

.portal-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, 100%);
  margin: 0 auto;
  padding-bottom: 42px;
}

.portal-header {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  grid-template-columns: minmax(210px, 1fr) auto minmax(210px, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 68px;
  margin-bottom: 34px;
  padding: 10px 0;
  backdrop-filter: blur(14px);
}

.portal-spo-logo {
  display: block;
  width: clamp(150px, 16vw, 220px);
  max-width: 42vw;
  height: auto;
  opacity: 0.96;
  margin-bottom: 2px;
  filter: drop-shadow(0 8px 20px rgba(82, 218, 235, 0.1));
}

.portal-brand-lockup,
.portal-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.portal-brand-lockup strong {
  display: block;
  color: #f4fbfc;
  font-size: 18px;
}

.portal-brand-lockup span {
  display: block;
  margin-top: 3px;
  color: #8ba3a8;
  font-size: 12px;
  font-weight: 800;
}

.portal-header-logo {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 10px;
  background: linear-gradient(150deg, rgba(6, 109, 127, 0.94), rgba(32, 171, 142, 0.94));
  color: #ffffff;
  font-size: 21px;
  font-weight: 900;
  cursor: pointer;
  user-select: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.portal-header-logo:active {
  transform: scale(0.97);
}

.portal-header-logo.has-logo {
  background-repeat: no-repeat;
  background-size: 92%;
  background-position: center;
  color: transparent;
}

.portal-nav-links {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 5px;
  border: 1px solid rgba(112, 220, 231, 0.16);
  border-radius: 999px;
  background: rgba(5, 16, 20, 0.42);
}

.portal-nav-links a {
  padding: 8px 12px;
  border-radius: 999px;
  color: #b9c9cc;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.portal-nav-links a:hover {
  background: rgba(112, 220, 231, 0.11);
  color: #f3fbfc;
}

.portal-header-actions {
  justify-content: flex-end;
}

.portal-signin-button {
  min-height: 38px;
  padding: 0 18px;
  border: 1px solid rgba(119, 240, 184, 0.42);
  border-radius: 999px;
  background: linear-gradient(135deg, #0b7f92, #12a883);
  color: #ffffff;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(18, 168, 131, 0.22);
}

.portal-assessment-button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid rgba(112, 220, 231, 0.28);
  border-radius: 999px;
  background: rgba(5, 16, 20, 0.5);
  color: #dff8fb;
  font-weight: 900;
}

.portal-assessment-button:hover {
  border-color: rgba(119, 240, 184, 0.46);
  background: rgba(25, 132, 145, 0.22);
}

.portal-grid {
  display: grid;
  grid-template-columns: minmax(380px, 0.92fr) minmax(430px, 1.08fr);
  gap: 46px;
  align-items: center;
  min-height: min(720px, calc(100vh - 126px));
  margin-bottom: 30px;
}

.portal-copy {
  display: grid;
  gap: 18px;
}

.portal-language,
.settings-language {
  display: inline-flex;
  width: fit-content;
  overflow: hidden;
  border: 1px solid rgba(112, 220, 231, 0.24);
  border-radius: 999px;
  background: rgba(5, 16, 20, 0.5);
}

.portal-language button,
.settings-language button {
  min-height: 30px;
  border: 0;
  background: transparent;
  color: #91a7aa;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 900;
}

.portal-language button.active,
.settings-language button.active {
  background: #52d7e6;
  color: #061014;
}

.portal-kicker {
  color: #70dce7;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.portal-copy h1 {
  max-width: 720px;
  margin: 0;
  font-size: clamp(62px, 8vw, 112px);
  line-height: 0.86;
  letter-spacing: 0;
}

.portal-copy p {
  max-width: 620px;
  margin: 0;
  color: #b9c9cc;
  font-size: 18px;
  line-height: 1.65;
}

.portal-credential-card {
  position: relative;
  display: grid;
  gap: 8px;
  max-width: 620px;
  padding: 16px 18px;
  overflow: hidden;
  border: 1px solid rgba(112, 220, 231, 0.22);
  border-left: 4px solid #52d7e6;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(82, 215, 230, 0.12), rgba(119, 240, 184, 0.07)),
    rgba(4, 17, 22, 0.72);
  box-shadow: inset 0 0 40px rgba(82, 215, 230, 0.06);
}

.portal-credential-card::after {
  content: "";
  position: absolute;
  top: -42px;
  right: -38px;
  width: 108px;
  height: 108px;
  border: 1px solid rgba(119, 240, 184, 0.16);
  border-radius: 50%;
}

.portal-credential-card strong {
  position: relative;
  z-index: 1;
  color: #f3fbfc;
  font-size: 18px;
  line-height: 1.45;
}

.portal-credential-card p {
  position: relative;
  z-index: 1;
  max-width: none;
  color: #a9bdc1;
  font-size: 14px;
  line-height: 1.55;
}

.portal-hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.portal-primary-cta {
  min-height: 44px;
  padding: 0 20px;
  border-radius: 8px;
}

.portal-hero-actions span {
  max-width: 360px;
  color: #91a7aa;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.portal-visual {
  display: grid;
  justify-items: center;
  gap: 16px;
}

.kinpost-figure-stage {
  position: relative;
  overflow: hidden;
  width: min(640px, 100%);
  aspect-ratio: 1.1 / 1;
  border: 1px solid rgba(112, 220, 231, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(122, 245, 190, 0.08), transparent 18%, transparent 82%, rgba(82, 218, 235, 0.1)),
    radial-gradient(circle at 50% 43%, rgba(82, 218, 235, 0.2), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.012));
  box-shadow:
    inset 0 0 72px rgba(82, 218, 235, 0.1),
    0 28px 90px rgba(2, 11, 15, 0.24);
}

#humanScanCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 18px rgba(82, 218, 235, 0.15));
}

.scan-label {
  position: absolute;
  min-width: 126px;
  padding: 8px 10px;
  border: 1px solid rgba(112, 220, 231, 0.22);
  border-radius: 6px;
  background: rgba(5, 16, 20, 0.62);
  color: #dff9fb;
  font-size: 12px;
  font-weight: 900;
}

.scan-label-top {
  top: 18px;
  left: 18px;
}

.scan-label-bottom {
  right: 18px;
  bottom: 18px;
}

.portal-signal {
  position: relative;
  width: min(620px, 100%);
  height: 86px;
  border: 1px solid rgba(112, 220, 231, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    repeating-linear-gradient(90deg, transparent 0 48px, rgba(112, 220, 231, 0.08) 49px 50px);
}

.portal-signal span {
  position: absolute;
  left: 26px;
  right: 26px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #52d7e6, #77f0b8, transparent);
  animation: signalSweep 3.6s linear infinite;
}

.portal-signal span:nth-child(1) {
  top: 22px;
}

.portal-signal span:nth-child(2) {
  top: 42px;
  animation-delay: 0.8s;
}

.portal-signal span:nth-child(3) {
  top: 62px;
  animation-delay: 1.6s;
}

@keyframes signalSweep {
  0% {
    transform: scaleX(0.1) translateX(-28%);
    opacity: 0;
  }
  18%,
  72% {
    opacity: 1;
  }
  100% {
    transform: scaleX(1) translateX(22%);
    opacity: 0;
  }
}

.portal-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 150px));
  gap: 12px;
}

.portal-metrics article,
.login-panel,
.brand-sheet {
  border: 1px solid rgba(177, 218, 222, 0.18);
  background: rgba(11, 25, 31, 0.78);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(18px);
}

.portal-metrics article {
  min-height: 82px;
  padding: 14px;
  border-radius: 8px;
}

.portal-metrics strong {
  display: block;
  color: #f4fbfc;
  font-size: 24px;
}

.portal-metrics span {
  display: block;
  margin-top: 8px;
  color: #93a9ad;
  font-size: 12px;
  font-weight: 800;
}

.portal-intro,
.portal-workflow {
  position: relative;
  z-index: 1;
  margin-top: 18px;
}

.portal-section-heading {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin-bottom: 18px;
}

.portal-section-heading.compact {
  max-width: none;
}

.portal-section-heading span {
  color: #70dce7;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.portal-section-heading h2 {
  margin: 0;
  color: #f4fbfc;
  font-size: clamp(26px, 3vw, 42px);
  line-height: 1.1;
}

.portal-section-heading p,
.portal-feature-grid p,
.workflow-steps p {
  margin: 0;
  color: #a7b9bd;
  line-height: 1.68;
}

.portal-feature-grid,
.workflow-steps {
  display: grid;
  gap: 12px;
}

.portal-feature-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.workflow-steps {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.portal-feature-grid article,
.workflow-steps article {
  border: 1px solid rgba(177, 218, 222, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018)),
    rgba(8, 20, 25, 0.72);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px);
}

.portal-feature-grid article {
  min-height: 174px;
  padding: 18px;
}

.portal-feature-grid strong,
.workflow-steps strong {
  display: block;
  color: #f4fbfc;
  font-size: 17px;
}

.portal-feature-grid p {
  margin-top: 12px;
  font-size: 14px;
}

.workflow-steps article {
  min-height: 132px;
  padding: 18px;
}

.workflow-steps span {
  display: block;
  margin-bottom: 14px;
  color: #77f0b8;
  font-size: 13px;
  font-weight: 900;
}

.workflow-steps p {
  margin-top: 10px;
  font-size: 14px;
}

.login-panel {
  padding: 26px;
  border-radius: 8px;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  padding: 92px 40px 32px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.login-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.login-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(1, 8, 11, 0.48);
  cursor: default;
}

.login-overlay .login-panel {
  position: relative;
  width: min(430px, calc(100vw - 32px));
  transform: translateX(28px);
  transition: transform 220ms ease;
}

.login-overlay.open .login-panel {
  transform: translateX(0);
}

.login-close-button {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(112, 220, 231, 0.2);
  border-radius: 8px;
  background: rgba(5, 16, 20, 0.72);
  color: #dff9fb;
  font-size: 24px;
  line-height: 1;
}

.login-brand,
.brand-preview-panel {
  display: flex;
  align-items: center;
  gap: 14px;
}

.portal-logo-preview,
.org-logo-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  flex: 0 0 auto;
  background: linear-gradient(150deg, rgba(6, 109, 127, 0.94), rgba(32, 171, 142, 0.94));
  color: #ffffff;
  font-weight: 900;
}

.portal-logo-preview {
  width: 54px;
  height: 54px;
  border-radius: 8px;
  font-size: 25px;
}

.org-logo-preview {
  width: 64px;
  height: 64px;
  border-radius: 9px;
  font-size: 29px;
}

.portal-logo-preview.has-logo,
.org-logo-preview.has-logo,
.brand-mark.has-logo {
  background-repeat: no-repeat;
  background-size: 84%;
  background-position: center;
  color: transparent;
}

.login-brand strong {
  display: block;
  font-size: 19px;
}

.login-brand span {
  display: block;
  margin-top: 5px;
  color: #91a7aa;
  font-size: 12px;
}

.login-form,
.brand-form {
  display: grid;
  gap: 15px;
  margin-top: 24px;
}

.login-form label,
.brand-form label {
  display: grid;
  gap: 8px;
  color: #9fb2b5;
  font-size: 12px;
  font-weight: 800;
}

.login-form input,
.brand-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(169, 200, 205, 0.28);
  border-radius: 6px;
  background: rgba(5, 16, 20, 0.62);
  color: #f4fbfc;
  padding: 0 12px;
  outline: none;
}

.login-form input:focus,
.brand-form input:focus {
  border-color: #52d7e6;
  box-shadow: 0 0 0 3px rgba(82, 215, 230, 0.16);
}

.portal-login-button {
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
}

.login-status,
.brand-hint {
  margin: 0;
  color: #91a7aa;
  font-size: 12px;
  line-height: 1.55;
}

.login-status[data-tone="error"],
.brand-hint[data-tone="error"] {
  color: #ffb0aa;
}

.login-status[data-tone="ok"],
.brand-hint[data-tone="ok"] {
  color: #8ef0b8;
}

.admin-overlay {
  position: fixed;
  inset: 0;
  z-index: 9;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 26px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 180ms ease, visibility 180ms ease;
}

.admin-overlay.open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.admin-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(1, 8, 11, 0.72);
  backdrop-filter: blur(10px);
}

.admin-panel {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  max-height: min(88vh, 860px);
  overflow: auto;
  padding: 28px;
  border: 1px solid rgba(112, 220, 231, 0.2);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(9, 26, 31, 0.98), rgba(2, 15, 18, 0.98)),
    repeating-linear-gradient(90deg, rgba(112, 220, 231, 0.04) 0 1px, transparent 1px 72px);
  color: #eefcff;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.admin-close-button {
  top: 18px;
  right: 18px;
}

.admin-panel-header {
  padding-right: 46px;
  border-bottom: 1px solid rgba(112, 220, 231, 0.14);
  padding-bottom: 20px;
}

.admin-panel-header span {
  color: #63dce8;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-panel-header h2 {
  margin: 8px 0 8px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.05;
}

.admin-panel-header p {
  max-width: 620px;
  color: #9fb2b5;
  font-size: 14px;
}

.admin-login-view {
  max-width: 460px;
}

.admin-dashboard-view {
  margin-top: 22px;
}

.admin-dashboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-dashboard-head strong {
  display: block;
  font-size: 22px;
}

.admin-dashboard-head span {
  display: block;
  margin-top: 4px;
  color: #91a7aa;
  font-size: 13px;
  font-weight: 800;
}

.admin-org-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(112, 220, 231, 0.15);
  border-radius: 8px;
  background: rgba(5, 16, 20, 0.58);
}

.admin-org-form label {
  display: grid;
  gap: 8px;
  color: #9fb2b5;
  font-size: 12px;
  font-weight: 900;
}

.admin-org-form input {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(169, 200, 205, 0.28);
  border-radius: 6px;
  background: rgba(2, 12, 15, 0.74);
  color: #f4fbfc;
  padding: 0 12px;
  outline: none;
}

.admin-org-form input:focus {
  border-color: #52d7e6;
  box-shadow: 0 0 0 3px rgba(82, 215, 230, 0.16);
}

.admin-form-actions {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.admin-organization-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.admin-empty-state,
.admin-organization-card {
  border: 1px solid rgba(169, 200, 205, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.admin-empty-state {
  display: grid;
  gap: 6px;
  padding: 20px;
  color: #9fb2b5;
}

.admin-empty-state strong {
  color: #eefcff;
  font-size: 18px;
}

.admin-organization-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 16px;
}

.admin-org-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.admin-org-title strong {
  font-size: 18px;
}

.admin-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.admin-status-pill.active {
  background: rgba(70, 197, 124, 0.16);
  color: #8ef0b8;
}

.admin-status-pill.pending {
  background: rgba(242, 151, 43, 0.14);
  color: #ffc270;
}

.admin-status-pill.expired {
  background: rgba(210, 73, 67, 0.16);
  color: #ffaaa4;
}

.admin-status-pill.inactive {
  background: rgba(169, 200, 205, 0.14);
  color: #b5c4c7;
}

.admin-org-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 9px;
  color: #aababe;
  font-size: 13px;
  font-weight: 800;
}

.admin-org-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-org-actions input {
  width: 170px;
  min-height: 38px;
  border: 1px solid rgba(169, 200, 205, 0.28);
  border-radius: 6px;
  background: rgba(2, 12, 15, 0.74);
  color: #f4fbfc;
  padding: 0 10px;
  outline: none;
}

.admin-org-actions input:focus {
  border-color: #52d7e6;
  box-shadow: 0 0 0 3px rgba(82, 215, 230, 0.16);
}

.ghost-button.danger {
  border-color: rgba(210, 73, 67, 0.35);
  color: #ffb0aa;
}

.app-shell {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 88px;
  padding: 18px 16px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  overflow: hidden;
  width: 44px;
  height: 44px;
  border-radius: 7px;
  background: linear-gradient(150deg, #096d7f, #0c918a);
  color: #fff;
  font-weight: 800;
  font-size: 23px;
}

.brand strong,
.clinician-card strong,
.client-card strong {
  display: block;
  font-weight: 700;
}

.brand span,
.clinician-card span,
.client-card span,
.session-strip span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 0;
}

.home-return-button {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 46px;
  margin: 12px 14px 0;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--teal-dark);
  text-align: left;
  font-weight: 800;
}

.home-return-button:hover {
  border-color: rgba(10, 132, 148, 0.35);
  background: var(--surface-soft);
}

.home-return-button .nav-icon {
  flex: 0 0 auto;
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 0 18px;
  border: 0;
  border-left: 4px solid transparent;
  background: transparent;
  color: #39484c;
  text-align: left;
}

.nav-item.active {
  border-left-color: var(--teal);
  background: var(--surface-soft);
  color: var(--teal-dark);
  font-weight: 700;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: inherit;
  font-size: 12px;
  font-weight: 800;
}

.clinician-card {
  display: grid;
  grid-template-columns: 42px 1fr 8px;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.avatar,
.client-photo {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dae7e8;
  color: #22545b;
  font-weight: 800;
}

.avatar {
  width: 42px;
  height: 42px;
}

.client-photo {
  width: 38px;
  height: 38px;
}

.status-dot,
.quality-dot,
.recording-dot {
  display: inline-block;
  border-radius: 50%;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--green);
}

.workspace {
  min-width: 0;
}

.workspace-section {
  display: none;
}

.workspace-section.active {
  display: block;
}

.workspace-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 124px;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.workspace-page-header h1 {
  margin: 6px 0 8px;
  font-size: clamp(28px, 4vw, 46px);
  line-height: 1.02;
  letter-spacing: 0;
}

.workspace-page-header p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.workspace-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.56fr);
  gap: 18px;
  padding: 22px;
}

.clients-layout {
  align-items: start;
}

.management-panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(15, 40, 45, 0.06);
}

.workspace-section > .management-panel {
  margin: 22px;
}

.workspace-search,
.client-form input,
.client-form textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  outline: none;
}

.workspace-search {
  min-height: 42px;
  margin-bottom: 14px;
  padding: 0 12px;
}

.workspace-search:focus,
.client-form input:focus,
.client-form textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(8, 123, 143, 0.12);
}

.client-form {
  display: grid;
  gap: 14px;
}

.client-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.client-form input,
.client-form textarea {
  min-height: 40px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  resize: vertical;
}

.form-row {
  display: grid;
  gap: 12px;
}

.form-row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.form-actions,
.record-actions,
.client-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.compact {
  min-height: 32px;
  padding: 0 12px;
  font-size: 12px;
}

.client-management-list,
.record-list,
.history-timeline,
.settings-check-list {
  display: grid;
  gap: 12px;
}

.client-management-card,
.record-card,
.history-item {
  display: grid;
  gap: 14px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.client-management-card {
  grid-template-columns: 46px minmax(0, 1fr) auto;
  align-items: center;
}

.client-management-card.active {
  border-color: rgba(8, 123, 143, 0.5);
  background: #eff9fa;
  box-shadow: inset 4px 0 0 var(--teal);
}

.client-management-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #d9ebec;
  color: var(--teal-dark);
  font-size: 18px;
  font-weight: 900;
}

.client-management-main,
.record-main,
.history-body {
  min-width: 0;
}

.client-management-main header,
.record-main header,
.history-body header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.client-management-main strong,
.record-main strong,
.history-body strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 16px;
}

.client-management-main header span,
.history-body header span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.client-management-main p,
.record-main p,
.history-body p {
  margin: 8px 0 10px;
  color: var(--muted);
  line-height: 1.55;
}

.record-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.record-meta-row span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  font-size: 12px;
}

.record-card {
  grid-template-columns: 72px minmax(0, 1fr) auto;
  align-items: center;
}

.record-score {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #ffffff 0 55%, transparent 57%),
    conic-gradient(var(--teal) 0 78%, #dfe8e7 78% 100%);
  color: var(--teal-dark);
  font-size: 22px;
  font-weight: 900;
}

.mode-badge {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.mode-badge.static {
  background: #edf5f4;
  color: #355f66;
}

.mode-badge.gait {
  background: #eaf3ff;
  color: #28547a;
}

.mode-badge.adams {
  background: #fff4e8;
  color: #8a5624;
}

.history-item {
  position: relative;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: start;
}

.history-marker {
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border: 3px solid #d7f2ec;
  border-radius: 50%;
  background: var(--teal);
  box-shadow: 0 0 0 1px rgba(8, 123, 143, 0.2);
}

.history-item::before {
  content: "";
  position: absolute;
  left: 21px;
  top: 34px;
  bottom: -14px;
  width: 1px;
  background: var(--line);
}

.history-item:last-child::before {
  display: none;
}

.settings-summary-panel {
  display: flex;
  align-items: center;
  gap: 16px;
}

.org-logo-preview.small {
  width: 72px;
  height: 72px;
  border-radius: 10px;
}

.settings-summary-panel strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
}

.settings-summary-panel p {
  margin: 6px 0 0;
  color: var(--muted);
}

.settings-check-list article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfd;
}

.settings-check-list strong,
.settings-check-list span {
  display: block;
}

.settings-check-list span {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.55;
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fbfdfd;
  color: var(--muted);
  text-align: center;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(230px, 0.8fr) minmax(230px, 1fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 88px;
  padding: 12px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.section-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.client-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.session-strip {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.session-strip strong {
  display: block;
  margin-top: 8px;
}

.action-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.ghost-button,
.primary-button,
.menu-button,
.play-button,
.rail-button,
.mode-tab {
  min-height: 38px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--text);
  white-space: nowrap;
}

.ghost-button,
.primary-button,
.play-button {
  padding: 0 14px;
}

.ghost-button:hover,
.rail-button:hover,
.mode-tab:hover,
.play-button:hover {
  border-color: var(--teal);
  color: var(--teal-dark);
}

.primary-button {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
  font-weight: 700;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.menu-button {
  width: 38px;
  border-color: transparent;
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.mode-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 12px 22px 10px;
}

.mode-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  min-width: 132px;
  background: var(--surface);
  color: #405056;
}

.mode-tab.active {
  border-color: var(--teal);
  background: #eef9fa;
  color: var(--teal-dark);
  font-weight: 800;
}

.mode-symbol {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: #dbe9e8;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.static-view-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px 14px;
  background: var(--surface);
}

.static-view-bar[hidden] {
  display: none;
}

.static-view-bar > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.static-view-button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text);
  font-weight: 700;
}

.static-view-button.active {
  border-color: var(--teal);
  background: #eef9fa;
  color: var(--teal-dark);
  box-shadow: inset 0 0 0 1px rgba(8, 123, 143, 0.12);
}

.quality-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
}

.quality-dot {
  width: 7px;
  height: 7px;
  margin-right: -4px;
}

.quality-dot.ok {
  background: var(--green);
}

.quality-dot.warn {
  background: var(--amber);
}

.camera-notice {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  align-items: center;
  gap: 12px;
  margin: 0 22px 12px;
  padding: 11px 14px;
  border: 1px solid #f0c38b;
  border-radius: 6px;
  background: #fff7ed;
  color: #5e4325;
}

.camera-notice[hidden] {
  display: none;
}

.camera-notice strong {
  color: #9b5819;
}

.camera-notice span {
  white-space: pre-line;
}

.camera-notice a {
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: none;
}

.camera-notice button {
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
}

.camera-notice .camera-notice-action {
  width: auto;
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(8, 123, 143, 0.35);
  border-radius: 5px;
  background: #ffffff;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
}

.camera-notice .camera-notice-action[hidden] {
  display: none;
}

.camera-notice .camera-notice-action:hover {
  border-color: var(--teal);
  background: #eef9fa;
}

.camera-notice #cameraNoticeClose {
  width: 28px;
  height: 28px;
  border-radius: 5px;
  color: #7a5a35;
  font-size: 20px;
}

.camera-notice #cameraNoticeClose:hover {
  background: rgba(122, 90, 53, 0.1);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  padding: 0 22px 22px;
}

.analysis-panel {
  min-width: 0;
}

.viewer {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  min-height: 420px;
  border: 1px solid #1b2b30;
  background: #071015;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.media-layer,
#overlayCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.media-layer {
  display: none;
  object-fit: cover;
  background: #071015;
}

.media-layer.visible {
  display: block;
}

#overlayCanvas {
  z-index: 3;
  pointer-events: none;
}

#angleChart,
#trackingPlot {
  display: block;
  width: 100%;
}

.viewer::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.44), transparent 28%, transparent 72%, rgba(0, 0, 0, 0.38)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.22), transparent 50%, rgba(0, 0, 0, 0.34));
  pointer-events: none;
}

.viewer-status,
.frame-chip,
.zoom-stack,
.tool-rail {
  position: absolute;
  z-index: 4;
}

.viewer-status {
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #d8e6e7;
  font-size: 12px;
}

.recording-dot {
  width: 7px;
  height: 7px;
  background: #45dd7d;
  box-shadow: 0 0 0 4px rgba(69, 221, 125, 0.12);
}

.frame-chip {
  top: 14px;
  right: 14px;
  padding: 8px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(15, 24, 29, 0.72);
  color: #e6f2f3;
  font-size: 12px;
  backdrop-filter: blur(10px);
}

.tool-rail {
  top: 74px;
  left: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: rgba(14, 24, 29, 0.74);
  backdrop-filter: blur(12px);
}

.rail-button {
  width: 58px;
  min-height: 58px;
  padding: 4px 0;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 0;
  background: transparent;
  color: #e2eef0;
  font-size: 13px;
}

.rail-button:last-child {
  border-bottom: 0;
}

.rail-button.active {
  background: rgba(8, 123, 143, 0.88);
  color: #fff;
  font-weight: 800;
}

.zoom-stack {
  right: 18px;
  bottom: 94px;
  display: grid;
  grid-template-rows: 34px 38px 34px;
  overflow: hidden;
  width: 46px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  background: rgba(15, 24, 29, 0.72);
  color: #e6f2f3;
  text-align: center;
  backdrop-filter: blur(10px);
}

.zoom-stack button {
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 20px;
}

.zoom-stack span {
  align-content: center;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 11px;
}

.transport {
  display: grid;
  grid-template-columns: auto auto 72px minmax(140px, 1fr) 126px;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: #0b151a;
  color: #dce8ea;
}

.play-button {
  min-height: 34px;
  border-color: rgba(255, 255, 255, 0.18);
  background: #17232a;
  color: #edf7f8;
}

.transport select {
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  background: #17232a;
  color: #edf7f8;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--teal);
}

#timeLabel {
  color: #c7d4d6;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.timeline {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(52px, 1fr);
  gap: 7px;
  overflow-x: auto;
  padding: 14px 24px;
  background: #0b151a;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.frame-thumb {
  display: grid;
  gap: 5px;
  padding: 4px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  background: #152228;
  color: #cad7d9;
  text-align: center;
  font-size: 12px;
}

.frame-thumb.active {
  border-color: #4ad7ee;
  box-shadow: 0 0 0 2px rgba(74, 215, 238, 0.18);
}

.thumb-image {
  position: relative;
  overflow: hidden;
  aspect-ratio: 1 / 0.76;
  border-radius: 3px;
  background-image: url("assets/squat-analysis-default.png");
  background-size: cover;
  background-position: center;
}

.thumb-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.26);
}

.chart-panel {
  padding: 14px 18px 20px;
  background: #0a1217;
  color: #dce9eb;
}

.analysis-panel > .score-section {
  padding: 16px 18px 18px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: #ffffff;
}

.analysis-panel > .score-section .panel-title {
  margin-bottom: 14px;
}

.analysis-panel > .score-section .score-row {
  grid-template-columns: 140px minmax(0, 1fr);
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

#chartPoint {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 5px;
  background: #152127;
  font-weight: 800;
}

.insight-panel {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  min-width: 0;
  padding: 16px 18px 18px;
  border-right: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.analysis-panel > .insight-panel > .quality-gate-section,
.analysis-panel > .insight-panel > .protocol-section,
.analysis-panel > .insight-panel > .findings-section,
.analysis-panel > .insight-panel > .phase-section,
.analysis-panel > .insight-panel > .cycle-section,
.analysis-panel > .insight-panel > .metric-bars,
.analysis-panel > .insight-panel > .mini-plot-section,
.analysis-panel > .insight-panel > .retest-section,
.analysis-panel > .insight-panel > .recommendations {
  grid-column: span 4;
  min-width: 0;
}

.analysis-panel > .insight-panel > .angle-cards {
  grid-column: 1 / -1;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.panel-title strong {
  font-size: 16px;
}

.panel-title span {
  color: var(--muted);
  font-size: 12px;
}

.score-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 18px;
  align-items: center;
}

.score-ring,
.stability-ring {
  display: grid;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 58%, transparent 59%),
    conic-gradient(var(--green) calc(var(--score) * 1%), #e2e9e9 0);
}

.score-ring {
  width: 130px;
  height: 130px;
}

.score-ring strong {
  display: block;
  color: var(--green);
  font-size: 44px;
  line-height: 1;
}

.score-ring span {
  margin-top: -36px;
  color: #475457;
}

.score-meta {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px 12px;
}

.score-meta label {
  color: var(--muted);
  font-size: 13px;
}

.meter {
  grid-column: 1 / -1;
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: #d9e2e1;
}

.meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.good {
  color: var(--green);
}

.warn-text {
  color: var(--amber);
}

.quality-gate-section,
.protocol-section,
.phase-section,
.cycle-section,
.retest-section,
.findings-section,
.metric-bars,
.mini-plot-section,
.recommendations {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfd;
}

#captureQualityStatus[data-tone="ok"],
#protocolStatus[data-tone="ok"] {
  color: var(--green);
  font-weight: 800;
}

#captureQualityStatus[data-tone="warn"],
#protocolStatus[data-tone="warn"] {
  color: var(--amber);
  font-weight: 800;
}

#captureQualityStatus[data-tone="bad"],
#protocolStatus[data-tone="bad"] {
  color: var(--red);
  font-weight: 800;
}

.quality-gate-score {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 10px;
}

.quality-gate-score strong {
  color: var(--teal-dark);
  font-size: 34px;
  line-height: 1;
}

.quality-gate-score span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.protocol-card {
  display: grid;
  gap: 4px;
  margin-bottom: 10px;
  padding: 10px 11px;
  border: 1px solid rgba(8, 123, 143, 0.22);
  border-radius: 6px;
  background: #eff8f8;
}

.protocol-card strong {
  color: var(--teal-dark);
  font-size: 14px;
}

.protocol-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quality-check-list,
.protocol-check-list,
.phase-list,
.cycle-evidence-grid,
.retest-grid {
  display: grid;
  gap: 8px;
}

.quality-check,
.protocol-check,
.phase-item,
.cycle-evidence-item,
.retest-item {
  display: grid;
  grid-template-columns: minmax(82px, 1fr) auto;
  gap: 4px 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--green);
  border-radius: 6px;
  background: #ffffff;
}

.quality-check.warn,
.protocol-check.warn,
.phase-item.active {
  border-left-color: var(--amber);
  background: #fffaf2;
}

.quality-check.bad,
.protocol-check.bad,
.retest-item.watch {
  border-left-color: var(--red);
  background: #fff8f7;
}

.quality-check span,
.protocol-check span,
.phase-item span,
.cycle-evidence-item span,
.retest-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.quality-check strong,
.protocol-check strong,
.phase-item strong,
.cycle-evidence-item strong,
.retest-item strong {
  color: var(--text);
  font-size: 14px;
  text-align: right;
}

.quality-check p,
.protocol-check p,
.phase-item p,
.cycle-evidence-item p,
.retest-item p {
  grid-column: 1 / -1;
  margin: 0;
  color: #3d4d51;
  font-size: 12px;
  line-height: 1.45;
}

.cycle-evidence-item {
  border-left-color: var(--teal);
  background: #f6fbfb;
}

.retest-item.good {
  border-left-color: var(--green);
  background: #f5fbf6;
}

.retest-section .full {
  width: 100%;
  margin-top: 10px;
}

.finding-table {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.finding-row {
  display: grid;
  grid-template-columns: 1fr 94px 56px;
  align-items: center;
  min-height: 38px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.finding-row:last-child {
  border-bottom: 0;
}

.finding-row span:nth-child(2) {
  color: var(--muted);
}

.finding-row strong {
  color: var(--red);
  text-align: right;
}

.angle-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.angle-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfc;
}

.angle-card label {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.angle-card strong {
  display: block;
  margin: 6px 0 3px;
  font-size: 20px;
}

.angle-card span {
  color: var(--muted);
  font-size: 11px;
}

.metric-item {
  display: grid;
  grid-template-columns: 82px 1fr 36px;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 12px;
}

.metric-scale {
  position: relative;
  height: 34px;
  border-bottom: 1px solid var(--line-strong);
}

.metric-scale::before,
.metric-scale::after {
  content: "";
  position: absolute;
  bottom: -4px;
  width: 1px;
  height: 8px;
  background: var(--line-strong);
}

.metric-scale::before {
  left: 20%;
}

.metric-scale::after {
  right: 20%;
}

.metric-marker {
  position: absolute;
  left: var(--pos);
  bottom: -6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(241, 149, 50, 0.13);
}

.metric-item strong {
  color: var(--red);
  font-size: 16px;
  text-align: right;
}

.mini-plot-section {
  position: relative;
}

.stability {
  position: absolute;
  right: 4px;
  bottom: 6px;
  display: grid;
  grid-template-columns: 56px 78px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.86);
  font-size: 12px;
}

.stability-ring {
  width: 52px;
  height: 52px;
}

.stability-ring strong {
  color: var(--amber);
  font-size: 14px;
}

.recommendations ul,
.report-body ul,
.report-body ol {
  margin: 0;
  padding-left: 18px;
}

.recommendations li {
  margin: 8px 0;
  color: #3d4d51;
  line-height: 1.45;
}

.recommendation-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.compact {
  min-height: 34px;
  padding: 0 10px;
  font-size: 13px;
}

.report-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
}

.brand-modal {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: none;
}

.report-modal.open {
  display: block;
}

.brand-modal.open {
  display: block;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 16, 20, 0.48);
}

.report-sheet {
  position: absolute;
  top: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1120px, calc(100vw - 48px));
  max-height: calc(100vh - 72px);
  overflow: auto;
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand-sheet {
  position: absolute;
  top: 50%;
  left: 50%;
  width: min(480px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  border-radius: 8px;
  background: #0b191f;
  color: #f4fbfc;
}

.brand-sheet header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid rgba(177, 218, 222, 0.16);
}

.brand-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: end;
  gap: 8px;
}

.brand-sheet h2 {
  margin: 6px 0 0;
}

.brand-form {
  padding: 22px 24px 24px;
}

.brand-preview-panel {
  padding: 14px;
  border: 1px solid rgba(177, 218, 222, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.brand-preview-panel strong {
  display: block;
  font-size: 18px;
}

.brand-preview-panel span {
  display: block;
  margin-top: 5px;
  color: #91a7aa;
  font-size: 12px;
  line-height: 1.45;
}

.brand-upload-row,
.brand-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.brand-actions {
  justify-content: space-between;
  margin-top: 4px;
}

.report-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 26px 30px;
  border-bottom: 1px solid var(--line);
}

.report-header h1 {
  margin: 8px 0 8px;
  font-size: 25px;
}

.report-header p {
  margin: 0;
  color: var(--muted);
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 10px;
  max-width: 280px;
}

.export-status {
  flex-basis: 100%;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.export-status a {
  color: var(--teal-dark);
  font-weight: 800;
  text-decoration: none;
}

.report-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 26px 30px 34px;
}

.report-meta-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--line);
}

.report-meta-grid div {
  min-width: 0;
  padding: 12px 14px;
  background: #fbfdfd;
}

.report-meta-grid span,
.report-score-card > span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.report-meta-grid strong {
  display: block;
  color: var(--text);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.report-hero-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, 0.65fr);
  gap: 20px;
}

.report-evidence {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #0b151a;
}

.report-evidence img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 520px;
  object-fit: contain;
}

.report-evidence figcaption {
  padding: 10px 14px;
  background: #fbfdfd;
  color: var(--muted);
  font-size: 13px;
}

.report-score-card,
.report-section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.report-score-card {
  display: flex;
  flex-direction: column;
}

.report-score-card p {
  margin: 8px 0 0;
  color: #3d4d51;
  line-height: 1.55;
}

.report-score-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
}

.report-score-tags span {
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.report-section.wide {
  grid-column: 1 / -1;
}

.report-section-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.report-section-head h2 {
  margin-bottom: 6px;
}

.report-section-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.report-section-head > span {
  align-self: start;
  padding: 7px 10px;
  border: 1px solid rgba(224, 92, 82, 0.35);
  border-radius: 5px;
  background: #fff2f0;
  color: #b83f36;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.report-section h2 {
  margin: 0 0 12px;
  font-size: 17px;
}

.report-section p,
.report-section li {
  margin: 0;
  color: #3d4d51;
  line-height: 1.65;
}

.report-section li + li {
  margin-top: 8px;
}

.report-score strong {
  color: var(--green);
  font-size: 54px;
}

.report-score span {
  color: var(--muted);
}

.report-finding-list {
  display: grid;
  gap: 10px;
}

.report-finding-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.report-finding-item:last-child {
  border-bottom: 0;
}

.report-finding-item strong {
  color: var(--text);
}

.report-finding-item span {
  color: var(--muted);
  font-size: 13px;
}

.report-finding-item b {
  color: var(--amber);
  font-size: 13px;
}

.report-angle-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
}

.report-angle-row {
  display: grid;
  grid-template-columns: 1fr 0.55fr 1.1fr 1.35fr;
  gap: 1px;
  background: var(--line);
}

.report-angle-row + .report-angle-row {
  border-top: 1px solid var(--line);
}

.report-angle-row > span,
.report-angle-row > strong,
.report-angle-row > p {
  margin: 0;
  padding: 11px 12px;
  background: #fbfdfd;
  color: #3d4d51;
  line-height: 1.5;
}

.report-angle-row.report-angle-head > span {
  background: var(--surface-soft);
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 800;
}

.report-angle-row strong {
  color: var(--text);
  font-size: 16px;
}

.report-anatomy-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
}

.report-anatomy-map {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f7fafb;
}

.report-anatomy-map img {
  display: block;
  width: 100%;
  background: #f7fafb;
}

.report-anatomy-map figcaption {
  padding: 10px 12px;
  background: #fbfdfd;
  color: var(--muted);
  font-size: 13px;
}

.report-priority-list,
.report-impact-list,
.report-evidence-chain,
.report-cycle-grid,
.report-protocol-grid {
  display: grid;
  gap: 10px;
}

.report-protocol-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.priority-item,
.impact-item,
.evidence-chain-item,
.report-cycle-card,
.report-protocol-card {
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--amber);
  border-radius: 6px;
  background: #fbfdfd;
}

.priority-item.high,
.impact-item.high,
.evidence-chain-item.high,
.report-protocol-card.watch {
  border-left-color: var(--red);
  background: #fff8f7;
}

.report-protocol-card.good {
  border-left-color: var(--green);
  background: #f5fbf6;
}

.priority-item header,
.impact-item header,
.evidence-chain-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.priority-item strong,
.impact-item strong,
.evidence-chain-item strong {
  color: var(--text);
}

.priority-item span,
.impact-item span,
.evidence-chain-item span {
  color: var(--muted);
  font-size: 13px;
}

.priority-item b,
.impact-item b,
.evidence-chain-item b {
  color: var(--red);
  font-size: 12px;
}

.priority-item p,
.impact-item p,
.evidence-chain-item p,
.report-cycle-card p,
.report-protocol-card p {
  margin: 0;
  color: #3d4d51;
  line-height: 1.55;
}

.report-cycle-card span,
.report-protocol-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.report-cycle-card strong,
.report-protocol-card strong {
  color: var(--text);
  font-size: 16px;
  line-height: 1.35;
}

.report-cycle-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.report-cycle-card {
  border-left-color: var(--teal);
  background: #f6fbfb;
}

.evidence-chain-item div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
  align-items: baseline;
}

.report-followup {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.report-followup article {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdfd;
}

.report-followup strong {
  display: block;
  margin-bottom: 8px;
  color: var(--teal-dark);
}

.report-followup p {
  margin: 0;
  color: #3d4d51;
  line-height: 1.55;
}

@media (max-width: 1180px) {
  .portal-header {
    grid-template-columns: 1fr;
  }

  .portal-nav-links,
  .portal-header-actions {
    justify-content: flex-start;
  }

  .portal-grid {
    grid-template-columns: 1fr;
  }

  .portal-visual {
    justify-items: start;
  }

  .portal-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-shell {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .brand div:last-child,
  .home-return-button span:last-child,
  .nav-item span:last-child,
  .clinician-card div {
    display: none;
  }

  .brand,
  .home-return-button,
  .nav-item,
  .clinician-card {
    justify-content: center;
    padding-left: 10px;
    padding-right: 10px;
  }

  .home-return-button {
    margin: 10px 10px 0;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .workspace-page-grid {
    grid-template-columns: 1fr;
  }

  .record-card {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .record-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .insight-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-panel > .insight-panel > .quality-gate-section,
  .analysis-panel > .insight-panel > .protocol-section,
  .analysis-panel > .insight-panel > .findings-section,
  .analysis-panel > .insight-panel > .phase-section,
  .analysis-panel > .insight-panel > .cycle-section,
  .analysis-panel > .insight-panel > .metric-bars,
  .analysis-panel > .insight-panel > .mini-plot-section,
  .analysis-panel > .insight-panel > .retest-section,
  .analysis-panel > .insight-panel > .recommendations {
    grid-column: span 1;
  }

  .analysis-panel > .insight-panel > .angle-cards {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .auth-portal {
    align-items: start;
    padding: 16px;
    overflow-y: auto;
  }

  .portal-header {
    position: relative;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-bottom: 20px;
  }

  .portal-spo-logo {
    width: 132px;
  }

  .portal-nav-links {
    justify-content: flex-start;
    overflow-x: auto;
  }

  .portal-header-actions {
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .portal-grid {
    grid-template-columns: 1fr;
    gap: 22px;
    min-height: auto;
  }

  .portal-copy {
    gap: 16px;
  }

  .portal-copy h1 {
    font-size: 60px;
  }

  .portal-copy p {
    font-size: 15px;
  }

  .portal-credential-card {
    padding: 14px 15px;
  }

  .portal-credential-card strong {
    font-size: 15px;
  }

  .portal-credential-card p {
    font-size: 13px;
  }

  .portal-hero-actions {
    align-items: stretch;
  }

  .portal-primary-cta {
    width: 100%;
  }

  .portal-assessment-button,
  .portal-signin-button {
    flex: 1 1 128px;
  }

  .portal-signal {
    height: 76px;
  }

  .kinpost-figure-stage {
    aspect-ratio: 1.06 / 1;
  }

  .portal-signal span:nth-child(1) {
    top: 22px;
  }

  .portal-signal span:nth-child(2) {
    top: 44px;
  }

  .portal-signal span:nth-child(3) {
    top: 66px;
  }

  .portal-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .portal-metrics article {
    min-height: 74px;
    padding: 10px;
  }

  .login-panel {
    padding: 20px;
  }

  .login-overlay {
    justify-content: center;
    align-items: flex-start;
    padding: 82px 16px 24px;
  }

  .login-overlay .login-panel {
    transform: translateY(-12px);
  }

  .login-overlay.open .login-panel {
    transform: translateY(0);
  }

  .admin-overlay {
    align-items: flex-start;
    padding: 74px 14px 20px;
  }

  .admin-panel {
    padding: 20px;
  }

  .admin-org-form,
  .admin-organization-card {
    grid-template-columns: 1fr;
  }

  .admin-dashboard-head,
  .admin-form-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .portal-feature-grid,
  .workflow-steps {
    grid-template-columns: 1fr;
  }

  .portal-feature-grid article,
  .workflow-steps article {
    min-height: auto;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    flex-direction: row;
    height: auto;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    min-width: 76px;
    min-height: 76px;
    border-bottom: 0;
    border-right: 1px solid var(--line);
  }

  .nav-list {
    flex-direction: row;
    padding: 0;
  }

  .nav-item {
    min-width: 64px;
    min-height: 76px;
    border-left: 0;
    border-bottom: 4px solid transparent;
  }

  .nav-item.active {
    border-left-color: transparent;
    border-bottom-color: var(--teal);
  }

  .clinician-card {
    display: none;
  }

  .topbar {
    grid-template-columns: 1fr;
    gap: 12px;
    min-height: auto;
    padding: 14px 22px;
  }

  .session-strip {
    padding-left: 0;
    border-left: 0;
  }

  .action-strip {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .action-strip .ghost-button,
  .action-strip .primary-button {
    width: 100%;
    min-width: 0;
    padding: 0 8px;
  }

  .menu-button {
    display: none;
  }

  .workspace-page-header {
    align-items: stretch;
    flex-direction: column;
    min-height: auto;
    padding: 20px 18px;
  }

  .workspace-page-header .primary-button,
  .workspace-page-header .ghost-button {
    width: 100%;
  }

  .workspace-page-grid {
    padding: 14px 12px;
  }

  .workspace-section > .management-panel {
    margin: 14px 12px;
  }

  .client-management-card,
  .record-card,
  .history-item {
    grid-template-columns: 1fr;
  }

  .client-management-avatar,
  .record-score,
  .history-marker {
    display: none;
  }

  .client-management-main header,
  .record-main header,
  .history-body header {
    align-items: flex-start;
    flex-direction: column;
  }

  .client-card-actions,
  .record-actions {
    justify-content: flex-start;
  }

  .history-item::before {
    display: none;
  }

  .form-row.three {
    grid-template-columns: 1fr;
  }

  .mode-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .static-view-bar {
    align-items: stretch;
    flex-direction: column;
    padding: 0 22px 14px;
  }

  .static-view-button {
    width: 100%;
  }

  .quality-badges {
    margin-left: 0;
  }

  .camera-notice {
    grid-template-columns: 1fr auto;
    margin: 0 12px 12px;
  }

  .camera-notice span,
  .camera-notice a,
  .camera-notice .camera-notice-action {
    grid-column: 1 / -1;
  }

  .camera-notice .camera-notice-action {
    justify-self: start;
  }

  .content-grid {
    padding: 0 12px 16px;
    max-width: 100vw;
    overflow: hidden;
  }

  .viewer {
    aspect-ratio: 4 / 3;
    min-height: 0;
  }

  .transport {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #frameRange,
  #timeLabel {
    grid-column: 1 / -1;
  }

  .score-row {
    grid-template-columns: 1fr;
  }

  .insight-panel {
    grid-template-columns: 1fr;
  }

  .analysis-panel > .insight-panel > .quality-gate-section,
  .analysis-panel > .insight-panel > .protocol-section,
  .analysis-panel > .insight-panel > .findings-section,
  .analysis-panel > .insight-panel > .phase-section,
  .analysis-panel > .insight-panel > .cycle-section,
  .analysis-panel > .insight-panel > .metric-bars,
  .analysis-panel > .insight-panel > .mini-plot-section,
  .analysis-panel > .insight-panel > .retest-section,
  .analysis-panel > .insight-panel > .recommendations,
  .analysis-panel > .insight-panel > .angle-cards {
    grid-column: 1 / -1;
  }

  .angle-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-sheet {
    top: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .brand-sheet {
    top: 8px;
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    overflow: auto;
    transform: translateX(-50%);
  }

  .report-header {
    padding: 20px 18px;
  }

  .report-body {
    padding: 18px 14px 24px;
  }

  .report-score-card,
  .report-section {
    padding: 14px;
  }

  .report-header,
  .report-body,
  .report-hero-grid,
  .report-anatomy-grid,
  .report-cycle-grid,
  .report-protocol-grid,
  .report-followup {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .report-section-head {
    flex-direction: column;
  }

  .report-section-head > span {
    align-self: start;
    white-space: normal;
  }

  .report-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-angle-row {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-shell,
  .modal-backdrop,
  .report-actions {
    display: none;
  }

  .report-modal,
  .report-modal.open,
  .report-sheet {
    position: static;
    display: block;
    width: auto;
    max-height: none;
    transform: none;
    box-shadow: none;
  }

  .report-body {
    padding: 18px 0;
  }

  .report-sheet {
    border-radius: 0;
  }

  .report-meta-grid,
  .report-hero-grid,
  .report-followup {
    break-inside: avoid;
  }
}
