:root {
  color-scheme: light;
  --bg: #f2f0e9;
  --surface: #fffdf7;
  --surface-2: #e9e7df;
  --surface-3: #dfe5df;
  --ink: #17302e;
  --muted: #647371;
  --subtle: #899492;
  --accent: #0d6661;
  --accent-strong: #084b48;
  --accent-soft: #d7ebe6;
  --coral: #e17c5e;
  --coral-soft: #f7dfd7;
  --danger: #ad3f4e;
  --danger-soft: #f7dce0;
  --warning: #8b651d;
  --warning-soft: #f3e8c8;
  --success: #276948;
  --success-soft: #dcece2;
  --line: rgba(23, 48, 46, .13);
  --line-strong: rgba(23, 48, 46, .24);
  --shadow: 0 16px 48px rgba(30, 48, 44, .09);
  --font: "Segoe UI", "Aptos", system-ui, -apple-system, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
  --text-xs: .72rem;
  --text-sm: .84rem;
  --text-md: .96rem;
  --text-lg: 1.15rem;
  --text-xl: 1.65rem;
  --text-2xl: clamp(2.35rem, 4.5vw, 4.8rem);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --dur-1: 140ms;
  --dur-2: 260ms;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101917;
  --surface: #172320;
  --surface-2: #202e2b;
  --surface-3: #293936;
  --ink: #eef1e9;
  --muted: #aab7b3;
  --subtle: #7e908b;
  --accent: #7fc4b8;
  --accent-strong: #a9d9d0;
  --accent-soft: #183e39;
  --coral: #ef9a7d;
  --coral-soft: #4d2c25;
  --danger: #ef8995;
  --danger-soft: #4a282e;
  --warning: #e1bd70;
  --warning-soft: #463b24;
  --success: #79c49b;
  --success-soft: #214232;
  --line: rgba(233, 244, 239, .12);
  --line-strong: rgba(233, 244, 239, .24);
  --shadow: 0 20px 54px rgba(0, 0, 0, .24);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: var(--text-md); line-height: 1.5; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.08; }

.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; transform: translateY(-160%); border-radius: var(--radius-sm); background: var(--ink); color: var(--bg); }
.skip-link:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 58%, transparent); outline-offset: 3px; }

.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: var(--text-md); letter-spacing: -.01em; }
.brand small { margin-top: 1px; color: var(--muted); font-size: var(--text-xs); }
.brand-mark { display: flex; align-items: end; gap: 3px; width: 33px; height: 33px; padding: 7px; border-radius: 50% 50% 50% 12px; background: var(--accent); }
.brand-mark span { width: 4px; border-radius: 4px; background: var(--surface); }
.brand-mark span:nth-child(1) { height: 9px; }
.brand-mark span:nth-child(2) { height: 16px; }
.brand-mark span:nth-child(3) { height: 12px; }
.eyebrow { margin-bottom: 9px; color: var(--accent); font-size: var(--text-xs); font-weight: 700; letter-spacing: .11em; text-transform: uppercase; }

.login-shell { display: grid; min-height: 100dvh; grid-template-columns: minmax(0, 1.15fr) minmax(390px, .85fr); }
.login-story { position: relative; display: flex; flex-direction: column; min-height: 100%; padding: clamp(28px, 5vw, 72px); overflow: hidden; background: var(--ink); color: var(--bg); }
.login-story::before { position: absolute; width: 44vw; height: 44vw; right: -18vw; bottom: -25vw; border: 1px solid color-mix(in srgb, var(--bg) 22%, transparent); border-radius: 50%; box-shadow: 0 0 0 6vw color-mix(in srgb, var(--bg) 3%, transparent), 0 0 0 13vw color-mix(in srgb, var(--bg) 3%, transparent); content: ""; }
.login-story .brand { position: relative; }
.login-story .brand-mark { background: var(--coral); }
.login-story .brand small { color: color-mix(in srgb, var(--bg) 65%, transparent); }
.login-story-copy { position: relative; max-width: 720px; margin: auto 0; padding: 12vh 0; }
.login-story-copy .eyebrow { color: var(--coral); }
.login-story-copy h1 { max-width: 12ch; margin-bottom: 24px; color: var(--bg); font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 400; letter-spacing: -.045em; }
.login-story-copy > p:last-child { max-width: 53ch; color: color-mix(in srgb, var(--bg) 72%, transparent); font-size: var(--text-lg); }
.care-rail { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 0; padding: 0; list-style: none; }
.care-rail::before { position: absolute; top: 13px; left: 20px; right: 20px; height: 1px; background: color-mix(in srgb, var(--bg) 18%, transparent); content: ""; }
.care-rail li { position: relative; display: grid; gap: 10px; }
.care-rail li span { display: grid; width: 27px; height: 27px; place-items: center; border: 1px solid color-mix(in srgb, var(--bg) 32%, transparent); border-radius: 50%; background: var(--ink); color: var(--coral); font-size: var(--text-xs); }
.care-rail li strong { color: color-mix(in srgb, var(--bg) 78%, transparent); font-size: var(--text-sm); }
.login-panel { display: grid; place-items: center; padding: clamp(28px, 7vw, 96px); background: var(--surface); }
.login-card { width: min(100%, 420px); }
.login-card h2 { margin-bottom: 10px; font-family: var(--font-display); font-size: var(--text-xl); font-weight: 400; }
.form-intro { margin-bottom: 32px; color: var(--muted); }
.mobile-brand { display: none; margin-bottom: 44px; }

label { display: grid; gap: 7px; margin-bottom: 18px; color: var(--muted); font-size: var(--text-sm); font-weight: 650; }
input, select { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); transition: border var(--dur-1), box-shadow var(--dur-1); }
input::placeholder { color: var(--subtle); }
input:focus, select:focus { border-color: var(--accent); outline: 0; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 9px; padding: 0 17px; border: 1px solid transparent; border-radius: var(--radius-sm); font-size: var(--text-sm); font-weight: 700; cursor: pointer; transition: transform var(--dur-1) var(--ease-out), background var(--dur-1), border var(--dur-1); }
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:disabled { cursor: wait; opacity: .58; }
.button.primary { background: var(--accent); color: var(--surface); }
:root[data-theme="dark"] .button.primary { color: #10201d; }
.button.primary:hover:not(:disabled) { background: var(--accent-strong); }
.button.secondary { border-color: var(--line-strong); background: var(--surface); }
.button.tertiary { min-height: 38px; padding-inline: 12px; border-color: var(--line); background: transparent; color: var(--muted); }
.button.wide { width: 100%; margin-top: 12px; }
.icon-button { display: grid; width: 42px; height: 42px; padding: 0; place-items: center; border: 1px solid var(--line); border-radius: var(--radius-sm); background: transparent; color: var(--muted); cursor: pointer; }
.icon-button:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--ink); }
.icon { flex: 0 0 auto; }
.alert { margin-bottom: 18px; padding: 12px 14px; border-radius: var(--radius-sm); font-size: var(--text-sm); }
.alert.error { border: 1px solid color-mix(in srgb, var(--danger) 35%, transparent); background: var(--danger-soft); color: var(--danger); }

.app-shell { display: grid; min-height: 100dvh; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; display: flex; height: 100dvh; flex-direction: column; padding: 26px 18px 18px; border-right: 1px solid var(--line); background: var(--surface); }
.sidebar nav { display: grid; gap: 5px; margin-top: 52px; }
.nav-item { display: flex; min-height: 46px; align-items: center; gap: 12px; padding: 0 13px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); font-size: var(--text-sm); font-weight: 650; text-align: left; cursor: pointer; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-strong); }
.sidebar-footer { display: grid; gap: 14px; margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); }
.user-chip { display: flex; min-width: 0; align-items: center; gap: 10px; }
.user-chip > span:last-child { min-width: 0; }
.user-chip strong, .user-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { font-size: var(--text-sm); }
.user-chip small { color: var(--muted); font-size: var(--text-xs); text-transform: capitalize; }
.avatar { display: grid; flex: 0 0 38px; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: var(--coral-soft); color: var(--coral); font-family: var(--font-display); font-size: var(--text-lg); }
.footer-actions { display: flex; gap: 8px; }
.workspace { width: min(100%, 1440px); padding: clamp(24px, 4vw, 58px); }
.page-header { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; animation: reveal var(--dur-2) var(--ease-out) both; }
.page-header h1 { margin-bottom: 8px; font-family: var(--font-display); font-size: clamp(2.4rem, 5vw, 4.25rem); font-weight: 400; letter-spacing: -.045em; }
.page-lead { max-width: 62ch; margin-bottom: 0; color: var(--muted); }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.metric { min-height: 154px; padding: 22px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); animation: reveal var(--dur-2) var(--ease-out) both; }
.metric:nth-child(2) { animation-delay: 55ms; }
.metric:nth-child(3) { animation-delay: 110ms; }
.metric strong, .metric span, .metric small { display: block; }
.metric strong { margin-bottom: 20px; font-family: var(--font-display); font-size: 2.6rem; font-weight: 400; }
.metric span { font-weight: 700; }
.metric small { margin-top: 4px; color: var(--muted); }
.flow-card, .channels-panel, .quiet-card { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); }
.flow-card { padding: clamp(22px, 3vw, 36px); animation: reveal var(--dur-2) 150ms var(--ease-out) both; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; }
.section-heading h2 { margin-bottom: 4px; font-family: var(--font-display); font-size: var(--text-xl); font-weight: 400; }
.section-heading p { margin-bottom: 0; color: var(--muted); font-size: var(--text-sm); }
.status-pill { display: inline-flex; min-height: 28px; align-items: center; padding: 0 10px; border-radius: 999px; font-size: var(--text-xs); font-weight: 750; white-space: nowrap; }
.status-pill.success { background: var(--success-soft); color: var(--success); }
.status-pill.warning { background: var(--warning-soft); color: var(--warning); }
.status-pill.neutral { background: var(--surface-2); color: var(--muted); }
.operations-health { padding: clamp(22px, 3vw, 34px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); animation: reveal var(--dur-2) 120ms var(--ease-out) both; }
.operations-health-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 26px; }
.status-panel { padding: 20px; border: 1px solid var(--line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface) 80%, var(--surface-2)); }
.status-panel h3 { margin-bottom: 14px; font-size: var(--text-md); }
.status-panel ul { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.status-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 58px; padding: 10px 0; border-top: 1px solid var(--line); }
.status-row:first-child { border-top: 0; }
.status-row strong, .status-row small { display: block; }
.status-row strong { font-size: var(--text-sm); }
.status-row small { margin-top: 3px; color: var(--muted); font-size: var(--text-xs); }
.status-row b { font-family: var(--font-display); font-size: var(--text-xl); font-weight: 400; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--subtle); }
.status-dot.success { background: var(--success); }
.status-dot.warning { background: var(--warning); }
.status-dot.danger { background: var(--danger); }
.journey-rail { position: relative; display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 36px 0 0; padding: 0; list-style: none; }
.journey-rail::before { position: absolute; top: 17px; left: 17px; right: 17px; height: 2px; background: var(--line); content: ""; }
.journey-rail li { position: relative; }
.journey-index { display: grid; width: 36px; height: 36px; margin-bottom: 17px; place-items: center; border: 2px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--muted); font-size: var(--text-sm); font-weight: 800; }
.journey-rail .ready .journey-index { border-color: var(--accent); background: var(--accent); color: var(--surface); }
.journey-rail strong { display: block; margin-bottom: 6px; }
.journey-rail p { max-width: 34ch; margin-bottom: 0; color: var(--muted); font-size: var(--text-sm); }
.quiet-card { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 18px; padding: 24px 28px; box-shadow: none; }
.quiet-card h2 { margin-bottom: 6px; font-size: var(--text-lg); }
.quiet-card p { max-width: 70ch; margin-bottom: 0; color: var(--muted); font-size: var(--text-sm); }
.tag { display: inline-flex; min-height: 26px; align-items: center; padding: 0 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: var(--text-xs); white-space: nowrap; }

.filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin: -10px 0 18px; }
.filter-chip { min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--muted); font-size: var(--text-sm); font-weight: 650; cursor: pointer; }
.filter-chip:hover { border-color: var(--line-strong); color: var(--ink); }
.filter-chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-strong); }
.operations-panel { min-height: 260px; padding: clamp(20px, 3vw, 32px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow); animation: reveal var(--dur-2) 80ms var(--ease-out) both; }
.appointment-timeline { position: relative; display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.appointment-timeline::before { position: absolute; top: 34px; bottom: 34px; left: 31px; width: 1px; background: var(--line); content: ""; }
.appointment-row { position: relative; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 22px; padding: 14px 0; }
.appointment-row + .appointment-row { border-top: 1px solid var(--line); }
.date-tile { z-index: 1; display: grid; width: 64px; height: 64px; place-content: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); text-align: center; }
.date-tile strong, .date-tile span { display: block; }
.date-tile strong { font-family: var(--font-display); font-size: 1.6rem; font-weight: 400; line-height: 1; }
.date-tile span { margin-top: 4px; color: var(--muted); font-size: .66rem; font-weight: 700; text-transform: uppercase; }
.appointment-copy { align-self: center; min-width: 0; padding-right: 8px; }
.appointment-heading { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.appointment-heading h2 { margin-bottom: 0; overflow: hidden; font-size: var(--text-lg); text-overflow: ellipsis; white-space: nowrap; }
.appointment-copy > p { margin: 5px 0 7px; color: var(--muted); font-size: var(--text-sm); }
.appointment-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--muted); font-size: var(--text-sm); }
.appointment-meta strong { color: var(--ink); }
.appointment-meta span::before { margin-right: 7px; color: var(--subtle); content: "·"; }
.empty-state.compact { margin-block: 42px 22px; }
.search-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; margin: -10px 0 18px; padding: 7px 7px 7px 15px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: 0 8px 30px rgba(30, 48, 44, .05); }
.search-bar > .icon { color: var(--muted); }
.search-bar input { min-height: 42px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.search-bar input:focus { box-shadow: none; }
.patient-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 24px; }
.patient-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface) 80%, var(--surface-2)); }
.patient-avatar { display: grid; width: 46px; height: 46px; place-items: center; border-radius: 50% 50% 50% 14px; background: var(--coral-soft); color: var(--coral); font-family: var(--font-display); font-size: var(--text-lg); }
.patient-card h3 { margin-bottom: 5px; font-size: var(--text-md); }
.patient-card p { margin-bottom: 11px; color: var(--muted); font-size: var(--text-sm); }

.handoff-list { display: grid; gap: 10px; }
.handoff-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: 16px; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface) 82%, var(--surface-2)); }
.handoff-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50% 50% 14px 50%; background: var(--coral-soft); color: var(--coral); }
.handoff-copy { min-width: 0; }
.handoff-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.handoff-heading h2 { margin: 0; overflow: hidden; font-size: var(--text-lg); text-overflow: ellipsis; white-space: nowrap; }
.handoff-copy > strong { font-size: var(--text-sm); }
.handoff-copy blockquote { margin: 9px 0; color: var(--muted); font-size: var(--text-sm); font-style: normal; line-height: 1.5; }
.handoff-meta { margin: 0; color: var(--subtle); font-size: var(--text-xs); }
.handoff-actions { display: flex; align-self: center; flex-direction: column; gap: 8px; }
.handoff-actions .button { white-space: nowrap; }

.channels-panel { padding: clamp(20px, 3vw, 32px); }
.channel-list { display: grid; gap: 10px; margin-top: 24px; }
.channel-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: color-mix(in srgb, var(--surface) 76%, var(--surface-2)); }
.channel-icon { display: grid; width: 44px; height: 44px; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); }
.channel-title { display: flex; align-items: center; gap: 10px; }
.channel-title h3 { margin-bottom: 0; font-size: var(--text-md); }
.channel-copy > p { margin: 4px 0 9px; color: var(--muted); font-size: var(--text-sm); text-transform: capitalize; }
.tag-row { display: flex; flex-wrap: wrap; gap: 5px; }
.credential-state { display: flex; align-items: center; gap: 7px; color: var(--warning); font-size: var(--text-sm); font-weight: 650; }
.credential-state.ready { color: var(--success); }
.empty-state { display: grid; max-width: 440px; justify-items: center; margin: 64px auto 36px; text-align: center; }
.empty-symbol { display: grid; width: 68px; height: 68px; margin-bottom: 18px; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--muted); }
.empty-state h3 { margin-bottom: 7px; }
.empty-state p { margin-bottom: 22px; color: var(--muted); }
.skeleton-list { display: grid; gap: 10px; margin-top: 24px; }
.skeleton-list span { height: 90px; border-radius: var(--radius-md); background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2)); background-size: 220% 100%; animation: skeleton 1.2s linear infinite; }

.drawer-backdrop { position: fixed; z-index: 30; inset: 0; display: flex; justify-content: flex-end; background: rgba(13, 26, 24, .48); animation: fade var(--dur-1) both; }
.drawer { width: min(100%, 480px); height: 100%; padding: 28px; overflow: auto; border-left: 1px solid var(--line); background: var(--surface); box-shadow: -20px 0 60px rgba(0,0,0,.15); animation: slide-in var(--dur-2) var(--ease-out) both; }
.drawer > header { display: flex; align-items: start; justify-content: space-between; gap: 20px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.drawer h2 { margin-bottom: 0; font-family: var(--font-display); font-size: var(--text-xl); font-weight: 400; }
.drawer form { padding-top: 24px; }
.drawer-intro { margin-bottom: 24px; color: var(--muted); font-size: var(--text-sm); }
.drawer-actions { position: sticky; bottom: -28px; display: flex; justify-content: flex-end; gap: 10px; margin: 26px -28px -28px; padding: 18px 28px; border-top: 1px solid var(--line); background: var(--surface); }
.conversation-summary { margin: 20px 0 6px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--coral-soft); color: var(--ink); font-size: var(--text-sm); font-weight: 650; }
.message-thread { display: flex; flex-direction: column; gap: 10px; padding: 22px 0 10px; }
.message-bubble { max-width: 86%; padding: 12px 14px 9px; border: 1px solid var(--line); border-radius: 16px 16px 16px 5px; background: var(--surface-2); }
.message-bubble.outbound { align-self: flex-end; border-color: color-mix(in srgb, var(--accent) 28%, var(--line)); border-radius: 16px 16px 5px 16px; background: var(--accent-soft); }
.message-bubble p { margin: 0 0 6px; color: var(--ink); font-size: var(--text-sm); line-height: 1.55; white-space: pre-wrap; }
.message-bubble time { color: var(--subtle); font-size: .7rem; }

.loading-view { display: grid; min-height: 100dvh; place-content: center; justify-items: center; color: var(--muted); }
.pulse-mark { display: flex; align-items: end; gap: 4px; width: 44px; height: 44px; margin-bottom: 14px; padding: 10px; border-radius: 50% 50% 50% 14px; background: var(--accent); }
.pulse-mark span { width: 5px; border-radius: 4px; background: var(--surface); animation: pulse 900ms ease-in-out infinite alternate; }
.pulse-mark span:nth-child(1) { height: 10px; }
.pulse-mark span:nth-child(2) { height: 22px; animation-delay: 160ms; }
.pulse-mark span:nth-child(3) { height: 15px; animation-delay: 320ms; }

@keyframes reveal { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } }
@keyframes slide-in { from { transform: translateX(32px); opacity: .7; } }
@keyframes skeleton { to { background-position: -220% 0; } }
@keyframes pulse { to { height: 8px; opacity: .55; } }

@media (max-width: 900px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { min-height: 100dvh; }
  .mobile-brand { display: block; }
  .app-shell { grid-template-columns: 78px minmax(0, 1fr); }
  .sidebar { padding-inline: 12px; }
  .sidebar .brand > div, .nav-item span, .user-chip > span:last-child { display: none; }
  .sidebar .brand { justify-content: center; }
  .nav-item { justify-content: center; padding: 0; }
  .user-chip { justify-content: center; }
  .footer-actions { flex-direction: column; align-items: center; }
  .metric-grid { grid-template-columns: 1fr; }
  .patient-grid { grid-template-columns: 1fr; }
  .operations-health-grid { grid-template-columns: 1fr; }
  .metric { min-height: 118px; }
  .metric strong { margin-bottom: 8px; }
}

@media (max-width: 660px) {
  .app-shell { display: block; padding-bottom: 74px; }
  .sidebar { position: fixed; z-index: 20; top: auto; bottom: 0; display: grid; width: 100%; height: 68px; grid-template-columns: 1fr auto; padding: 8px 14px; border-top: 1px solid var(--line); border-right: 0; }
  .sidebar > .brand, .sidebar-footer .user-chip { display: none; }
  .sidebar nav { display: flex; min-width: 0; gap: 2px; margin: 0; overflow-x: auto; scrollbar-width: none; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .nav-item { width: 58px; min-height: 50px; }
  .sidebar-footer { display: block; margin: 0; padding: 0; border: 0; }
  .footer-actions { flex-direction: row; }
  .workspace { padding: 24px 16px; }
  .page-header { align-items: stretch; flex-direction: column; }
  .page-header > .button { align-self: flex-start; }
  .journey-rail { grid-template-columns: 1fr; }
  .journey-rail::before { top: 17px; bottom: 17px; left: 17px; width: 2px; height: auto; }
  .journey-rail li { display: grid; grid-template-columns: 36px 1fr; gap: 14px; }
  .journey-index { margin: 0; }
  .quiet-card, .section-heading { align-items: flex-start; flex-direction: column; }
  .channel-card { grid-template-columns: auto minmax(0, 1fr); }
  .credential-state { grid-column: 1 / -1; padding-top: 12px; border-top: 1px solid var(--line); }
  .appointment-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .search-bar { grid-template-columns: auto minmax(0, 1fr); }
  .search-bar .button { grid-column: 1 / -1; width: 100%; }
  .nav-item { flex: 0 0 clamp(42px, 9.5vw, 50px); width: clamp(42px, 9.5vw, 50px); }
  .handoff-card { grid-template-columns: auto minmax(0, 1fr); }
  .handoff-actions { grid-column: 1 / -1; width: 100%; }
  .handoff-actions .button { width: 100%; }
}

@media (max-width: 380px) {
  .sidebar { padding-inline: 8px; }
  .sidebar nav { gap: 2px; }
  .nav-item { width: 38px; }
  .footer-actions { gap: 4px; }
  .icon-button { width: 38px; }
  .appointment-row { grid-template-columns: 54px minmax(0, 1fr); gap: 14px; }
  .date-tile { width: 54px; height: 54px; }
  .appointment-timeline::before { left: 26px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
