/* ════════════════════════════════════════════════════════════
   eReferrals — Planet DDS design system styles
   ──────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  font-family: var(--font-body);
  color: var(--fg-primary);
  background: var(--bg-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; }

/* ── VIEWS ──────────────────────────────────────────── */
.view { display: none; min-height: 100vh; flex-direction: column; background: var(--bg-primary); }
.view.active { display: flex; }
#view-signin.active, #view-signup.active { flex-direction: row; height: 100vh; min-height: unset; }
#view-launcher.active { background: var(--bg-secondary); align-items: center; justify-content: center; }

/* ════════════════════════════════════════════════════════════
   PLANET DDS BUTTON SYSTEM (skeuomorphic)
═════════════════════════════════════════════════════════════ */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: var(--fw-semibold); border-radius: var(--radius-md);
  font-size: var(--text-sm); line-height: 1; padding: 0 14px; height: 40px;
  position: relative; transition: background .1s linear, color .1s linear, box-shadow .1s linear;
  white-space: nowrap;
}
.btn svg { flex-shrink: 0; }
.btn.sm { height: 36px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 44px; padding: 0 18px; font-size: 15px; }
.btn.xl { height: 48px; padding: 0 22px; font-size: 16px; }

.btn-primary { background: var(--bg-brand-solid); color: var(--fg-on-brand); box-shadow: var(--shadow-xs-skeuomorphic); }
.btn-primary::before { content: ""; position: absolute; inset: 1px; border: 2px solid rgba(255,255,255,.18);
  border-radius: 7px; -webkit-mask: linear-gradient(#000, transparent 40%); mask: linear-gradient(#000, transparent 40%); pointer-events: none; }
.btn-primary:hover { background: var(--bg-brand-solid-hover); }
.btn-primary:focus-visible { outline: none; box-shadow: var(--shadow-xs-skeuomorphic), var(--focus-ring); }

.btn-secondary { background: #fff; color: var(--fg-secondary); border: 1px solid var(--gray-300);
  box-shadow: var(--shadow-xs-skeuomorphic); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-secondary:focus-visible { outline: none; box-shadow: var(--shadow-xs-skeuomorphic), var(--focus-ring); }

.btn-tertiary { color: var(--fg-tertiary); background: transparent; }
.btn-tertiary:hover { background: var(--gray-100); color: var(--fg-primary); }

.btn-destructive { background: var(--bg-error-solid); color: #fff; box-shadow: var(--shadow-xs-skeuomorphic); }
.btn-destructive:hover { background: var(--error-700); }

.btn-link { color: var(--fg-brand-primary); padding: 0; height: auto; }
.btn-link:hover { color: var(--fg-brand-secondary); text-decoration: underline; }

/* ════════════════════════════════════════════════════════════
   LAUNCHER
═════════════════════════════════════════════════════════════ */
.launcher-wrap { display: flex; flex-direction: column; align-items: center; padding: 40px 24px; width: 100%; }
.l-eyebrow { font-size: 11.5px; font-weight: 600; color: var(--fg-quaternary); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 12px; }
.l-title { font-size: 30px; font-weight: 600; color: var(--fg-primary); letter-spacing: -0.02em; margin-bottom: 6px; }
.l-sub { font-size: 16px; color: var(--fg-tertiary); margin-bottom: 40px; }
.l-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 720px; }
.l-card { background: #fff; border: 1px solid var(--border-secondary); border-radius: var(--radius-xl);
  padding: 24px; display: flex; flex-direction: column; gap: 14px; cursor: pointer;
  box-shadow: var(--shadow-xs); transition: box-shadow .15s, border-color .15s; }
.l-card:hover { box-shadow: var(--shadow-md); border-color: var(--gray-300); }
.l-card-icon { width: 44px; height: 44px; border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center; color: #fff; }
.l-card-icon.blue { background: var(--brand-600); }
.l-card-icon.teal { background: #0A6E7C; }
.l-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.6px; color: var(--fg-quaternary); margin-bottom: 4px; }
.l-card h2 { font-size: 17px; font-weight: 600; color: var(--fg-primary); letter-spacing: -0.01em; margin-bottom: 4px; }
.l-card-body { color: var(--fg-tertiary); font-size: 14px; line-height: 1.5; }
.l-steps { display: flex; flex-direction: column; gap: 7px; padding-top: 12px; border-top: 1px solid var(--border-tertiary); }
.l-step { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg-tertiary); }
.l-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.l-dot.blue { background: var(--brand-600); }
.l-dot.teal { background: #0A6E7C; }
.l-cta { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 600; margin-top: 2px; }
.l-cta.blue { color: var(--fg-brand-primary); }
.l-cta.teal { color: #0A6E7C; }
.l-footer { margin-top: 40px; font-size: 12.5px; color: var(--fg-quaternary); }

/* Dev-jump pills on launcher — for quick demo access to new screens */
.l-jump-row { margin-top: 32px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: 720px; }
.l-jump { padding: 6px 12px; background: #fff; border: 1px solid var(--border-secondary); border-radius: var(--radius-full);
  font-size: 12.5px; font-weight: 500; color: var(--fg-tertiary); cursor: pointer; }
.l-jump:hover { border-color: var(--brand-300); color: var(--fg-brand-primary); background: var(--brand-25); }
.l-jump-label { font-size: 11px; font-weight: 600; color: var(--fg-quaternary); text-transform: uppercase; letter-spacing: 0.6px;
  display: flex; align-items: center; padding-right: 6px; }

/* ════════════════════════════════════════════════════════════
   AURORA WEBSITE (kept on teal — separate brand)
═════════════════════════════════════════════════════════════ */
#view-aurora { --a-brand: #0A6E7C; --a-brand-dark: #065560; --a-brand-light: #E6F4F6; --a-brand-mid: #C2E8EC; --a-muted: #4B6A70; --a-border: #D5E8EB; }
.a-nav { position: sticky; top: 0; z-index: 50; background: rgba(255,255,255,.93); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--a-border); display: flex; align-items: center; justify-content: space-between;
  padding: 0 64px; height: 68px; flex-shrink: 0; }
.a-nav-logo { display: flex; align-items: center; gap: 12px; }
.a-nav-logo-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--a-brand); display: flex; align-items: center; justify-content: center; color: #fff; }
.a-nav-logo-text strong { display: block; font-size: 15px; font-weight: 600; color: #0F1C21; letter-spacing: -0.2px; line-height: 1.2; }
.a-nav-logo-text span { font-size: 12px; color: var(--a-muted); font-weight: 500; }
.a-nav-links { display: flex; align-items: center; gap: 32px; }
.a-nav-links a { font-size: 14px; font-weight: 500; color: var(--a-muted); }
.a-nav-links a:hover { color: #0F1C21; }
.a-nav-cta { height: 38px; padding: 0 18px; background: var(--a-brand); color: #fff; font-size: 14px; font-weight: 600; border-radius: var(--radius-md); display: flex; align-items: center; gap: 7px; }
.a-nav-cta:hover { background: var(--a-brand-dark); }
.a-body { flex: 1; overflow-y: auto; }
.a-hero { padding: 80px 64px 60px; display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; max-width: 1200px; margin: 0 auto; }
.a-eyebrow { display: inline-flex; align-items: center; gap: 7px; background: var(--a-brand-light); color: var(--a-brand);
  font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 16px; margin-bottom: 20px; border: 1px solid var(--a-brand-mid); }
.a-eyebrow span { width: 6px; height: 6px; border-radius: 50%; background: var(--a-brand); }
.a-hero h1 { font-size: 48px; font-weight: 700; color: #0F1C21; line-height: 1.1; letter-spacing: -1.5px; margin-bottom: 20px; }
.a-hero h1 em { font-style: normal; color: var(--a-brand); }
.a-hero-sub { font-size: 16px; color: var(--a-muted); line-height: 1.65; margin-bottom: 32px; }
.a-btn-hero { height: 48px; padding: 0 24px; background: var(--a-brand); color: #fff; font-size: 15px; font-weight: 600; border-radius: var(--radius-md); display: flex; align-items: center; gap: 8px; }
.a-btn-hero:hover { background: var(--a-brand-dark); }
.a-hero-card { background: linear-gradient(160deg, #C2E8EC 0%, #E6F4F6 100%); border-radius: 20px; padding: 28px; position: relative; overflow: hidden; }
.a-hero-card::before { content: ''; position: absolute; top: -60px; right: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(10,110,124,.1); }
.a-card-inner { background: #fff; border-radius: var(--radius-xl); padding: 20px 22px; box-shadow: 0 8px 32px rgba(10,110,124,.12); position: relative; }
.a-card-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.a-card-title { font-size: 14px; font-weight: 600; color: #0F1C21; }
.a-card-badge { font-size: 11.5px; font-weight: 600; padding: 2px 9px; border-radius: 10px; background: var(--success-50); color: var(--success-700); }
.a-card-items { display: flex; flex-direction: column; gap: 9px; }
.a-ci { display: flex; align-items: center; justify-content: space-between; font-size: 13px; }
.a-ci-left { display: flex; align-items: center; gap: 8px; }
.a-ci-dot { width: 8px; height: 8px; border-radius: 50%; }
.a-ci-status { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 8px; }
.s-received { background: var(--brand-50); color: var(--brand-700); }
.s-scheduled { background: #F9F5FF; color: #6941C6; }
.s-pending { background: var(--warning-50); color: var(--warning-700); }
.a-stats { background: var(--a-brand); padding: 32px 64px; display: grid; grid-template-columns: repeat(4, 1fr); }
.a-stat { text-align: center; }
.a-stat strong { display: block; font-size: 30px; font-weight: 700; color: #fff; letter-spacing: -1px; margin-bottom: 4px; }
.a-stat span { font-size: 13px; color: rgba(255,255,255,.7); }
.a-refer-section { background: linear-gradient(135deg, #0A6E7C 0%, #065560 100%); padding: 72px 64px; position: relative; overflow: hidden; }
.a-refer-section::before { content: ''; position: absolute; top: -100px; right: -100px; width: 400px; height: 400px; border-radius: 50%; background: rgba(255,255,255,.05); }
.a-refer-inner { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 48px; position: relative; z-index: 1; }
.a-refer-inner h2 { font-size: 36px; font-weight: 700; color: #fff; letter-spacing: -0.8px; line-height: 1.15; margin-bottom: 14px; }
.a-refer-inner h2 span { color: var(--a-brand-mid); }
.a-refer-inner > div > p { font-size: 15px; color: rgba(255,255,255,.75); line-height: 1.6; max-width: 500px; }
.a-refer-steps { display: flex; flex-direction: column; gap: 12px; margin-top: 24px; }
.a-refer-step { display: flex; align-items: center; gap: 12px; color: rgba(255,255,255,.85); font-size: 14px; }
.a-step-num { width: 26px; height: 26px; border-radius: 50%; background: rgba(255,255,255,.15); flex-shrink: 0; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: #fff; }
.a-refer-card { background: #fff; border-radius: var(--radius-2xl); padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.2); min-width: 280px; text-align: center; }
.a-refer-card-icon { width: 52px; height: 52px; background: var(--a-brand-light); border-radius: var(--radius-xl); display: flex; align-items: center; justify-content: center; margin: 0 auto 14px; color: var(--a-brand); }
.a-refer-card h3 { font-size: 16px; font-weight: 600; color: #0F1C21; margin-bottom: 8px; }
.a-refer-card p { font-size: 13px; color: var(--a-muted); line-height: 1.5; margin-bottom: 20px; }
.a-btn-refer { width: 100%; height: 44px; background: var(--a-brand); color: #fff; font-size: 14px; font-weight: 600; border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; gap: 8px; }
.a-btn-refer:hover { background: var(--a-brand-dark); }
.a-refer-note { margin-top: 10px; font-size: 12px; color: var(--fg-quaternary); }
.a-footer { background: #0F1C21; padding: 36px 64px; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.a-footer-brand { display: flex; align-items: center; gap: 10px; }
.a-footer-mark { width: 30px; height: 30px; border-radius: 7px; background: var(--a-brand); display: flex; align-items: center; justify-content: center; color: #fff; }
.a-footer-brand span { font-size: 14px; font-weight: 600; color: #fff; }
.a-footer-copy { font-size: 12.5px; color: rgba(255,255,255,.4); }
.a-back-btn { font-size: 13px; color: rgba(255,255,255,.55); display: flex; align-items: center; gap: 6px; }
.a-back-btn:hover { color: rgba(255,255,255,.85); }

/* ════════════════════════════════════════════════════════════
   PLANET DDS BRAND MARK (re-usable wordmark)
═════════════════════════════════════════════════════════════ */
.pds-mark { display: flex; align-items: center; gap: 10px; }
.pds-sq { width: 32px; height: 32px; border-radius: 8px; background: linear-gradient(135deg, var(--brand-500), var(--brand-700));
  position: relative; box-shadow: 0 2px 4px rgba(0,116,232,.3); flex-shrink: 0; }
.pds-sq.sm { width: 28px; height: 28px; border-radius: 7px; }
.pds-sq::after { content: ""; position: absolute; inset: 6px; border: 1.5px solid rgba(255,255,255,.9);
  border-radius: 999px; border-bottom-color: transparent; transform: rotate(-45deg); }
.pds-sq.sm::after { inset: 5px; border-width: 1.5px; }
.pds-wm { font-size: 16px; font-weight: 700; color: var(--fg-primary); letter-spacing: -0.01em; line-height: 1; }
.pds-wm .c { color: var(--fg-brand-primary); }
.pds-sub { font-size: 13px; color: var(--fg-tertiary); font-weight: 500; }
.pds-divider { width: 1px; height: 18px; background: var(--gray-300); margin: 0 10px; }
.ereferrals-logo { height: 24px; width: auto; display: block; }
.si-left .ereferrals-logo, .signup .ereferrals-logo { height: 28px; }

/* ════════════════════════════════════════════════════════════
   SIGN-IN / SIGN-UP (split layout)
═════════════════════════════════════════════════════════════ */
.si-left { width: 50%; min-width: 480px; display: flex; flex-direction: column; padding: 40px 64px; overflow-y: auto; }
.logo-row { display: flex; align-items: center; gap: 10px; margin-bottom: 56px; }
.form-area { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 420px; width: 100%; }
.form-area.hidden { display: none; }
.form-area h1.auth-h1 { font-size: 30px; font-weight: 600; color: var(--fg-primary); letter-spacing: -0.02em; margin-bottom: 8px; }
.auth-subtitle { font-size: 15px; color: var(--fg-tertiary); margin-bottom: 32px; line-height: 1.5; }
.field-group { display: flex; flex-direction: column; gap: 20px; margin-bottom: 24px; }
.name-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label { display: block; font-size: 14px; font-weight: 500; color: var(--gray-700); margin-bottom: 6px; }
.input-wrap { position: relative; }
.input-wrap > svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--fg-quaternary); pointer-events: none; }
.input-wrap input { padding-left: 40px !important; }
input[type="email"], input[type="text"], input[type="date"], input[type="tel"], select, textarea {
  width: 100%; padding: 10px 14px; border: 1px solid var(--gray-300); border-radius: var(--radius-md);
  font-size: 14px; font-family: inherit; color: var(--fg-primary); background: #fff; outline: none;
  transition: border-color .15s, box-shadow .15s; box-shadow: var(--shadow-xs);
}
input[type="email"] { height: 44px; }
input[type="email"]:focus, input[type="text"]:focus, input[type="date"]:focus, input[type="tel"]:focus,
select:focus, textarea:focus { border-color: var(--border-brand); box-shadow: var(--focus-ring); }
input::placeholder, textarea::placeholder { color: var(--fg-quaternary); }
select { background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a4a7ae' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; cursor: pointer; appearance: none; }
textarea { resize: vertical; min-height: 96px; line-height: 1.5; }

.btn-auth { width: 100%; height: 44px; margin-bottom: 24px; font-size: 15px; }
.info-box { background: var(--bg-secondary); border: 1px solid var(--border-secondary); border-radius: var(--radius-lg);
  padding: 14px 16px; font-size: 13.5px; color: var(--fg-tertiary); line-height: 1.55; display: flex; gap: 10px; align-items: flex-start; }
.info-box svg { flex-shrink: 0; margin-top: 2px; color: var(--fg-quaternary); }
.info-box a { color: var(--fg-brand-primary); }
.info-box a:hover { text-decoration: underline; }
.si-footer { margin-top: auto; display: flex; align-items: center; justify-content: space-between; padding-top: 24px; }
.powered { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--fg-quaternary); }
.powered strong { color: var(--gray-700); font-weight: 600; }
.powered-logo { height: 22px; width: auto; display: block; }
.footer-links { display: flex; gap: 16px; }
.footer-links a { font-size: 12.5px; color: var(--fg-quaternary); }
.footer-links a:hover { color: var(--gray-700); }

.check-email { display: none; flex-direction: column; justify-content: center; max-width: 420px; flex: 1; width: 100%; }
.check-email.active { display: flex; }
.email-icon { width: 52px; height: 52px; background: var(--bg-brand-primary); border-radius: var(--radius-xl); display: flex; align-items: center; justify-content: center; margin-bottom: 24px; color: var(--fg-brand-primary); }
.email-icon-outline { width: 56px; height: 56px; background: #fff; border: 1px solid var(--gray-200); border-radius: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 24px; color: var(--fg-primary); box-shadow: var(--shadow-xs); }
.email-icon-outline.expired-icon { background: var(--warning-50, #fffaeb); border-color: var(--warning-200, #fedf89); color: var(--warning-600, #dc6803); }
.email-highlight { font-weight: 600; color: var(--fg-primary); }
.resend-row { margin-top: 24px; font-size: 14px; color: var(--fg-tertiary); }
.resend-row button { color: var(--fg-brand-primary); font-size: 14px; font-weight: 600; padding: 0; }
.resend-row button:hover { text-decoration: underline; }
.resend-help { margin-top: 10px; font-size: 12.5px; color: var(--fg-tertiary); line-height: 1.5; max-width: 380px; }
.back-btn-inline { display: inline-flex; align-items: center; gap: 6px; margin-top: 20px; font-size: 14px; font-weight: 600; color: var(--fg-tertiary); padding: 0; align-self: flex-start; }
.back-btn-inline:hover { color: var(--gray-700); }

/* Right hero panel */
.si-right { flex: 1; background: linear-gradient(150deg, var(--brand-700) 0%, var(--brand-900) 100%); display: flex; flex-direction: column; justify-content: center; padding: 64px 56px; position: relative; overflow: hidden; }
.si-right::before { content: ""; position: absolute; top: -100px; right: -100px; width: 360px; height: 360px; border-radius: 50%; background: rgba(255,255,255,.04); }
.si-right::after { content: ""; position: absolute; bottom: -120px; left: -120px; width: 400px; height: 400px; border-radius: 50%; background: rgba(255,255,255,.03); }
.si-right-inner { position: relative; z-index: 1; }
.si-right h2 { font-size: 36px; font-weight: 700; color: #fff; line-height: 1.18; letter-spacing: -0.02em; margin-bottom: 16px; max-width: 400px; }
.si-right h2 span { color: var(--brand-200); }
.si-right-sub { font-size: 15px; color: rgba(255,255,255,.7); line-height: 1.65; max-width: 360px; margin-bottom: 40px; }
.features { display: flex; flex-direction: column; gap: 14px; }
.feature { display: flex; align-items: center; gap: 10px; font-size: 14px; color: rgba(255,255,255,.88); }
.feature .feat-check { width: 20px; height: 20px; border-radius: 999px; background: rgba(255,255,255,.15); display: flex; align-items: center; justify-content: center; color: #fff; flex-shrink: 0; }

/* ════════════════════════════════════════════════════════════
   SIGN-UP specifics
═════════════════════════════════════════════════════════════ */
.signup-stepper { display: flex; align-items: center; gap: 4px; margin-bottom: 28px; font-size: 12.5px; color: var(--fg-quaternary); font-weight: 500; }
.signup-stepper .ss-on { color: var(--fg-brand-primary); font-weight: 600; }
.signup-stepper .ss-sep { width: 18px; height: 1px; background: var(--gray-300); }

.field-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.csz-row { display: grid; grid-template-columns: 1fr 110px 120px; gap: 10px; }
.signup-verify-note { margin-top: 16px; font-size: 12.5px; color: var(--error-600, #b42318); line-height: 1.5; }
.role-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.role-option { padding: 12px 14px; border: 1.5px solid var(--gray-300); border-radius: var(--radius-md); cursor: pointer;
  display: flex; flex-direction: column; gap: 4px; background: #fff; transition: all .12s; text-align: left; }
.role-option:hover { border-color: var(--brand-300); background: var(--brand-25); }
.role-option.selected { border-color: var(--brand-500); background: var(--brand-25); }
.role-option .ro-title { font-size: 13.5px; font-weight: 600; color: var(--fg-primary); }
.role-option .ro-sub { font-size: 12px; color: var(--fg-tertiary); line-height: 1.4; }

/* ════════════════════════════════════════════════════════════
   SHARED TOPBAR (in-app)
═════════════════════════════════════════════════════════════ */
.topbar { height: 64px; background: #fff; border-bottom: 1px solid var(--border-secondary);
  display: flex; align-items: center; justify-content: space-between; padding: 0 32px;
  position: sticky; top: 0; z-index: 10; flex-shrink: 0; }
.topbar-left { display: flex; align-items: center; gap: 24px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-search { position: relative; width: 280px; }
.topbar-search svg { position: absolute; left: 10px; top: 10px; width: 18px; height: 18px; color: var(--fg-quaternary); }
.topbar-search input { padding: 9px 12px 9px 36px; height: 38px; background: #fff; font-size: 14px; }

.icon-btn { width: 38px; height: 38px; border-radius: var(--radius-md); border: 1px solid var(--gray-300); background: #fff;
  display: flex; align-items: center; justify-content: center; color: var(--fg-tertiary); box-shadow: var(--shadow-xs); position: relative; }
.icon-btn:hover { background: var(--gray-50); color: var(--fg-secondary); }
.icon-btn .notif-dot { position: absolute; top: 7px; right: 8px; width: 8px; height: 8px; border-radius: 50%; background: var(--error-500); border: 2px solid #fff; }

.avatar { width: 38px; height: 38px; border-radius: 999px; background: var(--brand-50); color: var(--brand-700);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--brand-100); }

.nav-back { display: flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 500; color: var(--fg-tertiary); padding: 0; }
.nav-back:hover { color: var(--fg-secondary); }

/* ════════════════════════════════════════════════════════════
   DASHBOARD
═════════════════════════════════════════════════════════════ */
#view-dashboard, #view-referral-detail, #view-patient-detail { background: var(--bg-secondary); }
.main { padding: 32px 32px 56px; max-width: 1200px; margin: 0 auto; flex: 1; width: 100%; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 28px; }
.page-header h1 { font-size: var(--display-xs); line-height: var(--display-xs-lh); font-weight: 600; color: var(--fg-primary); letter-spacing: -0.01em; margin-bottom: 4px; }
.page-header p { font-size: 14px; color: var(--fg-tertiary); }

.dashboard-alert { display: flex; align-items: center; gap: 10px; background: #EBF4FF; border: 1px solid #99CCF9; border-radius: var(--radius-lg); padding: 12px 16px; margin-bottom: 20px; }
.dashboard-alert-icon { color: var(--brand-blue, #0074E8); flex-shrink: 0; display: flex; align-items: center; }
.dashboard-alert-body { flex: 1; display: flex; align-items: center; gap: 16px; font-size: 14px; color: var(--fg-primary); }
.dashboard-alert-text { line-height: 1.4; }
.dashboard-alert-link { background: none; border: none; padding: 0; font-size: 14px; font-weight: 500; color: var(--brand-blue, #0074E8); cursor: pointer; text-decoration: underline; white-space: nowrap; }
.dashboard-alert-link:hover { color: #0060C4; }
.dashboard-alert-dismiss { background: none; border: none; padding: 4px; cursor: pointer; color: var(--fg-tertiary); display: flex; align-items: center; flex-shrink: 0; border-radius: 4px; }
.dashboard-alert-dismiss:hover { background: #CCE5FC; color: var(--fg-secondary); }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid var(--border-secondary); border-radius: var(--radius-xl); padding: 20px; box-shadow: var(--shadow-xs); }

/* CTA stat card — sits at the end of the metrics row, replaces the secondary "New referral" button */
.stat-cta {
  background: var(--brand-600, #0074E8);
  color: #fff;
  border-radius: var(--radius-xl);
  padding: 20px;
  display: flex; flex-direction: column; gap: 10px;
  box-shadow: var(--shadow-sm, 0 1px 3px rgba(16,24,40,.1));
  cursor: pointer;
  transition: transform .12s, box-shadow .12s, background .12s;
}
.stat-cta:hover { background: var(--brand-700, #0061c2); box-shadow: 0 6px 16px -4px rgba(0,116,232,.35); }
.stat-cta:focus-visible { outline: 3px solid rgba(255,255,255,.55); outline-offset: 2px; }
.stat-cta-title { font-size: 15px; font-weight: 600; line-height: 1.25; }
.stat-cta-sub { font-size: 13px; line-height: 1.45; color: rgba(255,255,255,.7); flex: 1; font-weight: 400; }
.stat-cta-btn {
  display: inline-flex; align-items: center; gap: 8px;
  align-self: stretch; justify-content: center;
  padding: 10px 16px;
  background: #fff; color: var(--brand-700, #0061c2);
  border-radius: 9999px;
  font-size: 13.5px; font-weight: 600;
  box-shadow: 0 1px 2px rgba(16,24,40,.06);
  transition: background .12s;
}
.stat-cta:hover .stat-cta-btn { background: #f5faff; }
.stat-label { font-size: 13px; font-weight: 500; color: var(--fg-tertiary); margin-bottom: 8px; }
.stat-value { font-size: 30px; line-height: 38px; font-weight: 600; color: var(--fg-primary); letter-spacing: -0.02em; margin-bottom: 4px; }
.stat-delta { font-size: 12.5px; font-weight: 500; color: var(--success-700); display: inline-flex; align-items: center; gap: 4px; }
.stat-delta.down { color: var(--error-700); }
.stat-delta svg { width: 14px; height: 14px; }

/* Table card */
.table-card { background: #fff; border: 1px solid var(--border-secondary); border-radius: var(--radius-xl); overflow: hidden; box-shadow: var(--shadow-xs); }
.table-toolbar { padding: 14px 20px; border-bottom: 1px solid var(--border-secondary); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tabs {
  display: flex; align-items: center; gap: 2px; flex: 1;
}
.tab {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500;
  color: var(--fg-tertiary);
  background: transparent;
  transition: background .12s, color .12s;
}
.tab:hover { background: var(--gray-50); color: var(--fg-secondary); }
.tab.active {
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: 600;
}
.tab-count {
  font-size: 11.5px; font-weight: 600;
  padding: 1px 7px; border-radius: 9999px;
  background: #fff; color: var(--fg-tertiary);
  border: 1px solid var(--border-secondary);
  min-width: 22px; text-align: center;
}
.tab.active .tab-count {
  background: #fff;
  color: var(--brand-700);
  border-color: var(--brand-200, #cfe4ff);
}

.table-search { position: relative; }
.table-search svg { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--fg-quaternary); }
.table-search input { width: 240px; height: 34px; padding: 0 12px 0 32px; font-size: 13.5px; }

.filter-btn { height: 34px; padding: 0 12px; background: #fff; border: 1px solid var(--gray-300); border-radius: var(--radius-md);
  font-size: 13.5px; font-weight: 500; color: var(--fg-secondary); display: flex; align-items: center; gap: 6px; box-shadow: var(--shadow-xs); }
.filter-btn:hover { background: var(--gray-50); }
.filter-btn .chip-count { background: var(--brand-50); color: var(--brand-700); padding: 1px 7px; border-radius: 10px; font-size: 11px; font-weight: 600; }

.filter-bar { display: none; padding: 10px 20px; gap: 8px; border-bottom: 1px solid var(--border-secondary); background: var(--gray-50); flex-wrap: wrap; }
.filter-bar.open { display: flex; }
.filter-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: #fff; border: 1px solid var(--gray-300); border-radius: var(--radius-full); font-size: 12.5px; font-weight: 500; color: var(--fg-secondary); }
.filter-chip strong { color: var(--fg-primary); font-weight: 600; }
.filter-chip .x { color: var(--fg-quaternary); padding: 0; display: flex; }
.filter-chip .x:hover { color: var(--fg-primary); }
.filter-bar .clear-all { font-size: 12.5px; color: var(--fg-brand-primary); font-weight: 500; padding: 4px 6px; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; font-weight: 500; color: var(--fg-tertiary); padding: 10px 20px;
  border-bottom: 1px solid var(--border-secondary); background: var(--gray-50); text-transform: none; }
td { padding: 14px 20px; font-size: 14px; color: var(--fg-secondary); border-bottom: 1px solid var(--border-tertiary); }
tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; transition: background .1s; }
tbody tr:hover td { background: var(--gray-25); }
tr.hidden { display: none; }
.patient-name { font-weight: 500; color: var(--fg-primary); }

/* Badge system using Planet DDS pill style */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 500;
  padding: 2px 10px; border-radius: 9999px; border: 1px solid; }
.badge .badge-dot { width: 6px; height: 6px; border-radius: 50%; }
.badge.pending { background: var(--warning-50); color: var(--warning-700); border-color: var(--warning-200); }
.badge.pending .badge-dot { background: var(--warning-500); }
.badge.received { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
.badge.received .badge-dot { background: var(--brand-500); }
.badge.accepted { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
.badge.accepted .badge-dot { background: var(--brand-500); }
.badge.in-progress { background: #F9F5FF; color: #6941C6; border-color: #E9D7FE; }
.badge.in-progress .badge-dot { background: #7F56D9; }
.badge.rejected { background: var(--error-50); color: var(--error-700); border-color: var(--error-200); }
.badge.rejected .badge-dot { background: var(--error-500); }
.badge.expired { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-300); }
.badge.expired .badge-dot { background: var(--gray-500); }
.badge.completed { background: var(--success-50); color: var(--success-700); border-color: var(--success-200); }
.badge.completed .badge-dot { background: var(--success-500); }
.badge.scheduled { background: #F9F5FF; color: #6941C6; border-color: #E9D7FE; }
.badge.scheduled .badge-dot { background: #7F56D9; }
.badge.declined { background: var(--error-50); color: var(--error-700); border-color: var(--error-200); }
.badge.declined .badge-dot { background: var(--error-500); }

.row-action { font-size: 13px; font-weight: 500; color: var(--fg-brand-primary); }
.row-action:hover { text-decoration: underline; }

.empty-state-row { padding: 56px 20px; text-align: center; display: none; }
.empty-state-row.show { display: block; }
.empty-state-row .es-title { font-size: 14px; color: var(--fg-tertiary); font-weight: 500; margin-bottom: 4px; }
.empty-state-row .es-sub { font-size: 13px; color: var(--fg-quaternary); }

/* Pagination */
.table-foot { padding: 12px 20px; border-top: 1px solid var(--border-secondary); display: flex; align-items: center; justify-content: space-between; background: #fff; }
.table-foot-info { font-size: 13px; color: var(--fg-tertiary); }
.table-pager { display: flex; gap: 4px; }
.pg-btn { height: 32px; min-width: 32px; padding: 0 10px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 500; color: var(--fg-secondary); background: #fff; border: 1px solid var(--gray-300); }
.pg-btn:hover { background: var(--gray-50); }
.pg-btn.active { background: var(--brand-50); border-color: var(--brand-200); color: var(--brand-700); }
.pg-btn:disabled { color: var(--fg-disabled); cursor: not-allowed; }

/* ════════════════════════════════════════════════════════════
   EMPTY STATE (first-time GP)
═════════════════════════════════════════════════════════════ */
.empty-hero { background: #fff; border: 1px solid var(--border-secondary); border-radius: var(--radius-xl); padding: 56px 40px; text-align: center; box-shadow: var(--shadow-xs); margin-bottom: 24px; position: relative; overflow: hidden; }
.empty-hero::before { content: ""; position: absolute; top: -200px; left: 50%; transform: translateX(-50%); width: 600px; height: 360px;
  background: radial-gradient(ellipse, var(--brand-50) 0%, transparent 70%); pointer-events: none; }
.empty-hero-inner { position: relative; max-width: 480px; margin: 0 auto; }
.empty-featured-icon { width: 56px; height: 56px; background: var(--bg-brand-primary); border: 1px solid var(--brand-100);
  border-radius: var(--radius-xl); display: inline-flex; align-items: center; justify-content: center;
  color: var(--fg-brand-primary); margin-bottom: 20px; box-shadow: var(--shadow-xs); }
.empty-hero h2 { font-size: 22px; font-weight: 600; color: var(--fg-primary); margin-bottom: 8px; letter-spacing: -0.01em; }
.empty-hero p { font-size: 15px; color: var(--fg-tertiary); margin-bottom: 24px; line-height: 1.5; }
.empty-hero-cta { display: inline-flex; gap: 10px; }

.starter-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 32px; }
.starter-tile { display: flex; gap: 12px; padding: 16px; background: var(--gray-25); border: 1px solid var(--border-secondary); border-radius: var(--radius-lg); text-align: left; }
.starter-tile .st-icon { width: 36px; height: 36px; border-radius: var(--radius-md); background: #fff; border: 1px solid var(--border-secondary); display: flex; align-items: center; justify-content: center; color: var(--fg-brand-primary); flex-shrink: 0; }
.starter-tile h4 { font-size: 13.5px; font-weight: 600; color: var(--fg-primary); margin-bottom: 4px; }
.starter-tile p { font-size: 12.5px; color: var(--fg-tertiary); line-height: 1.45; }

/* ════════════════════════════════════════════════════════════
   NEW REFERRAL (form)
═════════════════════════════════════════════════════════════ */
#view-new-referral { background: var(--bg-secondary); }
.form-page { padding: 40px 24px 64px; max-width: 720px; margin: 0 auto; flex: 1; width: 100%; }
.form-page-title { font-size: var(--display-xs); line-height: var(--display-xs-lh); font-weight: 600; color: var(--fg-primary); letter-spacing: -0.01em; margin-bottom: 4px; }
.form-page-sub { font-size: 14px; color: var(--fg-tertiary); margin-bottom: 32px; }
.stepper { display: flex; align-items: center; margin-bottom: 32px; }
.step { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.step-circle {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; flex-shrink: 0;
  position: relative;
  transition: all .2s; box-shadow: var(--shadow-xs);
}
.step.complete .step-circle { background: var(--brand-600); color: #fff; border: 1px solid var(--brand-700); }
.step.active .step-circle {
  background: #fff; color: transparent;
  border: 1.5px solid var(--brand-600);
  box-shadow: 0 0 0 4px var(--brand-50);
}
.step.active .step-circle::after {
  content: ''; width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand-600);
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.step.inactive .step-circle {
  background: #fff; color: transparent;
  border: 1.5px solid var(--gray-300);
  box-shadow: none;
}
.step.inactive .step-circle::after {
  content: ''; width: 8px; height: 8px; border-radius: 50%;
  background: var(--gray-300);
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
}
.step-label strong { font-size: 13.5px; font-weight: 600; display: block; line-height: 1.2; }
.step.active .step-label strong { color: var(--brand-700); }
.step.complete .step-label strong { color: var(--fg-primary); }
.step.inactive .step-label strong { color: var(--fg-quaternary); }
.step-label span { font-size: 12px; color: var(--fg-quaternary); }
.step.active .step-label span { color: var(--brand-700); }
.step-connector { flex: 1; height: 2px; background: var(--gray-200); margin: 0 16px; min-width: 60px; max-width: 120px; border-radius: 1px; }
.step-connector.done { background: var(--brand-600); }

.form-card { background: #fff; border: 1px solid var(--border-secondary); border-radius: var(--radius-xl); padding: 28px 32px; box-shadow: var(--shadow-xs); }
.form-section-title { font-size: 16px; font-weight: 600; color: var(--fg-primary); margin-bottom: 20px; padding-bottom: 16px; border-bottom: 1px solid var(--border-tertiary); }
.field { margin-bottom: 20px; }
.field:last-child { margin-bottom: 0; }
.label-optional { font-size: 12px; font-weight: 400; color: var(--fg-quaternary); margin-left: 4px; }
.req { color: var(--error-500); font-weight: 500; margin-left: 1px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-row-3 { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; }
.provider-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--gray-50); border: 1px solid var(--border-secondary); border-radius: var(--radius-md); }
.provider-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand-50); color: var(--brand-700);
  border: 1px solid var(--brand-100); display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; flex-shrink: 0; }
.provider-info { display: flex; flex-direction: column; gap: 1px; }
.provider-name { font-size: 14px; font-weight: 600; color: var(--fg-primary); }
.provider-email { font-size: 12.5px; color: var(--fg-tertiary); }

.phone-row { display: flex; gap: 10px; align-items: center; }
.phone-input { flex: 1; }
.phone-type-group { display: flex; border: 1px solid var(--gray-300); border-radius: var(--radius-md); overflow: hidden; flex-shrink: 0; box-shadow: var(--shadow-xs); }
.phone-type { padding: 0 14px; height: 42px; background: #fff; font-size: 13.5px; font-weight: 500; color: var(--fg-tertiary); border-right: 1px solid var(--gray-300); }
.phone-type:last-child { border-right: none; }
.phone-type:hover { background: var(--gray-50); color: var(--fg-secondary); }
.phone-type.selected { background: var(--brand-50); color: var(--brand-700); font-weight: 600; }

.upload-zone { border: 1.5px dashed var(--gray-300); border-radius: var(--radius-lg); padding: 24px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.upload-zone:hover { border-color: var(--brand-300); background: var(--brand-25); }
.upload-icon { width: 40px; height: 40px; background: #fff; border: 1px solid var(--border-secondary); border-radius: var(--radius-md); display: flex; align-items: center; justify-content: center; margin: 0 auto 10px; color: var(--fg-tertiary); box-shadow: var(--shadow-xs); }
.upload-label { font-size: 13.5px; color: var(--fg-secondary); margin-bottom: 4px; }
.upload-label strong { color: var(--fg-brand-primary); }
.upload-hint { font-size: 12px; color: var(--fg-quaternary); }
.file-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border: 1px solid var(--border-secondary); border-radius: var(--radius-md); background: #fff; font-size: 13px; }
.file-item-icon { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--gray-100); display: flex; align-items: center; justify-content: center; flex-shrink: 0; font-size: 9px; font-weight: 700; color: var(--fg-tertiary); letter-spacing: .3px; }
.file-item-name { flex: 1; font-weight: 500; color: var(--fg-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-item-size { font-size: 12px; color: var(--fg-quaternary); flex-shrink: 0; }
.file-item-remove { width: 24px; height: 24px; color: var(--fg-quaternary); display: flex; align-items: center; justify-content: center; border-radius: var(--radius-xs); flex-shrink: 0; }
.file-item-remove:hover { background: var(--error-50); color: var(--error-700); }

.form-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 24px; }

/* Tooth selector */
.tooth-overlay { display: none; position: fixed; inset: 0; background: rgba(10,13,18,.4); z-index: 300; align-items: center; justify-content: center; padding: 24px; }
.tooth-overlay.open { display: flex; }
.tooth-modal { background: #fff; border-radius: var(--radius-xl); padding: 24px; width: min(740px, 96vw); box-shadow: var(--shadow-2xl); }
.tooth-modal-cols { display: flex; gap: 20px; align-items: flex-start; }
.tooth-col-main { flex: 1; min-width: 0; }
.tooth-col-surfaces { width: 148px; flex-shrink: 0; }
.tooth-col-quadrants { width: 88px; flex-shrink: 0; }
.tooth-section-label { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; color: var(--gray-700); text-transform: uppercase; margin-bottom: 8px; }
.tooth-grid-row { display: grid; grid-template-columns: repeat(16, 1fr); gap: 2px; margin-bottom: 2px; }
.tooth-cell { height: 28px; border: 1px solid var(--gray-300); border-radius: var(--radius-xs); font-size: 11px; font-weight: 500; color: var(--gray-700); display: flex; align-items: center; justify-content: center; cursor: pointer; background: #fff; user-select: none; transition: background .1s, border-color .1s; }
.tooth-cell:hover { background: var(--brand-25); border-color: var(--brand-300); }
.tooth-cell.active { background: var(--brand-600); border-color: var(--brand-700); color: #fff; }
.tooth-cell.blank { background: transparent; border-color: transparent; cursor: default; pointer-events: none; }
.tooth-cell.primary { font-size: 10.5px; color: var(--fg-tertiary); }
.tooth-midgap { height: 6px; }
.surface-btn, .quadrant-btn { display: block; width: 100%; text-align: center; padding: 6px 10px; margin-bottom: 4px; border: 1px solid var(--gray-300); border-radius: var(--radius-sm); font-size: 12.5px; font-weight: 500; color: var(--gray-700); background: #fff; cursor: pointer; transition: background .1s, border-color .1s; }
.surface-btn { text-align: left; }
.surface-btn:hover, .quadrant-btn:hover { background: var(--gray-50); }
.surface-btn.active, .quadrant-btn.active { background: var(--brand-50); border-color: var(--brand-500); color: var(--brand-700); }
.quadrant-grid-ui { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.quadrant-single { grid-column: 1 / -1; }
.tooth-modal-footer { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-secondary); }
.tooth-display-field { min-height: 42px; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: var(--radius-md); font-size: 14px; background: #fff; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px; transition: border-color .15s; box-shadow: var(--shadow-xs); }
.tooth-display-field:hover { border-color: var(--brand-300); }
.tooth-tags-wrap { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.tooth-tag { background: var(--brand-50); color: var(--brand-700); border-radius: var(--radius-sm); padding: 2px 8px; font-size: 12px; font-weight: 500; }

/* ════════════════════════════════════════════════════════════
   REFERRAL DETAIL VIEW (with variants)
═════════════════════════════════════════════════════════════ */
.detail-header { display: flex; flex-direction: column; gap: 8px; margin-bottom: 24px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--fg-tertiary); }
.breadcrumb a { color: var(--fg-tertiary); }
.breadcrumb a:hover { color: var(--fg-secondary); }
.breadcrumb .crumb-sep { color: var(--fg-quaternary); }
.breadcrumb .crumb-current { color: var(--fg-primary); font-weight: 500; }

.detail-titlebar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.detail-titlebar h1 { font-size: 28px; line-height: 36px; font-weight: 600; color: var(--fg-primary); letter-spacing: -0.01em; }
.detail-sub { font-size: 14px; color: var(--fg-tertiary); margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.detail-sub .crumb-sep { color: var(--fg-quaternary); }
.detail-actions { display: flex; gap: 8px; align-items: center; }

/* Variant A — two-column timeline + sidebar */
.rd-layout-A { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; }
.rd-layout-A.single { grid-template-columns: 1fr; }

.card { background: #fff; border: 1px solid var(--border-secondary); border-radius: var(--radius-xl); box-shadow: var(--shadow-xs); overflow: hidden; }
.card-header { padding: 16px 20px; border-bottom: 1px solid var(--border-secondary); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-size: 15px; font-weight: 600; color: var(--fg-primary); }
.card-body { padding: 20px; }
.card-body.tight { padding: 8px 0; }

/* Detail summary card (top of variant A) */
.rd-summary { background: #fff; border: 1px solid var(--border-secondary); border-radius: var(--radius-xl); padding: 24px; box-shadow: var(--shadow-xs); margin-bottom: 16px; }
.rd-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }
.rd-meta-label { font-size: 12px; font-weight: 500; color: var(--fg-tertiary); margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.rd-meta-value { font-size: 14px; font-weight: 500; color: var(--fg-primary); }
.rd-meta-value.with-avatar { display: flex; align-items: center; gap: 8px; }

/* Activity timeline */
.timeline { padding: 16px 20px 8px; position: relative; }
.tl-item { display: flex; gap: 14px; padding-bottom: 18px; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:not(:last-child)::before {
  content: ""; position: absolute; left: 15px; top: 32px; bottom: 0; width: 1.5px; background: var(--gray-200);
}
.tl-icon { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; position: relative; z-index: 1; }
.tl-icon.brand { background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); }
.tl-icon.success { background: var(--success-50); color: var(--success-700); border: 1px solid var(--success-200); }
.tl-icon.warning { background: var(--warning-50); color: var(--warning-700); border: 1px solid var(--warning-200); }
.tl-icon.neutral { background: var(--gray-100); color: var(--fg-tertiary); border: 1px solid var(--gray-200); }
.tl-icon.purple { background: #F9F5FF; color: #6941C6; border: 1px solid #E9D7FE; }
.tl-content { flex: 1; padding-top: 4px; min-width: 0; }
.tl-title { font-size: 14px; color: var(--fg-secondary); line-height: 1.5; }
.tl-title b { color: var(--fg-primary); font-weight: 600; }
.tl-time { font-size: 12px; color: var(--fg-quaternary); margin-top: 2px; }
.tl-note { margin-top: 8px; padding: 10px 12px; background: var(--gray-50); border-radius: var(--radius-md); font-size: 13px; color: var(--fg-secondary); line-height: 1.45; border-left: 3px solid var(--brand-200); }

/* Messages (in detail view) */
.message-list { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; max-height: 360px; overflow-y: auto; }
.msg { display: flex; gap: 10px; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.msg-avatar.other { background: var(--gray-100); color: var(--gray-700); border-color: var(--gray-200); }
.msg-bubble { background: var(--gray-50); border: 1px solid var(--border-secondary); border-radius: var(--radius-md); padding: 10px 12px; max-width: 80%; }
.msg-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--fg-tertiary); margin-bottom: 4px; }
.msg-meta b { color: var(--fg-primary); font-weight: 600; }
.msg-text { font-size: 13.5px; color: var(--fg-secondary); line-height: 1.5; }
.msg.self { flex-direction: row-reverse; }
.msg.self .msg-bubble { background: var(--brand-25); border-color: var(--brand-100); }
.msg.self .msg-meta { justify-content: flex-end; }
.message-input { padding: 12px 16px; border-top: 1px solid var(--border-secondary); background: #fff; display: flex; gap: 8px; align-items: center; }
.message-input input { flex: 1; height: 38px; font-size: 14px; }

/* Attachments grid */
.attach-grid { padding: 16px 20px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.attach { display: flex; gap: 10px; padding: 10px 12px; border: 1px solid var(--border-secondary); border-radius: var(--radius-md); background: #fff; align-items: center; }
.attach:hover { border-color: var(--gray-300); background: var(--gray-25); }
.attach-thumb { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--gray-100); display: flex; align-items: center; justify-content: center; color: var(--fg-tertiary); flex-shrink: 0; font-weight: 700; font-size: 10px; letter-spacing: 0.3px; }
.attach-thumb.pdf { background: var(--error-50); color: var(--error-700); }
.attach-thumb.img { background: var(--brand-50); color: var(--brand-700); }
.attach-info { min-width: 0; flex: 1; }
.attach-name { font-size: 13px; font-weight: 500; color: var(--fg-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-meta { font-size: 12px; color: var(--fg-quaternary); }

/* Sidebar info-card list */
.info-list { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.info-row { display: flex; flex-direction: column; gap: 2px; }
.info-row .il { font-size: 12px; font-weight: 500; color: var(--fg-tertiary); }
.info-row .iv { font-size: 14px; color: var(--fg-primary); }
.info-row .iv-stack { display: flex; flex-direction: column; gap: 2px; }
.info-row .iv-stack span { font-size: 13px; color: var(--fg-secondary); }

/* Status pill in detail header */
.status-pill-large { padding: 4px 12px; font-size: 13px; }

/* Variant B — vertical activity-first (full width timeline) */
.rd-layout-B .timeline-card { margin-bottom: 16px; }
.rd-layout-B .info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Variant C — tabbed */
.rd-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border-secondary); margin-bottom: 16px; }
.rd-tab { padding: 10px 14px; font-size: 14px; font-weight: 500; color: var(--fg-tertiary); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.rd-tab:hover { color: var(--fg-secondary); }
.rd-tab.active { color: var(--fg-brand-primary); border-bottom-color: var(--brand-600); font-weight: 600; }
.rd-tab-panel { display: none; }
.rd-tab-panel.active { display: block; }

/* ════════════════════════════════════════════════════════════
   PATIENT DETAIL
═════════════════════════════════════════════════════════════ */
.patient-header { background: #fff; border: 1px solid var(--border-secondary); border-radius: var(--radius-xl); padding: 24px; box-shadow: var(--shadow-xs); margin-bottom: 20px; display: flex; gap: 20px; align-items: flex-start; }
.patient-avatar-lg { width: 64px; height: 64px; border-radius: 50%; background: var(--brand-50); border: 1px solid var(--brand-100); color: var(--brand-700); display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; flex-shrink: 0; }
.patient-id-block { flex: 1; min-width: 0; }
.patient-name-lg { font-size: 22px; font-weight: 600; color: var(--fg-primary); letter-spacing: -0.01em; margin-bottom: 4px; }
.patient-meta-row { display: flex; align-items: center; gap: 16px; color: var(--fg-tertiary); font-size: 13.5px; flex-wrap: wrap; }
.patient-meta-row .crumb-sep { color: var(--fg-quaternary); }
.patient-quick-stats { display: flex; gap: 24px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-tertiary); }
.pqs-item { font-size: 13px; color: var(--fg-tertiary); }
.pqs-item strong { display: block; font-size: 18px; font-weight: 600; color: var(--fg-primary); margin-bottom: 2px; }

.patient-grid { display: grid; grid-template-columns: 320px 1fr; gap: 20px; }
.patient-grid.layout-stacked { grid-template-columns: 1fr; }
.contact-section { display: flex; flex-direction: column; gap: 16px; }

/* Variant B for patient detail: header is full-width banner */
.patient-banner { background: linear-gradient(135deg, var(--brand-50) 0%, var(--bg-secondary) 100%); border: 1px solid var(--brand-100); }

/* ════════════════════════════════════════════════════════════
   SNACKBAR
═════════════════════════════════════════════════════════════ */
.snackbar { position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(16px);
  background: var(--gray-900); color: #fff; display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-radius: var(--radius-lg); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-2xl); opacity: 0; pointer-events: none; transition: opacity .22s ease, transform .22s ease;
  z-index: 200; white-space: nowrap; }
.snackbar.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.snackbar-icon { width: 22px; height: 22px; background: var(--success-500); border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: #fff; }
.snackbar-action { color: var(--brand-200); font-weight: 600; font-size: 14px; padding: 0 0 0 8px; }
.snackbar-action:hover { text-decoration: underline; }

/* ════════════════════════════════════════════════════════════
   TWEAKS-FRIENDLY
═════════════════════════════════════════════════════════════ */
.variant-hidden { display: none !important; }


/* ════════════════════════════════════════════════════════════
   ROW ACTIONS (dashboard table)
═════════════════════════════════════════════════════════════ */
.row-actions { display: inline-flex; align-items: center; gap: 2px; }
.row-action-btn {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--fg-quaternary); cursor: pointer; padding: 0;
  transition: background .12s, color .12s, border-color .12s;
}
.row-action-btn:hover { background: var(--gray-100); color: var(--brand-700); border-color: var(--gray-200); }
.row-action-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.row-action-count {
  position: absolute; top: 2px; right: 2px;
  min-width: 14px; height: 14px; padding: 0 3px;
  font-size: 9px; font-weight: 700; line-height: 14px;
  background: var(--brand-600); color: #fff;
  border-radius: 99px; text-align: center;
}

/* ════════════════════════════════════════════════════════════
   PREVIEW DRAWER
═════════════════════════════════════════════════════════════ */
.preview-backdrop {
  position: fixed; inset: 0; background: rgba(16,24,40,.55);
  opacity: 0; pointer-events: none; z-index: 90;
  transition: opacity .2s ease;
  backdrop-filter: blur(2px);
}
.preview-backdrop.open { opacity: 1; pointer-events: auto; }

.preview-drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(480px, 94vw); background: var(--bg-secondary, #f5f7fa);
  box-shadow: -16px 0 48px -12px rgba(16,24,40,.18);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .26s cubic-bezier(.32,.72,.32,1);
  z-index: 100;
}
.preview-drawer.open { transform: translateX(0); }

.pv-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 24px;
  background: #fff; border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}
.pv-head-left { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.pv-ref-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  color: var(--fg-quaternary); text-transform: uppercase;
}
.pv-title-row { display: flex; align-items: center; gap: 12px; }
.pv-title-row h2 { font-size: 20px; font-weight: 600; color: var(--fg-primary); margin: 0; line-height: 1.2; }
.pv-head-actions { display: flex; align-items: center; gap: 8px; }
.pv-att-pill {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px;
  font-size: 10px; font-weight: 700;
  background: var(--gray-100); color: var(--gray-700);
  border-radius: 99px;
}
.pv-close {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; margin-left: 4px;
  background: transparent; border: 1px solid transparent; border-radius: var(--radius-sm);
  color: var(--fg-tertiary); cursor: pointer;
}
.pv-close:hover { background: var(--gray-100); color: var(--fg-primary); }

.pv-body {
  flex: 1 1 0; display: flex; flex-direction: column;
  gap: 0; min-height: 0; overflow-y: auto;
  padding: 20px 20px 40px;
  background: var(--gray-50);
}

/* Left PDF pane */
.pv-pdf-pane {
  background: #2a2f37;
  display: flex; flex-direction: column; min-height: 0;
}
.pv-pdf-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #1f242b; color: #cbd5e1;
  border-bottom: 1px solid #0f1318;
}
.pv-pdf-tools { display: flex; align-items: center; gap: 8px; }
.pv-tool {
  width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid transparent; border-radius: 6px;
  color: #cbd5e1; cursor: pointer;
}
.pv-tool:hover { background: rgba(255,255,255,.08); }
.pv-zoom { font-size: 12px; font-weight: 500; min-width: 44px; text-align: center; }
.pv-pdf-page-label { font-size: 12px; color: #9aa3b2; }
.pv-pdf-scroller { flex: 1; overflow-y: auto; padding: 28px; display: flex; justify-content: center; }
.pv-pdf-page {
  background: #fff;
  width: 100%; max-width: 720px; min-height: 940px;
  padding: 56px 64px;
  box-shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px rgba(0,0,0,.35);
  border-radius: 2px;
  color: #1a1f2b;
  font-size: 13px; line-height: 1.55;
}
.pv-pdf-letterhead {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding-bottom: 20px; border-bottom: 2px solid #1a1f2b; margin-bottom: 28px;
}
.pv-pdf-from-label, .pv-pdf-from-clinic, .pv-pdf-from-addr { font-size: 11px; color: #5a6477; }
.pv-pdf-from-label { font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.pv-pdf-from-name { font-size: 15px; font-weight: 700; color: #1a1f2b; margin-bottom: 2px; }
.pv-pdf-from-clinic { font-weight: 500; color: #1a1f2b; }
.pv-pdf-meta { text-align: right; }
.pv-pdf-ref {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; font-weight: 700; color: var(--brand-700);
  background: var(--brand-50); padding: 4px 8px; border-radius: 4px;
  display: inline-block;
}
.pv-pdf-sent { font-size: 11px; color: #5a6477; margin-top: 8px; }
.pv-pdf-doc-title {
  font-size: 22px; font-weight: 700; margin: 0 0 24px; color: #1a1f2b; letter-spacing: -.01em;
}
.pv-pdf-section { margin-bottom: 22px; }
.pv-pdf-section h3 {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: #5a6477;
  border-bottom: 1px solid #e6e9ee; padding-bottom: 6px; margin: 0 0 12px;
}
.pv-pdf-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 24px;
}
.pv-pdf-grid > div { display: flex; flex-direction: column; gap: 2px; }
.pv-pdf-k { font-size: 10px; color: #7a8595; text-transform: uppercase; letter-spacing: .04em; }
.pv-pdf-v { font-size: 13px; color: #1a1f2b; font-weight: 500; }
.pv-pdf-prose { margin: 0; font-size: 13px; color: #2a3142; }
.pv-pdf-attachments ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.pv-pdf-attachments li {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: #f7f8fa; border: 1px solid #e6e9ee; border-radius: 4px;
  font-size: 12px; color: #2a3142;
}
.pv-att-icon {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; height: 22px; padding: 0 6px;
  font-size: 9px; font-weight: 800; letter-spacing: .04em;
  background: var(--brand-50); color: var(--brand-700);
  border-radius: 3px;
}
.pv-pdf-footer {
  margin-top: 32px; padding-top: 14px;
  border-top: 1px solid #e6e9ee;
  display: flex; justify-content: space-between;
  font-size: 10px; color: #7a8595;
}

/* Right summary */
.pv-summary {
  background: var(--bg-secondary, #f5f7fa);
  padding: 20px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
}
.pv-card {
  background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-xs);
}
.pv-card-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.pv-card-head-tight { margin-bottom: 12px; align-items: center; justify-content: space-between; }
.pv-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--brand-50); color: var(--brand-700);
  font-size: 14px; font-weight: 600; flex-shrink: 0;
  border: 1px solid var(--brand-100);
}
.pv-avatar-provider { background: #F0F4FF; color: #2942A3; border-color: #DCE5FA; }
.pv-card-eyebrow {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--fg-quaternary); margin-bottom: 2px;
}
.pv-card-title { font-size: 16px; font-weight: 600; color: var(--fg-primary); line-height: 1.25; }
.pv-card-sub { font-size: 13px; color: var(--fg-tertiary); margin-top: 2px; }
.pv-kv {
  margin: 0; display: grid; gap: 10px; border-top: 1px solid var(--gray-100); padding-top: 12px;
}
.pv-kv > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.pv-kv dt { color: var(--fg-tertiary); font-weight: 500; margin: 0; }
.pv-kv dd { color: var(--fg-primary); font-weight: 500; margin: 0; text-align: right; }

.pv-attach-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.pv-attach-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 10px; background: var(--gray-50); border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
}
.pv-att-thumb {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 800; letter-spacing: .04em; flex-shrink: 0;
}
.pv-att-img { background: #E8F1FF; color: #2942A3; }
.pv-att-doc { background: #FEE4E2; color: #B42318; }
.pv-att-name { font-size: 13px; font-weight: 500; color: var(--fg-primary); }
.pv-att-meta { font-size: 11px; color: var(--fg-tertiary); margin-top: 2px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%) translateY(20px);
  background: #1a1f2b; color: #fff; padding: 12px 18px;
  border-radius: var(--radius-md); font-size: 13px; font-weight: 500;
  box-shadow: 0 12px 32px rgba(0,0,0,.25);
  opacity: 0; pointer-events: none; z-index: 200;
  transition: opacity .2s ease, transform .2s ease;
  display: flex; align-items: center; gap: 10px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { color: #5db871; }

@media (max-width: 900px) {
  .pv-body { grid-template-columns: 1fr; }
  .pv-pdf-pane { max-height: 50vh; }
}

/* ─── Side-rail preview variant (experimental) ───
   When body.preview-rail-mode is set, the drawer becomes a narrow
   right-side panel showing only the PDF preview. The backdrop is
   hidden so the dashboard table behind stays interactive. */
body.preview-rail-mode .preview-backdrop { display: none !important; }
body.preview-rail-mode .preview-drawer {
  width: min(480px, 95vw);
  box-shadow: -16px 0 48px -16px rgba(16,24,40,.18), -2px 0 0 0 var(--border-secondary, #e9eaeb);
}
body.preview-rail-mode .pv-pdf-page {
  /* Slightly tighter padding so the doc breathes in a narrow rail */
  padding: 36px 40px;
}
body.preview-rail-mode .pv-pdf-scroller { padding: 16px; }

/* Mode toggle button */
.pv-mode-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 10px;
  border-radius: 6px; background: var(--gray-100); color: var(--fg-secondary);
  border: 1px solid var(--border-primary); cursor: pointer;
  font-size: 12px; font-weight: 500;
}
.pv-mode-toggle:hover { background: var(--gray-200); color: var(--fg-primary); }
.pv-mode-toggle svg { flex-shrink: 0; }


/* ════════════════════════════════════════════════════════════
   REFERRAL DETAIL — single PDF + activity layout
═════════════════════════════════════════════════════════════ */
.rd-shell {
  display: grid; grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px; align-items: start;
}
.rd-pdf-pane {
  background: #2a2f37; border-radius: var(--radius-lg);
  overflow: hidden; box-shadow: var(--shadow-md);
  display: flex; flex-direction: column;
  min-height: 0;
}
.rd-pdf-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px; background: #1f242b; color: #cbd5e1;
  border-bottom: 1px solid #0f1318;
}
.rd-pdf-tools, .rd-pdf-actions { display: flex; align-items: center; gap: 8px; }
.rd-pdf-page-label { font-size: 12px; color: #9aa3b2; }
.rd-pdf-scroller { padding: 28px; max-height: calc(100vh - 220px); overflow-y: auto; display: flex; justify-content: center; }
.rd-pdf-page { max-width: 720px; min-height: 940px; }

.rd-sidebar { display: flex; flex-direction: column; gap: 16px; }
.rd-side-card {
  background: #fff; border: 1px solid var(--border-secondary);
  border-radius: var(--radius-lg); padding: 18px 20px;
  box-shadow: var(--shadow-xs);
}
.rd-side-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-100); }
.rd-side-head h3 { font-size: 14px; font-weight: 600; color: var(--fg-primary); margin: 0; letter-spacing: -0.01em; }
.rd-side-sub { font-size: 12px; color: var(--fg-quaternary); }
.rd-side-link { font-size: 12px; color: var(--brand-700); text-decoration: none; font-weight: 500; }
.rd-side-link:hover { text-decoration: underline; }
.rd-side-patient { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.rd-side-name { font-size: 14px; font-weight: 600; color: var(--fg-primary); }
.rd-side-meta { font-size: 12px; color: var(--fg-tertiary); margin-top: 2px; }
.rd-side-list { margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rd-side-list > div { display: grid; grid-template-columns: 90px 1fr; gap: 8px; align-items: baseline; }
.rd-side-list dt { font-size: 12px; color: var(--fg-quaternary); font-weight: 500; margin: 0; }
.pv-kv dd.pv-kv-empty { color: var(--fg-quaternary); font-weight: 400; font-style: italic; }
.rd-side-list dd { font-size: 13px; color: var(--fg-primary); margin: 0; font-weight: 500; }
.rd-side-list dd.rd-side-empty { color: var(--fg-quaternary); font-weight: 400; font-style: italic; }
.rd-side-attach { list-style: none; margin: 0 0 12px 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rd-side-attach li { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius-md); transition: background 0.12s; }
.rd-side-attach li:hover { background: var(--gray-50); }
.rd-att-thumb {
  width: 32px; height: 32px; border-radius: var(--radius-sm); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em; color: #fff;
}
.rd-att-thumb.img { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.rd-att-thumb.pdf { background: linear-gradient(135deg, #ef4444, #f97316); }
.rd-att-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rd-att-name { font-size: 13px; color: var(--fg-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rd-att-meta { font-size: 11px; color: var(--fg-quaternary); }
.rd-att-btn {
  background: none; border: none; padding: 6px; border-radius: var(--radius-sm);
  color: var(--fg-tertiary); cursor: pointer; flex-shrink: 0;
}
.rd-att-btn:hover { background: var(--gray-100); color: var(--fg-primary); }
.rd-att-all { width: 100%; }
.rd-activity { /* now a sidebar card; remove sticky positioning */ }
.rd-activity-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--gray-100); }
.rd-activity-head h3 { font-size: 15px; font-weight: 600; color: var(--fg-primary); margin: 0; }
.rd-activity-sub { font-size: 12px; color: var(--fg-quaternary); }
.rd-activity-list { list-style: none; margin: 0; padding: 0; position: relative; }
.rd-activity-list::before {
  content: ''; position: absolute; top: 6px; bottom: 6px; left: 7px;
  width: 2px; background: var(--gray-200);
}
.rd-act-item {
  position: relative; display: grid; grid-template-columns: 28px 1fr;
  gap: 8px; padding-bottom: 18px;
}
.rd-act-item:last-child { padding-bottom: 0; }
.rd-act-dot {
  width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2px solid var(--gray-300);
  margin-top: 2px; z-index: 1; position: relative;
}
.rd-act-dot-done { background: var(--brand-600); border-color: var(--brand-600); }
.rd-act-dot-current {
  border-color: var(--brand-600);
  box-shadow: 0 0 0 4px var(--brand-50);
}
.rd-act-dot-current::after {
  content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--brand-600);
}
.rd-act-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.rd-act-meta { font-size: 12px; color: var(--fg-tertiary); font-weight: 500; }
.rd-act-sub { font-size: 12px; color: var(--fg-quaternary); margin-top: 2px; line-height: 1.4; }
.rd-act-comment {
  display: flex; gap: 8px; align-items: flex-start;
  margin-top: 8px; padding: 8px 10px;
  background: var(--gray-50); border: 1px solid var(--gray-100);
  border-radius: var(--radius-sm);
  font-size: 12.5px; color: var(--fg-secondary); line-height: 1.5;
}
.rd-act-comment-icon { color: var(--fg-quaternary); margin-top: 2px; flex-shrink: 0; }

@media (max-width: 1100px) {
  .rd-shell { grid-template-columns: 1fr; }
}


/* ════════════════════════════════════════════════════════════
   RADIO CARD GRID  (selectable cards w/ icon + title + sub)
   Used for specialty selection on the new-referral form.
═════════════════════════════════════════════════════════════ */
.radio-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.radio-card {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 40px 12px 14px;
  background: #fff;
  border: 1px solid var(--border-secondary);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: border-color .12s, box-shadow .12s, background .12s;
}
.radio-card .rc-icon { display: none; }
.radio-card:hover {
  background: var(--gray-50);
  border-color: var(--border-primary);
}
.radio-card input[type="radio"] {
  position: absolute; opacity: 0; pointer-events: none; inset: 0;
}
.radio-card .rc-icon { display: none; }
.radio-card .rc-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.radio-card .rc-title {
  font-size: 14px; font-weight: 500; color: var(--fg-primary); line-height: 1.3;
}
.radio-card .rc-sub {
  font-size: 12.5px; color: var(--fg-tertiary); line-height: 1.35;
}
.radio-card .rc-check {
  position: absolute; top: 50%; right: 14px; transform: translateY(-50%);
  width: 18px; height: 18px; border-radius: 5px;
  border: 1px solid var(--border-primary);
  background: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  color: transparent;
  transition: background .12s, border-color .12s, color .12s;
}
.radio-card .rc-check svg { width: 12px; height: 12px; }
.radio-card.selected {
  border-color: var(--brand-500, #1570EF);
  box-shadow: 0 0 0 1px var(--brand-500, #1570EF), 0 1px 2px rgba(16,24,40,.04);
  background: #fff;
}

.radio-card.selected .rc-check {
  background: var(--brand-500, #1570EF);
  border-color: var(--brand-500, #1570EF);
  color: #fff;
}
.radio-card input[type="radio"]:focus-visible ~ .rc-check,
.radio-card:focus-within {
  outline: none;
}
.radio-card input[type="radio"]:focus-visible ~ .rc-check {
  box-shadow: 0 0 0 3px var(--brand-100, #d5e8ff);
}
@media (max-width: 720px) {
  .radio-card-grid { grid-template-columns: 1fr; }
}
