:root {
  color-scheme: light;
  --bg: #f5f8fa;
  --surface: #ffffff;
  --surface-soft: #f8fbfc;
  --surface-muted: #eef5f7;
  --panel: var(--surface);
  --text: #14201f;
  --text-strong: #0d1b1e;
  --muted: #687887;
  --muted-2: #91a1ae;
  --line: #dbe5ea;
  --line-soft: #edf2f5;
  --primary: #287d6e;
  --primary-dark: #1f6257;
  --primary-soft: #e5f3ef;
  --primary-subtle: #f2f8f6;
  --accent: #5fbfa8;
  --accent-soft: #e9f7f3;
  --danger: #b85b5b;
  --danger-soft: #fff1f1;
  --warning: #9c6b28;
  --warning-soft: #fff7e8;
  --entry-bg: linear-gradient(135deg, #eef6f8 0%, #e3f0f4 52%, #dcebf0 100%);
  --blue: var(--primary);
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 8px 22px rgba(21, 41, 52, 0.06);
  --shadow-md: 0 18px 46px rgba(21, 41, 52, 0.12);
  --focus-ring: 0 0 0 3px rgba(40, 125, 110, 0.18);
  --button-text: #ffffff;
}

.followup-kpis,
.handover-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.followup-kpi,
.handover-kpi {
  background: var(--card-bg, #fff);
  border: 1px solid var(--line, #dbe5ef);
  border-radius: 10px;
  padding: 14px;
}

.followup-kpi span,
.handover-kpi span {
  color: var(--muted, #64748b);
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
}

.followup-kpi strong,
.handover-kpi strong {
  color: var(--brand, #174a9c);
  font-size: 22px;
}

.followup-board {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.followup-card {
  align-items: center;
  background: var(--card-bg, #fff);
  border: 1px solid var(--line, #dbe5ef);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}

.followup-card.is-overdue {
  border-color: #fca5a5;
  box-shadow: 0 8px 24px rgba(239, 68, 68, 0.08);
}

.followup-card-head,
.handover-history-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.followup-card h3,
.handover-section h3,
.handover-group h3 {
  margin: 6px 0;
}

.followup-card p,
.followup-card small,
.handover-config small {
  color: var(--muted, #64748b);
}

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

.followup-rules-grid,
.handover-config-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 12px;
}

.followup-rule-card {
  background: var(--soft-bg, #f8fbff);
  border: 1px solid var(--line, #dbe5ef);
  border-radius: 10px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.followup-rule-card textarea {
  min-height: 96px;
}

.handover-report {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-bottom: 16px;
}

.handover-section,
.handover-group {
  background: var(--card-bg, #fff);
  border: 1px solid var(--line, #dbe5ef);
  border-radius: 10px;
  padding: 14px;
}

.handover-group + .handover-group {
  margin-top: 12px;
}

.handover-history-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.handover-history-row {
  background: var(--soft-bg, #f8fbff);
  border: 1px solid var(--line, #dbe5ef);
  border-radius: 8px;
  padding: 10px 12px;
}

@media (max-width: 720px) {
  .followup-card {
    grid-template-columns: 1fr;
  }

  .followup-actions {
    justify-content: flex-start;
  }

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

  .schedule-month-day {
    min-height: 118px;
    padding: 8px;
  }

  .schedule-month-date {
    font-size: 11px;
  }
}

@media (max-width: 460px) {
  .schedule-month-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .theme-mode-control {
    gap: 5px;
  }

  .theme-mode-control select {
    min-width: 86px;
    padding-left: 9px;
    padding-right: 24px;
  }
}

@media (max-width: 720px) {
  .dashboard-detail-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .dashboard-detail-row small {
    grid-column: 1;
  }

  .dashboard-detail-row em {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

.other-ledger-head {
  margin-bottom: 14px;
}

.other-module-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 190px));
  gap: 8px;
  margin-bottom: 14px;
  border-bottom: 1px solid #dbe3ea;
}

.other-module-tabs button {
  min-width: 0;
  min-height: 42px;
  padding: 8px 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #64748b;
  font-weight: 800;
}

.other-module-tabs button.is-active {
  border-bottom-color: var(--primary);
  color: var(--primary);
  background: #eff6ff;
}

.other-module-tabs span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 22px;
  margin-left: 5px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #e2e8f0;
  color: #334155;
  font-size: 12px;
}

.other-module-tabs button.is-active span {
  background: #dbeafe;
  color: #1d4ed8;
}

.other-module-panel {
  min-width: 0;
}

.other-ledger-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.other-ledger-kpi {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid #dbe3ea;
  border-radius: 8px;
  background: #f8fafc;
}

.other-ledger-kpi span,
.other-ledger-kpi strong {
  display: block;
}

.other-ledger-kpi span {
  color: #64748b;
  font-size: 12px;
}

.other-ledger-kpi strong {
  margin-top: 4px;
  color: #172033;
  font-size: 21px;
  line-height: 1.2;
}

.other-ledger-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border: 1px solid #dbe3ea;
  border-radius: 8px;
  background: #fff;
}

.other-ledger-toolbar label {
  display: grid;
  min-width: 150px;
  gap: 5px;
  color: #475569;
  font-size: 12px;
}

.other-ledger-toolbar select {
  width: 100%;
  min-height: 38px;
}

.other-ledger-list {
  display: grid;
  gap: 10px;
}

.other-ledger-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.15fr) minmax(240px, 1fr) minmax(190px, 0.68fr);
  gap: 16px;
  align-items: center;
  min-width: 0;
  padding: 15px;
  border: 1px solid #dbe3ea;
  border-left: 4px solid #d89a24;
  border-radius: 8px;
  background: #fff;
}

.other-ledger-row.is-confirmed {
  border-left-color: #2f855a;
  background: #fbfefc;
}

.other-package-row {
  border-left-color: #2563eb;
}

.other-package-row.is-confirmed {
  border-left-color: #2f855a;
}

.other-refund-row {
  border-left-color: #b45309;
}

.other-refund-row.is-confirmed {
  border-left-color: #2f855a;
}

.other-refund-row.is-needs-evidence {
  border-left-color: #d89a24;
  background: #fffdf7;
}

.other-ledger-status.is-needs-evidence {
  color: #7a4d00;
  background: #fff3d2;
}

.other-refund-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.other-ledger-primary,
.other-ledger-candidates,
.other-ledger-decision {
  min-width: 0;
}

.other-ledger-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.other-ledger-title strong {
  color: #172033;
  font-size: 15px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.other-ledger-title span {
  flex: 0 0 auto;
  color: #8a5b00;
  font-weight: 700;
}

.other-ledger-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 9px;
  margin-top: 8px;
}

.other-ledger-meta span {
  color: #64748b;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.other-ledger-candidates {
  display: grid;
  gap: 5px;
}

.other-ledger-candidates strong {
  color: #253044;
  font-size: 14px;
  overflow-wrap: anywhere;
}

.other-ledger-candidates small {
  color: #64748b;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.other-ledger-level,
.other-ledger-status {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.other-ledger-level {
  color: #4b5563;
  background: #eef1f4;
}

.other-ledger-status.is-pending {
  color: #7a4d00;
  background: #fff3d2;
}

.other-ledger-status.is-confirmed {
  color: #216e49;
  background: #e4f5eb;
}

.other-ledger-decision {
  display: grid;
  justify-items: start;
  gap: 8px;
}

.other-ledger-reviewed {
  color: #64748b;
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.other-ledger-review-note {
  display: block;
  color: #334155;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.other-ledger-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.other-ledger-actions button {
  min-width: 88px;
  min-height: 36px;
  padding: 7px 11px;
  white-space: normal;
}

@media (max-width: 1080px) {
  .other-ledger-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .other-ledger-decision {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  .other-module-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .other-module-tabs button {
    padding-left: 8px;
    padding-right: 8px;
    white-space: normal;
  }

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

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

  .other-refund-summary .other-ledger-kpi:last-child {
    grid-column: 1 / -1;
  }

  .other-ledger-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .other-ledger-toolbar label {
    min-width: 0;
  }

  .other-ledger-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
  }

  .other-ledger-decision {
    grid-column: auto;
  }

  .other-ledger-actions button {
    flex: 1 1 120px;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f171a;
    --surface: #162125;
    --surface-soft: #1b292e;
    --surface-muted: #223238;
    --panel: var(--surface);
    --text: #e6eef0;
    --text-strong: #f5fbfc;
    --muted: #a5b3ba;
    --muted-2: #7f929b;
    --line: #2b3e45;
    --line-soft: #22333a;
    --primary: #8fc7e6;
    --primary-dark: #b5daf0;
    --primary-soft: #183444;
    --primary-subtle: #132930;
    --accent: #7ad7bd;
    --accent-soft: #153a34;
    --danger: #f09a9a;
    --danger-soft: #3b2020;
    --warning: #f0c77c;
    --warning-soft: #342814;
    --entry-bg: linear-gradient(135deg, #101a1d 0%, #152429 52%, #182b31 100%);
    --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.22);
    --shadow-md: 0 22px 58px rgba(0, 0, 0, 0.36);
    --focus-ring: 0 0 0 3px rgba(143, 199, 230, 0.24);
    --button-text: #081316;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f171a;
  --surface: #162125;
  --surface-soft: #1b292e;
  --surface-muted: #223238;
  --panel: var(--surface);
  --text: #e6eef0;
  --text-strong: #f5fbfc;
  --muted: #a5b3ba;
  --muted-2: #7f929b;
  --line: #2b3e45;
  --line-soft: #22333a;
  --primary: #7ad7bd;
  --primary-dark: #a2e4d2;
  --primary-soft: #153a34;
  --primary-subtle: #102b27;
  --accent: #7ad7bd;
  --accent-soft: #153a34;
  --danger: #f09a9a;
  --danger-soft: #3b2020;
  --warning: #f0c77c;
  --warning-soft: #342814;
  --entry-bg: linear-gradient(135deg, #101a1d 0%, #152429 52%, #182b31 100%);
  --shadow-sm: 0 10px 28px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 22px 58px rgba(0, 0, 0, 0.36);
  --focus-ring: 0 0 0 3px rgba(122, 215, 189, 0.24);
  --button-text: #081316;
}

:root[data-theme="light"] {
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.01em;
}

#sessionRestoreScreen {
  display: none;
}

.session-booting #sessionRestoreScreen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  background: #f5f8fa;
  color: #34495e;
}

.session-booting #sessionRestoreScreen strong {
  font-size: 20px;
}

.session-booting #sessionRestoreScreen span {
  font-size: 14px;
  color: #637381;
}

.session-booting #entryScreen,
.session-booting #appShell {
  display: none !important;
}

.is-hidden {
  display: none !important;
}

.entry-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
  background: linear-gradient(135deg, #123f91 0%, #1769b3 55%, #2daeea 100%);
}

.entry-card {
  width: min(760px, 100%);
  display: grid;
  gap: 24px;
  padding: 34px;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.24);
}

.entry-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cloud-data-state {
  display: grid;
  gap: 6px;
  min-height: 88px;
  align-content: center;
  padding: 18px;
  border: 1px solid #d5dde7;
  border-radius: 6px;
  background: #f7f9fc;
  color: #334155;
}

.cloud-data-state strong {
  color: #172033;
  font-size: 15px;
}

.cloud-data-state span {
  color: #64748b;
  font-size: 13px;
  line-height: 1.6;
}

.cloud-data-state.is-loading {
  border-color: #b8d2ee;
  background: #f1f7ff;
}

.cloud-data-state.is-unavailable {
  border-color: #ead29c;
  background: #fff9ec;
}

.cloud-data-state.is-error {
  border-color: #e8b8b8;
  background: #fff3f3;
}

.cloud-read-only-mode [data-cloud-read-only-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  filter: grayscale(0.25);
}

.entry-logo {
  width: 220px;
  height: 96px;
  object-fit: contain;
}

.entry-title {
  display: grid;
  justify-items: end;
  gap: 6px;
  text-align: right;
}

.entry-title strong {
  color: var(--primary);
  font-size: 26px;
  line-height: 1.2;
}

.entry-title span {
  max-width: 320px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.entry-mode-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 6px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
}

.entry-mode-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--primary);
  font-weight: 800;
  cursor: pointer;
}

.entry-mode-button.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 8px 18px rgba(20, 78, 166, 0.18);
}

.entry-mode-button:active {
  transform: scale(0.98);
}

.entry-card h1 {
  color: var(--primary);
}

.entry-card p {
  margin-top: 8px;
  color: var(--muted);
}

.entry-login {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}

.entry-login label {
  display: grid;
  gap: 6px;
}

.client-auth-fields {
  grid-column: 1 / -1;
  display: grid;
  gap: 0;
  padding: 16px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
}

.client-login-panel {
  display: grid;
  grid-template-columns: 1fr;
  align-items: stretch;
  gap: 14px;
}

.client-auth-fields strong {
  color: var(--primary);
}

.client-auth-fields p {
  margin-top: 5px;
  font-size: 13px;
  line-height: 1.5;
}

.client-auth-consent {
  align-self: center;
}

.client-register-panel {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
  padding: 0;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: transparent;
  border: 0;
}

.client-register-panel > div:first-child {
  grid-column: 1 / -1;
}

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

.client-test-controls {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  padding: 12px;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  background: #f8fafc;
}

.client-test-controls span {
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.app-shell {
  min-height: 100vh;
}

.store-indicator {
  margin-top: 10px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
}

.identity-indicator {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

#currentStore,
#currentIdentity {
  display: none !important;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  width: 240px;
  height: 100vh;
  padding: 24px;
  overflow: hidden;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.brand {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "logo"
    "title"
    "actions";
  align-items: start;
  gap: 10px;
  margin-bottom: 28px;
}

.brand > div:not(.sidebar-actions) {
  grid-area: title;
  min-width: 0;
  overflow: hidden;
}

.sidebar-actions {
  grid-area: actions;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: stretch;
  justify-content: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.sidebar .sidebar-actions {
  justify-items: stretch;
}

.sidebar .sidebar-theme-control,
.sidebar .sidebar-logout,
.sidebar .sidebar-toggle {
  max-width: 100%;
}

.sidebar .sidebar-theme-control {
  display: grid;
  grid-template-columns: 1fr;
  white-space: normal;
}

.sidebar .sidebar-theme-control select {
  width: 100%;
  min-width: 0;
}

.brand-logo {
  grid-area: logo;
  width: 126px;
  height: 52px;
  object-fit: contain;
  flex: 0 0 126px;
}

.brand-subtitle,
.topbar p,
.panel-head p,
.list-item span {
  color: var(--muted);
}

.panel-head p:empty {
  display: none;
}

.brand-subtitle {
  color: var(--primary);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.2;
  white-space: nowrap;
  word-break: keep-all;
}

.brand .role-heading {
  margin-top: 4px;
  gap: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  max-width: 100%;
  overflow: hidden;
}

.brand .inline-role-select {
  min-width: 92px;
  max-width: 110px;
  height: 28px;
  padding: 0 26px 0 8px;
  border-radius: 8px;
  font-size: 13px;
}

.brand #currentRoleText {
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.35;
  font-size: 13px;
}

.sidebar-toggle {
  display: none;
  padding: 8px 12px;
}

nav {
  flex: 1 1 auto;
  display: grid;
  min-height: 0;
  padding-right: 4px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #cbd5e1 transparent;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  gap: 8px;
}

nav::-webkit-scrollbar {
  width: 6px;
}

nav::-webkit-scrollbar-thumb {
  border-radius: 6px;
  background: #cbd5e1;
}

nav::-webkit-scrollbar-track {
  background: transparent;
}

nav a {
  display: block;
  padding: 12px 14px;
  border-radius: 8px;
  color: #334155;
  text-decoration: none;
}

nav a.active,
nav a:hover {
  background: #dbeafe;
  color: var(--primary-dark);
  font-weight: 700;
}

.main {
  margin-left: 240px;
  padding: 28px;
}

.main > section {
  display: none;
}

.main > section.active-view {
  display: block;
}

.main > section.stats.active-view,
.main > section.grid.active-view {
  display: grid;
}

.main > section.grid.active-view > .panel {
  display: none;
}

.main > section.grid.active-view > .panel.active-nested {
  display: block;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.client-preview-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.client-preview-legend span,
.client-preview-mode [data-client-production]::before,
.client-preview-mode .sidebar::before {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 26px;
  padding: 4px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
}

.client-preview-legend .production,
.client-preview-mode [data-client-production]::before {
  border: 1px solid #93c5fd;
  background: #eff6ff;
  color: #123f91;
}

.client-preview-legend .test-only,
.client-preview-mode .sidebar::before {
  border: 1px dashed #94a3b8;
  background: #f8fafc;
  color: #475569;
}

.client-preview-mode [data-client-production]::before {
  content: "正式版客户可见";
  margin-bottom: 14px;
}

.client-preview-mode .sidebar::before {
  content: "仅测试页面导航";
  margin: 0 16px 14px;
}

.client-preview-mode .topbar {
  display: none;
}

.client-preview-mode .login-box::before {
  content: "仅测试页面：权限切换";
  padding: 5px 8px;
  border: 1px dashed #94a3b8;
  border-radius: 6px;
  background: #f8fafc;
  color: #475569;
  font-size: 12px;
  font-weight: 700;
}

.client-preview-mode .store-indicator,
.client-preview-mode .identity-indicator {
  outline: 1px dashed #94a3b8;
  outline-offset: 3px;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
}

.role-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.inline-role-select {
  width: auto;
  min-width: 116px;
  height: 38px;
  padding: 0 34px 0 10px;
  border-color: #bfdbfe;
  color: var(--primary);
  font-size: 22px;
  font-weight: 900;
}

#currentRoleText {
  color: var(--text);
  font-weight: 900;
}

.brand .role-heading {
  margin-top: 4px;
  gap: 6px;
  color: #475569;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.brand .inline-role-select {
  min-width: 92px;
  height: 28px;
  padding: 0 26px 0 8px;
  border-radius: 8px;
  font-size: 13px;
}

.brand #currentRoleText {
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  line-height: 1.35;
  font-size: 13px;
}

.role-heading.single-role::after {
  content: "";
  color: var(--text);
  font-weight: 900;
}

.detail-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.detail-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 14px;
}

.detail-table th,
.detail-table td {
  padding: 10px 12px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}

.detail-table th {
  background: #eff6ff;
  color: var(--primary-dark);
  font-weight: 900;
}

.detail-table td {
  background: #ffffff;
  color: var(--text);
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 16px;
}

.login-box {
  display: grid;
  gap: 6px;
  min-width: 180px;
}

.login-box label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

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

select,
input,
textarea,
button {
  height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  font-size: 14px;
}

button {
  padding: 0 16px;
  border: 0;
  background: var(--primary);
  color: #ffffff;
  cursor: pointer;
}

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

.ghost-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
}

.ghost-button:hover {
  background: #f8fafc;
}

input,
textarea {
  width: 100%;
  padding: 0 12px;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  height: 16px;
  min-width: 16px;
  padding: 0;
}

textarea {
  min-height: 88px;
  padding-top: 10px;
  resize: vertical;
  line-height: 1.5;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.stats article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.stats article {
  padding: 20px;
}

.stats span {
  display: block;
  color: var(--muted);
  font-size: 14px;
}

.stats strong {
  display: block;
  margin-top: 10px;
  color: var(--primary);
  font-size: 34px;
}

.panel {
  margin-bottom: 16px;
  padding: 20px;
}

.panel-sub {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

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

.panel-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.panel-head.compact {
  margin-bottom: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 10px;
  border-top: 1px solid var(--line);
  text-align: left;
}

th {
  color: var(--muted);
  font-weight: 600;
}

.tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 12px;
}

.tag.paid {
  background: #dbeafe;
  color: #123f91;
}

.tag.warn {
  background: #fef3c7;
  color: #92400e;
}

.tag.active {
  background: #dbeafe;
  color: #1d4ed8;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.wide-panel {
  grid-column: 1 / -1;
}

#staff {
  grid-column: 1 / -1;
}

.detail-grid {
  margin-top: 16px;
}

.list-item,
.setting,
.inventory-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.inventory-item.warning strong {
  color: #b45309;
}

.report-grid,
.settings-grid,
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}

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

.quick-card {
  height: auto;
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--text);
  text-align: left;
}

.quick-card:hover {
  border-color: #93c5fd;
  background: #eff6ff;
}

.quick-card span,
.quick-card strong {
  display: block;
}

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

.quick-card strong {
  margin-top: 10px;
  color: var(--primary);
  font-size: 26px;
}

.workflow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.client-care-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.client-profile-heading {
  margin-top: 4px;
}

.client-care-board p,
.empty-care-state {
  margin-top: 10px;
  color: #475569;
  line-height: 1.65;
}

.product-category-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 4px;
  width: 100%;
  max-width: 520px;
  margin-bottom: 18px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f5f9;
}

.product-category-tabs button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 6px;
  border-color: transparent;
  background: transparent;
}

.product-category-tabs button.is-active {
  border-color: #bfdbfe;
  background: #ffffff;
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.product-category-tabs button span {
  display: inline-grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #dbeafe;
  color: #123f91;
  font-size: 12px;
}

.client-care-board button {
  margin-top: 14px;
}

.empty-care-state {
  padding: 18px;
  border: 1px dashed #93c5fd;
  border-radius: 8px;
  background: #f8fbff;
}

.report-card,
.setting {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.report-card {
  text-align: left;
  cursor: pointer;
}

.report-card:hover {
  border-color: var(--primary);
  background: #eff6ff;
}

.report-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.report-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  color: var(--primary);
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

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

.setting {
  display: block;
  border-top: 1px solid var(--line);
}

.setting-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.setting-head strong {
  min-width: 0;
  color: var(--text);
  font-size: 15px;
}

.setting-head .tag {
  flex: 0 0 auto;
  white-space: nowrap;
}

.setting p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.client-institution {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
}

.client-institution-brand {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
}

.client-institution-brand img {
  width: 180px;
  height: 78px;
  object-fit: contain;
}

.client-institution-brand strong {
  color: var(--primary);
  font-size: 21px;
}

.client-institution-brand p,
.section-heading p,
.institution-contact {
  color: var(--muted);
  line-height: 1.65;
}

.client-institution-brand p {
  margin-top: 8px;
}

.institution-points {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.institution-points span {
  padding: 11px 12px;
  border-left: 3px solid var(--accent);
  background: #ffffff;
  color: #1e3a5f;
  font-size: 13px;
  font-weight: 700;
}

.institution-contact {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid #dbeafe;
  font-size: 13px;
}

.client-therapist-section,
.client-personal-section {
  margin-top: 24px;
}

.client-secondary-menu {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 560px);
  margin: 18px auto 0;
}

.client-secondary-menu button {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  padding: 12px 10px;
  text-align: center;
  border: 1px solid #60a5fa;
  background: #eff6ff;
  color: var(--primary);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.08);
}

.client-secondary-menu button span {
  color: var(--primary);
  font-weight: 800;
}

.client-secondary-menu button strong {
  color: #475569;
  font-size: 12px;
  font-weight: 600;
}

.client-secondary-menu button:hover {
  border-color: var(--primary);
  background: #dbeafe;
  transform: translateY(-1px);
}

.client-home-footer-note {
  margin-top: 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading h3 {
  color: var(--primary);
}

.section-heading p {
  margin-top: 5px;
  font-size: 13px;
}

.client-therapist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.client-therapist-card {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  min-height: 104px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.client-therapist-card.is-selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.therapist-photo {
  width: 72px;
  height: 92px;
  border-radius: 7px;
  object-fit: cover;
  object-position: center 16%;
  background: #eef2f7;
}

.therapist-avatar {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 50%;
  background: var(--therapist-bg);
  color: var(--therapist-color);
  font-size: 20px;
  font-weight: 800;
}

.client-therapist-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
}

.client-therapist-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.client-therapist-title h4 {
  margin: 0;
  color: var(--primary);
  font-size: 15px;
}

.client-therapist-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.client-therapist-title em {
  color: #b45309;
  font-size: 11px;
  font-style: normal;
  font-weight: 700;
  white-space: nowrap;
}

.client-therapist-title em.is-open {
  color: #047857;
}

.client-therapist-copy p {
  margin: 12px 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.55;
}

.client-therapist-copy button {
  width: 100%;
  margin-top: auto;
  height: 34px;
}

.therapist-intro-modal {
  display: grid;
  gap: 16px;
}

.therapist-intro-head {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
}

.therapist-intro-head img {
  width: 96px;
  height: 122px;
  border-radius: 8px;
  object-fit: cover;
  object-position: center 16%;
  background: #eef2f7;
}

.therapist-intro-head h3 {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 20px;
}

.therapist-intro-head strong {
  color: #334155;
  font-size: 14px;
}

.therapist-intro-modal section {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.therapist-intro-modal h4 {
  margin: 0;
  color: var(--primary);
  font-size: 14px;
}

.therapist-intro-modal ul {
  margin: 0;
  padding-left: 18px;
  color: #475569;
  line-height: 1.7;
}

.single-action {
  justify-content: stretch;
}

.single-action button {
  width: 100%;
}

.client-registration {
  display: grid;
  gap: 14px;
  margin-top: 24px;
  padding: 18px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
}

.client-registration p {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.5;
}

.verification-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.consent-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.entry-login label.consent-check {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
}

.consent-check input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin: 0;
}

.client-registration-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.client-registration-actions span {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
}

.selected-therapist-banner {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px 13px;
  border-radius: 7px;
  background: #dbeafe;
}

.selected-therapist-banner span,
.selected-therapist-banner small {
  color: #475569;
}

.selected-therapist-banner strong {
  color: var(--primary);
}

.appointment-detail-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
  border-bottom: 3px solid var(--accent);
  background: #ffffff;
}

.appointment-detail-header > div > span {
  color: #047857;
  font-size: 13px;
  font-weight: 800;
}

.appointment-detail-header h2 {
  margin-top: 5px;
  color: var(--primary);
  font-size: 24px;
}

.appointment-detail-header p {
  margin-top: 6px;
  color: var(--muted);
}

.appointment-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 22px 0;
}

.appointment-detail-grid section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.appointment-detail-grid h3 {
  margin-bottom: 12px;
  color: var(--primary);
}

.appointment-detail-grid p {
  margin-top: 10px;
  color: #475569;
  line-height: 1.7;
}

.appointment-detail-grid dl,
.appointment-detail-grid dd {
  margin: 0;
}

.appointment-detail-grid dl {
  display: grid;
  gap: 10px;
}

.appointment-detail-grid dl div {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.appointment-detail-grid dt {
  color: var(--muted);
}

.appointment-detail-grid dd {
  color: #334155;
  font-weight: 700;
}

.appointment-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.appointment-empty {
  padding: 48px 20px;
  text-align: center;
}

.appointment-empty p {
  margin: 10px 0 18px;
  color: var(--muted);
}

.store-choice-hint {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: #eff6ff;
  color: #334155;
  font-size: 13px;
}

.store-choice-hint strong {
  color: var(--primary);
}

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

.workflow-strip span {
  padding: 9px;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--primary);
  text-align: center;
  font-size: 12px;
  font-weight: 800;
}

.deadline-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
}

.deadline-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.deadline-head strong {
  color: var(--primary);
}

.deadline-head span,
.deadline-empty {
  color: var(--muted);
  font-size: 12px;
}

.deadline-empty {
  margin: 0;
}

.deadline-item {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto;
  gap: 4px 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.deadline-item:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 14px rgba(18, 63, 145, 0.1);
}

.deadline-item strong {
  color: var(--primary);
  white-space: nowrap;
}

.deadline-item small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.deadline-item.is-overdue {
  border-color: #fca5a5;
  background: #fff7f7;
}

.deadline-item.is-overdue strong {
  color: #b91c1c;
}

.performance-table {
  margin-top: 16px;
}

.finance-scope {
  margin-bottom: 12px;
  color: var(--primary);
  font-weight: 900;
}

.finance-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 12px;
}

.finance-card {
  width: 100%;
  appearance: none;
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  text-align: left;
  box-sizing: border-box;
  cursor: pointer;
}

.finance-card:hover {
  border-color: color-mix(in srgb, var(--primary) 60%, var(--line));
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transform: none;
}

.finance-card:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.finance-card:active {
  transform: translateY(1px);
}

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

.finance-card strong {
  color: var(--primary);
  font-size: 24px;
  line-height: 1.1;
}

.finance-card small {
  align-self: end;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
}

.finance-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.finance-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-sizing: border-box;
}

.finance-panel h3 {
  margin: 0 0 12px;
  color: var(--primary);
  font-size: 15px;
}

.finance-bars,
.finance-ranking {
  display: grid;
  gap: 10px;
}

.finance-bar-row,
.finance-rank-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.finance-rank-row {
  grid-template-columns: minmax(70px, 1fr) minmax(0, 1fr) auto;
}

.finance-bar-row span,
.finance-rank-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-bar-row div,
.finance-rank-row div {
  height: 10px;
  border-radius: 99px;
  background: #e8f2ff;
  overflow: hidden;
}

.finance-bar-row i,
.finance-rank-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--primary);
}

.finance-rank-row i {
  background: #22c55e;
}

.finance-bar-row strong,
.finance-rank-row strong {
  color: var(--text);
  font-size: 12px;
  white-space: nowrap;
}

.finance-commission-list {
  display: grid;
  gap: 8px;
}

.finance-commission-list article {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  padding: 10px;
  border-radius: 8px;
  background: #f8fbff;
}

.finance-commission-list span {
  color: var(--muted);
  font-size: 12px;
}

.finance-commission-list b {
  grid-row: 1 / span 2;
  grid-column: 2;
  align-self: center;
  color: var(--primary);
}

.finance-ai-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: var(--text);
  line-height: 1.55;
}

.finance-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
}

.finance-summary-actions button {
  min-width: 132px;
}

.finance-summary-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0;
  padding: 12px;
  border-radius: 8px;
  background: #f8fbff;
}

.finance-summary-number span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.finance-summary-number strong {
  color: var(--primary);
  font-size: 20px;
}

.finance-cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 4px 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

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

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

.finance-cost-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.finance-cost-row strong {
  color: var(--primary);
  white-space: nowrap;
}

.finance-cost-row small {
  grid-column: 1 / -1;
  color: var(--muted);
}

.editable-detail-table input {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 6px 8px;
  box-sizing: border-box;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.finance-cost-edit-table {
  min-width: 480px;
}

.finance-cost-edit-table th:nth-child(2) {
  width: 140px;
}

.finance-cost-row-actions {
  justify-content: flex-start;
  margin-top: 12px;
}

.assignment-toolbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.assignment-toolbar strong {
  color: var(--primary);
}

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

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

.assignment-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px) auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.assignment-card div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.assignment-card span,
.assignment-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.assignment-controls {
  display: grid;
  grid-template-columns: minmax(96px, 1fr) minmax(128px, 1fr) minmax(88px, 0.8fr);
  gap: 8px;
  min-width: 0;
}

.assignment-controls select,
.assignment-controls input {
  width: 100%;
  min-width: 0;
}

.salary-card {
  display: grid;
  gap: 8px;
  max-width: 460px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.salary-card strong {
  color: var(--primary);
  font-size: 32px;
}

.salary-card span,
.salary-card small {
  color: var(--muted);
}

.sidebar-logout {
  width: 100%;
  padding: 8px 12px;
  white-space: nowrap;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
}

.session-warning {
  color: #b45309;
  font-weight: 800;
}

.member-unregistered {
  color: var(--muted);
}

.schedule-toolbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  margin: 0 0 14px;
  overflow-x: auto;
  white-space: nowrap;
}

.schedule-control-group {
  min-height: 44px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.schedule-toolbar .schedule-view-switch {
  flex: 0 0 auto;
}

.schedule-toolbar .therapist-legend {
  flex: 0 0 auto;
  min-width: max-content;
  margin-bottom: 0;
}

.schedule-toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.schedule-period-nav {
  display: grid;
  grid-template-columns: 40px minmax(210px, 300px) 40px;
  align-items: center;
  gap: 8px;
  width: 360px;
  flex: 0 0 360px;
}

.schedule-summary {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-height: 38px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.schedule-summary strong {
  color: var(--text-strong);
}

.integrated-workspace {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

#dashboard .workbench-heading {
  margin-bottom: 10px;
}

#dashboard .integrated-workspace > .panel-head {
  margin-bottom: 8px;
}

#dashboard .integrated-workspace > .panel-head h2 {
  font-size: 16px;
}

#dashboard .dashboard-followup-workspace > .panel-head {
  display: none;
}

#dashboard .dashboard-followup-workspace {
  padding-top: 8px;
}

#dashboard .integrated-workspace > .panel-head p,
#dashboard .integrated-workspace > .config-panel {
  display: none;
}

#dashboard .followup-board,
#dashboard .handover-report {
  max-height: 320px;
  overflow: auto;
}

#dashboard .followup-kpis {
  display: none;
}

#dashboard .followup-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.experience-metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.followup-mini-list {
  display: block;
  grid-column: 1 / -1;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.55;
  text-align: left;
}

.section-inline-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.section-inline-heading > div {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.section-inline-heading strong {
  color: var(--text);
  font-size: 16px;
}

.section-inline-heading span,
.section-inline-heading small {
  color: var(--muted);
  font-size: 12px;
}

.today-customer-section,
.finance-review-overview {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.today-customer-list {
  display: grid;
  gap: 8px;
}

.today-customer-row {
  display: grid;
  grid-template-columns: 90px minmax(100px, 1fr) 80px minmax(120px, 1.2fr) 224px;
  gap: 16px;
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
}

.today-customer-row:hover {
  border-color: var(--primary);
  background: var(--surface);
}

.today-customer-assessment {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.today-customer-assessment small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.today-customer-actions {
  display: grid;
  grid-template-columns: 56px 104px 48px;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.today-customer-actions em,
.today-customer-transition {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
}

.today-customer-actions .mini-button {
  margin: 0;
  min-height: 32px;
  white-space: nowrap;
}

.today-customer-actions:has(> .today-customer-transition:empty) {
  grid-template-columns: 56px 48px;
  justify-content: end;
}

.today-customer-transition:empty {
  display: none;
}

.today-customer-row > time,
.today-customer-therapist {
  font-variant-numeric: tabular-nums;
  line-height: 20px;
}

.today-customer-main,
.today-customer-assessment {
  line-height: 20px;
}

.today-customer-row time,
.today-customer-row em {
  color: var(--primary);
  font-size: 13px;
  font-style: normal;
  font-weight: 800;
}

.today-customer-main,
.today-customer-main strong,
.today-customer-main small {
  display: block;
  min-width: 0;
}

.today-customer-main small,
.today-customer-therapist {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-customer-row > .today-customer-therapist {
  margin-top: 0;
}

.compact-empty-state {
  min-height: 64px;
  padding: 20px;
}

.finance-review-overview {
  margin-top: 10px;
  background: var(--surface-soft);
}

#reports > .other-module-tabs {
  display: none;
}

.finance-review-shortcuts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.finance-review-shortcuts button {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "label value" "note value";
  align-items: center;
  min-height: 72px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.finance-review-shortcuts button:hover {
  border-color: var(--primary);
}

.finance-review-shortcuts span {
  grid-area: label;
  font-weight: 800;
}

.finance-review-shortcuts strong {
  grid-area: value;
  color: var(--primary);
  font-size: 24px;
}

.finance-review-shortcuts small {
  grid-area: note;
  color: var(--muted);
}

.profile-block-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.finance-review-workspace {
  margin-top: 10px;
  padding-top: 0;
  border-top: 0;
}

.dashboard-handover-workspace {
  margin-top: 8px;
  padding-top: 8px;
}

#dashboard .followup-card {
  min-height: 0;
  padding: 12px;
}

#dashboard .handover-detail-disclosure {
  margin-top: 10px;
}

#dashboard .handover-detail-disclosure > summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 700;
}

.main > section.panel.active-view > .panel-head:first-child h2,
.main > section.panel.active-view > .panel-head:first-child .schedule-title-row > h2 {
  display: none;
}

.main > section.panel.active-view > .panel-head:first-child {
  min-height: 0;
  margin-bottom: 10px;
}

.main > section.panel.active-view > .table-wrap,
.main > section.panel.active-view > .detail-table-wrap {
  max-height: calc(100vh - 250px);
  overflow: auto;
}

@media (max-width: 980px) {
  #dashboard .followup-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .section-inline-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .today-customer-row {
    grid-template-columns: 82px minmax(0, 1fr) 62px;
    gap: 8px;
  }

  .today-customer-row > .today-customer-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .today-customer-assessment {
    grid-column: 1 / -1;
  }

  .today-customer-therapist {
    display: block;
  }

  .finance-review-shortcuts {
    grid-template-columns: 1fr;
  }

  .schedule-toolbar {
    gap: 6px;
  }

  .schedule-therapist-control {
    grid-template-columns: auto minmax(54px, 68px);
    gap: 5px;
    width: auto;
  }

  .schedule-therapist-color {
    display: none;
  }

  .schedule-therapist-control select {
    min-height: 34px;
    padding: 5px 22px 5px 7px;
  }

  .schedule-period-nav {
    grid-template-columns: 28px 140px 28px;
    gap: 4px;
    width: 204px;
    flex-basis: 204px;
  }

  .schedule-period-nav label {
    gap: 4px;
    font-size: 12px;
  }

  .schedule-period-nav input {
    width: 82px;
    min-width: 82px;
    padding: 5px;
  }

  .schedule-period-button {
    width: 28px !important;
    min-width: 28px !important;
    padding-inline: 0;
  }
}

.finance-review-workspace {
  margin-top: 28px;
}

.schedule-period-button {
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  padding: 0;
  font-size: 18px;
  line-height: 40px;
  text-align: center;
}

.schedule-view-switch {
  display: flex;
  gap: 8px;
}

.schedule-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.schedule-title-row h2 {
  margin: 0;
}

#generateHandoverButton {
  white-space: nowrap;
}

.client-login-copy strong {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
}

.client-login-copy strong span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

#appointments table,
#patients table {
  width: 100%;
  min-width: 100%;
  table-layout: fixed;
}

#appointments,
#patients {
  width: 100%;
  max-width: 100%;
}

#appointments > table,
#patients > table {
  display: table;
  max-width: 100%;
}

#appointments table,
#appointments thead,
#appointments tbody,
#appointments tr,
#patients table,
#patients thead,
#patients tbody,
#patients tr {
  inline-size: 100%;
}

#appointments > table thead,
#appointments > table tbody,
#appointments > table tr,
#patients > table thead,
#patients > table tbody,
#patients > table tr {
  width: 100%;
}

#appointments th,
#appointments td,
#patients th,
#patients td {
  white-space: normal;
  word-break: break-word;
}

#appointments th:nth-child(1),
#appointments td:nth-child(1) {
  width: 18%;
}

#appointments th:nth-child(8),
#appointments td:nth-child(8) {
  width: 16%;
}

#patients th:nth-child(1),
#patients td:nth-child(1) {
  width: 16%;
}

#patients th:nth-child(5),
#patients td:nth-child(5) {
  width: 18%;
}

.appointment-day-toolbar {
  display: grid;
  grid-template-columns: 42px minmax(180px, 260px) 42px;
  align-items: center;
  gap: 8px;
  width: min(100%, 380px);
  margin: 0 0 14px;
}

.appointment-day-toolbar input {
  margin-top: 0;
  text-align: center;
  font-weight: 800;
}

.appointment-day-toolbar button {
  min-width: 42px;
  padding: 0;
  font-size: 16px;
  font-weight: 900;
}

.empty-table-cell {
  padding: 22px;
  text-align: center;
  color: var(--muted);
  width: 100%;
  min-width: 100%;
}

.processed-appointments {
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f8fafc;
}

.processed-appointments summary {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 14px;
  cursor: pointer;
  color: var(--primary);
  font-weight: 800;
  list-style: none;
}

.processed-appointments summary::-webkit-details-marker {
  display: none;
}

.processed-appointments summary::after {
  content: "展开";
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.processed-appointments[open] summary::after {
  content: "收起";
}

.processed-appointments .detail-table-wrap {
  padding: 0 12px 12px;
}

.schedule-view-switch .is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.therapist-legend {
  display: block;
  margin-bottom: 14px;
}

.schedule-therapist-control {
  display: grid;
  grid-template-columns: auto 12px minmax(180px, 320px);
  align-items: center;
  gap: 9px;
  width: min(100%, 430px);
}

.schedule-therapist-control label {
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.schedule-therapist-control select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 34px 8px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
}

.schedule-therapist-control select:focus-visible {
  border-color: var(--primary);
  outline: 2px solid var(--primary-soft);
  outline-offset: 1px;
}

.schedule-therapist-control select:disabled {
  color: #475569;
  cursor: default;
  opacity: 1;
}

.schedule-therapist-color,
.schedule-event-therapist {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.schedule-therapist-color i,
.schedule-event-therapist i {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  background: var(--therapist-color);
}

.therapist-all {
  --therapist-color: #475569;
  --therapist-bg: #f1f5f9;
}

.therapist-color-0 { --therapist-color: #1d4ed8; --therapist-bg: #dbeafe; }
.therapist-color-1 { --therapist-color: #0f766e; --therapist-bg: #ccfbf1; }
.therapist-color-2 { --therapist-color: #15803d; --therapist-bg: #dcfce7; }
.therapist-color-3 { --therapist-color: #a16207; --therapist-bg: #fef3c7; }
.therapist-color-4 { --therapist-color: #be123c; --therapist-bg: #ffe4e6; }

.schedule-calendar {
  width: 100%;
  min-width: 0;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
}

.schedule-rule-note {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  background: #eff6ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.schedule-day-grid {
  --schedule-day-slot-height: 82px;
  display: block;
  min-width: var(--schedule-day-min-width, 760px);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-radius: 6px;
  isolation: isolate;
  overflow: hidden;
}

.schedule-day-row {
  display: grid;
  grid-template-columns: 72px repeat(var(--schedule-day-columns, 1), minmax(158px, 1fr));
}

.schedule-day-row:not(.schedule-day-header) {
  height: var(--schedule-day-slot-height);
}

.schedule-grid-head,
.schedule-time,
.schedule-slot {
  min-width: 0;
  min-height: 62px;
  padding: 7px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.schedule-day-header .schedule-grid-head {
  min-height: 44px;
}

.schedule-day-header .schedule-grid-head:not(.schedule-day-date) {
  border-top: 3px solid var(--therapist-color, var(--primary));
}

.schedule-day-header .schedule-grid-head small {
  display: block;
  margin-top: 4px;
  color: #60788c;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
}

.schedule-day-row:not(.schedule-day-header) > .schedule-time,
.schedule-day-row:not(.schedule-day-header) > .schedule-slot {
  height: 100%;
  min-height: 0;
}

.schedule-grid-head {
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 800;
}

.schedule-therapist-label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--therapist-color, #334155);
  font-weight: 800;
  text-align: left;
}

.schedule-therapist-label i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--therapist-color, var(--primary));
}

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

.schedule-slot {
  position: relative;
  background: #ffffff;
  overflow: visible;
}

.schedule-slot-events {
  position: absolute;
  inset: 0;
  min-width: 0;
  pointer-events: none;
  z-index: 3;
}

.schedule-event,
.schedule-available {
  width: 100%;
  height: auto;
  min-height: 40px;
  padding: 7px 8px;
  border-radius: 6px;
  text-align: left;
  line-height: 1.35;
  white-space: normal;
}

.schedule-event {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 104px;
  border: 1px solid var(--therapist-color);
  border-left-width: 4px;
  background: var(--therapist-bg);
  color: #1f2937;
  overflow: visible;
}

.schedule-event-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

.schedule-event-therapist {
  color: var(--therapist-color);
  font-size: 12px;
  font-weight: 900;
}

.schedule-event-duration {
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid color-mix(in srgb, var(--therapist-color) 28%, transparent);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.65);
  color: var(--therapist-color);
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

.schedule-event-patient,
.schedule-event-time,
.schedule-event-service {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.schedule-event-time {
  color: #475569;
  font-size: 11px;
  font-weight: 800;
}

.schedule-event-service {
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}

.schedule-event-patient {
  color: #334155;
  font-size: 12px;
}

.schedule-event-patient strong {
  color: #111827;
  font-size: 13px;
}

.schedule-event-mini {
  gap: 2px;
  min-height: 0;
  padding: 5px 6px;
  font-size: 10px;
}

.schedule-event-compact-time,
.schedule-event-compact-service,
.schedule-event-compact-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-event-compact-time {
  color: var(--therapist-color);
  font-size: 10px;
  font-weight: 900;
}

.schedule-event-compact-service {
  color: #1f2937;
  font-size: 10px;
  font-weight: 800;
}

.schedule-event-compact-meta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: #475569;
  font-size: 9px;
}

.schedule-event-compact-meta i {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--therapist-color);
}

.schedule-event-day,
.schedule-event-week {
  position: absolute;
  top: calc(var(--schedule-event-top, 0%) + 4px);
  left: calc(var(--schedule-event-left, 0%) + 4px);
  z-index: 4;
  width: calc(var(--schedule-event-width, 100%) - 8px);
  height: calc(var(--schedule-event-height, 100%) - 8px);
  min-height: 0;
  margin: 0;
  overflow: hidden;
  pointer-events: auto;
}

.schedule-event-short {
  gap: 1px;
  padding: 4px 6px;
}

.schedule-event-short .schedule-event-head {
  gap: 5px;
}

.schedule-event-short .schedule-event-therapist,
.schedule-event-short .schedule-event-patient,
.schedule-event-short .schedule-event-patient strong,
.schedule-event-short .schedule-event-service {
  font-size: 10px;
  line-height: 1.15;
}

.schedule-event-short .schedule-event-time,
.schedule-event-short .schedule-event-duration {
  font-size: 9px;
  line-height: 1.1;
}

.schedule-slot-event-start {
  background: #f8fafc;
}

.schedule-slot-empty {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.schedule-slot-unavailable {
  background: #f8fafc;
}

.schedule-event:hover {
  background: var(--therapist-bg);
  filter: brightness(0.97);
}

.schedule-event.schedule-conflict {
  border-color: #dc2626;
  background: #fee2e2;
  color: #991b1b;
}

.schedule-available {
  border: 1px dashed #94a3b8;
  background: #ffffff;
  color: #64748b;
}

.schedule-available.internal-only {
  border-color: #bae6fd;
  background: #f0f9ff;
  color: #0369a1;
}

.schedule-available:hover {
  border-color: var(--primary);
  background: #eff6ff;
  color: var(--primary);
}

.schedule-therapist-name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: auto;
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid var(--therapist-color);
  border-radius: 999px;
  background: var(--therapist-bg);
  color: var(--therapist-color);
  font-size: 12px;
  font-weight: 800;
}

.schedule-therapist-name.is-active {
  background: var(--therapist-bg);
  box-shadow: inset 0 0 0 1px var(--therapist-color);
}

.schedule-week-grid {
  --schedule-week-slot-height: 82px;
  display: grid;
  grid-template-columns: 58px repeat(7, minmax(0, 1fr));
  grid-template-rows: 42px;
  grid-auto-rows: var(--schedule-week-slot-height);
  width: 100%;
  min-width: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  isolation: isolate;
}

.schedule-week-view {
  min-width: 0;
}

.schedule-week-dense-grid {
  display: none;
  grid-template-columns: 58px repeat(7, minmax(0, 1fr));
  grid-template-rows: 42px;
  grid-auto-rows: minmax(46px, auto);
  width: 100%;
  min-width: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.schedule-week-agenda {
  display: none;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.schedule-week-view.is-all .schedule-week-grid {
  display: none;
}

.schedule-week-view.is-all .schedule-week-dense-grid {
  display: grid;
}

.schedule-week-dense-cell {
  display: grid;
  align-content: start;
  gap: 4px;
  min-width: 0;
  min-height: 46px;
  padding: 4px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.schedule-week-dense-cell.is-empty {
  background: #fbfdfe;
}

.schedule-week-dense-event {
  display: grid;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 5px 6px;
  overflow: hidden;
  border: 1px solid var(--therapist-color);
  border-left-width: 3px;
  border-radius: 5px;
  background: var(--therapist-bg);
  color: #1f2937;
  text-align: left;
}

.schedule-week-dense-primary,
.schedule-week-dense-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.schedule-week-dense-primary b {
  flex: 0 0 auto;
  color: var(--therapist-color);
  font-size: 9px;
}

.schedule-week-dense-primary span,
.schedule-week-dense-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-week-dense-primary span {
  color: #1f2937;
  font-size: 10px;
  font-weight: 800;
}

.schedule-week-dense-meta {
  color: #526273;
  font-size: 9px;
}

.schedule-week-dense-meta i {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--therapist-color);
}

.schedule-week-agenda-day {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.schedule-week-agenda-day.is-empty {
  background: #fbfdfe;
}

.schedule-week-agenda-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
  min-height: 36px;
  padding: 7px 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #f4f8fb;
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  text-align: left;
}

.schedule-week-agenda-head small {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
}

.schedule-week-agenda-events {
  display: grid;
  gap: 5px;
  padding: 6px;
}

.schedule-week-agenda-event {
  display: grid;
  gap: 2px;
  width: 100%;
  min-width: 0;
  padding: 6px;
  overflow: hidden;
  border: 1px solid var(--therapist-color);
  border-left-width: 3px;
  border-radius: 5px;
  background: var(--therapist-bg);
  color: #1f2937;
  text-align: left;
}

.schedule-week-agenda-primary,
.schedule-week-agenda-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.schedule-week-agenda-primary b {
  flex: 0 0 auto;
  color: var(--therapist-color);
  font-size: 9px;
}

.schedule-week-agenda-primary span,
.schedule-week-agenda-meta {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-week-agenda-primary span {
  font-size: 10px;
  font-weight: 800;
}

.schedule-week-agenda-meta {
  color: #526273;
  font-size: 9px;
}

.schedule-week-agenda-meta i {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--therapist-color);
}

.schedule-week-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.schedule-week-head,
.schedule-week-time,
.schedule-week-cell {
  box-sizing: border-box;
  height: 100%;
  min-height: 48px;
  padding: 6px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.schedule-week-head {
  min-height: 0;
  background: #f8fafc;
  color: var(--primary);
  font-size: 11px;
  font-weight: 900;
  text-align: center;
}

.schedule-week-head span,
.schedule-week-head small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-week-head small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.schedule-week-time {
  min-height: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.schedule-week-cell {
  position: relative;
  display: block;
  min-height: 0;
  padding: 0;
  min-width: 0;
  overflow: visible;
}

.schedule-week-available {
  min-height: 30px;
  padding: 5px;
  font-size: 10px;
  line-height: 1.2;
}

.schedule-day-column,
.schedule-month-day {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.schedule-day-heading {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.schedule-therapist-lane {
  display: grid;
  gap: 6px;
  padding: 9px;
  border-bottom: 1px solid #eef2f7;
}

.schedule-therapist-lane:last-child {
  border-bottom: 0;
}

.schedule-therapist-name {
  color: var(--therapist-color);
  font-size: 12px;
  font-weight: 800;
}

.schedule-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  width: 100%;
}

.schedule-month-day {
  min-height: 150px;
  padding: 0;
  min-width: 0;
  overflow: visible;
}

.schedule-month-date {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px;
  margin-bottom: 6px;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.schedule-month-date small {
  color: var(--muted);
  font-size: 9px;
  white-space: nowrap;
}

.schedule-month-weekday {
  padding: 6px;
  border-radius: 5px;
  background: #eef5fa;
  color: #475569;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.schedule-month-day-button {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  width: 100%;
  min-height: 148px;
  height: 100%;
  padding: 8px;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: inherit;
  text-align: left;
}

.schedule-month-day-button:hover {
  background: #f8fbfd;
}

.schedule-month-events {
  display: grid;
  align-content: start;
  gap: 4px;
  width: 100%;
}

.settings-availability-rules {
  margin-top: 16px;
}

.leave-month-toolbar { display: flex; align-items: center; gap: 8px; margin: 0 0 14px; width: fit-content; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.leave-month-toolbar strong { min-width: 136px; color: #173f5b; font-size: 15px; text-align: center; }
.leave-status-bar { display: flex; align-items: center; gap: 16px; min-height: 38px; padding: 8px 12px; border: 1px solid #d6e4ee; border-bottom: 0; border-radius: 6px 6px 0 0; background: #f7fbfe; color: #456176; font-size: 12px; }
.leave-status-bar span { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; }
.leave-status-bar small { margin-left: auto; color: #71879a; }
.leave-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #2b86c5; }
.leave-status-dot.approved { background: #2e9b66; }
.leave-status-dot.pending { background: #d68a18; }
.leave-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid #cdddea;
  border-radius: 0 0 6px 6px;
  background: #fff;
}
.leave-calendar-weekday { padding: 9px 6px; border-right: 1px solid #dbe7ef; background: #eaf4fb; color: #335a75; font-size: 12px; font-weight: 800; text-align: center; }
.leave-calendar-day { position: relative; display: flex; min-width: 0; min-height: 102px; padding: 8px; flex-direction: column; gap: 7px; border: 0; border-top: 1px solid #dbe7ef; border-right: 1px solid #dbe7ef; border-radius: 0; background: #fff; color: #29465b; text-align: left; transition: background-color 120ms ease, box-shadow 120ms ease; }
.leave-calendar-day:hover { z-index: 1; background: #eef7fd; box-shadow: inset 0 0 0 2px #88bfe4; }
.leave-calendar-day:focus-visible { z-index: 2; outline: 3px solid rgba(43, 134, 197, .28); outline-offset: -3px; }
.leave-calendar-day:disabled { cursor: default; opacity: 1; }
.leave-calendar-day.is-outside { background: #f7f9fb; color: #9aa9b5; }
.leave-calendar-day.is-today .leave-day-number { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: #247fbd; color: #fff; }
.leave-calendar-day.has-items::after { position: absolute; top: 10px; right: 9px; width: 5px; height: 5px; border-radius: 50%; background: #5aa9dc; content: ""; }
.leave-day-number { font-size: 13px; font-weight: 800; }
.leave-day-items { display: grid; gap: 4px; min-width: 0; }
.leave-day-tag { overflow: hidden; padding: 3px 5px; border-radius: 3px; background: #e8f3fb; color: #225f8e; font-size: 10px; font-style: normal; line-height: 1.3; text-overflow: ellipsis; white-space: nowrap; }
.leave-day-tag.pending { background: #fff3df; color: #985c00; }
.leave-day-tag.approved { background: #e7f6ee; color: #177144; }
.leave-day-more { color: #60788c; font-size: 10px; font-style: normal; }
.leave-records { margin-top: 14px; border-top: 1px solid #dbe7ef; }
.leave-records-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 2px 9px; cursor: pointer; list-style: none; }
.leave-records-head::-webkit-details-marker { display: none; }
.leave-records-head strong::before { display: inline-block; margin-right: 7px; color: #5083a7; content: "▸"; transition: transform 120ms ease; }
.leave-records[open] .leave-records-head strong::before { transform: rotate(90deg); }
.leave-records-head span { color: #60788c; font-size: 12px; }
.leave-table-wrap { overflow-x: auto; }
.leave-table { width: 100%; min-width: 760px; }
.leave-table td small { display: block; margin-top: 4px; color: #708294; }
.leave-loading { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; min-height: 260px; align-content: center; padding: 28px; }
.leave-loading span { height: 64px; border-radius: 5px; background: linear-gradient(90deg, #edf3f7 25%, #f8fbfd 50%, #edf3f7 75%); background-size: 200% 100%; animation: leave-loading 1.1s linear infinite; }
.leave-loading p { grid-column: 1 / -1; margin: 4px 0 0; color: #71879a; font-size: 12px; text-align: center; }
@keyframes leave-loading { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .leave-loading span { animation: none; } }

.schedule-low-balance {
  display: inline-flex;
  align-items: center;
  margin-right: 5px;
  padding: 1px 5px;
  border: 1px solid #dc3545;
  border-radius: 4px;
  background: #fff2f3;
  color: #b42331;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.35;
  white-space: nowrap;
}

.schedule-week-dense-primary > .schedule-low-balance,
.schedule-week-agenda-primary > .schedule-low-balance,
.schedule-month-event-primary > .schedule-low-balance {
  flex: 0 0 auto;
  margin: 0 0 0 auto;
  overflow: visible;
  border-color: #dc3545;
  background: #fff2f3;
  color: #b42331;
  font-size: 9px;
  line-height: 1.25;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .leave-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .leave-calendar { min-width: 700px; }
  .leave-board { overflow-x: auto; }
  .leave-records { min-width: 700px; }
}

.schedule-month-event {
  display: grid;
  gap: 1px;
  min-width: 0;
  padding: 4px 5px;
  border-left: 3px solid var(--therapist-color);
  border-radius: 4px;
  background: var(--therapist-bg);
}

.schedule-month-event-primary,
.schedule-month-event-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.schedule-month-event-primary b {
  flex: 0 0 auto;
  color: var(--therapist-color);
  font-size: 9px;
}

.schedule-month-event-primary span,
.schedule-month-event-meta {
  min-width: 0;
  overflow-wrap: anywhere;
}

.schedule-month-event-primary span {
  color: #1f2937;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.25;
}

.schedule-month-event-meta {
  color: #475569;
  font-size: 8px;
  line-height: 1.25;
}

.schedule-month-event-meta i {
  flex: 0 0 auto;
  width: 5px;
  height: 5px;
  border-radius: 1px;
  background: var(--therapist-color);
}

.schedule-month-more {
  color: var(--primary);
  font-size: 9px;
  font-weight: 800;
}

.profile-quick-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.theme-mode-control {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  gap: 8px;
  line-height: 1.2;
  margin: 0;
  white-space: nowrap;
}

.sidebar-theme-control {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  width: 100%;
}

.theme-mode-control select {
  appearance: none;
  background: var(--surface) linear-gradient(45deg, transparent 50%, var(--muted) 50%) calc(100% - 13px) 50% / 5px 5px no-repeat;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  min-height: 38px;
  min-width: 96px;
  padding: 8px 28px 8px 12px;
}

.sidebar-theme-control select,
.sidebar-logout {
  width: 100%;
  min-width: 0;
}

.sidebar-logout {
  justify-content: center;
}

.entry-theme-control {
  justify-content: flex-end;
  margin: -6px 0 12px;
  width: 100%;
}

.sidebar-theme-control {
  align-self: center;
}

.availability-rules {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.availability-rules summary {
  color: var(--primary);
  font-weight: 800;
  cursor: pointer;
}

.availability-rules .table-wrap {
  margin-top: 12px;
}

.schedule-editor {
  display: grid;
  gap: 18px;
}

.schedule-editor .modal-note {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.schedule-editor .modal-note span,
.schedule-editor-section-head span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.schedule-editor-week {
  display: grid;
  gap: 10px;
}

.schedule-editor-day {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.schedule-editor-day-head,
.schedule-editor-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-body .schedule-editor-day-head label,
.modal-body .schedule-editor-full-day {
  display: inline-flex;
  align-items: center;
  grid-auto-flow: column;
  justify-content: start;
  gap: 7px;
}

.schedule-editor-ranges,
[data-schedule-closures] {
  display: grid;
  gap: 8px;
}

.schedule-editor-range {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr)) minmax(130px, 0.9fr) auto;
  align-items: end;
  gap: 8px;
}

.schedule-editor-range select {
  min-width: 0;
}

.schedule-editor-closures {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.schedule-editor-section-head > div {
  display: grid;
  gap: 3px;
}

.schedule-editor-closure {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.schedule-editor-closure .schedule-editor-remove {
  align-self: end;
  justify-self: start;
}

.schedule-change-preview {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid #f59e0b;
  border-radius: 8px;
  background: #fffbeb;
}

.schedule-change-preview p {
  margin: 0;
  color: #78350f;
  font-size: 13px;
  line-height: 1.6;
}

.commission-policy-panel .panel-head {
  margin-bottom: 10px;
}

.policy-edit-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) repeat(2, minmax(120px, 0.6fr));
  gap: 8px 12px;
  align-items: end;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.policy-edit-row strong,
.policy-edit-row small {
  grid-column: 1 / -1;
}

.policy-edit-row small {
  color: var(--muted);
  font-size: 12px;
}

.policy-edit-row label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.staff-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: 12px;
}

.staff-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.staff-add-card,
.catalog-add-card {
  width: 100%;
  min-height: 160px;
  height: 100%;
  display: grid;
  place-content: center;
  gap: 6px;
  border: 1px dashed var(--primary);
  border-radius: var(--radius-lg);
  background: var(--primary-subtle);
  color: var(--primary-dark);
  text-align: center;
}

.staff-add-card:hover,
.catalog-add-card:hover {
  border-style: solid;
  background: var(--primary-soft);
}

.staff-add-card strong,
.catalog-add-card strong {
  font-size: 18px;
}

.staff-add-card span,
.catalog-add-card span {
  color: var(--muted);
  font-size: 12px;
}

.leave-availability-rules {
  margin-top: 14px;
}

.leave-day-detail-list {
  display: grid;
  gap: 8px;
}

.leave-day-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-soft);
}

.leave-day-detail-row div,
.leave-day-detail-row span {
  display: grid;
  gap: 2px;
}

.leave-day-detail-row small {
  color: var(--muted);
}

@media (max-width: 720px) {
  .leave-day-detail-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .leave-day-detail-row small {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

#availability,
#leave,
#patients,
#catalog,
#staff {
  padding-top: 14px;
}

@media (min-width: 721px) {
  #availability.active-view,
  #leave.active-view,
  #patients.active-nested {
    padding-top: 14px;
  }
}

.auxiliary-register-grid .consent-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  line-height: 1.5;
}

.auxiliary-register-grid .consent-check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 3px;
}

.staff-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.staff-card-head div {
  display: grid;
  gap: 4px;
}

.staff-card-head strong {
  color: var(--primary);
  font-size: 16px;
}

.staff-card-head span,
.staff-card-meta {
  color: var(--muted);
  font-size: 12px;
}

.staff-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.staff-card-roles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.staff-card-actions {
  align-content: start;
}

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

.product-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

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

.product-card h3 {
  margin-top: 4px;
  color: var(--primary);
}

.product-card p {
  color: #334155;
  line-height: 1.6;
}

.product-card strong {
  color: var(--primary);
  font-size: 18px;
}

.assessment-cover {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  padding: 22px;
  border-radius: 8px;
  background: linear-gradient(135deg, #123f91 0%, #1769b3 55%, #2daeea 100%);
  color: #ffffff;
}

.assessment-cover img {
  width: 150px;
  height: 66px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.92);
}

.assessment-cover strong,
.assessment-cover span {
  display: block;
}

.assessment-cover strong {
  font-size: 24px;
}

.assessment-cover span {
  margin-top: 6px;
  opacity: 0.88;
}

.form-section {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.form-section h3 {
  margin-bottom: 14px;
  color: var(--primary);
}

.form-section label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
}

.inline-checkbox {
  display: flex !important;
  grid-template-columns: none !important;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  line-height: 1.5;
}

.multi-check-dropdown {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.multi-check-dropdown summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px;
  cursor: pointer;
  list-style: none;
}

.multi-check-dropdown summary::-webkit-details-marker {
  display: none;
}

.multi-check-dropdown summary span {
  color: #334155;
  font-weight: 800;
}

.multi-check-dropdown summary strong {
  min-width: 0;
  color: var(--primary);
  font-size: 13px;
  font-weight: 800;
  text-align: right;
}

.multi-check-menu {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.multi-check-menu.compact {
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
}

.multi-check-menu label {
  display: flex;
  grid-template-columns: none;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.multi-check-menu input[data-multi-other],
.multi-check-menu button {
  grid-column: 1 / -1;
}

.catalog-category-board {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  margin-top: 0;
  margin-bottom: 0;
}

.catalog-category-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  width: 100%;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: thin;
  box-sizing: border-box;
}

.catalog-category-tab {
  display: flex;
  flex: 1 0 108px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 108px;
  min-height: 44px;
  padding: 9px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  white-space: nowrap;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.catalog-category-tab:hover {
  border-color: rgba(47, 111, 159, 0.52);
  background: var(--primary-subtle);
}

.catalog-category-tab.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 6px 16px rgba(47, 111, 159, 0.2);
}

.catalog-category-tab small {
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.catalog-category-tab.is-active small {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.catalog-category-panel {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.catalog-category-panel h3 {
  display: flex;
  justify-content: space-between;
  color: var(--primary);
}

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

.catalog-category-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  grid-auto-rows: 1fr;
  align-items: stretch;
  gap: 10px;
}

.catalog-product-card,
.catalog-category-list article {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto auto;
  gap: 0;
  width: 100%;
  height: 100%;
  min-height: 112px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.05);
  box-sizing: border-box;
  color: inherit;
  text-align: left;
  overflow: hidden;
}

.catalog-product-card {
  cursor: pointer;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.catalog-product-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  background: #f8fbff;
  box-shadow: 0 10px 26px rgba(15, 23, 42, 0.12);
}

.catalog-product-card:active {
  transform: scale(0.99);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

.catalog-product-card strong,
.catalog-product-title {
  display: block;
  min-width: 0;
  margin-bottom: 8px;
  color: var(--primary);
  font-size: 14px;
  font-weight: 900;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-product-card span,
.catalog-product-price {
  display: block;
  min-width: 0;
  margin-bottom: 8px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-product-card small,
.catalog-product-desc {
  display: -webkit-box;
  min-width: 0;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

.catalog-product-meta {
  display: block;
  margin-bottom: 10px;
  color: #64748b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.catalog-product-card em,
.catalog-product-status {
  justify-self: start;
  align-self: end;
  padding: 2px 6px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.catalog-product-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.catalog-product-actions .mini-button {
  min-height: 30px;
  padding: 5px 10px;
}

.catalog-category-list strong {
  display: block;
  min-width: 0;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-category-list span {
  display: block;
  min-width: 0;
  color: var(--primary);
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
}

.catalog-category-list small,
.catalog-category-list p {
  display: block;
  min-width: 0;
  color: var(--muted);
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
}

.check-field {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.check-field legend {
  padding: 0 4px;
  color: #334155;
  font-weight: 800;
}

.check-field label {
  display: flex;
  grid-template-columns: none;
  flex-direction: row;
  align-items: center;
  gap: 7px;
  font-weight: 600;
}

.check-field.horizontal {
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
}

.check-field.horizontal legend {
  grid-column: 1 / -1;
}

.form-section select,
.modal-grid select {
  width: 100%;
  padding: 0 10px;
}

#aiLoadPatient {
  margin: 12px 0;
}

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

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

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

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

.form-grid.five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.consent-box p {
  margin-bottom: 14px;
  color: #334155;
  line-height: 1.7;
}

.body-section {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
}

.body-section img {
  width: 100%;
}

.large-input {
  min-height: 150px;
}

.upload-box {
  padding: 18px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: #eff6ff;
}

.ai-status {
  padding: 7px 10px;
  border: 1px solid #93c5fd;
  border-radius: 6px;
  background: #eff6ff;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.ai-notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  background: #eff6ff;
  color: #1e3a5f;
  font-size: 13px;
  line-height: 1.6;
}

.ai-choice-section {
  display: grid;
  gap: 9px;
  margin-bottom: 16px;
}

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

.choice-grid label,
.modal-choice-grid label,
.ai-plan-list label,
.ai-action-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  cursor: pointer;
}

.choice-grid input,
.modal-choice-grid input,
.ai-plan-list input,
.ai-action-list input {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
}

.warning-choice {
  padding: 12px;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
}

.ai-output-section {
  border-color: #93c5fd;
}

.ai-plan-list,
.ai-action-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.ai-plan-list label {
  align-items: flex-start;
}

.ai-plan-list input {
  margin-top: 2px;
}

.ai-recommendation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.ai-output-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.modal-choice-group {
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  border: 0;
}

.modal-choice-group legend {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.modal-choice-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.therapist-choice-group .modal-choice-grid {
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
}

.therapist-choice-group .modal-choice-grid label {
  min-height: 34px;
  padding: 7px 8px;
}

.action-filters {
  display: grid;
  grid-template-columns: auto 180px 220px minmax(220px, 1fr);
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}

.action-selection-bar {
  position: sticky;
  top: 12px;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #93c5fd;
  border-radius: 8px;
  background: #eff6ff;
  box-shadow: 0 8px 24px rgba(18, 63, 145, 0.1);
}

.action-selection-bar strong,
.action-selection-bar span {
  display: block;
}

.action-selection-bar strong {
  color: var(--primary);
}

.action-selection-bar span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.action-selection-actions {
  display: flex;
  gap: 8px;
}

.action-type-filter {
  display: flex;
  gap: 8px;
}

.action-filters label {
  display: grid;
  gap: 6px;
}

.action-filters select {
  width: 100%;
  padding: 0 10px;
}

.action-filters .ghost-button.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.action-count {
  margin: -4px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.action-library-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.action-card {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.action-card-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.action-card h3 {
  color: var(--primary);
}

.action-meta {
  color: var(--muted);
  font-size: 12px;
}

.action-text-sections {
  display: grid;
  gap: 10px;
}

.action-text-item {
  display: grid;
  grid-template-columns: 68px 1fr;
  gap: 8px;
  color: #334155;
  font-size: 13px;
  line-height: 1.6;
}

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

.action-checks {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.action-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #334155;
}

.action-checks input {
  width: 16px;
  height: 16px;
}

.action-empty {
  grid-column: 1 / -1;
  padding: 32px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.selected-actions {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.selected-actions strong {
  color: var(--primary);
}

.selected-action-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.selected-action-pill {
  padding: 6px 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #123f91;
  font-size: 12px;
}

.section-note {
  margin-bottom: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.measurement-help {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.measurement-help span {
  padding: 6px 10px;
  border-radius: 999px;
  background: #dbeafe;
  color: #123f91;
  font-size: 12px;
}

.profile-detail {
  display: grid;
  gap: 12px;
}

.profile-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}

.profile-summary span {
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 700;
}

.profile-block {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.profile-block h3 {
  margin-bottom: 8px;
  color: var(--primary);
}

.profile-block p {
  color: #334155;
  line-height: 1.7;
}

.profile-history {
  display: grid;
  gap: 10px;
}

.profile-history > h3 {
  color: var(--primary);
}

.profile-history-item {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid #bfdbfe;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  background: #f8fbff;
}

.profile-history-item > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.profile-history-item strong {
  color: var(--primary);
}

.profile-history-item span {
  color: var(--muted);
  font-size: 12px;
}

.profile-history-item p {
  color: #334155;
  line-height: 1.65;
}

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

.team-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.team-card-heading {
  display: flex;
  align-items: center;
  gap: 12px;
}

.team-photo {
  width: 72px;
  height: 82px;
}

.team-card h3 {
  color: var(--primary);
}

.team-role {
  color: var(--muted);
  font-size: 13px;
}

.team-list {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 13px;
  line-height: 1.5;
}

.team-card.disabled {
  background: #f8fafc;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 20;
  max-width: 360px;
  padding: 12px 16px;
  border-radius: 8px;
  background: #123f91;
  color: #ffffff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.42);
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  width: min(680px, 100%);
  max-height: min(760px, calc(100vh - 48px));
  overflow: auto;
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.24);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.modal-body {
  display: grid;
  gap: 14px;
  padding: 20px;
}

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

.modal-grid .full-span {
  grid-column: 1 / -1;
}

.appointment-problem-field textarea {
  min-height: 108px;
  resize: vertical;
}

.appointment-customer-type .modal-choice-grid,
.appointment-service-field .modal-choice-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.appointment-service-field .modal-choice-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.modal-note {
  min-width: 0;
}

.sale-flow-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  background: #f8fbff;
}

.sale-flow-card strong {
  color: var(--primary);
  font-size: 15px;
  font-weight: 900;
}

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

.sale-flow-steps span {
  min-width: 0;
  padding: 7px 8px;
  border-radius: 8px;
  background: #ffffff;
  color: #1e3a8a;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.sale-flow-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.modal-body label {
  display: grid;
  gap: 6px;
}

.full-span {
  grid-column: 1 / -1;
}

.staff-permission-grid,
.staff-role-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.staff-permission-grid label,
.staff-role-card {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #f8fbff;
  color: var(--primary);
  font-weight: 700;
}

.staff-permission-grid input,
.staff-role-card input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 16px;
}

.staff-role-choice {
  display: grid;
  gap: 14px;
  line-height: 1.6;
}

.staff-role-choice p {
  margin: 0;
  color: #334155;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 8px;
}

.confirmation-copy {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #334155;
  line-height: 1.7;
}

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

.mini-button {
  height: 30px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--primary);
  font-size: 12px;
  white-space: nowrap;
  word-break: keep-all;
}

.mini-button:hover {
  background: #eff6ff;
}

/* UI upgrade: employee-side design system layer. Keeps business classes intact. */
body {
  background: var(--bg);
}

/* Login experience: the anatomical spotlight is isolated from all business views. */
.entry-screen {
  --spotlight-x: 37%;
  --spotlight-y: 49%;
  grid-template-columns: minmax(0, 1.45fr) minmax(420px, 0.72fr);
  place-items: stretch;
  padding: 0;
  overflow: hidden;
  background: #eef3f2;
}

.entry-visual {
  position: relative;
  min-width: 0;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  touch-action: none;
  contain: layout paint;
}

.entry-visual::after {
  position: absolute;
  inset: 0;
  z-index: 3;
  background:
    linear-gradient(90deg, rgba(246, 249, 248, 0.08) 48%, rgba(238, 243, 242, 0.96) 100%),
    linear-gradient(0deg, rgba(238, 243, 242, 0.88) 0%, rgba(238, 243, 242, 0.06) 46%);
  content: "";
  pointer-events: none;
}

.entry-visual-layer {
  position: absolute;
  inset: 0;
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.entry-visual-surface {
  background-image: var(--entry-surface-image, url("./assets/login/knee-surface.webp"));
  filter: var(--entry-surface-filter, none) saturate(0.72) contrast(0.82) brightness(1.16);
}

.entry-visual-anatomy {
  z-index: 1;
  background-image: var(--entry-anatomy-image, url("./assets/login/knee-surface.webp"));
  clip-path: circle(clamp(150px, 20vw, 265px) at var(--spotlight-x) var(--spotlight-y));
  will-change: clip-path;
}

.entry-visual.surface-only .entry-visual-anatomy,
.entry-visual.surface-only .entry-spotlight-ring {
  display: none;
}

.entry-spotlight-ring {
  position: absolute;
  left: var(--spotlight-x);
  top: var(--spotlight-y);
  z-index: 2;
  width: clamp(300px, 40vw, 530px);
  aspect-ratio: 1;
  border: 1px solid rgba(28, 105, 89, 0.42);
  border-radius: 50%;
  box-shadow:
    0 0 0 1px rgba(28, 105, 89, 0.1),
    0 0 38px rgba(28, 105, 89, 0.1);
  pointer-events: none;
  transform: translate(-50%, -50%);
  will-change: left, top;
}

.entry-visual-copy {
  position: absolute;
  left: clamp(28px, 5vw, 76px);
  bottom: clamp(34px, 7vh, 82px);
  z-index: 4;
  display: grid;
  gap: 6px;
  max-width: calc(100% - 56px);
  color: #152624;
}

.entry-visual-copy span {
  color: #176d5a;
  font-size: 11px;
  font-weight: 800;
}

.entry-visual-copy strong {
  font-size: 34px;
  line-height: 1.24;
  letter-spacing: 0;
  white-space: nowrap;
}

.entry-visual-copy small {
  color: #647773;
  font-size: 13px;
}

.entry-screen > .entry-card {
  position: relative;
  z-index: 5;
  align-self: center;
  width: min(520px, calc(100% - 64px));
  margin: 32px;
  padding: 38px;
  border-color: rgba(92, 125, 118, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 26px 72px rgba(42, 70, 64, 0.18);
  backdrop-filter: blur(12px);
}

.entry-screen .entry-logo {
  width: 156px;
  height: 68px;
  filter: none;
  opacity: 0.9;
}

.entry-screen .entry-title strong {
  color: #173b34;
  font-size: 22px;
}

.entry-screen .entry-title span,
.entry-screen .entry-login label {
  color: #536b66;
}

.entry-screen .entry-login {
  grid-template-columns: 1fr;
  gap: 16px;
}

.password-login-panel {
  border-top: 1px solid #dbe5e2;
  padding-top: 12px;
}

.password-login-panel summary {
  color: #526b66;
  cursor: pointer;
  font-size: 13px;
  text-align: center;
}

.password-login-fields {
  display: grid;
  gap: 14px;
  padding-top: 16px;
}

.entry-screen .entry-login input,
.entry-screen .entry-login select {
  min-height: 44px;
  border-color: #c7d6d2;
  background: #f8fbfa;
  color: #172b27;
}

.entry-screen .entry-login input::placeholder {
  color: #849590;
}

.entry-screen #loginButton {
  min-height: 46px;
  margin-top: 4px;
  background: #247d69;
  color: #ffffff;
  font-weight: 900;
}

.entry-screen #loginButton:hover {
  background: #1c6a59;
}

@media (max-width: 980px) {
  .entry-screen {
    grid-template-columns: 1fr;
    align-content: end;
  }

  .entry-visual {
    position: absolute;
    inset: 0;
  }

  .entry-visual::after {
    background: linear-gradient(0deg, rgba(238, 243, 242, 0.98) 0%, rgba(238, 243, 242, 0.18) 72%);
  }

  .entry-screen > .entry-card {
    align-self: end;
    width: min(560px, calc(100% - 32px));
    margin: 16px auto;
  }

  .entry-visual-copy {
    top: 28px;
    bottom: auto;
  }
}

@media (max-width: 620px) {
  .entry-screen > .entry-card {
    padding: 24px;
  }

  .entry-card-top {
    align-items: flex-start;
  }

  .entry-screen .entry-logo {
    width: 126px;
    height: 54px;
  }

  .entry-screen .entry-title span,
  .entry-visual-copy small {
    display: none;
  }

  .entry-visual-copy strong {
    font-size: 22px;
  }

  .entry-visual-anatomy {
    clip-path: circle(135px at var(--spotlight-x) var(--spotlight-y));
  }

  .entry-spotlight-ring {
    width: 270px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .entry-visual-anatomy,
  .entry-spotlight-ring {
    transition: none;
  }
}

.app-shell {
  background: transparent;
}

.entry-screen {
  background: #eef3f2;
}

.entry-card,
.panel,
.stats article,
.finance-card,
.finance-panel,
.catalog-category-panel,
.catalog-product-card,
.catalog-category-list article,
.staff-card,
.processed-appointments,
.schedule-day-column,
.schedule-month-day,
.modal,
.panel-sub,
.sale-flow-card,
.confirmation-copy {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.entry-card {
  border-color: rgba(255, 255, 255, 0.72);
}

.sidebar {
  background: rgba(255, 255, 255, 0.9);
  border-right: 1px solid var(--line-soft);
  box-shadow: 8px 0 28px rgba(21, 41, 52, 0.04);
  backdrop-filter: blur(18px);
}

:root[data-theme="dark"] .sidebar,
:root[data-theme="dark"] .entry-card,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .finance-card,
:root[data-theme="dark"] .finance-panel,
:root[data-theme="dark"] .catalog-category-panel,
:root[data-theme="dark"] .catalog-product-card,
:root[data-theme="dark"] .catalog-category-list article {
  background: var(--surface);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .sidebar,
  :root:not([data-theme="light"]) .entry-card,
  :root:not([data-theme="light"]) .modal,
  :root:not([data-theme="light"]) .panel,
  :root:not([data-theme="light"]) .finance-card,
  :root:not([data-theme="light"]) .finance-panel,
  :root:not([data-theme="light"]) .catalog-category-panel,
  :root:not([data-theme="light"]) .catalog-product-card,
  :root:not([data-theme="light"]) .catalog-category-list article {
    background: var(--surface);
  }
}

.brand-subtitle,
.finance-panel h3,
.catalog-category-panel h3,
.panel-head h2,
h1,
h2,
h3 {
  color: var(--text-strong);
  letter-spacing: 0.01em;
}

.brand-subtitle {
  color: var(--primary-dark);
}

nav a {
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}

nav a.active,
nav a:hover {
  border-color: var(--line-soft);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.theme-toggle {
  min-width: 80px;
  padding: 0 12px;
}

button,
.mini-button,
.entry-mode-button {
  border-radius: var(--radius-sm);
  font-weight: 800;
  transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
}

button {
  background: var(--primary);
  color: var(--button-text);
  box-shadow: none;
}

button:hover {
  background: var(--primary-dark);
  box-shadow: 0 10px 22px rgba(47, 111, 159, 0.16);
}

button:active,
.mini-button:active,
.entry-mode-button:active {
  transform: translateY(1px);
}

.ghost-button,
.mini-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--primary-dark);
}

.ghost-button:hover,
.mini-button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

button[disabled],
button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

select,
input,
textarea {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

select:focus,
input:focus,
textarea:focus,
button:focus-visible {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

input::placeholder,
textarea::placeholder {
  color: var(--muted-2);
}

.topbar {
  padding: 0 2px;
}

.topbar p {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  padding: 22px;
}

.panel-head {
  align-items: flex-start;
}

.panel-head p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.detail-table,
table {
  border-collapse: separate;
  border-spacing: 0;
}

.detail-table th,
.detail-table td,
th,
td {
  border-color: var(--line-soft);
  color: var(--text);
}

.detail-table th,
th {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 900;
}

.detail-table tbody tr:nth-child(even) td,
tbody tr:nth-child(even) td {
  background: var(--surface-soft);
}

.detail-table td,
td {
  background: var(--surface);
}

.tag {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 800;
}

.tag.warn {
  background: var(--warning-soft);
  color: var(--warning);
}

.tag.active,
.tag.paid {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.finance-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.finance-card {
  min-height: 96px;
  padding: 16px;
}

.finance-card span,
.finance-summary-number span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.finance-card strong,
.finance-summary-number strong,
.finance-commission-list b,
.finance-cost-row strong {
  color: var(--primary-dark);
}

.finance-layout {
  gap: 16px;
}

.finance-panel {
  padding: 18px;
}

.finance-summary-number,
.finance-commission-list article {
  border: 1px solid var(--line-soft);
  background: var(--surface-soft);
}

.finance-summary-actions {
  align-items: center;
}

.finance-cost-row {
  border-bottom-color: var(--line-soft);
}

.refund-order-preview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.refund-create-block {
  order: 1;
}

.refund-history-block {
  order: 2;
}

.refund-order-preview > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.refund-order-preview span {
  color: var(--muted);
  font-size: 11px;
}

.refund-order-preview strong {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 13px;
}

.refund-confirm-check {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid var(--warning);
  border-radius: var(--radius-md);
  background: var(--warning-soft);
}

.refund-confirm-check input {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 2px;
}

.refund-confirm-check span {
  color: var(--text);
  font-weight: 800;
}

@media (max-width: 720px) {
  .refund-order-preview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.catalog-category-board {
  gap: 16px;
}

.catalog-category-panel {
  padding: 16px;
  background: var(--surface-soft);
}

.catalog-category-list {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.catalog-product-card,
.catalog-category-list article {
  min-height: 160px;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface);
}

.catalog-product-card:hover {
  border-color: rgba(47, 111, 159, 0.52);
  background: var(--primary-subtle);
  box-shadow: var(--shadow-md);
}

.catalog-product-card strong,
.catalog-product-title {
  color: var(--text-strong);
  font-size: 14px;
}

.catalog-product-card span,
.catalog-product-price {
  color: var(--primary-dark);
  font-size: 13px;
}

.catalog-product-card small,
.catalog-product-desc,
.catalog-product-meta {
  color: var(--muted);
}

.catalog-product-card em,
.catalog-product-status {
  background: var(--accent-soft);
  color: var(--accent);
}

.schedule-grid-head,
.schedule-week-head,
.schedule-day-heading {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.schedule-time,
.schedule-week-time {
  background: var(--surface-soft);
  color: var(--muted);
}

.schedule-slot,
.schedule-week-cell {
  background: var(--surface);
}

.schedule-slot-unavailable,
.schedule-slot-busy-continuation,
.schedule-available {
  background: var(--surface-soft);
}

.schedule-available {
  border-color: var(--line);
  color: var(--muted);
}

.schedule-available:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.schedule-rule-note {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.modal-backdrop {
  background: rgba(8, 19, 22, 0.54);
  backdrop-filter: blur(3px);
}

.modal {
  box-shadow: var(--shadow-md);
}

.modal-head {
  background: var(--surface);
  border-bottom-color: var(--line-soft);
}

.modal-body {
  background: var(--surface);
}

.sale-flow-card,
.staff-permission-grid label,
.staff-role-card {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text);
}

.sale-flow-steps span {
  background: var(--surface);
  color: var(--primary-dark);
}

.toast {
  background: var(--text-strong);
  color: var(--surface);
}

:root[data-theme="dark"] .brand-logo,
:root[data-theme="dark"] .entry-logo {
  filter: brightness(1.08) saturate(0.92);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .brand-logo,
  :root:not([data-theme="light"]) .entry-logo {
    filter: brightness(1.08) saturate(0.92);
  }
}

@media (min-width: 901px) and (max-width: 1500px) {
  .sidebar {
    width: 220px;
    padding: 20px 16px;
  }

  .brand {
    gap: 8px;
    margin-bottom: 22px;
  }

  .brand-logo {
    width: 118px;
    flex-basis: 118px;
  }

  nav {
    gap: 5px;
  }

  nav a {
    padding: 10px 11px;
  }

  .main {
    min-width: 0;
    margin-left: 220px;
    padding: 22px;
  }

  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 14px;
  }

  .topbar > div:first-child {
    min-width: min(520px, 100%);
  }

  .panel {
    min-width: 0;
  }

  .panel > table {
    display: block;
    min-width: 720px;
    overflow-x: auto;
    white-space: nowrap;
  }

  #appointments.panel > table,
  #patients.panel > table {
    display: table;
    width: 100%;
    min-width: 100%;
    max-width: 100%;
    table-layout: fixed;
    overflow: visible;
    white-space: normal;
  }

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

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

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

}

@media (max-width: 900px) {
  .sidebar {
    position: static;
    width: auto;
    height: auto;
    padding: 14px 16px;
    overflow: visible;
  }

  .main {
    margin-left: 0;
    padding: 16px;
  }

  .brand {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "logo title actions";
    column-gap: 8px;
    row-gap: 0;
    margin-bottom: 0;
    align-items: center;
  }

  .sidebar-actions {
    justify-self: end;
    grid-template-columns: minmax(96px, 132px) auto;
    align-items: center;
    justify-content: end;
    width: 100%;
    max-width: min(100%, 260px);
  }

  .sidebar-theme-control {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .brand-logo {
    width: 92px;
    height: 42px;
    flex-basis: 92px;
  }

  .sidebar-toggle {
    display: inline-flex;
  }

  nav {
    flex: none;
    max-height: 0;
    padding-right: 0;
    overflow: hidden;
    scrollbar-gutter: auto;
    gap: 5px;
    margin-top: 0;
    transition: max-height 0.22s ease, margin-top 0.22s ease;
  }

  .sidebar-logout {
    display: inline-flex;
    width: auto;
    margin: 0;
  }

  .sidebar-open nav {
    max-height: min(68vh, 560px);
    margin-top: 14px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  nav a {
    padding: 10px 12px;
  }

  .entry-login {
    grid-template-columns: 1fr;
  }

  .client-auth-fields {
    grid-template-columns: 1fr;
  }

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

  .client-register-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

  .topbar,
  .grid {
    display: block;
  }

  .main > section.grid.active-view {
    display: block;
  }

  .assignment-card,
  .assignment-controls {
    grid-template-columns: 1fr;
  }

  .main > section.grid.active-view > .panel.active-nested {
    display: block;
    width: 100%;
  }

  .topbar {
    margin-bottom: 14px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar p {
    margin-top: 6px;
    line-height: 1.5;
  }

  .login-box {
    min-width: 0;
    margin-top: 10px;
  }

  .schedule-toolbar {
    display: flex;
    justify-content: flex-start;
  }

  #appointments.panel > table,
  #patients.panel > table {
    display: table;
    min-width: 100%;
    width: 100%;
    overflow: visible;
    white-space: normal;
  }

  .action-selection-bar,
  .action-selection-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .client-registration-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .client-registration-actions span {
    margin-right: 0;
  }

  .staff-permission-grid,
  .staff-role-grid {
    grid-template-columns: 1fr;
  }

  .staff-card-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

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

  .report-grid,
  .quick-grid,
  .catalog-category-board,
  .settings-grid,
  .modal-grid,
  .action-filters,
  .action-library-grid,
  .team-grid,
  .form-grid.two,
  .form-grid.three,
  .form-grid.four,
  .form-grid.five,
  .choice-grid,
  .modal-choice-grid,
  .ai-recommendation-grid,
  .template-grid,
  .body-section {
    grid-template-columns: 1fr;
  }

  .therapist-choice-group .modal-choice-grid {
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  }

  .schedule-editor-range,
  .schedule-editor-closure {
    grid-template-columns: 1fr;
  }

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

  .schedule-editor-day-head,
  .schedule-editor-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .schedule-editor-remove,
  .schedule-editor-section-head button {
    width: 100%;
  }

  .client-care-board,
  .workflow-strip,
  .client-institution-brand,
  .appointment-detail-grid {
    grid-template-columns: 1fr;
  }

  .institution-points {
    grid-template-columns: 1fr 1fr;
  }

  .client-institution-brand img {
    width: 150px;
  }

  .client-therapist-card {
    grid-template-columns: 64px minmax(0, 1fr);
    gap: 8px;
    padding: 8px;
  }

  .therapist-photo {
    width: 64px;
    height: 84px;
  }

  .selected-therapist-banner {
    grid-template-columns: 1fr;
  }

  .appointment-detail-header,
  .appointment-detail-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Final responsive overrides: keep schedule controls and cards inside the viewport. */
@media (max-width: 720px) {
  .panel-head > button {
    flex: 0 0 auto;
    min-width: 64px;
    white-space: nowrap;
  }

  #reports > .panel-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    gap: 10px;
  }

  #reports > .panel-head h2 {
    margin: 0;
    white-space: nowrap;
  }

  #reports > .panel-head .panel-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 6px;
  }

  #reports > .panel-head .panel-actions button {
    width: 100%;
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  .entry-card-top {
    gap: 10px;
  }

  .sidebar-actions {
    grid-template-columns: minmax(0, 1fr) auto;
    max-width: 100%;
  }

  .sidebar-theme-control {
    min-width: 0;
  }

  .sidebar-logout {
    padding-left: 10px;
    padding-right: 10px;
  }

  .entry-logo {
    width: 160px;
    height: 70px;
  }

  .schedule-therapist-control {
    grid-template-columns: auto 12px minmax(0, 1fr);
    width: 100%;
  }

  .schedule-day-row {
    grid-template-columns: 60px repeat(var(--schedule-day-columns, 1), minmax(172px, 1fr));
  }

  .schedule-week-grid {
    display: none;
  }

  .schedule-week-dense-grid,
  .schedule-week-view.is-all .schedule-week-dense-grid {
    display: none;
  }

  .schedule-week-agenda,
  .schedule-week-view.is-single .schedule-week-agenda,
  .schedule-week-view.is-all .schedule-week-agenda {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .schedule-week-agenda-head {
    min-height: 34px;
    padding: 6px 7px;
  }

  .schedule-month-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .schedule-month-weekday,
  .schedule-month-blank {
    display: none;
  }

  .schedule-month-day {
    min-height: 54px;
    padding: 0;
  }

  .schedule-month-day.has-events {
    min-height: 132px;
  }

  .schedule-month-day-button {
    min-height: 52px;
    padding: 7px;
  }

  .schedule-month-day.has-events .schedule-month-day-button {
    min-height: 130px;
  }

  .schedule-month-date {
    font-size: 11px;
    line-height: 1.35;
  }
}

@media (max-width: 460px) {
  .sidebar-actions {
    grid-template-columns: 1fr;
    justify-self: stretch;
  }

  .sidebar-logout {
    width: 100%;
  }

  .entry-logo {
    width: 116px;
    height: 52px;
  }

  .entry-title span {
    font-size: 13px;
  }

  .schedule-therapist-control {
    grid-template-columns: 1fr 12px;
  }

  .schedule-therapist-control label {
    grid-column: 1 / -1;
  }

  .schedule-therapist-control select {
    grid-column: 1;
    grid-row: 2;
  }

  .schedule-therapist-color {
    grid-column: 2;
    grid-row: 2;
  }

  .schedule-week-agenda,
  .schedule-week-view.is-single .schedule-week-agenda,
  .schedule-month-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }

  .theme-mode-control {
    gap: 5px;
  }

  .theme-mode-control select {
    min-width: 86px;
    padding-left: 9px;
    padding-right: 24px;
  }
}
/* Internal knowledge base: read-only clinical reference layout. */
.knowledge-head p {
  margin: 4px 0 0;
  color: var(--muted, #64748b);
}

.knowledge-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(150px, 220px) minmax(130px, 180px);
  gap: 12px;
  margin-bottom: 16px;
}

.knowledge-toolbar label {
  display: grid;
  gap: 6px;
  color: var(--muted, #64748b);
  font-size: 12px;
}

.knowledge-toolbar input,
.knowledge-toolbar select {
  width: 100%;
}

.knowledge-layout {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.6fr);
  gap: 16px;
  min-height: 520px;
}

.knowledge-list,
.knowledge-detail {
  min-width: 0;
  border: 1px solid var(--line, #dbe4ec);
  border-radius: 8px;
  background: var(--surface, #fff);
}

.knowledge-list {
  display: grid;
  align-content: start;
  gap: 8px;
  max-height: 680px;
  padding: 10px;
  overflow-y: auto;
}

.knowledge-card {
  display: grid;
  gap: 5px;
  width: 100%;
  min-height: 86px;
  padding: 12px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: #f7fafc;
  color: #17324d;
  text-align: left;
}

.knowledge-card:hover,
.knowledge-card.active {
  border-color: #7bb4d7;
  background: #edf6fb;
  transform: none;
}

.knowledge-card strong,
.knowledge-card small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.knowledge-card strong {
  font-size: 14px;
  white-space: nowrap;
}

.knowledge-card small,
.knowledge-card-type {
  color: #64748b;
  font-size: 12px;
}

.knowledge-card-type {
  color: #2f7da7;
}

.knowledge-detail {
  padding: 20px;
  overflow: hidden;
}

.knowledge-detail-article {
  display: grid;
  gap: 18px;
}

.knowledge-detail-article header {
  display: grid;
  gap: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line, #e7edf2);
}

.knowledge-detail-article header span {
  color: #2f7da7;
  font-size: 12px;
}

.knowledge-detail-article h3,
.knowledge-detail-article h4,
.knowledge-detail-article p {
  margin: 0;
}

.knowledge-detail-article h3 {
  font-size: 20px;
}

.knowledge-detail-article h4 {
  margin-bottom: 8px;
  font-size: 14px;
}

.knowledge-detail-article ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
  color: #41566c;
}

.knowledge-phase-list {
  display: grid;
  gap: 12px;
}

.knowledge-phase {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line, #e1e8ef);
  border-radius: 8px;
  background: #fbfdfe;
}

.knowledge-phase > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.knowledge-phase > div:first-child span {
  color: #64748b;
  font-size: 12px;
}

.knowledge-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.knowledge-chip-list span {
  padding: 6px 9px;
  border-radius: 6px;
  background: #edf6f3;
  color: #2f6254;
  font-size: 12px;
}

.knowledge-empty {
  padding: 28px 16px;
  color: #64748b;
  text-align: center;
}

.textbook-source-note {
  padding: 14px 16px;
  border-left: 3px solid #2f7da7;
  background: #f1f7fb;
}

.textbook-source-note strong {
  display: block;
  margin-bottom: 6px;
  color: #1e5879;
}

@media (max-width: 760px) {
  .knowledge-toolbar,
  .knowledge-layout {
    grid-template-columns: 1fr;
  }

  .knowledge-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 320px;
  }

  .knowledge-detail {
    padding: 14px;
  }
}

@media (max-width: 460px) {
  .knowledge-list {
    grid-template-columns: 1fr;
  }
}

/* Employee operations workbench: dense, schedule-first daily workflow. */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.brand-subtitle,
.brand .role-heading,
.operation-topbar,
.workbench-heading,
.operations-kpi,
.operation-block,
.global-search-result {
  letter-spacing: 0;
}

nav {
  gap: 4px;
}

nav > a {
  min-height: 40px;
  padding: 10px 12px;
}

.operation-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: 66px;
  margin: -28px -28px 18px;
  padding: 11px 28px;
  border-bottom: 1px solid var(--line-soft);
  background: rgba(247, 250, 252, 0.94);
  backdrop-filter: blur(16px);
}

.topbar-current-view {
  display: grid;
  gap: 2px;
  min-width: 150px;
}

.topbar-current-view > span {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
}

.topbar-current-view > strong {
  color: var(--text-strong);
  font-size: 18px;
}

.topbar-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-width: 0;
}

.global-search-shell {
  position: relative;
  width: min(340px, 32vw);
  min-width: 240px;
}

.global-search-shell input {
  width: 100%;
  height: 40px;
  padding: 0 13px;
  background: var(--surface);
}

.global-search-results {
  position: absolute;
  inset: calc(100% + 6px) 0 auto 0;
  z-index: 50;
  display: grid;
  max-height: 420px;
  padding: 6px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.global-search-result {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 4px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.global-search-result:last-child {
  border-bottom: 0;
}

.global-search-result:hover {
  background: var(--primary-soft);
  color: var(--text);
  box-shadow: none;
  transform: none;
}

.global-search-result > span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.global-search-result strong,
.global-search-result small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.global-search-result strong {
  color: var(--text-strong);
  font-size: 14px;
}

.global-search-result small {
  color: var(--muted);
  font-size: 12px;
}

.global-search-result em {
  flex: 0 0 auto;
  color: var(--primary-dark);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.global-search-empty {
  padding: 18px 12px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

#dashboard.panel {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.operation-view-tabs {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 14px;
  padding: 3px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  scrollbar-width: none;
}

.operation-view-tabs::-webkit-scrollbar {
  display: none;
}

.operation-view-tabs button {
  flex: 0 0 auto;
  min-width: 96px;
  min-height: 34px;
  padding: 7px 13px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: none;
}

.operation-view-tabs button:hover {
  background: var(--surface-soft);
  color: var(--text-strong);
  box-shadow: none;
  transform: none;
}

.operation-view-tabs button.active {
  background: var(--surface);
  color: var(--primary-dark);
  box-shadow: 0 1px 3px rgba(21, 41, 52, 0.12);
}

.workbench-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

.workbench-heading > div:first-child {
  display: grid;
  gap: 3px;
}

.workbench-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workbench-heading h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
}

.workbench-commands {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.operations-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

#roleDashboard .dashboard-primary-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

  #roleDashboard .dashboard-secondary-kpis {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.pending-operation-list .operations-kpi > span {
  display: grid;
  gap: 4px;
}

.pending-operation-list .operations-kpi > span > strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.25;
}

.pending-operation-list .operations-kpi > span > small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.pending-operation-list .operations-kpi > b {
  color: var(--kpi-color);
  font-size: 21px;
}

.pending-operation-list .operations-kpi {
  position: relative;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 68px;
  padding: 11px 14px;
}

.dashboard-overdue-dot {
  position: absolute;
  right: 48px;
  bottom: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.operations-kpi {
  --kpi-color: var(--primary);
  display: grid;
  align-content: center;
  gap: 7px;
  min-height: 84px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--kpi-color);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

#roleDashboard .dashboard-primary-kpis .operations-kpi {
  box-sizing: border-box;
  height: 76px;
  min-height: 76px;
  padding: 11px 13px;
  grid-template-rows: 20px 28px;
  align-content: center;
  align-items: start;
  justify-items: start;
  gap: 4px;
  margin: 0;
  font-family: inherit;
  line-height: 20px;
}

#roleDashboard .dashboard-primary-kpis .operations-kpi strong {
  font-size: 23px;
  line-height: 28px;
}

.operations-kpi:hover {
  border-color: color-mix(in srgb, var(--kpi-color) 60%, var(--line));
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transform: none;
}

.operations-kpi.is-active {
  border-color: var(--kpi-color);
  background: color-mix(in srgb, var(--kpi-color) 8%, var(--surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--kpi-color) 22%, transparent);
}

.dashboard-kpi-detail {
  margin: -4px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.dashboard-kpi-detail .section-inline-heading {
  margin-bottom: 8px;
}

.dashboard-pending-detail {
  margin: -5px 0 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.dashboard-detail-list {
  display: grid;
  gap: 6px;
}

.dashboard-detail-row {
  display: grid;
  grid-template-columns: minmax(120px, 0.8fr) minmax(110px, 0.7fr) minmax(180px, 1.3fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.dashboard-detail-row span,
.dashboard-detail-row small {
  color: var(--muted);
}

.dashboard-detail-row em {
  color: var(--primary);
  font-style: normal;
  font-weight: 900;
}

.dashboard-detail-row.is-overdue {
  border-left: 3px solid var(--danger);
}

.dashboard-detail-row.is-overdue em {
  color: var(--danger);
}

.dashboard-kpi-close {
  width: 30px;
  min-width: 30px;
  height: 30px;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

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

.operations-kpi strong {
  color: var(--kpi-color);
  font-size: 25px;
  line-height: 1;
}

.operations-kpi.tone-teal { --kpi-color: #0f766e; }
.operations-kpi.tone-green { --kpi-color: #15803d; }
.operations-kpi.tone-amber { --kpi-color: #a16207; }
.operations-kpi.tone-red { --kpi-color: #b91c1c; }
.operations-kpi.tone-blue { --kpi-color: var(--primary); }

.operations-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.72fr);
  gap: 14px;
  align-items: start;
}

.operation-block {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.operation-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 58px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.operation-block-head > div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

.operation-block-head h3 {
  margin: 0;
  font-size: 16px;
}

.operation-block-head span {
  color: var(--muted);
  font-size: 12px;
}

.today-appointment-list,
.pending-operation-list {
  display: grid;
}

.today-appointment-row {
  display: grid;
  grid-template-columns: 116px minmax(150px, 1fr) auto 118px;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  box-shadow: inset 3px 0 0 var(--therapist-color, var(--primary));
}

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

.today-appointment-row time {
  color: var(--text-strong);
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.today-appointment-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.today-appointment-main strong,
.today-appointment-main span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.today-appointment-main strong {
  color: var(--text-strong);
  font-size: 14px;
}

.today-appointment-main span {
  color: var(--muted);
  font-size: 12px;
}

.today-appointment-status {
  padding: 4px 7px;
  border-radius: 5px;
  background: var(--therapist-bg, var(--surface-soft));
  color: var(--therapist-color, var(--muted));
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.today-appointment-action {
  display: flex;
  justify-content: flex-end;
}

.today-appointment-action .mini-button {
  width: 112px;
}

.empty-operation-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 96px;
  padding: 18px;
  color: var(--muted);
}

.empty-operation-state strong {
  color: var(--text-strong);
}

.operation-more {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-top: 1px solid var(--line-soft);
  border-radius: 0;
  background: var(--surface-soft);
  color: var(--primary-dark);
  font-size: 12px;
}

.pending-operation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 68px;
  padding: 11px 13px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  border-radius: 0;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

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

.pending-operation-row:hover {
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: none;
  transform: none;
}

.pending-operation-row > span {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.pending-operation-row strong {
  color: var(--text-strong);
  font-size: 13px;
}

.pending-operation-row small {
  color: var(--muted);
  font-size: 11px;
}

.pending-operation-row b {
  min-width: 32px;
  color: var(--primary-dark);
  font-size: 20px;
  text-align: right;
}

.pending-operation-row.is-danger b,
.pending-operation-row.is-danger small {
  color: var(--danger);
}

@media (max-width: 1240px) {
  .operations-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

#roleDashboard .dashboard-secondary-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pending-operation-row:nth-last-child(2) {
    border-bottom: 0;
  }
}

@media (min-width: 901px) and (max-width: 1500px) {
  .operation-topbar {
    margin: -22px -22px 18px;
    padding-right: 22px;
    padding-left: 22px;
  }
}

@media (max-width: 900px) {
  .operation-topbar {
    position: sticky;
    margin: -16px -16px 16px;
    padding: 10px 16px;
  }

  .global-search-shell {
    width: min(320px, 45vw);
    min-width: 210px;
  }
}

@media (max-width: 720px) {
  .operation-topbar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
    justify-content: stretch;
    gap: 10px;
    margin: -16px -16px 14px;
  }

  .topbar-current-view > strong {
    display: none;
  }

  .topbar-tools,
  .global-search-shell {
    width: 100%;
    min-width: 0;
  }

  .topbar-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    justify-content: stretch;
  }

  .workbench-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .workbench-commands {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .workbench-commands button {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
  }

  .operations-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #roleDashboard .dashboard-primary-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .today-appointment-row {
    grid-template-columns: 104px minmax(0, 1fr) auto;
    gap: 8px;
  }

  .today-appointment-status {
    grid-column: 2;
    width: fit-content;
  }

  .today-appointment-action {
    grid-column: 3;
    grid-row: 1 / span 2;
  }

  #roleDashboard .dashboard-secondary-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .pending-operation-row:nth-last-child(2) {
    border-bottom: 1px solid var(--line-soft);
  }
}

@media (max-width: 460px) {
  .topbar-tools {
    grid-template-columns: 1fr;
  }

  .workbench-heading h2 {
    font-size: 21px;
  }

  .workbench-commands {
    grid-template-columns: 1fr 1fr;
  }

  .operations-kpi {
    min-height: 76px;
    padding: 11px;
  }

  .today-appointment-row {
    grid-template-columns: 1fr auto;
    padding: 11px 12px;
  }

  .today-appointment-row time,
  .today-appointment-main,
  .today-appointment-status {
    grid-column: 1;
  }

  .today-appointment-action {
    grid-column: 2;
    grid-row: 1 / span 3;
  }

  .today-appointment-action .mini-button {
    width: auto;
    max-width: 104px;
    white-space: normal;
  }

  .empty-operation-state {
    align-items: stretch;
    flex-direction: column;
  }
}

/* Finance editor: convert wide editable tables into complete mobile form rows. */
@media (max-width: 720px) {
  .modal-head h2 {
    min-width: 0;
    font-size: 18px;
    line-height: 1.35;
  }

  .modal-head button {
    flex: 0 0 auto;
    min-width: 64px;
    white-space: nowrap;
  }

  .finance-combined-detail .detail-table-wrap {
    overflow: visible;
  }

  .finance-combined-detail .detail-table {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .finance-combined-detail .detail-table thead {
    display: none;
  }

  .finance-combined-detail .detail-table tbody {
    display: grid;
    gap: 10px;
  }

  .finance-combined-detail .detail-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
  }

  .finance-combined-detail .detail-table td {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    text-overflow: clip;
  }

  .finance-combined-detail .detail-table td::before {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
  }

  .finance-combined-detail .finance-cost-edit-table td:first-child,
  .finance-combined-detail .editable-detail-table:not(.finance-cost-edit-table) td:first-child {
    grid-column: 1 / -1;
  }

  .finance-combined-detail .finance-cost-edit-table td:first-child::before {
    content: "成本项目";
  }

  .finance-combined-detail .finance-cost-edit-table td:nth-child(2)::before {
    content: "月度金额";
  }

  .finance-combined-detail .editable-detail-table:not(.finance-cost-edit-table) td:first-child {
    color: var(--text-strong);
    font-weight: 900;
  }

  .finance-combined-detail .editable-detail-table:not(.finance-cost-edit-table) td:nth-child(2)::before {
    content: "底薪";
  }

  .finance-combined-detail .editable-detail-table:not(.finance-cost-edit-table) td:nth-child(3)::before {
    content: "社保";
  }
}

@media (max-width: 460px) {
  .modal-backdrop {
    padding: 10px;
  }

  .modal {
    max-height: calc(100vh - 20px);
  }

  .modal-head {
    gap: 10px;
    padding: 14px;
  }

  .modal-body {
    padding: 12px;
  }

  .finance-combined-detail .profile-block {
    padding: 10px;
  }
}

/* Theme consolidation: retire legacy blue chrome while preserving semantic and therapist colors. */
.other-module-tabs button.is-active,
.entry-mode-actions,
.client-preview-legend .production,
.client-preview-mode [data-client-production]::before,
.detail-table th,
.quick-card:hover,
.store-choice-hint,
.schedule-rule-note,
.schedule-available:hover,
.schedule-editor .modal-note,
.upload-box,
.ai-status,
.ai-notice,
.action-selection-bar,
.selected-actions,
.mini-button:hover {
  background: var(--primary-soft);
}

.entry-mode-actions,
.client-auth-fields,
.client-register-panel,
.inline-role-select,
.product-category-tabs button.is-active,
.client-institution,
.client-registration,
.schedule-editor .modal-note,
.selected-actions,
.sale-flow-card,
.staff-permission-grid label,
.staff-role-card {
  border-color: var(--line);
}

.client-preview-legend .production,
.client-preview-mode [data-client-production]::before,
.quick-card:hover,
.client-secondary-menu button,
.ai-status,
.action-selection-bar {
  border-color: var(--accent);
}

.client-auth-fields,
.client-institution,
.client-registration,
.finance-commission-list article,
.sale-flow-card,
.staff-permission-grid label,
.staff-role-card {
  background: var(--surface-soft);
}

.catalog-product-card:hover {
  background: var(--primary-subtle);
}

.tag,
.selected-action-pill {
  background: var(--accent-soft);
  color: var(--primary-dark);
}

.tag.active,
.tag.paid,
.product-category-tabs button span {
  background: var(--primary-soft);
  color: var(--primary-dark);
}

.client-preview-legend .production,
.client-preview-mode [data-client-production]::before,
.ai-notice {
  color: var(--text);
}

.action-selection-bar {
  box-shadow: var(--shadow-sm);
}

.toast {
  background: var(--primary-dark);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --primary: #7ad7bd;
    --primary-dark: #a2e4d2;
    --primary-soft: #153a34;
    --primary-subtle: #102b27;
    --focus-ring: 0 0 0 3px rgba(122, 215, 189, 0.24);
  }
}

@media (max-width: 760px), (pointer: coarse) {
  .entry-visual-anatomy {
    clip-path: circle(138px at 50% 48%);
  }

  .entry-spotlight-ring {
    display: none;
  }
}

.entry-screen .entry-card-top {
  justify-content: flex-start;
}

.entry-screen .entry-title {
  justify-items: start;
  text-align: left;
}

/* Impeccable refinement layer: one quiet, task-focused system for staff operations. */
:root {
  --bg: #f3f8fc;
  --surface: #ffffff;
  --surface-soft: #f7fafd;
  --surface-muted: #edf4f9;
  --text: #263746;
  --text-strong: #122b44;
  --muted: #607487;
  --muted-2: #8293a2;
  --line: #d5e2ec;
  --line-soft: #e8f0f6;
  --primary: #2b78b9;
  --primary-dark: #174f87;
  --primary-soft: #e5f2fb;
  --primary-subtle: #f2f8fc;
  --accent: #2daeea;
  --accent-soft: #e7f6fd;
  --success: #2d7b4a;
  --success-soft: #eaf4ed;
  --danger: #aa4c4c;
  --danger-soft: #faeeee;
  --warning: #95621d;
  --warning-soft: #fbf3e5;
  --radius-sm: 6px;
  --radius-md: 7px;
  --radius-lg: 8px;
  --shadow-sm: 0 4px 14px rgba(18, 63, 103, 0.055);
  --shadow-md: 0 14px 36px rgba(18, 63, 103, 0.13);
  --focus-ring: 0 0 0 3px rgba(43, 120, 185, 0.2);
}

body {
  line-height: 1.5;
  text-rendering: optimizeLegibility;
}

.sidebar {
  width: 208px;
  padding: 20px 16px;
  background: var(--surface);
  border-right-color: var(--line);
  box-shadow: 5px 0 18px rgba(18, 63, 103, 0.04);
  backdrop-filter: none;
}

.brand {
  gap: 8px;
  margin-bottom: 22px;
}

.brand-logo {
  width: 108px;
  height: 42px;
  flex-basis: 108px;
  filter: none;
}

.brand .role-heading,
.brand #currentRoleText {
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.sidebar nav {
  flex: 0 1 auto;
  grid-auto-rows: minmax(40px, max-content);
  align-content: start;
  gap: 6px;
  padding-right: 0;
  overflow-y: auto;
}

.sidebar nav > a {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.sidebar nav > a:hover {
  border-color: var(--line);
  background: var(--surface-soft);
  color: var(--text-strong);
}

.sidebar nav > a.active {
  border-color: #bfd9ed;
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-weight: 700;
}

.sidebar-logout {
  min-height: 38px;
  font-weight: 600;
}

.main {
  margin-left: 208px;
  padding: 24px;
}

.operation-topbar {
  min-height: 68px;
  margin: -24px -24px 18px;
  padding: 11px 24px;
  border-bottom-color: var(--line);
  background: rgba(243, 248, 252, 0.98);
  backdrop-filter: none;
}

.topbar-current-view {
  gap: 1px;
}

.topbar-current-view > strong {
  font-size: 20px;
  font-weight: 720;
}

.topbar-current-view > span {
  color: var(--muted);
  font-weight: 600;
}

.global-search-shell {
  width: min(380px, 36vw);
}

.global-search-shell input,
input,
select,
textarea {
  border-color: var(--line);
  background: var(--surface);
}

button,
.mini-button,
.entry-mode-button {
  min-height: 38px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  letter-spacing: 0;
}

button:hover {
  box-shadow: none;
  transform: none;
}

.ghost-button,
.mini-button {
  background: var(--surface);
  color: var(--primary-dark);
}

.panel,
.panel-sub,
.finance-card,
.finance-panel,
.catalog-category-panel,
.catalog-product-card,
.catalog-category-list article,
.staff-card,
.setting,
.operation-block,
.modal {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.panel {
  padding: 20px;
}

.panel-head {
  margin-bottom: 14px;
}

.main > section.panel:not(#dashboard) > .panel-head:first-child h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.main > section.panel:not(#dashboard) > .panel-head:first-child {
  min-height: 40px;
  justify-content: flex-end;
}

.main > section.panel:not(#dashboard) > .panel-head:first-child > div:first-child {
  min-width: 0;
}

.main > section.panel:not(#dashboard) > .panel-head:first-child > div:first-child:has(> h2:only-child) {
  display: none;
}

.panel-head h2,
.panel-head h3,
.finance-panel h3,
.catalog-category-panel h3 {
  font-weight: 720;
}

.panel-head p,
.muted-note,
.catalog-product-desc,
.catalog-product-meta,
.staff-card-head span,
.setting p {
  color: var(--muted);
  font-weight: 400;
}

table {
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 12px 10px;
}

th,
.detail-table th {
  background: var(--primary-soft);
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 700;
}

td {
  font-size: 13px;
}

tbody tr {
  transition: background-color 0.14s ease;
}

tbody tr:hover td {
  background: var(--primary-subtle);
}

.tag,
.catalog-product-status {
  border-radius: 5px;
  font-weight: 700;
}

.operations-kpi {
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: inset 0 2px 0 color-mix(in srgb, var(--kpi-color) 72%, transparent);
}

.operations-kpi:hover {
  border-color: color-mix(in srgb, var(--kpi-color) 45%, var(--line));
  background: color-mix(in srgb, var(--kpi-color) 4%, var(--surface));
  box-shadow: inset 0 2px 0 var(--kpi-color);
}

.operations-kpi.is-active {
  border-color: color-mix(in srgb, var(--kpi-color) 62%, var(--line));
  background: color-mix(in srgb, var(--kpi-color) 7%, var(--surface));
  box-shadow: inset 0 2px 0 var(--kpi-color);
}

.operations-kpi span,
.pending-operation-list .operations-kpi > span > strong {
  color: var(--text);
  font-weight: 600;
}

.operations-kpi strong,
.pending-operation-list .operations-kpi > b {
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.dashboard-kpi-detail,
.dashboard-pending-detail {
  padding: 14px;
  border-color: var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.section-inline-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-kpi-close {
  margin-left: auto;
}

#roleDashboard .section-inline-heading {
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

#roleDashboard .section-inline-heading > div:first-child {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}

#roleDashboard .section-inline-heading > div:first-child > span {
  margin: 0;
}

.dashboard-detail-row,
.today-customer-row {
  border-radius: var(--radius-sm);
}

.dashboard-detail-row.is-overdue {
  border-left-width: 1px;
  border-color: color-mix(in srgb, var(--danger) 45%, var(--line));
  background: var(--danger-soft);
}

.finance-grid {
  gap: 10px;
}

.finance-card {
  min-height: 104px;
  padding: 15px;
  border-color: var(--line);
  background: var(--surface);
  text-align: left;
}

.finance-card:hover,
.catalog-product-card:hover,
.staff-card:hover {
  border-color: #b8d2cd;
  background: var(--primary-subtle);
  box-shadow: var(--shadow-sm);
  transform: none;
}

.finance-card strong {
  margin-top: 4px;
  font-size: 24px;
  font-weight: 720;
}

.finance-card small {
  margin-top: auto;
  color: var(--primary);
  font-weight: 600;
}

.finance-layout {
  gap: 12px;
}

.finance-panel {
  padding: 16px;
}

.finance-summary-number {
  min-height: 56px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.catalog-category-tabs {
  max-width: none;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}

.catalog-category-tab {
  border: 1px solid var(--line);
  background: var(--surface);
}

.catalog-category-tab.is-active {
  border-color: var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.catalog-category-tab.is-active span,
.catalog-category-tab.is-active small {
  color: #ffffff;
}

.catalog-category-list {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 10px;
}

.catalog-product-card,
.catalog-category-list article {
  min-height: 190px;
  padding: 14px;
}

.catalog-product-title {
  line-height: 1.4;
}

.catalog-product-desc {
  line-height: 1.55;
}

.catalog-product-actions {
  margin-top: auto;
}

.staff-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.staff-card {
  min-height: 160px;
  padding: 14px;
}

.staff-card-head strong {
  color: var(--text-strong);
  font-size: 16px;
  font-weight: 720;
}

.settings-grid {
  gap: 10px;
}

.setting {
  min-height: 118px;
  padding: 14px;
  background: var(--surface);
}

.setting h3 {
  font-size: 15px;
  font-weight: 700;
}

.schedule-grid,
.schedule-week-dense-grid,
.schedule-month-grid {
  font-size: 12px;
}

.schedule-time,
.schedule-week-time,
.schedule-month-date,
.schedule-grid-head,
.schedule-week-head,
.schedule-day-heading {
  font-size: 12px;
}

.schedule-slot,
.schedule-week-cell {
  font-size: 12px;
  line-height: 1.35;
}

@media (max-width: 1180px) and (min-width: 721px) {
  .schedule-toolbar {
    display: grid;
    grid-template-columns: auto minmax(200px, 1fr) minmax(320px, 404px);
    gap: 10px;
    width: 100%;
    overflow: visible;
  }

  .schedule-therapist-control,
  .schedule-period-nav {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .schedule-period-nav {
    grid-template-columns: 40px minmax(180px, 1fr) 40px;
    flex-basis: auto;
  }
}

.modal-backdrop {
  background: rgba(16, 34, 36, 0.48);
  backdrop-filter: none;
}

.modal-head {
  padding: 16px 18px;
}

.modal-body {
  padding: 18px;
}

.modal-head h2 {
  font-size: 19px;
  font-weight: 720;
}

/* Login surface uses the same OrthoRe blue system as the staff workspace. */
.entry-screen {
  background: #edf6fc;
}

.entry-visual::after {
  background:
    linear-gradient(90deg, rgba(247, 251, 254, 0.08) 48%, rgba(237, 246, 252, 0.96) 100%),
    linear-gradient(0deg, rgba(237, 246, 252, 0.88) 0%, rgba(237, 246, 252, 0.06) 46%);
}

.entry-spotlight-ring {
  border-color: rgba(45, 174, 234, 0.44);
  box-shadow:
    0 0 0 1px rgba(18, 63, 145, 0.1),
    0 0 38px rgba(45, 174, 234, 0.12);
}

.entry-visual-copy {
  color: var(--text-strong);
}

.entry-visual-copy span {
  color: var(--primary);
}

.entry-visual-copy small {
  color: var(--muted);
}

.entry-screen > .entry-card {
  border-color: #c9ddeb;
  box-shadow: 0 26px 72px rgba(18, 63, 103, 0.16);
}

.entry-screen .entry-title strong {
  color: var(--text-strong);
}

.entry-screen .entry-title span,
.entry-screen .entry-login label {
  color: var(--muted);
}

.entry-screen .entry-login input,
.entry-screen .entry-login select {
  border-color: #bfd4e4;
  background: #f8fbfe;
  color: var(--text-strong);
}

.entry-screen .entry-login input::placeholder {
  color: var(--muted-2);
}

.entry-screen #loginButton {
  background: var(--primary);
}

.entry-screen #loginButton:hover {
  background: var(--primary-dark);
}

.compliance-footer {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.compliance-footer a {
  color: inherit;
  text-decoration: none;
}

.compliance-footer a:hover,
.compliance-footer a:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.entry-compliance-footer {
  margin-top: 18px;
}

.app-compliance-footer {
  padding: 8px 0 2px;
}

@media (min-width: 901px) and (max-width: 1500px) {
  .sidebar {
    width: 208px;
    padding: 20px 16px;
  }

  .main {
    margin-left: 208px;
    padding: 24px;
  }

  .operation-topbar {
    margin: -24px -24px 18px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .brand-logo {
    width: 108px;
    flex-basis: 108px;
  }
}

@media (max-width: 900px) {
  .sidebar {
    width: auto;
    padding: 14px 16px;
  }

  .brand-logo {
    width: 94px;
    height: 38px;
    flex-basis: 94px;
  }

  .main {
    margin-left: 0;
    padding: 16px;
  }

  .operation-topbar {
    margin: -16px -16px 16px;
  }

  .sidebar nav {
    flex: 0 1 auto;
  }
}

@media (max-width: 720px) {
  .schedule-toolbar {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    overflow: visible;
    white-space: normal;
  }

  .schedule-toolbar .schedule-view-switch,
  .schedule-toolbar .therapist-legend,
  .schedule-toolbar .schedule-period-nav {
    width: 100%;
    min-width: 0;
  }

  .schedule-view-switch button {
    flex: 1 1 0;
  }

  .schedule-period-nav {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    flex-basis: auto;
  }

  .schedule-period-nav label,
  .schedule-period-nav input {
    width: 100%;
  }

  .schedule-summary {
    justify-content: space-between;
  }

  .panel {
    padding: 14px;
  }

  #patients {
    padding-right: 10px;
    padding-left: 10px;
  }

  #patients th,
  #patients td {
    padding-right: 5px;
    padding-left: 5px;
    font-size: 11px;
  }

  #patients td:last-child {
    padding-right: 3px;
    padding-left: 3px;
  }

  #patients td:last-child .mini-button {
    width: 100%;
    min-width: 0;
    min-height: 32px;
    padding: 4px 3px;
    white-space: normal;
    font-size: 11px;
    line-height: 1.25;
  }

  .operation-topbar {
    padding: 12px 16px;
    background: var(--surface-soft);
  }

  .workbench-heading {
    margin-bottom: 12px;
  }

  .operations-kpi,
  #roleDashboard .dashboard-primary-kpis .operations-kpi,
  .pending-operation-list .operations-kpi {
    min-height: 72px;
    padding: 11px 12px;
  }

  .dashboard-kpi-detail,
  .dashboard-pending-detail {
    padding: 12px;
  }

  .catalog-category-list,
  .staff-card-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .catalog-product-card,
  .catalog-category-list article,
  .staff-card,
  .setting {
    min-height: 0;
  }
}

@media (max-width: 460px) {
  .brand {
    margin-bottom: 10px;
  }

  .topbar-current-view {
    min-width: 0;
  }

  .finance-card {
    min-height: 96px;
  }

  .finance-card strong {
    font-size: 21px;
  }

  .schedule-grid,
  .schedule-week-dense-grid,
  .schedule-month-grid,
  .schedule-time,
  .schedule-week-time,
  .schedule-slot,
  .schedule-week-cell {
    font-size: 12px;
  }
}
