:root, html[data-theme="light"] {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --border: #e3e6ea;
  --ink: #1f2937;
  --ink-muted: #5f6b7a;
  --ink-faint: #9aa4b1;
  --accent: #2b6cb0;
  --accent-hover: #245a96;
  --danger: #c0392b;
  --success: #2f855a;
  --warning: #b07e1c;
  --shadow: 0 1px 2px rgba(15,23,42,.06), 0 4px 12px rgba(15,23,42,.04);
  --radius: 8px;
}
html[data-theme="dark"] {
  --bg: #0f172a;
  --surface: #1e293b;
  --border: #334155;
  --ink: #e5e7eb;
  --ink-muted: #94a3b8;
  --ink-faint: #64748b;
  --accent: #60a5fa;
  --accent-hover: #3b82f6;
  --danger: #f87171;
  --success: #4ade80;
  --warning: #fbbf24;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 16px rgba(0,0,0,.4);
}
html[data-theme="sepia"] {
  --bg: #f4ecd8;
  --surface: #fbf5e6;
  --border: #d8cdb1;
  --ink: #3a2c14;
  --ink-muted: #6b5a3d;
  --ink-faint: #9d8b6f;
  --accent: #8a5a2b;
  --accent-hover: #6e451d;
  --danger: #c0392b;
  --success: #5d8a3d;
  --warning: #b07e1c;
}

html[data-font-size="small"] body { font-size: 13.5px; }
html[data-font-size="normal"] body { font-size: 15px; }
html[data-font-size="large"] body { font-size: 17px; }
html[data-font-size="xl"] body { font-size: 19px; }

html[data-font-family="serif"] body {
  font-family: Georgia, "Iowan Old Style", "Apple Garamond", "Times New Roman", serif;
}
html[data-font-family="mono"] body {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a:not(.btn) { color: var(--accent); }
a:not(.btn):hover { color: var(--accent-hover); }

#app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 18px; color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.topnav { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.topnav a { color: var(--ink-muted); text-decoration: none; }
.topnav a:hover { color: var(--ink); }
.topnav .badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 12px; background: #ebf3fb; color: var(--accent);
  font-weight: 600;
}
.topnav-user {
  font-size: 13px;
  color: var(--ink); font-weight: 600;
  border-right: 1px solid var(--border);
  padding-right: 12px; margin-right: 4px;
}
.topnav-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; color: var(--ink-muted);
}
.topnav-icon:hover { color: var(--ink); }
.topnav-icon svg { width: 18px; height: 18px; }
.topnav-search-row {
  display: inline-flex; align-items: stretch; height: 28px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  overflow: hidden;
}
.topnav-search-prefix {
  display: inline-flex; align-items: center; padding: 0 8px;
  background: var(--bg); color: var(--ink-muted);
  font: 600 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em; border-right: 1px solid var(--border);
}
.reminder-banner-host {
  display: flex; flex-direction: column; gap: 0;
  position: sticky; top: 0; z-index: 900;
}
.reminder-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: #ffd84d; color: #1a1300;
  border-bottom: 1px solid #b89400;
  font-size: 14px; font-weight: 500;
  animation: reminder-banner-in 240ms ease-out;
}
@keyframes reminder-banner-in {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.reminder-banner-icon { display: inline-flex; align-items: center; color: #5a3700; }
.reminder-banner-text { flex: 1; min-width: 0; word-break: break-word; }
.reminder-banner-clickable { cursor: pointer; }
.reminder-banner-clickable:hover { background: #ffe57a; }
.reminder-banner-clickable:focus-visible { outline: 2px solid #5a3700; outline-offset: -2px; }
.reminder-banner-link {
  color: #1a1300; text-decoration: underline;
  font-weight: 600; padding: 0 8px;
}
.reminder-banner-link:hover { color: #000; }
.reminder-banner-close {
  background: transparent; border: none; cursor: pointer;
  width: 28px; height: 28px; border-radius: 6px;
  font-size: 22px; line-height: 1; color: #5a3700; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.reminder-banner-close:hover { background: rgba(0,0,0,0.08); color: #000; }
.calendar-gear {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0;
}
.calendar-gear svg { width: 16px; height: 16px; }

main { flex: 1; padding: 32px 24px; }

.container { max-width: 1100px; margin: 0 auto; }
.container.narrow { max-width: 480px; }
.container.medium { max-width: 760px; }

h1 { font-size: 24px; margin: 0 0 8px; letter-spacing: -0.01em; }
h2 { font-size: 18px; margin: 24px 0 8px; }
h3 { font-size: 15px; margin: 18px 0 6px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.lead { color: var(--ink-muted); margin: 0 0 20px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card.compact { padding: 16px; }
.card + .card { margin-top: 16px; }
.card.is-loading { opacity: 0.55; pointer-events: none; transition: opacity 120ms ease; }
.card { transition: opacity 120ms ease; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.spacer { flex: 1 1 auto; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin: 12px 0 4px;
}
.inline-help { font-size: 12px; color: var(--ink-muted); margin: 4px 0 0; }

input[type="text"], input[type="email"], input[type="password"],
input[type="datetime-local"], input[type="search"],
textarea, select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: var(--surface);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(43,108,176,.18);
}
textarea { min-height: 80px; resize: vertical; }

.checkbox-row {
  display: flex; gap: 10px; margin: 16px 0 8px;
  align-items: flex-start; font-size: 13px;
  color: var(--ink-muted); line-height: 1.5;
}
.checkbox-row input[type="checkbox"] { margin-top: 3px; }
.checkbox-row label { margin: 0; font-size: 13px; font-weight: 400; color: inherit; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--accent); color: #fff; border: none;
  padding: 9px 16px; border-radius: 6px; font: inherit;
  font-weight: 600; cursor: pointer; transition: background .15s;
  text-decoration: none;
}
.btn:hover { background: var(--accent-hover); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.btn-secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--border); }
.btn.btn-secondary:hover { background: var(--bg); }
.btn.btn-danger { background: var(--danger); }
.btn.btn-danger:hover { background: #a02d20; }
.btn.btn-success { background: var(--success); }
.btn.btn-success:hover { filter: brightness(0.92); }
.btn.btn-block { width: 100%; justify-content: center; }
.btn.btn-small { padding: 5px 10px; font-size: 13px; font-weight: 500; }
.btn.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn.btn-ghost:hover { color: var(--ink); background: var(--bg); }

.alert { padding: 10px 12px; border-radius: 6px; font-size: 14px; margin: 12px 0; }
.alert.alert-error { background: #fdecea; color: #8a1a10; border: 1px solid #f5c2bd; }
.alert.alert-success { background: #e6f4ec; color: #1f5b3a; border: 1px solid #b6dac3; }
.alert.alert-info { background: #ebf3fb; color: #1d4e88; border: 1px solid #b5d2ec; }
.alert.alert-warning { background: #fff7e6; color: #8a5a0a; border: 1px solid #f3d96b; }

.form-actions { display: flex; gap: 8px; margin-top: 20px; }
.form-actions .btn { flex: 0 0 auto; }
.form-aside { margin-top: 20px; font-size: 14px; color: var(--ink-muted); }

.recovery-box {
  background: #fffbe6;
  border: 1px solid #f3d96b;
  padding: 14px 16px;
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 15px;
  letter-spacing: 0.02em;
  word-break: break-all;
  user-select: all;
  margin: 12px 0;
}
.code-pill {
  display: inline-block;
  background: #f3f4f6;
  border: 1px solid var(--border);
  padding: 3px 8px;
  border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 13px;
  user-select: all;
}

.toast {
  position: fixed;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%) scale(0.96);
  background: #1f2937; color: #fff;
  padding: 16px 22px; border-radius: 8px;
  font-size: 15px; font-weight: 600;
  box-shadow: 0 12px 36px rgba(0,0,0,.28);
  z-index: 60; max-width: 90vw; min-width: 240px; text-align: center;
  opacity: 0;
  transition: opacity .15s, transform .15s;
  pointer-events: none;
}
.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.toast.toast-error   { background: var(--danger); }
.toast.toast-success { background: var(--success); }

.footer {
  padding: 18px 24px; text-align: center; color: var(--ink-muted);
  border-top: 1px solid var(--border); background: var(--surface); font-size: 13px;
}

.dashboard-empty { text-align: center; padding: 48px 24px; color: var(--ink-muted); }
.dashboard-empty h1 { color: var(--ink); }
.kvgrid {
  display: grid; grid-template-columns: max-content 1fr;
  gap: 6px 16px; font-size: 14px; margin: 16px 0;
}
.kvgrid dt { color: var(--ink-muted); }
.kvgrid dd { margin: 0; color: var(--ink); }

.spinner {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================================================
   Therapist client list
   ====================================================================== */
.page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 16px; flex-wrap: wrap;
}
.page-header h1 { margin: 0; }

.dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  background: #cbd5e1; vertical-align: middle;
}
.dot.dot-active {
  background: #2f855a;
  box-shadow: 0 0 0 0 rgba(47,133,90,.6);
  animation: pulseDot 1.6s infinite;
}
@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(47,133,90,.55); }
  70% { box-shadow: 0 0 0 6px rgba(47,133,90,0); }
  100% { box-shadow: 0 0 0 0 rgba(47,133,90,0); }
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.table {
  width: 100%; border-collapse: collapse;
}
.table th, .table td {
  text-align: left; padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.table th {
  color: var(--ink-muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.04em;
  background: #fafbfc;
  user-select: none;
}
.table th.sortable { cursor: pointer; }
.table th.sortable:hover { color: var(--ink); }
.table th .sort-arrow { display: inline-block; width: 12px; color: var(--ink-faint); }
.table tbody tr { transition: background-color .1s; }
.table tbody tr:hover { background: #fafbfc; cursor: pointer; }
.table tbody tr:last-child td { border-bottom: none; }
.table tr.row-inactive td {
  color: var(--ink-faint);
}
.table tr.row-inactive td.case { color: var(--ink-muted); }

/* Section heading row inside an index table — used for grouping (e.g. "Today",
   "Tomorrow", "Case referrals"). Reads as a divider, not a row, so the table
   stays one continuous shape instead of fragmenting into card-style chunks. */
.table tbody tr.table-section { background: transparent; cursor: default; }
.table tbody tr.table-section:hover { background: transparent; }
.table tbody tr.table-section .table-section-cell {
  padding: 18px 14px 6px;
  border-bottom: none;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 11px;
  font-weight: 600;
}
/* First section row in a table doesn't need top spacing — header already there. */
.table tbody tr.table-section:first-child .table-section-cell {
  padding-top: 8px;
}

.format-pill {
  display: inline-block;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #ebf3fb; color: var(--accent);
  text-transform: capitalize;
}
.format-pill.format-in_person { background: #fef3e2; color: #8a5a0a; }
.format-pill.format-group { background: #efe7fb; color: #4c2db0; }
.format-pill.format-phone { background: #e5f7ec; color: #2c6e3f; }
.format-pill.empty { background: #f3f4f6; color: var(--ink-faint); }

.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--ink-muted);
}
.empty-state h2 { color: var(--ink); margin-bottom: 6px; }

/* ========================================================================
   Tooltip (i) hover
   ====================================================================== */
.info-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: #ebf3fb; color: var(--accent);
  font-size: 11px; font-weight: 700;
  cursor: help; margin-left: 6px; vertical-align: middle;
  position: relative;
  user-select: none;
}
.info-icon::before { content: 'i'; font-style: italic; font-family: Georgia, serif; }
.info-icon[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute; left: 50%; top: 24px;
  transform: translateX(-50%);
  background: #1f2937; color: #fff;
  padding: 8px 10px; border-radius: 6px;
  font-size: 12px; line-height: 1.4;
  font-style: normal; font-weight: 400;
  white-space: normal;
  width: 240px; max-width: 320px; z-index: 30;
  box-shadow: 0 6px 16px rgba(0,0,0,.18);
}
.info-icon[data-tip]:hover::before {
  content: 'i';
}

/* ========================================================================
   Modal
   ====================================================================== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 64px 16px; z-index: 40;
}
.modal {
  background: var(--surface); border-radius: var(--radius);
  padding: 24px; max-width: 540px; width: 100%;
  box-shadow: 0 16px 48px rgba(0,0,0,.18);
  max-height: 90vh; overflow: auto;
}

/* ========================================================================
   Case file
   ====================================================================== */
.case-header {
  display: flex; align-items: center; gap: 14px;
  flex-wrap: wrap;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}
.case-header .case-num {
  font-size: 22px; font-family: ui-monospace, "SF Mono", Menlo, monospace;
  letter-spacing: 0.05em; font-weight: 700;
}
.case-header .meta { color: var(--ink-muted); font-size: 14px; }

.tabs {
  display: flex; gap: 6px; border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.tabs .tab {
  padding: 8px 14px; border: none; background: transparent;
  color: var(--ink-muted); cursor: pointer; font: inherit; font-size: 14px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs .tab.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.tabs .tab .tab-count {
  display: inline-block; min-width: 20px; padding: 0 6px;
  background: var(--ink-faint, #aaa); color: #fff;
  border-radius: 999px; font-size: 11px; font-weight: 600; margin-left: 4px;
}
.tabs .tab.active .tab-count { background: var(--accent); }

/* Sessions list (collapsible rows) */
.session-row {
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); margin-bottom: 8px;
  overflow: hidden;
}
.session-row .summary {
  padding: 10px 14px; cursor: pointer; display: flex;
  align-items: center; gap: 10px; justify-content: space-between;
}
.session-row .summary:hover { background: var(--bg); }
.session-row .summary .when {
  font-weight: 600; min-width: 200px;
}
.session-row .body {
  padding: 12px 14px; border-top: 1px solid var(--border);
  display: none;
}
.session-row.open .body { display: block; }
.session-row .arrow { color: var(--ink-faint); transition: transform .12s; display: inline-block; }
.session-row.open .arrow { transform: rotate(90deg); }

.divider-today {
  text-align: center; color: var(--ink-faint);
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  padding: 8px 0; border-top: 1px dashed var(--border); margin: 12px 0;
}

/* Assignment list/cards on case file */
.assignment-card {
  padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 6px; background: var(--surface); margin-bottom: 8px;
  display: flex; gap: 12px; align-items: center;
}
.assignment-card .progress {
  display: inline-block; min-width: 64px; text-align: right;
  font-size: 13px; color: var(--ink-muted);
}
.assignment-card .progress.done { color: var(--success); }
.status-pill {
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: #f3f4f6; color: var(--ink-muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.status-pill.status-submitted { background: #e6f4ec; color: var(--success); }
.status-pill.status-reviewed { background: #ebf3fb; color: var(--accent); }
.status-pill.status-in_progress { background: #fff7e6; color: var(--warning); }

/* Practice info grid (Settings → Practice). */
.pi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 14px;
  margin-top: 8px;
}
@media (max-width: 600px) { .pi-grid { grid-template-columns: 1fr; } }
.pi-field label {
  display: block;
  font-size: 12px; font-weight: 600;
  color: var(--ink-muted);
  margin-bottom: 2px;
}

/* ========================================================================
   Generic flat line list — used for reminders, dashboard upcoming, etc.
   No card frames; rows separated only by thin borders.
   ====================================================================== */
.line-list { list-style: none; padding: 0; margin: 0; }
.line-row {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  flex-wrap: wrap;
}
.line-row:last-child { border-bottom: none; }
.line-row-clickable { cursor: pointer; transition: background-color .1s; }
.line-row-clickable:hover { background: var(--bg); }
.line-row-dim { opacity: .65; }
.line-when {
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 110px;
}
.line-body {
  flex: 1; min-width: 0;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.line-status {
  color: var(--ink-faint); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
  flex-shrink: 0;
}
.line-actions { display: inline-flex; gap: 6px; flex-shrink: 0; }
.line-action {
  background: transparent;
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--ink-muted);
  cursor: pointer;
}
.line-action:hover { background: var(--bg); color: var(--ink); }
.line-action-danger:hover { color: var(--danger); border-color: var(--danger); }

/* ========================================================================
   Settings panels — sectioned cards instead of one long list.
   ====================================================================== */
.settings-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 18px 22px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.settings-panel-h {
  margin: 0 0 12px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
}
.settings-panel h3 {
  margin: 14px 0 6px;
  text-transform: none;
  font-size: 13px;
  color: var(--ink);
  letter-spacing: 0;
}
.settings-panel h3:first-of-type { margin-top: 4px; }
.settings-danger {
  border-color: rgba(192,57,43,.4);
}

/* Tab strip across the top of the Settings page. */
.settings-tabs {
  display: flex; gap: 2px; align-items: stretch;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.settings-tab {
  background: transparent; border: none; cursor: pointer;
  padding: 10px 14px; font-size: 14px; color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.settings-tab:hover { color: var(--ink); }
.settings-tab.active {
  color: var(--ink); font-weight: 600;
  border-bottom-color: var(--accent, #2b6cb0);
}

/* Per-day work-hour rows. */
.work-hours { display: flex; flex-direction: column; gap: 8px; }
.work-hours-row {
  display: grid; grid-template-columns: 60px 1fr auto; gap: 12px;
  align-items: center; padding: 6px 0;
  border-bottom: 1px dashed var(--border);
}
.work-hours-row:last-child { border-bottom: none; }
.work-hours-day { font-weight: 600; color: var(--ink); }
.work-hours-windows { display: flex; flex-direction: column; gap: 4px; }
.work-hours-window {
  display: inline-flex; align-items: center; gap: 6px;
}
.work-hours-window input[type=time] {
  padding: 4px 6px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.work-hours-x {
  background: transparent; border: none; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--ink-muted);
  padding: 2px 6px; border-radius: 4px;
}
.work-hours-x:hover { background: var(--bg); color: var(--danger); }

/* Custom event-types editor rows. */
.event-types { display: flex; flex-direction: column; gap: 6px; }
.event-types-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0;
}
.event-types-add { border-top: 1px dashed var(--border); padding-top: 10px; margin-top: 6px; }

/* Personal calendar event block in the schedule grid. Inline color is set
   per-event via a CSS variable on the element. */
.sg-block.sg-block-event {
  background: color-mix(in srgb, var(--ev-color, #94a3b8) 16%, transparent);
  color: color-mix(in srgb, var(--ev-color, #94a3b8) 65%, #000);
  border-left: 3px solid var(--ev-color, #94a3b8);
}
.sg-block.sg-block-event:hover { background: color-mix(in srgb, var(--ev-color, #94a3b8) 28%, transparent); }

/* Red "pending approvals" pill above the dashboard schedule. */
.pending-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(192,57,43,.1); color: var(--danger, #c0392b);
  border: 1px solid rgba(192,57,43,.4);
  font-weight: 600; font-size: 13px; text-decoration: none;
  white-space: nowrap;
}
.pending-pill:hover { background: rgba(192,57,43,.18); }

/* Pending-appointments inbox. */
.pending-list { display: flex; flex-direction: column; gap: 0; }
.pending-row {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px 0;
  border-top: 1px solid var(--border);
}
.pending-row:last-child { border-bottom: 1px solid var(--border); }
.pending-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pending-when { font-weight: 600; }
.pending-len { color: var(--ink-muted); }
.pending-contact {
  background: var(--bg);
  padding: 10px 12px; border-radius: 4px;
  font-size: 14px; line-height: 1.6;
}
.pending-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ========================================================================
   Practice Health rings (dashboard top — replaces big stat boxes).
   Layout: rings (left, ~40%) + clickable practice stats (right, ~60%) on
   desktop; stacks on narrow screens.
   ====================================================================== */
.top-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: 16px;
  margin: 8px 0;
}
@media (max-width: 720px) {
  .top-panel { grid-template-columns: 1fr; }
}
.top-panel-stats {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 0;
}
.panel-stats-h3 {
  margin: 6px 16px 4px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--ink-muted);
}
.panel-stat-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink);
  cursor: pointer;
  transition: background-color .12s;
}
.panel-stat-row:hover { background: var(--bg); color: var(--accent); }
.panel-stat-label { font-size: 13px; color: var(--ink-muted); }
.panel-stat-row:hover .panel-stat-label { color: inherit; }
.panel-stat-value {
  font-size: 14px; font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.ring-row {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0;
}
.ring-cell {
  display: flex; flex-direction: column; align-items: center;
  text-align: center;
  flex: 1;
  min-width: 120px;
}
.ring-cell.ring-clickable { cursor: pointer; }
.ring-cell.ring-clickable:hover .ring-label { color: var(--accent); }
.ring-label {
  font-size: 12px; font-weight: 600;
  margin-top: 6px;
  color: var(--ink);
}
.ring-sublabel {
  font-size: 11px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* ========================================================================
   Schedule grid (dashboard weekly view) — vertically scrollable, full 24h.
   ====================================================================== */
.schedule-scroll {
  max-height: 70vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
}
.schedule-grid {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  background: var(--surface);
}
.sg-cell {
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  min-height: 44px;
  padding: 4px 6px;
  background: var(--surface);
  font-size: 12px;
  position: relative;
}
.sg-cell:nth-child(8n) { border-right: none; }
.sg-cell.sg-head {
  background: var(--bg);
  font-weight: 600;
  text-align: center;
  font-size: 12px;
  color: var(--ink-muted);
  padding: 8px 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  position: sticky;
  top: 0;
  z-index: 2;
}
.sg-cell.sg-head.sg-today { color: var(--accent); }
.sg-cell.sg-hour {
  background: var(--bg);
  text-align: right;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  padding-top: 6px;
  padding-right: 8px;
}
.sg-cell.sg-empty {
  cursor: pointer;
  transition: background-color .12s, box-shadow .12s;
}
.sg-cell.sg-empty::before {
  content: attr(data-hour);
  position: absolute;
  top: 4px; left: 6px;
  font-size: 10px;
  color: var(--ink-faint);
  opacity: 0.5;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}
.sg-cell.sg-empty:hover {
  background: rgba(43,108,176,.08);
  box-shadow: inset 0 0 0 1px var(--accent);
}
.sg-cell.sg-empty:hover::after {
  content: '+ Add';
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}
.sg-cell.sg-empty-past {
  background: repeating-linear-gradient(
    -45deg,
    var(--bg),
    var(--bg) 4px,
    var(--surface) 4px,
    var(--surface) 8px
  );
}
.sg-cell.sg-empty-past:hover {
  background: rgba(160,160,160,.16);
  box-shadow: inset 0 0 0 1px var(--ink-faint);
}
.sg-cell.sg-empty-past:hover::after {
  content: '+ Back-date';
  color: var(--ink-muted);
}
.sg-block {
  background: rgba(46,160,90,.12);
  color: var(--success);
  border-left: 3px solid var(--success);
  padding: 4px 6px;
  border-radius: 3px;
  font-size: 12px;
  cursor: pointer;
  margin: 1px 0;
}
.sg-block .sg-block-time { font-size: 10px; color: var(--ink-muted); margin-top: 1px; }
.sg-block.sg-block-past {
  background: rgba(120,120,120,.12);
  color: var(--ink-muted);
  border-left-color: var(--ink-faint);
}
/* Pending booking request — orange, signals "tentatively held, needs your nod". */
.sg-block.sg-block-pending {
  background: rgba(232,140,40,.16);
  color: #8a4400;
  border-left: 3px solid #e88c28;
}
.sg-block.sg-block-pending:hover { background: rgba(232,140,40,.26); }

/* Day-divider row inside the All appointments table — full-width agenda
   separator, not a clickable row. */
.table tr.appt-day-row td {
  background: var(--bg);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-muted);
  padding: 8px 12px;
}
.table tr.appt-day-row:hover { background: transparent; cursor: default; }
.table tr.appt-day-row:hover td { background: var(--bg); }

/* All-appointments planner — relative-day sections, hairline-divided rows. */
.appt-section { margin-bottom: 18px; }
.appt-section-h {
  font-size: 12px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-muted);
  margin: 0 0 4px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.appt-rows { display: flex; flex-direction: column; }
.appt-row {
  display: grid;
  grid-template-columns: 60px 90px 1fr;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color .1s;
}
.appt-row:hover { background: var(--bg); }
.appt-row:last-child { border-bottom: none; }
.appt-time {
  font-variant-numeric: tabular-nums;
  font-weight: 600; color: var(--ink);
}
.appt-tag { justify-self: start; }
.appt-detail { display: flex; flex-direction: column; min-width: 0; }
.appt-detail-main {
  color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.appt-detail-sub {
  color: var(--ink-muted); font-size: 12px; margin-top: 1px;
}
@media (max-width: 600px) {
  .appt-row { grid-template-columns: 52px 76px 1fr; gap: 8px; }
}

/* ========================================================================
   Admin tab — minimalist, no big boxes.
   ====================================================================== */
.nav-admin {
  font-weight: 600;
  color: var(--accent) !important;
  border-left: 1px solid var(--border);
  padding-left: 12px !important;
  margin-left: 4px;
}
.admin-tabs {
  display: flex; gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.admin-tab {
  background: transparent; border: none; cursor: pointer;
  padding: 8px 14px; font: inherit; font-size: 14px;
  color: var(--ink-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.admin-tab:hover { color: var(--ink); }
.admin-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.admin-table { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.admin-table .table { margin: 0; }

.admin-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px;
}
@media (max-width: 600px) { .admin-grid { grid-template-columns: 1fr; } }

.admin-stats-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}
@media (max-width: 720px) { .admin-stats-grid { grid-template-columns: 1fr; } }
.admin-stats-grid h3 { margin-bottom: 8px; }

.table.compact td, .table.compact th {
  padding: 6px 10px; font-size: 13px;
}

.pill {
  display: inline-block; font-size: 11px; padding: 2px 7px; border-radius: 999px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  background: #f3f4f6; color: var(--ink-muted);
}
.pill.pill-accent { background: rgba(43,108,176,.12); color: var(--accent); }
.pill.pill-warn { background: #fff7e6; color: var(--warning); }
.pill.pill-danger { background: #fdecea; color: var(--danger); }

/* Distinct tag colors per kind (session / reminder / homework / etc).
   Used in bell list, dashboard upcoming, case-file lists. */
.tag {
  display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em;
  border: 1px solid transparent;
}
.tag.tag-session   { background: #e6f0fa; color: #1d4e88; border-color: #c2dbf3; }
.tag.tag-reminder  { background: #fff5e1; color: #8a5a0a; border-color: #f3d96b; }
.tag.tag-homework  { background: #efe7fb; color: #4c2db0; border-color: #d8c4f3; }
.tag.tag-comment   { background: #fdebf3; color: #9b1d54; border-color: #f4c2da; }
.tag.tag-thought   { background: #e0f3ee; color: #1f6953; border-color: #b8dccd; }
.tag.tag-support   { background: #f4f4f4; color: var(--ink); border-color: var(--border); }
.tag.tag-test      { background: #f3f4f6; color: var(--ink-muted); border-color: var(--border); }

/* ========================================================================
   Session-notes minimalist list (case file)
   ====================================================================== */
.note-list { display: flex; flex-direction: column; }
.note-row {
  border-bottom: 1px solid var(--border);
}
.note-row:last-child { border-bottom: none; }
.note-headline {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 6px;
  cursor: pointer;
  font-size: 13px;
  transition: background-color .12s;
}
.note-headline:hover { background: var(--bg); }
.note-arrow {
  color: var(--ink-faint); font-size: 10px; width: 10px;
  transition: transform .12s;
  flex-shrink: 0;
}
.note-row.open .note-arrow { transform: rotate(90deg); }
.note-when { color: var(--ink-muted); font-variant-numeric: tabular-nums; flex-shrink: 0; }
.note-preview {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink);
}
.note-attach {
  color: var(--ink-faint); font-size: 12px;
  flex-shrink: 0;
}
.note-body {
  padding: 12px 14px 16px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}

/* ========================================================================
   Client portal (anonymous) — flat list redesign.
   No card frames. No shadows. Lines + dividers only.
   ====================================================================== */
.client-portal { background: var(--surface); min-height: 100vh; }
.client-portal .topbar { border-bottom: 1px solid var(--border); }

/* Login page (kept simple, no card chrome). */
.cp-login-form { padding: 0; max-width: 400px; margin: 40px auto; }
.cp-login-brand { padding-bottom: 12px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.cp-cn-row {
  display: flex; align-items: stretch; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); overflow: hidden;
}
.cp-cn-prefix {
  display: inline-flex; align-items: center; padding: 0 10px;
  background: var(--bg); color: var(--ink-muted);
  font: 600 14px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em; border-right: 1px solid var(--border);
}
.cp-cn-row input.cp-cn-with-prefix {
  flex: 1; border: none; background: transparent; padding: 8px 10px; font-size: 16px;
  outline: none;
}

/* Two-column shell: bigger sidebar, content on the right. */
.cp-shell {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 36px;
  padding: 24px 28px;
}
@media (max-width: 720px) {
  .cp-shell { grid-template-columns: 1fr; gap: 18px; padding: 16px; }
  .cp-sidebar { order: 2; border-right: none; padding-right: 0; }
}

/* Sidebar: case # BIG, therapist info readable, Send-a-Note button. */
.cp-sidebar {
  color: var(--ink);
  border-right: 1px solid var(--border);
  padding-right: 20px;
  font-size: 15px;
}
.cp-case-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint); margin-bottom: 4px;
}
.cp-case-number {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  margin-bottom: 4px;
}
.cp-divider {
  height: 1px; background: var(--border);
  margin: 18px 0;
}
.cp-sidebar-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-faint); margin-bottom: 8px;
}
.cp-sidebar-name {
  color: var(--ink); font-weight: 700; font-size: 18px;
  margin-bottom: 6px;
}
.cp-sidebar-tagline {
  margin-bottom: 8px; color: var(--ink-muted); font-size: 14px;
}
.cp-sidebar-contact { color: var(--ink-muted); font-size: 14px; }
.cp-sidebar-contact a { color: var(--accent); text-decoration: none; }
.cp-sidebar-contact a:hover { text-decoration: underline; }
.cp-sidebar-line {
  font-size: 14px;
  color: var(--ink-muted);
  margin: 2px 0;
  line-height: 1.4;
}
.cp-sidebar-line a { color: var(--accent); text-decoration: none; }
.cp-sidebar-line a:hover { text-decoration: underline; }
.cp-sidebar-logo { max-width: 180px; max-height: 64px; margin-bottom: 12px; display: block; }

.cp-main { min-width: 0; }

/* Page header row: title + action button (right). */
.cp-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 18px;
  flex-wrap: wrap;
}

.cp-h1 { font-size: 24px; margin: 0; letter-spacing: -0.01em; }
.cp-h2 {
  font-size: 13px; margin: 14px 0 6px;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-muted); font-weight: 600;
}
.cp-meta { color: var(--ink-muted); font-size: 13px; }

/* Flat line list — used for assignments + past submissions. */
.cp-line-list { list-style: none; padding: 0; margin: 4px 0 8px; }
.cp-line {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color .1s;
}
.cp-line:hover { background: var(--bg); }
.cp-line:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.cp-line-title { color: var(--ink); font-size: 15px; }
.cp-line-sub {
  color: var(--ink-muted); font-size: 12px;
  white-space: nowrap;
}
.cp-line-ts {
  color: var(--ink-faint); font-size: 12px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Status dots: red = pending, yellow = submitted, green = reviewed. */
.cp-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  display: inline-block;
}
.cp-dot.dot-pending   { background: #ef4444; }
.cp-dot.dot-submitted { background: #f59e0b; }
.cp-dot.dot-reviewed  { background: #16a34a; }

.cp-legend {
  display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 11px; color: var(--ink-muted);
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.cp-legend > span { display: inline-flex; align-items: center; gap: 6px; }

/* Brief lines from therapist. */
.cp-brief-row { padding: 10px 0; border-bottom: 1px solid var(--border); }
.cp-brief-row:last-child { border-bottom: none; }

/* Assignment form. */
.cp-form { margin-top: 12px; }
.cp-intro {
  border-left: 3px solid var(--accent);
  padding: 8px 12px;
  background: var(--bg);
  margin-bottom: 14px;
}
.cp-body-read { margin-bottom: 16px; }
.cp-field-label { display: block; font-size: 14px; font-weight: 600; margin: 8px 0 4px; }
.cp-radio-row { display: flex; gap: 8px; align-items: center; padding: 4px 0; }
.cp-instructions {
  font-size: 14px; color: var(--ink);
  margin-bottom: 14px; padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

/* Conversation thread on a submitted assignment — flat list, sender on the
   side, no chat-bubbles. Therapist messages get an accent stripe. */
.thread-msg {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.thread-msg:last-child { border-bottom: none; }
.thread-meta {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 11px; color: var(--ink-muted);
  text-transform: uppercase; letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.thread-who { font-weight: 600; color: var(--ink); }
.thread-when { font-variant-numeric: tabular-nums; color: var(--ink-faint); }
.thread-body {
  font-size: 14px;
  white-space: pre-wrap;
  color: var(--ink);
}
.thread-msg.thread-therapist .thread-who { color: var(--accent); }

/* Live preview block on the template preview modal — wraps the same client
   form renderer in a subtle bordered area so it's clear this is a try-it,
   not the actual field-by-field submission flow. */
.cp-preview-wrap {
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: var(--bg);
}

/* Repeating-group field — flat list, not boxes. Each entry reads as a numbered
   item with its sub-fields stacked underneath; only a thin top divider
   separates rows so it looks like a list, not a stack of cards. */
.rep-group { margin-top: 6px; }
.rep-row {
  padding: 8px 0 6px;
  border-top: 1px solid var(--border);
}
.rep-row:first-child { border-top: none; padding-top: 0; }
.rep-row-head {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--ink-muted);
  margin-bottom: 4px;
}
.rep-row-num {
  font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.rep-row-remove {
  background: transparent; border: none; color: var(--ink-muted);
  font-size: 12px; cursor: pointer; padding: 2px 6px;
  border-radius: 4px;
}
.rep-row-remove:hover { color: var(--danger); background: var(--bg); }
.rep-subfield { margin: 4px 0; }
.rep-add { margin-top: 6px; }

/* Inline preview shown in the Send-a-Note modal after success. */
.cp-sent-preview {
  margin: 14px 0;
  padding: 12px 14px;
  background: var(--bg);
  border-left: 3px solid var(--success);
  border-radius: 4px;
  font-size: 14px;
}

/* Read-only thought record view (after submit). */
.cp-tr-readrow { padding: 10px 0; border-bottom: 1px solid var(--border); }
.cp-tr-readrow:last-child { border-bottom: none; }
.cp-tr-readlabel {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-faint); margin-bottom: 4px;
}
.cp-tr-readvalue { font-size: 14px; white-space: pre-wrap; color: var(--ink); }

.disclaimer-bar {
  background: #fffbe6; border-bottom: 1px solid #f3d96b;
  font-size: 13px; padding: 8px 16px; text-align: center; color: #8a5a0a;
}

/* ========================================================================
   Bell icon + dropdown panel
   ====================================================================== */
.bell-btn {
  position: relative; background: var(--surface); border: 1px solid var(--border);
  cursor: pointer; padding: 6px 10px; line-height: 1;
  color: var(--ink); border-radius: 6px;
  display: inline-flex; align-items: center; gap: 0;
  margin-left: 4px;
}
.bell-btn:hover { background: var(--bg); border-color: var(--accent); color: var(--accent); }
.bell-icon { font-size: 16px; line-height: 1; }
.bell-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 999px; min-width: 16px; text-align: center;
  border: 2px solid var(--surface);
}
.bell-panel {
  position: absolute; top: 56px; right: 16px; width: 360px; max-height: 70vh; overflow: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0,0,0,.18); z-index: 30;
}
.bell-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.bell-mark-all {
  background: transparent; border: none; color: var(--accent);
  font-size: 12px; cursor: pointer; padding: 2px 6px; border-radius: 4px;
}
.bell-mark-all:hover { background: var(--bg); }
.bell-empty, .bell-loading { padding: 24px 14px; color: var(--ink-muted); text-align: center; font-size: 13px; }
.bell-item {
  display: flex; gap: 10px; align-items: flex-start; justify-content: space-between;
  padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 13px;
}
.bell-item:last-child { border-bottom: none; }
.bell-item-unread { background: rgba(43,108,176,.06); }
.bell-item-clickable { cursor: pointer; transition: background-color .1s; }
.bell-item-clickable:hover { background: var(--bg); }
.bell-item-clickable:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.bell-item-body { flex: 1; min-width: 0; }
.bell-item-title { color: var(--ink); margin-bottom: 2px; word-wrap: break-word; }
.bell-item-time { color: var(--ink-faint); font-size: 11px; }
.bell-action {
  background: transparent; border: 1px solid var(--border); color: var(--ink-muted);
  padding: 3px 8px; border-radius: 4px; font-size: 11px; cursor: pointer;
}
.bell-action:hover { background: var(--bg); color: var(--ink); }

/* ========================================================================
   Sequential client form progress bar
   ====================================================================== */
.progress-bar {
  width: 100%; height: 6px; background: #f3f4f6;
  border-radius: 999px; overflow: hidden; margin: 4px 0 16px;
}
.progress-fill {
  height: 100%; background: var(--accent);
  width: 0%; transition: width .25s ease;
}
.step-body { margin: 12px 0; }

/* ========================================================================
   Markdown body styling
   ====================================================================== */
.md-body { font-size: 15px; line-height: 1.65; color: var(--ink); }
.md-body h1, .md-body h2, .md-body h3, .md-body h4 {
  margin: 18px 0 8px; line-height: 1.25;
}
.md-body h1 { font-size: 22px; }
.md-body h2 { font-size: 18px; }
.md-body h3 { font-size: 15px; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.md-body h4 { font-size: 14px; }
.md-body p { margin: 8px 0; }
.md-body ul, .md-body ol { margin: 8px 0 8px 24px; padding: 0; }
.md-body li { margin: 4px 0; }
.md-body code {
  background: #f3f4f6; padding: 1px 6px; border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px;
}
.md-body pre {
  background: #f3f4f6; padding: 12px 14px; border-radius: 6px;
  overflow: auto;
}
.md-body pre code { background: transparent; padding: 0; font-size: 13px; }
.md-body blockquote {
  border-left: 3px solid var(--border);
  padding: 4px 14px; color: var(--ink-muted);
  margin: 12px 0; background: #fafbfc; border-radius: 0 4px 4px 0;
}
.md-body a { color: var(--accent); }

@media (max-width: 720px) {
  .table th, .table td { padding: 8px 10px; font-size: 13px; }
  .table .col-format, .table .col-last { display: none; }
  main { padding: 20px 14px; }
  .topbar { padding: 12px 14px; }
  .card { padding: 18px; }
  .footer { padding: 14px; }
  .case-header .case-num { font-size: 18px; }
}

/* ──────────────────────────────────────────────────────────────────────────
   Mobile pass (target: 390px wide / iPhone). The site is desktop-first;
   this block covers the worst breaks on small screens without rebuilding
   the layouts.
   ────────────────────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Topbar: stack brand above the nav, let the nav wrap naturally. */
  .topbar { flex-direction: column; align-items: stretch; gap: 8px; padding: 10px 12px; }
  .topnav {
    flex-wrap: wrap; gap: 8px 14px; row-gap: 8px;
    justify-content: flex-start;
  }
  .topnav-user {
    border-right: none; padding-right: 0; margin-right: 0;
    width: 100%;
  }

  /* Main container padding tight on phones. */
  main { padding: 14px 10px; }
  .container { padding: 0 4px; }

  /* Tables: allow horizontal scroll instead of squishing. */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 480px; }

  /* Modals: near full-screen on phones. */
  .modal { max-width: calc(100vw - 16px); margin: 8px; padding: 16px; }

  /* Rings: keep them inline but smaller. */
  .ring-cell { min-width: 80px; }

  /* Form inputs: full-width, larger touch target. */
  input[type="text"], input[type="email"], input[type="password"],
  input[type="number"], input[type="datetime-local"], input[type="search"],
  textarea, select { font-size: 16px; }  /* prevent iOS auto-zoom */

  /* Schedule grid stays horizontally scrollable (already wrapped in
     .schedule-scroll); just ensure it doesn't blow out the container. */
  .schedule-scroll { max-width: 100%; }
}

/* Demo-mode banner. Renders only on installs running with DEMO_MODE=1. */
.demo-banner {
  display: flex; align-items: center; gap: 12px;
  background: #fef3c7; color: #78350f;
  padding: 8px 16px;
  border-bottom: 1px solid #fcd34d;
  font-size: 13px;
}
.demo-banner > strong {
  background: #92400e; color: #fffbeb;
  padding: 2px 8px; border-radius: 999px;
  font-size: 11px; letter-spacing: .06em;
}
.demo-banner-lead { flex: 1; }
.demo-banner .btn { padding: 4px 10px; }
