/* Dawrio Glass — one token set and three glass materials, loaded last.
   Re-skins the existing markup only; no layout or behaviour changes.
   Opaque fallbacks: no backdrop-filter support, or reduced transparency. */

:root {
  /* Colour: one accent, quiet neutrals, fixed status tints */
  --accent: #3e4acb;
  --accent-hover: #3440b8;
  --accent-ink: #2f3aa8;
  --accent-soft: rgba(62, 74, 203, .10);
  --accent-softer: rgba(62, 74, 203, .06);
  --mint: #2fb39d;

  --ink: #0f1729;
  --ink-2: #3b4559;
  --ink-3: #6a7489;
  --hairline: rgba(15, 23, 41, .08);
  --hairline-strong: rgba(15, 23, 41, .14);

  --ok: #0f7251;      --ok-bg: rgba(19, 128, 93, .11);
  --warn: #a2560a;    --warn-bg: rgba(242, 153, 38, .15);
  --bad: #be3329;     --bad-bg: rgba(220, 60, 50, .10);
  --info: var(--accent); --info-bg: var(--accent-soft);
  --switch-on: #16854b;

  /* Materials: thin (bars), regular (content), thick (floating) */
  --mat-thin: rgba(255, 255, 255, .58);
  --mat-regular: rgba(255, 255, 255, .64);
  --mat-thick: rgba(255, 255, 255, .84);
  --blur-thin: saturate(180%) blur(20px);
  --blur-regular: saturate(170%) blur(28px);
  --blur-thick: saturate(180%) blur(40px);
  --edge: inset 0 1px 0 rgba(255, 255, 255, .75);
  --float: 0 1px 2px rgba(15, 23, 41, .06), 0 12px 40px rgba(15, 23, 41, .14);

  --r-ctl: 10px;
  --r-card: 18px;
  --r-sheet: 26px;

  --ease: cubic-bezier(.2, .8, .2, 1);

  /* Map every legacy variable onto the new tokens */
  --muted: var(--ink-3);
  --teal: var(--accent);
  --teal2: var(--accent-soft);
  --line: var(--hairline);
  --bg: #f4f5fb;
  --nav: var(--ink);
  --radius: var(--r-card);
  --surface: var(--mat-regular);
  --glass-border: rgba(255, 255, 255, .7);
  --shadow: none;
  --brand-forest: var(--ink);
  --brand-teal: var(--accent);
  --care-ink: var(--ink);
  --care-muted: var(--ink-3);
  --care-accent: var(--accent);
  --care-line: var(--hairline);
  --care-tint: var(--accent-softer);
  --care-control-border: var(--hairline-strong);

  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01";
  color: var(--ink);
}

/* A saturated, soft mesh: what the glass refracts */
body {
  background:
    radial-gradient(42% 46% at 92% 4%, rgba(132, 146, 255, .42) 0, transparent 70%),
    radial-gradient(38% 42% at 6% 92%, rgba(84, 214, 186, .34) 0, transparent 70%),
    radial-gradient(34% 38% at 62% 58%, rgba(255, 196, 168, .30) 0, transparent 72%),
    radial-gradient(30% 34% at 24% 18%, rgba(196, 176, 255, .30) 0, transparent 72%),
    #f4f5fb;
  background-attachment: fixed;
  color: var(--ink);
}

/* Type */
h1 { color: var(--ink); font-weight: 680; letter-spacing: -.028em; }
h2, h3 { color: var(--ink); letter-spacing: -.01em; }
h2 { font-weight: 640; }
.eyebrow, .nav-label, .welcome-banner .eyebrow { color: var(--ink-3); letter-spacing: .08em; font-weight: 650; }
.sub, .stat-note, .cell-sub, .task small, .panel-head .sub, .crumb, .profile-text small { color: var(--ink-3); }
.stat-label, .profile-text, .crumb strong, td, .task p { color: var(--ink-2); }
.cell-title, .crumb strong { color: var(--ink); }
.stat-value, .care-metric strong, .care-metric .care-metric-value, .price { color: var(--ink); font-variant-numeric: tabular-nums; }
.care-visit-time, .care-visit-time strong, .care-visit-time time { font-variant-numeric: tabular-nums; }

/* Thin material: top bar */
.topbar {
  background: var(--mat-thin);
  -webkit-backdrop-filter: var(--blur-thin);
  backdrop-filter: var(--blur-thin);
  border-bottom: 1px solid var(--hairline);
  box-shadow: none;
}
.avatar { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }

/* Regular material: sidebar */
.sidebar {
  background: rgba(255, 255, 255, .5);
  -webkit-backdrop-filter: var(--blur-regular);
  backdrop-filter: var(--blur-regular);
  border-inline-end: 1px solid var(--hairline);
  box-shadow: none;
  color: var(--ink-2);
}
.workspace-label {
  background: var(--mat-thick);
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: var(--edge), 0 1px 2px rgba(15, 23, 41, .05);
  color: var(--ink-3);
}
.workspace-label strong { color: var(--ink); }
.workspace-label > .icon { color: var(--accent); }
.nav { color: var(--ink-2); border-radius: var(--r-ctl); transition: background .2s var(--ease), color .2s var(--ease); }
.nav .icon { color: var(--ink-3); }
.nav:hover { background: rgba(15, 23, 41, .045); color: var(--ink); }
.nav.active, .nav[aria-current=page],
[dir=rtl] .nav.active, [dir=rtl] .nav[aria-current=page] {
  background: var(--accent-soft);
  color: var(--accent-ink);
  box-shadow: none;
  font-weight: 650;
}
.nav.active .icon, .nav[aria-current=page] .icon { color: var(--accent); }
.nav-scroll { scrollbar-color: rgba(15, 23, 41, .15) transparent; }
.sidebar-foot { border-color: var(--hairline); color: var(--ink-3); }
.status-dot { background: var(--switch-on); box-shadow: 0 0 0 3px rgba(48, 180, 108, .18); }
.brand-tagline { color: var(--ink-3); }

/* Regular material: content surfaces. No shadow; material + hairline + top highlight. */
.stat, .panel, .module-card, .module-list, .care-panel, .login-form {
  background: var(--mat-regular);
  -webkit-backdrop-filter: var(--blur-regular);
  backdrop-filter: var(--blur-regular);
  border: 1px solid rgba(255, 255, 255, .72);
  box-shadow: var(--edge), 0 1px 2px rgba(15, 23, 41, .04);
  border-radius: var(--r-card);
}
.stat { min-height: 124px; }
.stat-value { font-weight: 680; letter-spacing: -.03em; }
.stat-icon,
.stat:nth-child(2) .stat-icon,
.stat:nth-child(3) .stat-icon,
.stat:nth-child(4) .stat-icon { background: var(--accent-softer); color: var(--accent); }
.panel-head, .care-panel-head { border-bottom-color: var(--hairline); }
.module-card:hover { box-shadow: var(--edge), 0 8px 28px rgba(15, 23, 41, .08); }
.module-card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.care-summary, .care-metric + .care-metric { border-color: var(--hairline); }

.welcome-banner {
  background: linear-gradient(120deg, #2b37a6, #4a57d8 60%, #4c8fd6);
  border: 1px solid rgba(255, 255, 255, .25);
  box-shadow: 0 10px 30px rgba(62, 74, 203, .22);
  color: #fff;
}
.welcome-banner h2 { color: #fff; }
.welcome-banner p, .welcome-banner .eyebrow { color: rgba(255, 255, 255, .82); }

/* Inset grouped lists */
th { background: transparent; color: var(--ink-3); border-color: var(--hairline); letter-spacing: .04em; }
td { border-bottom-color: var(--hairline); }
tbody tr.clickable { transition: background .15s var(--ease); }
tbody tr.clickable:hover { background: var(--accent-softer); }
.task { border-color: var(--hairline); }
.task .marker { border-color: var(--warn); }
.care-visit, .care-queue-item { border-color: var(--hairline); }
button.care-queue-item:hover { background: var(--accent-softer); }

/* Status: small pills with fixed tints */
.badge { border-radius: 999px; padding: 4px 10px; font-weight: 600; letter-spacing: .01em; }
.badge.green { color: var(--ok); background: var(--ok-bg); }
.badge.orange, .tasks-count { color: var(--warn); background: var(--warn-bg); }
.badge.blue { color: var(--accent-ink); background: var(--accent-soft); }
.badge.red { color: var(--bad); background: var(--bad-bg); }
.notice.info { background: var(--info-bg); border-color: transparent; color: var(--accent-ink); }
.notice.success { background: var(--ok-bg); border-color: transparent; color: var(--ok); }
.notice.error { background: var(--bad-bg); border-color: transparent; color: var(--bad); }
.patient-alert { background: var(--warn-bg); border-color: rgba(162, 86, 10, .2); }

/* Controls */
button {
  border-radius: var(--r-ctl);
  background: rgba(255, 255, 255, .72);
  border: 1px solid var(--hairline-strong);
  color: var(--ink);
  box-shadow: 0 1px 1px rgba(15, 23, 41, .04);
  transition: background .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease), transform .12s var(--ease);
}
button:hover { background: rgba(255, 255, 255, .95); border-color: rgba(15, 23, 41, .2); }
button:active { transform: scale(.98); }
button.primary {
  background: linear-gradient(180deg, #4a56d6, var(--accent));
  border-color: var(--accent-hover);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 2px rgba(62, 74, 203, .3), 0 6px 16px rgba(62, 74, 203, .22);
}
button.primary:hover { background: linear-gradient(180deg, #4350cc, var(--accent-hover)); border-color: var(--accent-hover); }
button.quiet { background: transparent; border-color: transparent; box-shadow: none; color: var(--accent-ink); }
button.quiet:hover { background: var(--accent-softer); color: var(--accent-ink); }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid rgba(62, 74, 203, .45); outline-offset: 2px; }

input:not([type=checkbox]):not([type=radio]), textarea, select {
  background: rgba(255, 255, 255, .78);
  border: 1px solid var(--hairline-strong);
  border-radius: var(--r-ctl);
  color: var(--ink);
}
input::placeholder, textarea::placeholder { color: var(--ink-3); }
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(62, 74, 203, .16); outline: none; }
.field, .login-form .field, .detail-item label, .field small { color: var(--ink-2); }
.search input { border-radius: 999px; background: var(--mat-thick); box-shadow: var(--edge); }
.search .icon { color: var(--ink-3); }

/* Segmented filters */
.filters { background: rgba(15, 23, 41, .05); border-radius: 12px; padding: 3px; gap: 2px; width: fit-content; }
.filter { border-radius: 9px; color: var(--ink-2); min-height: 32px; padding: 6px 14px; }
.filter:hover { background: rgba(255, 255, 255, .5); }
.filter.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 41, .12), 0 0 0 .5px rgba(15, 23, 41, .06); }
.segmented button.active { background: #fff; color: var(--ink); }
.care-date-step { display: inline-flex; gap: 2px; padding: 3px; background: rgba(15, 23, 41, .05); border-radius: 12px; }
.care-date-step button { background: transparent; border-color: transparent; box-shadow: none; border-radius: 9px; min-height: 34px; }
.care-date-step button:hover { background: #fff; box-shadow: 0 1px 3px rgba(15, 23, 41, .12); }

.toggle input:checked + span { background: var(--switch-on); }
.toggle, .toggle input { color: var(--ink-2); }
.pagination { color: var(--ink-3); }
.skip-link { background: var(--accent); color: #fff; }
.nav-scrim { background: rgba(15, 23, 41, .28); }

.quick-grid button { background: rgba(255, 255, 255, .6); border-color: var(--hairline); color: var(--ink-2); }
.quick-grid button:hover { background: #fff; }
.quick-grid .icon { color: var(--accent); }

/* Module store */
.module-row { border-color: var(--hairline); }
.module-row:hover { background: var(--accent-softer); }
.module-row-icon,
.module-row:nth-child(4n + 1) .module-row-icon,
.module-row:nth-child(4n + 2) .module-row-icon,
.module-row:nth-child(4n + 3) .module-row-icon,
.module-icon { background: var(--accent-softer); color: var(--accent); border-radius: 12px; }
.module-list-head { background: transparent; color: var(--ink-3); border-color: var(--hairline); }
.subscription-summary {
  background: linear-gradient(120deg, rgba(62, 74, 203, .12), rgba(47, 179, 157, .12));
  -webkit-backdrop-filter: var(--blur-regular);
  backdrop-filter: var(--blur-regular);
  border: 1px solid rgba(255, 255, 255, .75);
  box-shadow: var(--edge);
}
.subscription-summary .store-summary { background: none; border: 0; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.module-row-price { color: var(--ink); font-variant-numeric: tabular-nums; }
.module-row-price small, .module-row-info p { color: var(--ink-3); }
.module-row-info .cell-sub { color: var(--ink-3); }
.subscription-summary h2, .store-summary h2, .subscription-summary strong, .store-summary strong { color: var(--ink); }
.subscription-summary p, .store-summary p { color: var(--ink-2); }

/* Thick material: sheets, popovers, toasts */
.modal-backdrop {
  background: rgba(15, 23, 41, .22);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  backdrop-filter: blur(10px) saturate(120%);
}
/* Sheets are near-opaque: the full-screen backdrop already blurs the page, and a
   backdrop-filter or transform on .modal would capture the fixed Assistant button. */
.modal {
  background: rgba(250, 251, 255, .97);
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: var(--r-sheet);
  box-shadow: var(--edge), 0 30px 80px rgba(15, 23, 41, .25);
  animation: glass-sheet-in .28s var(--ease);
}
.modal-head { background: transparent; border-bottom-color: var(--hairline); border-radius: var(--r-sheet) var(--r-sheet) 0 0; }
.modal-head h2 { font-size: 17px; font-weight: 650; }
.modal-foot { background: rgba(255, 255, 255, .45); border-top-color: var(--hairline); border-radius: 0 0 var(--r-sheet) var(--r-sheet); }
@keyframes glass-sheet-in { from { opacity: 0; } to { opacity: 1; } }

#toast {
  background: rgba(22, 28, 45, .82);
  -webkit-backdrop-filter: var(--blur-thick);
  backdrop-filter: var(--blur-thick);
  color: #fff;
  border-radius: 14px;
  box-shadow: var(--float);
}

.assistant-launch {
  background: linear-gradient(180deg, #4a56d6, var(--accent));
  border-color: var(--accent-hover);
  border-radius: 999px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 8px 24px rgba(62, 74, 203, .35);
}
.assistant-launch:hover { background: linear-gradient(180deg, #4350cc, var(--accent-hover)); }
.assistant-panel, #assistant-confirmation {
  background: var(--mat-thick);
  -webkit-backdrop-filter: var(--blur-thick);
  backdrop-filter: var(--blur-thick);
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: 20px;
  box-shadow: var(--edge), var(--float);
}
.assistant-panel .panel-head { background: rgba(255, 255, 255, .6); -webkit-backdrop-filter: var(--blur-thin); backdrop-filter: var(--blur-thin); }
#navigator-dock { background: rgba(22, 28, 45, .85); -webkit-backdrop-filter: var(--blur-thick); backdrop-filter: var(--blur-thick); border-radius: 16px; }

/* Sign-in */
.login-art {
  background:
    radial-gradient(60% 60% at 12% 0%, rgba(110, 124, 255, .55) 0, transparent 70%),
    radial-gradient(50% 50% at 90% 100%, rgba(47, 179, 157, .38) 0, transparent 70%),
    #141d3d;
}
.login-art .badge, .login-art .badge.green {
  background: rgba(255, 255, 255, .1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-color: rgba(255, 255, 255, .22);
  color: #eef1ff;
  border-radius: 999px;
}
.login-form h1 { color: var(--ink); }
.login-form input { background: rgba(255, 255, 255, .85); border-color: var(--hairline-strong); }
@media (max-width: 800px) {
  .login-layout { background: transparent; }
}

/* Phone: thin-material tab bar */
@media (max-width: 800px) {
  .mobile-dock {
    background: rgba(255, 255, 255, .72);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    backdrop-filter: saturate(180%) blur(24px);
    border-top: 1px solid var(--hairline);
    box-shadow: none;
  }
  .dock-item { color: var(--ink-3); }
  .dock-item.active, .dock-item[aria-current=page] { color: var(--accent); background: transparent; }
  .dock-item.active .icon, .dock-item[aria-current=page] .icon { stroke-width: 2.1; }
  .dock-item:hover { background: rgba(15, 23, 41, .04); color: var(--ink); }
  .stat { min-height: 0; }
}

/* Account menu: name, language and sign-out in one place */
/* The top bar's blur makes it a stacking context; lift it above page content so its menu is not painted over. */
.topbar { position: relative; z-index: 40; }
.account-menu { position: relative; }
.account-menu > summary {
  display: flex; align-items: center; gap: 10px; list-style: none; cursor: pointer;
  padding: 4px 6px 4px 12px; border-radius: 999px; border: 1px solid transparent;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary:hover, .account-menu[open] > summary { background: rgba(255, 255, 255, .7); border-color: var(--hairline); }
.account-menu > summary:focus-visible { outline: 3px solid rgba(62, 74, 203, .45); outline-offset: 2px; }
.account-menu .profile-text { text-align: end; }
.account-menu .profile-text small { text-transform: capitalize; }
.account-pop {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 60; width: 260px;
  display: flex; flex-direction: column; gap: 2px; padding: 8px;
  /* Opaque: a blur here cannot reach the page through the top bar, and any translucency lets the heading bleed through. */
  background: #fff;
  border: 1px solid rgba(255, 255, 255, .9); border-radius: 16px; box-shadow: var(--edge), var(--float);
  animation: glass-sheet-in .18s var(--ease);
}
.account-who { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--hairline); }
.account-who strong { display: block; color: var(--ink); font-size: 14px; }
.account-who small { display: block; color: var(--ink-3); font-size: 12px; overflow-wrap: anywhere; }
.account-pop .account-item { display: flex; align-items: center; gap: 10px; width: 100%; justify-content: flex-start; padding: 10px; border-radius: 10px; color: var(--ink); font-weight: 550; }
.account-pop .account-item:hover { background: var(--accent-softer); color: var(--ink); }
.account-pop .account-signout, .account-pop .account-signout:hover { color: var(--bad); }
.account-pop .account-signout:hover { background: var(--bad-bg); }
@media (max-width: 800px) { .account-menu .profile-text { display: none; } .account-menu > summary { padding: 3px; } }

/* Record actions: one primary, then secondary, destructive pushed to the end */
.action-list { align-items: center; }
.action-list .action-spacer { flex: 1 1 12px; order: 2; }
.action-list button.danger { order: 3; }
button.danger { color: var(--bad); }
button.danger:hover { background: var(--bad-bg); border-color: rgba(190, 51, 41, .3); color: var(--bad); }

/* Long forms inside dialogs: the submit button stays in view */
.modal-content form button.primary[type=submit]:last-child,
.modal-content #record-action-form button.primary[type=submit] {
  position: sticky; bottom: -1px; z-index: 2;
  box-shadow: 0 -12px 20px 6px rgba(255, 255, 255, .85), inset 0 1px 0 rgba(255, 255, 255, .22), 0 6px 16px rgba(62, 74, 203, .22);
}
td.num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink); white-space: nowrap; }

/* ---------- Controls and fields: one size scale everywhere ---------- */
:root { --ink-3: #596377; }
.eyebrow { font-size: 11px; }
button { font-size: 14px; min-height: 40px; padding: 9px 16px; font-weight: 600; }
button.small { font-size: 13px; min-height: 36px; padding: 7px 13px; }
button.quiet.small { padding-inline: 10px; }
.quick-grid button { font-size: 13px; min-height: 52px; padding: 12px 14px; gap: 10px; }
.filter { font-size: 13px; }
.filters select, #status-filter { min-width: 180px; }

.field, .login-form .field { font-size: 13px; font-weight: 600; color: var(--ink-2); gap: 6px; }
.field small, .field .sub { font-size: 12px; font-weight: 400; color: var(--ink-3); }
.form-grid { gap: 18px 20px; }
#record-form > * + *, #patient-form > * + *, #record-action-form form > * + * { margin-top: 18px; }
input:not([type=checkbox]):not([type=radio]), select { min-height: 44px; padding: 10px 12px; font-size: 15px; }
textarea { min-height: 96px; padding: 10px 12px; font-size: 15px; line-height: 1.55; }
.modal input:not([type=checkbox]):not([type=radio]), .modal textarea, .modal select { background-color: #fff; }
select {
  -webkit-appearance: none; appearance: none; padding-inline-end: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%23596377' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
[dir=rtl] select { background-position: left 14px center; padding-inline-end: 12px; padding-inline-start: 38px; }
select[multiple] { background-image: none; padding-inline-end: 12px; }
input:disabled, select:disabled, textarea:disabled { background-color: rgba(15, 23, 41, .04); color: var(--ink-3); border-style: dashed; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 18px; height: 18px; }
.check-field { font-size: 14px; font-weight: 500; color: var(--ink); }
input[type=file] { padding: 8px; font-size: 14px; }
input[type=file]::file-selector-button { border: 1px solid var(--hairline-strong); border-radius: 8px; background: #fff; padding: 6px 12px; margin-inline-end: 10px; font: inherit; font-weight: 600; cursor: pointer; }

/* Expandable sections: chevron instead of the browser triangle */
.modal details > summary, .content details > summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 10px;
  font-size: 14px; font-weight: 600; color: var(--accent-ink); padding: 8px 0;
}
.modal details > summary::-webkit-details-marker, .content details > summary::-webkit-details-marker { display: none; }
.modal details > summary::before, .content details > summary::before {
  content: ""; flex: none; width: 7px; height: 7px; margin-inline: 2px 2px;
  border-inline-end: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s var(--ease);
}
[dir=rtl] .modal details > summary::before, [dir=rtl] .content details > summary::before { transform: rotate(45deg); }
.modal details[open] > summary::before, .content details[open] > summary::before { transform: rotate(45deg); }
[dir=rtl] .modal details[open] > summary::before, [dir=rtl] .content details[open] > summary::before { transform: rotate(-45deg); }

/* Specialty profile refresh reads as a link, not a full-width bar */
[data-action=specialty-refresh-form] { align-self: flex-start; width: auto; min-height: 32px; padding: 4px 0; background: transparent; border-color: transparent; box-shadow: none; color: var(--accent-ink); }
[data-action=specialty-refresh-form]:hover { background: transparent; text-decoration: underline; }

/* Record detail: quiet summary band and readable values */
.detail-hero { background: var(--accent-softer); border: 1px solid var(--hairline); border-radius: 14px; }
.detail-grid { gap: 18px 24px; }
.detail-item label { font-size: 11px; font-weight: 650; letter-spacing: .06em; color: var(--ink-3); text-transform: uppercase; }
.detail-item div { font-size: 15px; color: var(--ink); }
.notice { font-size: 14px; border-radius: 12px; }
.notice:not(.info):not(.success):not(.error) { background: var(--warn-bg); border-color: transparent; color: var(--warn); }
.modal-foot { gap: 10px; }
.modal-foot button:not(.primary) { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.modal-foot button:not(.primary):hover { background: rgba(15, 23, 41, .05); color: var(--ink); }
.modal-head [data-action=close-modal] { width: 34px; height: 34px; min-height: 34px; padding: 0; display: grid; place-items: center; border-radius: 999px; background: rgba(15, 23, 41, .06); color: var(--ink-2); }
.modal-head [data-action=close-modal]:hover { background: rgba(15, 23, 41, .1); }

/* Remaining old-theme greens */
input, textarea, select { color: var(--ink); }
.total-line { color: var(--ink-2); }
.total-line.grand { color: var(--ink); }
.module-row-control .toggle { color: var(--ink-2); }
.assistant-panel hr { border-top-color: var(--hairline); }
.patient-banner .avatar { color: var(--accent-ink); background: var(--accent-soft); border-color: transparent; }
.patient-facts { background: rgba(15, 23, 41, .03); border-color: var(--hairline); }
.patient-alert { background: var(--warn-bg); border-color: rgba(162, 86, 10, .22); border-inline-start-color: var(--warn); color: #6b3a06; }

/* Opaque fallbacks */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sidebar, .topbar, .stat, .panel, .module-card, .module-list, .care-panel, .login-form, .modal, .assistant-panel, .mobile-dock { background: #fbfbfe; }
}
@media (prefers-reduced-transparency: reduce) {
  .sidebar, .topbar, .stat, .panel, .module-card, .module-list, .care-panel, .login-form, .modal, .assistant-panel, .mobile-dock, #assistant-confirmation {
    background: #fbfbfe; -webkit-backdrop-filter: none; backdrop-filter: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .modal { animation: none; }
  button:active { transform: none; }
}
@media (forced-colors: active) {
  .nav.active, .nav[aria-current=page] { outline: 2px solid Highlight; }
}

/* Merge with the current full-page clinical workspaces and header assistant. */
:root {
  --practice-ink: var(--ink);
  --practice-muted: var(--ink-3);
  --practice-accent: var(--accent);
  --practice-surface: #fbfbfe;
  --practice-line: var(--hairline-strong);
  --practice-focus: var(--accent-ink);
}
.topbar { position: sticky; top: 0; }
.topbar:has(#assistant-root) { -webkit-backdrop-filter: none; backdrop-filter: none; }
.record-workspace { background: rgba(250, 251, 255, .96); border-color: var(--hairline-strong); box-shadow: var(--edge); }
.workspace-footer { background: #fbfbfe; border-color: var(--hairline); }
.account-menu > .account-pop { display: flex; width: min(280px, calc(100vw - 32px)); padding: 8px; gap: 2px; border-color: var(--hairline-strong); box-shadow: var(--edge), var(--float); }
.account-menu > summary { min-height: 44px; min-width: 44px; }
.record-more > div { background: #fff; border-color: var(--hairline-strong); box-shadow: var(--float); }
.patient-inline-create, .booking-duration { background: var(--accent-softer); border-color: var(--hairline-strong); }
button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex]:focus-visible,
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid var(--accent-ink); outline-offset: 3px; }
[dir=rtl] select { padding-inline-start: 12px; padding-inline-end: 38px; }
@media (max-width: 800px) {
  input:not([type=checkbox]):not([type=radio]), textarea, select { font-size: 16px; }
  .nav-open .sidebar { z-index: 80; background: rgba(250, 251, 255, .98); }
  .nav-open .nav-scrim { z-index: 79; }
  .sidebar > .brand { width: calc(100% - 48px); align-self: flex-start; }
  .sidebar > .brand .brand-image { max-width: 100%; height: auto; }
  .nav-open .nav-close { top: 20px; inset-inline-start: auto; inset-inline-end: 12px; z-index: 2; min-width: 44px; min-height: 44px; background: var(--accent-soft); }
  button.small, button.filter, .account-menu > summary,
  .top-actions .assistant-launch, .top-actions .mobile-menu { min-width: 44px; min-height: 44px; }
  .account-menu > summary { width: auto; }
  .filters select, #status-filter { min-width: min(180px, 100%); }
  .modal-head [data-action=close-modal] { width: 44px; height: 44px; min-height: 44px; }
  .record-workspace { padding: 18px; }
  .mobile-dock { background: rgba(255, 255, 255, .96) !important; }
  /* Keep the whole visit readable without a sideways table on phones. */
  .dashboard-agenda, .dashboard-agenda tbody { display: block; width: 100%; }
  .dashboard-agenda thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .dashboard-agenda tr { display: block; padding: 16px; border-bottom: 1px solid var(--hairline); }
  .dashboard-agenda td { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; padding: 5px 0; border: 0; white-space: normal; overflow-wrap: anywhere; }
  .dashboard-agenda td:first-child { display: block; margin-bottom: 6px; }
  .dashboard-agenda td[data-label]::before { content: attr(data-label); color: var(--ink-3); font-size: 12px; font-weight: 500; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .record-workspace, #assistant-confirmation, .subscription-summary { background: #fbfbfe; }
  .modal-backdrop { background: rgba(15, 23, 41, .4); }
}
@media (prefers-reduced-transparency: reduce) {
  .record-workspace, .subscription-summary, .workspace-label, #toast, #navigator-dock { background: #fbfbfe; color: var(--ink); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .modal-backdrop { background: rgba(15, 23, 41, .4); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .mobile-dock { background: #fbfbfe !important; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .record-workspace, .account-pop, .modal, .panel, .care-panel { background: Canvas; color: CanvasText; border: 1px solid CanvasText; }
  button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline-color: Highlight; }
}

/* ---------- Voice-first capture ---------- */
.voice-panel { display: flex; flex-direction: column; gap: 16px; }
.voice-for { display: flex; flex-direction: column; gap: 8px; }
.voice-for-field { margin: 0; }
.voice-stage {
  display: flex; align-items: center; gap: 20px; padding: 20px 22px;
  border-radius: 20px; border: 1px solid rgba(62, 74, 203, .14);
  background: radial-gradient(120% 140% at 0% 0%, rgba(62, 74, 203, .12), transparent 60%), radial-gradient(90% 120% at 100% 100%, rgba(47, 179, 157, .12), transparent 60%), #fff;
}
.voice-mic {
  position: relative; flex: none; width: 76px; height: 76px; min-height: 76px; padding: 0; border-radius: 999px; display: grid; place-items: center;
  color: #fff; border: 0; background: linear-gradient(180deg, #4f5be0, var(--accent));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 10px 26px rgba(62, 74, 203, .35);
}
.voice-mic:hover { background: linear-gradient(180deg, #4652d6, var(--accent-hover)); }
.voice-mic .icon { width: 32px; height: 32px; stroke-width: 1.8; position: relative; z-index: 1; }
.voice-mic-ring { position: absolute; inset: -6px; border-radius: inherit; border: 2px solid rgba(62, 74, 203, .25); opacity: 0; }
.voice-mic.listening { background: linear-gradient(180deg, #e0483d, #be3329); box-shadow: 0 10px 26px rgba(190, 51, 41, .35); }
.voice-mic.listening .voice-mic-ring { opacity: 1; border-color: rgba(190, 51, 41, .35); animation: voice-pulse 1.4s var(--ease) infinite; }
@keyframes voice-pulse { 0% { transform: scale(.92); opacity: .9; } 100% { transform: scale(1.35); opacity: 0; } }
.voice-prompt { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.voice-prompt strong { font-size: 18px; font-weight: 650; color: var(--ink); letter-spacing: -.01em; }
.voice-prompt .sub { font-size: 14px; }
.voice-mode { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.voice-transcript { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.voice-transcript textarea { min-height: 72px; font-size: 16px; line-height: 1.55; }
.voice-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.voice-status:empty { display: none; }
.voice-status { font-size: 14px; color: var(--accent-ink); }
.voice-status.error { color: var(--bad); }

.voice-review { border: 1px solid var(--hairline); border-radius: 16px; background: #fff; overflow: hidden; }
.voice-review-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 12px; padding: 14px 16px; border-bottom: 1px solid var(--hairline); }
.voice-review-head strong { font-size: 15px; color: var(--ink); }
.voice-rows { display: flex; flex-direction: column; }
.voice-row {
  display: grid; grid-template-columns: minmax(110px, 160px) minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; min-height: 48px; padding: 10px 16px; border: 0; border-radius: 0; border-bottom: 1px solid var(--hairline);
  background: transparent; box-shadow: none; text-align: start; font-weight: 400;
}
.voice-row:last-child { border-bottom: 0; }
.voice-row:hover { background: var(--accent-softer); border-color: var(--hairline); }
.voice-row:active { transform: none; }
.voice-row-label { font-size: 13px; color: var(--ink-3); font-weight: 600; }
.voice-row-value { font-size: 15px; color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; }
.voice-row-empty { color: var(--ink-3); font-style: italic; }
.voice-row.needed .voice-row-label { color: var(--bad); }
.voice-tag { font-size: 11px; font-weight: 650; padding: 3px 8px; border-radius: 999px; white-space: nowrap; color: var(--ink-3); background: rgba(15, 23, 41, .05); }
.voice-tag.voice { color: var(--accent-ink); background: var(--accent-soft); }
.voice-tag.edited { color: var(--warn); background: var(--warn-bg); }
.voice-tag.default, .voice-tag.set { color: var(--ink-2); }
.voice-tag.needed { color: var(--bad); background: var(--bad-bg); }
.voice-missing { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 12px 16px; border-top: 1px solid var(--hairline); background: var(--bad-bg); font-size: 13px; color: var(--bad); font-weight: 600; }
.voice-chip { min-height: 30px; padding: 4px 12px; border-radius: 999px; font-size: 13px; color: var(--bad); border-color: rgba(190, 51, 41, .3); background: #fff; }

.voice-all-fields { border-top: 1px solid var(--hairline); padding-top: 6px; }
.voice-all-fields > .voice-all-body { padding-top: 10px; }
.voice-all-body > * + * { margin-top: 18px; }
.voice-filled > input, .voice-filled > select, .voice-filled > textarea,
.voice-filled input:not([type=checkbox]), .voice-filled select, .voice-filled textarea { border-color: rgba(62, 74, 203, .45); background-color: #f7f8ff; }
.voice-modal .modal-content { padding-top: 20px; }

/* Saved: everything that was stored */
.voice-saved { display: flex; flex-direction: column; gap: 18px; }
.voice-saved-hero { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: 16px; background: var(--ok-bg); }
.voice-saved-hero > .icon { width: 34px; height: 34px; padding: 6px; border-radius: 999px; background: var(--ok); color: #fff; stroke-width: 2.4; flex: none; }
.voice-saved-hero h3 { font-size: 18px; margin: 2px 0 4px; }
.voice-saved-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--hairline); border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden; }
.voice-saved-grid > div { background: #fff; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.voice-saved-grid span { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }
.voice-saved-grid strong { font-size: 14px; color: var(--ink); overflow-wrap: anywhere; font-weight: 600; }
.voice-saved h4 { font-size: 13px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin: 4px 0 -6px; }
.voice-saved-fields { margin: 0; border: 1px solid var(--hairline); border-radius: 14px; overflow: hidden; background: #fff; }
.voice-saved-fields > div { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr); gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--hairline); }
.voice-saved-fields > div:last-child { border-bottom: 0; }
.voice-saved-fields dt { font-size: 13px; font-weight: 600; color: var(--ink-3); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.voice-saved-fields dd { margin: 0; font-size: 15px; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.voice-saved-provenance { background: var(--accent-softer); }
.voice-saved-provenance > div { border-bottom-color: rgba(62, 74, 203, .1); }

/* Record detail: the dictation behind a record */
.voice-detail { margin-bottom: 20px; border: 1px solid rgba(62, 74, 203, .18); border-radius: 14px; padding: 4px 14px; background: var(--accent-softer); }
.voice-detail > summary .icon { width: 16px; height: 16px; }
.voice-detail blockquote { margin: 6px 0 10px; padding: 10px 14px; border-inline-start: 3px solid var(--accent); background: #fff; border-radius: 8px; font-size: 15px; color: var(--ink); white-space: pre-wrap; }

@media (max-width: 800px) {
  .record-workspace:has([data-voice-panel]) .page-heading { flex-direction: row; align-items: center; gap: 12px; margin-bottom: 18px; }
  .record-workspace:has([data-voice-panel]) .page-heading .eyebrow,
  .record-workspace:has([data-voice-panel]) .page-heading .sub { display: none; }
  .record-workspace:has([data-voice-panel]) .page-heading h1 { font-size: 25px; margin: 0; }
  .record-workspace:has([data-voice-panel]) .page-heading button { min-height: 44px; }
}

@media (max-width: 800px) {
  .voice-stage { flex-direction: column; text-align: center; padding: 22px 16px; }
  .voice-prompt { align-items: center; }
  .voice-mic { width: 88px; height: 88px; }
  .voice-row { grid-template-columns: minmax(0, 1fr) auto; }
  .voice-row-label { grid-column: 1 / -1; margin-bottom: -6px; }
  .voice-saved-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .voice-saved-fields > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
@media (prefers-reduced-motion: reduce) { .voice-mic.listening .voice-mic-ring { animation: none; } }
/* Phones: keep the Assistant button clear of a dialog's Save button */
@media (max-width: 800px) { .dialog-open .assistant-launch { bottom: calc(118px + env(safe-area-inset-bottom)); } }

