/* ============================================================
   Dentist Direct — ZEN Enterprise
   Clinical referral platform. Design tokens + base styles.
   ============================================================ */

:root {
  /* Brand — ZEN Enterprise */
  --zen-orange: #ee8c2b;
  --zen-orange-600: #e07c18;
  --zen-orange-700: #c46a12;
  --zen-orange-soft: #fdf1e3;
  --zen-orange-soft-2: #fbe6cf;
  --zen-gray: #7f8184;

  /* Neutrals — cool slate */
  --bg: #f4f6f9;
  --bg-2: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --line: #e3e8ef;
  --line-strong: #d3dae3;
  --ink: #1c2430;
  --ink-2: #46505d;
  --ink-3: #6b7682;
  --ink-4: #97a1ad;

  /* Functional accents (calm, clinical) */
  --info: #2f6fb0;
  --info-soft: #e9f1f9;
  --success: #2f8a5b;
  --success-soft: #e6f3ec;
  --warn: #b9802a;
  --warn-soft: #f8efdd;
  --danger: #c2453d;
  --danger-soft: #faeae8;
  --violet: #6b53b8;
  --violet-soft: #efecf9;

  /* Type */
  --sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Radius + shadow */
  --r-sm: 7px;
  --r: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(20, 30, 45, 0.06), 0 1px 3px rgba(20, 30, 45, 0.04);
  --shadow: 0 2px 6px rgba(20, 30, 45, 0.06), 0 6px 18px rgba(20, 30, 45, 0.06);
  --shadow-lg: 0 10px 30px rgba(20, 30, 45, 0.12), 0 4px 10px rgba(20, 30, 45, 0.06);
  --shadow-pop: 0 18px 50px rgba(20, 30, 45, 0.18);

  --sidebar-w: 248px;
  --content-max: 1180px;
}

/* Theme: Focused (denser, more orange presence) */
[data-theme="focused"] {
  --bg: #f1f3f7;
  --content-max: 1240px;
}
[data-density="compact"] {
  --pad-card: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}
button { font-family: inherit; cursor: pointer; }
input, textarea, select { font-family: inherit; }
::selection { background: var(--zen-orange-soft-2); }

/* Scrollbars */
*::-webkit-scrollbar { width: 11px; height: 11px; }
*::-webkit-scrollbar-thumb { background: #cdd5df; border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
*::-webkit-scrollbar-thumb:hover { background: #b6c0cc; background-clip: padding-box; border: 3px solid transparent; }

/* ---------- App shell ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-logo {
  padding: 20px 20px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border-bottom: 1px solid var(--line);
}
.sidebar-logo img { height: 30px; width: auto; display: block; }
.sidebar-logo .divider { width: 1px; height: 24px; background: var(--line-strong); }
.sidebar-logo .product { display: flex; flex-direction: column; line-height: 1.05; }
.sidebar-logo .product b { font-size: 14px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.sidebar-logo .product span { font-size: 10.5px; color: var(--ink-3); letter-spacing: 0.02em; }

.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-4); padding: 14px 12px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--r-sm);
  color: var(--ink-2); font-size: 14px; font-weight: 500;
  border: none; background: transparent; width: 100%; text-align: left;
  transition: background .14s, color .14s;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; color: var(--ink-4); transition: color .14s; }
.nav-item:hover { background: var(--surface-2); color: var(--ink); }
.nav-item:hover svg { color: var(--ink-2); }
.nav-item.active { background: var(--zen-orange-soft); color: var(--zen-orange-700); font-weight: 600; }
.nav-item.active svg { color: var(--zen-orange); }
.nav-item .badge-count { margin-left: auto; font-size: 11px; font-weight: 700; background: var(--bg-2); color: var(--ink-3); padding: 1px 7px; border-radius: 20px; }
.nav-item.active .badge-count { background: var(--zen-orange); color: #fff; }

.sidebar-user {
  border-top: 1px solid var(--line);
  padding: 12px; display: flex; align-items: center; gap: 10px;
}
.sidebar-user .meta { line-height: 1.15; min-width: 0; }
.sidebar-user .meta b { font-size: 13px; font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .meta span { font-size: 11.5px; color: var(--ink-3); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 60px; flex: 0 0 60px; background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px; padding: 0 28px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 0; white-space: nowrap; }
.topbar .crumb { color: var(--ink-3); font-size: 13px; }
.topbar .spacer { flex: 1; }

.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 20px; padding: 7px 14px; width: 280px; color: var(--ink-3);
}
.search input { border: none; background: transparent; outline: none; font-size: 13.5px; color: var(--ink); width: 100%; }
.search svg { width: 16px; height: 16px; }

.content { flex: 1; overflow-y: auto; }
.page { max-width: var(--content-max); margin: 0 auto; padding: 28px 28px 80px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: var(--r-sm); border: 1px solid transparent;
  font-size: 14px; font-weight: 600; padding: 9px 16px; line-height: 1;
  transition: background .14s, border-color .14s, box-shadow .14s, transform .04s;
  white-space: nowrap; color: var(--ink);
}
.btn:active { transform: translateY(0.5px); }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--zen-orange); color: #fff; box-shadow: 0 1px 2px rgba(196,106,18,.25); }
.btn-primary:hover { background: var(--zen-orange-600); }
.btn-secondary { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--ink-4); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg-2); color: var(--ink); }
.btn-danger-ghost { background: transparent; color: var(--danger); }
.btn-danger-ghost:hover { background: var(--danger-soft); }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn-sm { padding: 6px 11px; font-size: 13px; gap: 6px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 22px; }
[data-density="compact"] .card-pad { padding: 16px; }
.card-head { display: flex; align-items: center; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.card-head .sub { font-size: 12.5px; color: var(--ink-3); }

/* ---------- Chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 20px;
  background: var(--bg-2); color: var(--ink-2); white-space: nowrap;
}
.chip svg { width: 13px; height: 13px; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-violet { background: var(--violet-soft); color: var(--violet); }
.chip-orange { background: var(--zen-orange-soft); color: var(--zen-orange-700); }
.chip-neutral { background: var(--bg-2); color: var(--ink-2); }

/* ---------- Avatar ---------- */
.avatar {
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #fff; flex: 0 0 auto; font-size: 13px; letter-spacing: .01em;
  background: var(--zen-gray);
}
.avatar-36 { width: 36px; height: 36px; }
.avatar-32 { width: 32px; height: 32px; font-size: 12px; }
.avatar-28 { width: 28px; height: 28px; font-size: 11px; }
.avatar-44 { width: 44px; height: 44px; font-size: 15px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.field label .opt { font-weight: 500; color: var(--ink-4); }
.input, .textarea, .select {
  border: 1px solid var(--line-strong); border-radius: var(--r-sm);
  padding: 10px 12px; font-size: 14px; color: var(--ink); background: var(--surface);
  outline: none; transition: border-color .14s, box-shadow .14s; width: 100%;
}
.textarea { resize: vertical; min-height: 80px; line-height: 1.55; }
.input:focus, .textarea:focus, .select:focus { border-color: var(--zen-orange); box-shadow: 0 0 0 3px var(--zen-orange-soft); }
.field .hint { font-size: 11.5px; color: var(--ink-4); }

/* ---------- Misc ---------- */
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; box-shadow: var(--shadow-sm); }
.kpi .label { font-size: 12px; color: var(--ink-3); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.kpi .label svg { width: 15px; height: 15px; }
.kpi .value { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; margin-top: 8px; line-height: 1; }
.kpi .delta { font-size: 12px; color: var(--ink-3); margin-top: 7px; }

.row { display: flex; align-items: center; }
.muted { color: var(--ink-3); }
.mono { font-family: var(--mono); }
.sep { height: 1px; background: var(--line); border: 0; margin: 0; }

/* Stepper */
.stepper { display: flex; align-items: center; gap: 0; }
.step { display: flex; align-items: center; gap: 10px; }
.step .dot { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12.5px; font-weight: 700; background: var(--bg-2); color: var(--ink-3); border: 1.5px solid var(--line-strong); flex: 0 0 26px; }
.step .dot svg { width: 14px; height: 14px; }
.step .lbl { font-size: 13px; font-weight: 600; color: var(--ink-3); white-space: nowrap; }
.step.active .dot { background: var(--zen-orange); border-color: var(--zen-orange); color: #fff; }
.step.active .lbl { color: var(--ink); }
.step.done .dot { background: var(--success); border-color: var(--success); color: #fff; }
.step.done .lbl { color: var(--ink-2); }
.step-line { width: 38px; height: 2px; background: var(--line-strong); margin: 0 10px; border-radius: 2px; }
.step-line.done { background: var(--success); }

/* Skeleton */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.skel { background: linear-gradient(90deg, #eef1f5 0%, #f6f8fb 50%, #eef1f5 100%); background-size: 800px 100%; animation: shimmer 1.2s infinite linear; border-radius: 6px; }

/* Placeholder image (x-ray etc) */
.ph {
  background-color: #eef1f5;
  background-image: repeating-linear-gradient(135deg, #e6eaf0 0, #e6eaf0 8px, #eef1f5 8px, #eef1f5 16px);
  border: 1px dashed var(--line-strong); border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 6px;
  color: var(--ink-4); font-family: var(--mono); font-size: 11px; text-align: center;
}

/* fade/slide in */
@keyframes fadeUp { from { transform: translateY(8px); } to { transform: none; } }
.fade-up { animation: fadeUp .32s cubic-bezier(.2,.7,.3,1); }
@media (prefers-reduced-motion: reduce) { .fade-up { animation: none; } }

a { color: var(--info); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Toast */
.toast-wrap { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: var(--r); font-size: 13.5px; font-weight: 500; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 10px; animation: fadeUp .3s both; }
.toast svg { width: 17px; height: 17px; color: #7be0a8; }

/* ============================================================
   Component styles — dashboard, wizard, doc, workflow, portal
   ============================================================ */

/* ---------- Dashboard ---------- */
.reftable { width: 100%; border-collapse: collapse; }
.reftable th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-4); padding: 11px 18px; border-bottom: 1px solid var(--line); }
.reftable td { padding: 12px 18px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.reftable tbody tr { cursor: pointer; transition: background .12s; }
.reftable tbody tr:hover { background: var(--surface-2); }
.reftable tbody tr:last-child td { border-bottom: none; }

.patientrow { display: flex; align-items: center; gap: 11px; width: 100%; padding: 9px 10px; border: none; background: transparent; border-radius: var(--r-sm); cursor: pointer; transition: background .12s; }
.patientrow:hover { background: var(--surface-2); }
.patientrow.sel { background: var(--zen-orange-soft); }

.feed { display: flex; flex-direction: column; }
.feed-item { display: flex; gap: 12px; position: relative; }
.feed-dot { width: 28px; height: 28px; border-radius: 8px; padding: 0; justify-content: center; flex: 0 0 28px; z-index: 1; }
.feed-line { position: absolute; left: 13.5px; top: 28px; bottom: 0; width: 2px; background: var(--line); }

/* ---------- Wizard ---------- */
.wizard { display: flex; flex-direction: column; height: 100vh; }
.wizard-top { flex: 0 0 64px; display: flex; align-items: center; padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.wizard-body { flex: 1; overflow-y: auto; background: var(--bg); }
.wizard-foot { flex: 0 0 72px; display: flex; align-items: center; gap: 16px; padding: 0 28px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(20,30,45,.04); }
.wizard-foot-info { flex: 1; display: flex; align-items: center; gap: 10px; justify-content: center; flex-wrap: wrap; }
.wstep { padding: 34px 28px 56px; }
.wstep-head { text-align: center; margin-bottom: 26px; }
.wstep-head h2 { font-size: 24px; letter-spacing: -0.02em; margin: 0; }
.wstep-head p { color: var(--ink-3); font-size: 14px; margin: 9px auto 0; max-width: 580px; line-height: 1.5; }

.recordgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 18px; }
.recordgrid > div { display: flex; flex-direction: column; gap: 2px; }
.recordgrid span { font-size: 11px; color: var(--ink-4); font-weight: 500; }
.recordgrid b { font-size: 13px; font-weight: 600; }

@keyframes spinkf { to { transform: rotate(360deg); } }
.spin { animation: spinkf 1s linear infinite; }

/* segmented control */
.seg { display: inline-flex; background: var(--bg-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: none; background: transparent; padding: 6px 13px; border-radius: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-3); transition: background .14s, color .14s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg button:disabled { opacity: .55; }

/* switch */
.switch { width: 36px; height: 21px; border-radius: 20px; background: var(--line-strong); position: relative; transition: background .16s; flex: 0 0 36px; display: inline-block; }
.switch.on { background: var(--success); }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: #fff; transition: transform .16s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch.on .knob { transform: translateX(15px); }
.toggle-row { display: flex; align-items: center; gap: 10px; background: none; border: none; padding: 0; cursor: pointer; }

/* ---------- Specialty picker ---------- */
.spec-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.spec-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--line); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; text-align: left; transition: border-color .14s, box-shadow .14s, transform .04s; }
.spec-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.spec-card.sel { border-color: var(--zen-orange); box-shadow: 0 0 0 3px var(--zen-orange-soft); }
.spec-name { font-weight: 700; font-size: 13.5px; letter-spacing: -0.01em; }
.spec-blurb { font-size: 11.5px; color: var(--ink-3); line-height: 1.35; margin-top: 2px; }
.spec-suggest { position: absolute; top: -8px; right: 12px; background: var(--zen-orange); color: #fff; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 20px; letter-spacing: 0.02em; }

/* specialist list/cards */
.sp-cardgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.sp-card { padding: 16px; border: 1.5px solid var(--line); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; text-align: left; transition: border-color .14s, box-shadow .14s; display: block; }
.sp-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.sp-card.sel { border-color: var(--zen-orange); box-shadow: 0 0 0 3px var(--zen-orange-soft); }
.sp-stats { display: flex; gap: 14px; font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.sp-stats span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.sp-stats svg { color: var(--ink-4); }

.sp-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 16px; background: transparent; border: none; cursor: pointer; text-align: left; transition: background .12s; }
.sp-row:hover { background: var(--surface-2); }
.sp-row.sel { background: var(--zen-orange-soft); }
.sp-rowstat { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-2); flex: 0 0 auto; min-width: 52px; }
.sp-rowstat svg { color: var(--ink-4); }

/* ---------- Attachments ---------- */
.attach-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; transition: border-color .14s, background .14s; }
.attach-row:hover { border-color: var(--line-strong); }
.attach-row.on { border-color: var(--zen-orange-soft-2); background: var(--zen-orange-soft); }
.attach-tile { display: flex; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }

/* ---------- Referral document ---------- */
.refdoc { background: #fff; font-family: var(--serif); color: #1a222e; padding: 46px 48px; font-size: 13.5px; line-height: 1.62; }
.refdoc-compact { padding: 30px 32px; font-size: 12.5px; }
.refdoc-letterhead { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #1a222e; padding-bottom: 16px; gap: 20px; }
.refdoc-letterhead > div:last-child { flex: 0 0 auto; }
.refdoc-letterhead b { white-space: nowrap; }
.refdoc-clinic { font-family: var(--sans); font-weight: 700; font-size: 15px; margin-top: 10px; letter-spacing: -0.01em; white-space: nowrap; }
.refdoc-meta { font-family: var(--sans); font-size: 11px; color: var(--ink-3); line-height: 1.55; margin-top: 3px; }
.refdoc-title { font-family: var(--sans); font-weight: 800; letter-spacing: 0.1em; font-size: 12.5px; color: #1a222e; white-space: nowrap; }
.refdoc-urgent { font-family: var(--sans); color: var(--danger); font-weight: 800; font-size: 11.5px; margin-top: 5px; letter-spacing: 0.03em; }
.refdoc-toblock { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 22px; }
.refdoc-eyebrow { font-family: var(--sans); font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-4); }
.refdoc-name { font-family: var(--sans); font-weight: 700; font-size: 14.5px; margin-top: 5px; letter-spacing: -0.01em; }
.refdoc-sub { font-family: var(--sans); font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.refdoc-section { margin-top: 20px; }
.refdoc-patientgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 24px; margin-top: 9px; font-family: var(--sans); }
.refdoc-patientgrid > div { display: flex; flex-direction: column; gap: 1px; }
.refdoc-patientgrid span { font-size: 10px; color: var(--ink-4); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.refdoc-patientgrid b { font-size: 13px; font-weight: 600; color: #1a222e; }
.refdoc-body { margin-top: 7px; color: #2a333f; }
.refdoc-clintable { width: 100%; border-collapse: collapse; margin-top: 9px; font-family: var(--sans); }
.refdoc-clintable td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; font-size: 13px; color: #2a333f; }
.refdoc-clintable td:first-child { width: 38%; color: var(--ink-3); font-weight: 600; padding-right: 18px; }
.refdoc-sign { margin-top: 28px; }
.refdoc-signline { font-style: italic; font-size: 19px; color: #1a222e; margin-bottom: 4px; }

/* onward referral banner inside the letter */
.refdoc-onward { display: flex; align-items: center; gap: 7px; margin-top: 14px; padding: 8px 12px; background: var(--zen-orange-soft); border: 1px solid var(--zen-orange-soft-2); border-radius: var(--r-sm); font-family: var(--sans); font-size: 11.5px; color: var(--zen-orange-700); font-weight: 600; }
.refdoc-onward svg { color: var(--zen-orange); }

/* ---------- Onward referral overlay ---------- */
.onward-overlay { position: fixed; inset: 0; z-index: 120; background: var(--bg); display: flex; flex-direction: column; }
.onward-top { flex: 0 0 64px; display: flex; align-items: center; gap: 16px; padding: 0 22px; background: var(--surface); border-bottom: 1px solid var(--line); }
.onward-body { flex: 1; overflow-y: auto; }
.onward-step { padding: 30px 28px 50px; }
.onward-foot { flex: 0 0 72px; display: flex; align-items: center; gap: 16px; padding: 0 28px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(20,30,45,.04); }

/* referral chain */
.onward-chain { display: flex; align-items: center; gap: 10px; padding: 16px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-lg); flex-wrap: wrap; }
.chainnode { display: flex; align-items: center; gap: 9px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 8px 12px; }
.chainnode div { line-height: 1.15; min-width: 0; }
.chainnode b { font-size: 12.5px; display: block; white-space: nowrap; }
.chainnode span { font-size: 10.5px; color: var(--ink-4); }
.chainnode.active { border-color: var(--zen-orange); box-shadow: 0 0 0 2px var(--zen-orange-soft); }
.chainnode.target { border-color: var(--success); box-shadow: 0 0 0 2px var(--success-soft); }
.chainlink { color: var(--ink-4); display: flex; align-items: center; }
.onward-chain.mini { padding: 10px; gap: 7px; }
.onward-chain.mini .chainnode { padding: 6px 9px; gap: 7px; }
.onward-chain.mini .chainnode b { font-size: 11.5px; }

/* notify cards */
.notifycard { border: 1.5px solid var(--line); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; transition: border-color .14s, opacity .14s; }
.notifycard:not(.on) { opacity: .55; }
.notifycard.on { border-color: var(--line-strong); }
.notifycard-head { display: flex; align-items: center; gap: 9px; padding: 11px 13px; border-bottom: 1px solid var(--line); }
.notifycard-body { padding: 12px 13px; }
.notify-chan { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.03em; }
.notify-link { display: flex; align-items: center; gap: 5px; margin-top: 9px; padding: 7px 9px; background: var(--zen-orange-soft); border-radius: var(--r-sm); font-size: 10.5px; color: var(--zen-orange-700); }

/* ---------- Login + MFA ---------- */
.login-wrap { display: grid; grid-template-columns: minmax(0, 460px) 1fr; min-height: 100vh; background: var(--surface); }
.login-brand { background: var(--ink); color: #fff; padding: 38px 40px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.login-brand::after { content: ""; position: absolute; right: -120px; top: -120px; width: 360px; height: 360px; border-radius: 50%; background: radial-gradient(circle, rgba(238,140,43,.28), transparent 70%); }
.login-brand img { display: block; height: 30px; width: auto; }
.login-brand-logo { display: inline-flex; align-items: center; background: #fff; border-radius: 10px; padding: 9px 14px; position: relative; z-index: 1; box-shadow: 0 2px 10px rgba(0,0,0,.18); }
.login-brand-body { margin-top: auto; margin-bottom: auto; position: relative; z-index: 1; }
.login-brand-body h1 { font-size: 34px; letter-spacing: -0.03em; margin: 0 0 14px; }
.login-brand-body p { font-size: 15px; line-height: 1.6; color: #c9d0d8; max-width: 36ch; margin: 0; }
.login-brand-points { display: flex; flex-direction: column; gap: 12px; margin-top: 30px; font-size: 13.5px; font-weight: 500; color: #e3e8ef; }
.login-brand-points > div { white-space: nowrap; }
.login-brand-points svg { color: var(--zen-orange); }
.login-brand-foot { font-size: 12px; color: #8b94a0; position: relative; z-index: 1; }
.login-panel { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); box-shadow: var(--shadow-lg); padding: 34px 34px 26px; }
.login-card h2 { font-size: 24px; letter-spacing: -0.02em; margin: 4px 0 0; }
.login-step-label { font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--zen-orange-700); }
.login-sub { font-size: 13.5px; color: var(--ink-3); margin: 8px 0 0; line-height: 1.5; }
.login-demo { display: flex; align-items: center; justify-content: center; gap: 7px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--ink-4); }
.login-demo svg { color: var(--ink-4); }
.login-mfa-badge { width: 52px; height: 52px; border-radius: 14px; background: var(--zen-orange-soft); color: var(--zen-orange-700); display: flex; align-items: center; justify-content: center; }
.mfa-inputs { display: flex; gap: 10px; margin: 22px 0; }
.mfa-box { width: 100%; aspect-ratio: 1; text-align: center; font-size: 24px; font-weight: 700; color: var(--ink); border: 1.5px solid var(--line-strong); border-radius: var(--r); outline: none; transition: border-color .14s, box-shadow .14s; min-width: 0; }
.mfa-box:focus { border-color: var(--zen-orange); box-shadow: 0 0 0 3px var(--zen-orange-soft); }
@keyframes shakekf { 10%,90%{transform:translateX(-1px);} 20%,80%{transform:translateX(2px);} 30%,50%,70%{transform:translateX(-4px);} 40%,60%{transform:translateX(4px);} }
.login-card.shake { animation: shakekf .4s; }
@media (max-width: 820px) { .login-wrap { grid-template-columns: 1fr; } .login-brand { display: none; } }

/* ---------- Message specialist ---------- */
.msg-modal{background:var(--surface);border-radius:var(--r-xl);box-shadow:var(--shadow-pop);width:100%;max-width:620px;max-height:calc(100vh - 48px);display:flex;flex-direction:column;overflow:hidden}
.msg-head{display:flex;gap:14px;align-items:center;padding:18px 22px 14px;border-bottom:1px solid var(--line)}
.msg-head h2{margin:2px 0 0;font-size:17px;letter-spacing:-.01em}
.msg-body{padding:16px 22px;overflow-y:auto;display:flex;flex-direction:column;gap:14px}
.msg-to{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px;font-size:13px}
.msg-to>span:first-child{font-size:12px;font-weight:700;color:var(--ink-3);width:52px}
.msg-to .mono{font-size:12px;color:var(--ink-3)}
.msg-summary{border:1px solid var(--line);border-left:3px solid var(--zen-orange);border-radius:var(--r);background:var(--surface-2);padding:12px 14px;display:flex;flex-direction:column;gap:6px}
.msg-summary-title{display:flex;align-items:center;gap:7px;font-size:11px;font-weight:700;letter-spacing:.05em;text-transform:uppercase;color:var(--zen-orange-700);margin-bottom:2px}
.msg-summary-row{display:grid;grid-template-columns:72px minmax(0,1fr);gap:10px;font-size:13px}
.msg-summary-row span{color:var(--ink-4);font-weight:600;font-size:12px}
.msg-summary-row b{font-weight:600;color:var(--ink);word-break:break-word}
.msg-foot{display:flex;align-items:center;gap:10px;padding:14px 22px;border-top:1px solid var(--line);background:var(--surface-2)}

/* ---------- Attachments upload / viewer ---------- */
.attach-row{cursor:pointer}
.att-thumb-btn{border:none;background:none;padding:0;cursor:zoom-in;border-radius:6px;display:flex}
.att-thumb-btn:focus-visible{outline:2px solid var(--zen-orange);outline-offset:2px}
.dropzone{border:1.5px dashed var(--line-strong);border-radius:var(--r);background:var(--surface-2);padding:22px 16px;display:flex;flex-direction:column;align-items:center;gap:6px;text-align:center;font-size:13.5px;color:var(--ink-2);cursor:pointer;transition:border-color .14s,background .14s}
.dropzone:hover,.dropzone.drag{border-color:var(--zen-orange);background:var(--zen-orange-soft)}
.dz-ico{width:40px;height:40px;border-radius:10px;background:var(--zen-orange-soft);color:var(--zen-orange-700);display:flex;align-items:center;justify-content:center;margin-bottom:4px}
.dz-link{color:var(--zen-orange-700);font-weight:600;text-decoration:underline}
.dz-hint{font-size:11.5px;color:var(--ink-4)}
.attach-tile .btn:disabled{opacity:.35}
.att-modal{background:var(--surface);border-radius:var(--r-xl);box-shadow:var(--shadow-pop);width:100%;max-width:960px;height:min(820px,calc(100vh - 48px));display:flex;flex-direction:column;overflow:hidden}
.att-head{display:flex;align-items:center;gap:12px;padding:14px 18px;border-bottom:1px solid var(--line)}
.att-body{flex:1;min-height:0;background:#2a313b;display:flex;align-items:center;justify-content:center;overflow:auto}
.att-img{max-width:100%;max-height:100%;object-fit:contain;display:block}
.att-frame{width:100%;height:100%;border:0;background:#fff}
.att-text{margin:0;width:100%;height:100%;overflow:auto;background:#fff;padding:20px;font-family:var(--mono);font-size:12.5px;line-height:1.55;white-space:pre-wrap;color:var(--ink)}
.att-empty{background:var(--surface);border-radius:var(--r-lg);padding:30px 34px;max-width:420px;display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center}
.att-empty b{font-size:15px}
.att-empty span{font-size:13px;color:var(--ink-3);line-height:1.5}

/* ---------- Dashboard KPI drill-down ---------- */
.kpi-btn{font:inherit;color:inherit;text-align:left;cursor:pointer;transition:border-color .14s,box-shadow .14s,transform .06s;width:100%}
.kpi-btn:hover{border-color:var(--line-strong);box-shadow:var(--shadow)}
.kpi-btn:active{transform:translateY(1px)}
.kpi-btn.on{border-color:var(--kpi-tone);box-shadow:0 0 0 3px color-mix(in srgb,var(--kpi-tone) 16%,transparent)}
.kpi-btn .kpi-go{margin-left:auto;color:var(--ink-4);transition:transform .14s,color .14s}
.kpi-btn:hover .kpi-go,.kpi-btn.on .kpi-go{color:var(--kpi-tone);transform:translateX(2px)}
.reftable tbody tr.empty-row:hover{background:transparent}

/* ---------- Specialist detail ---------- */
.spd-grid{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:20px;align-items:start}
.spd-row{display:grid;grid-template-columns:16px 88px minmax(0,1fr);gap:10px;align-items:center;padding:10px 0;border-bottom:1px solid var(--line);font-size:13.5px}
.spd-row:last-child{border-bottom:none}
.spd-row svg{color:var(--ink-4)}
.spd-label{color:var(--ink-3);font-size:12.5px;font-weight:600}
.spd-value{color:var(--ink);font-weight:600;word-break:break-word}
.spd-empty{color:var(--ink-4);font-style:italic;font-size:12.5px}
.spd-stats{display:grid;grid-template-columns:1fr 1fr;gap:12px}
.spd-stats>div{display:flex;flex-direction:column;gap:2px;background:var(--surface-2);border:1px solid var(--line);border-radius:var(--r);padding:10px 12px}
.spd-stats span{font-size:11px;color:var(--ink-4);font-weight:600}
.spd-stats b{font-size:16px;letter-spacing:-.01em}
button.sp-card{width:100%;font:inherit;color:inherit}
@media (max-width:900px){.spd-grid{grid-template-columns:1fr}}

/* ---------- Read me ---------- */
.login-panel{position:relative;flex-direction:column;gap:18px}
.readme-login-link{display:inline-flex;align-items:center;gap:7px;background:var(--warn-soft);color:var(--warn);border:1px solid #ecdcb9;border-radius:20px;padding:7px 14px;font-size:12.5px;font-weight:600;cursor:pointer}
.readme-login-link:hover{background:#f3e5c6}
.readme-overlay{position:fixed;inset:0;background:rgba(20,28,38,.42);z-index:300;display:flex;align-items:center;justify-content:center;padding:24px}
.readme-modal{background:var(--surface);border-radius:var(--r-xl);box-shadow:var(--shadow-pop);width:100%;max-width:640px;max-height:calc(100vh - 48px);display:flex;flex-direction:column;overflow:hidden}
.readme-head{display:flex;gap:14px;align-items:flex-start;padding:22px 22px 16px;border-bottom:1px solid var(--line)}
.readme-ico{width:36px;height:36px;flex:0 0 36px;border-radius:10px;background:var(--warn-soft);color:var(--warn);display:flex;align-items:center;justify-content:center}
.readme-eyebrow{font-size:11px;font-weight:700;letter-spacing:.08em;text-transform:uppercase;color:var(--warn)}
.readme-head h2{margin:3px 0 0;font-size:16.5px;line-height:1.35;letter-spacing:-.01em;text-wrap:pretty}
.readme-body{padding:16px 22px 6px;overflow-y:auto}
.readme-note{margin:0 0 10px;font-size:13.5px;color:var(--ink-3)}
.readme-body section{margin-bottom:14px}
.readme-body h3{margin:0 0 6px;font-size:11.5px;font-weight:800;letter-spacing:.06em;text-transform:uppercase;color:var(--ink-2)}
.readme-body ul{margin:0;padding-left:18px;display:flex;flex-direction:column;gap:5px}
.readme-body li{font-size:13.5px;line-height:1.5;color:var(--ink-2);text-wrap:pretty}
.readme-body a{word-break:break-all}
.readme-foot{display:flex;justify-content:flex-end;padding:14px 22px;border-top:1px solid var(--line);background:var(--surface-2)}

/* ---------- Notifications dropdown ---------- */
.notifbell { position: relative; }
.notif-dot { position: absolute; top: 1px; right: 1px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 8px; background: var(--zen-orange); color: #fff; font-size: 9.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--surface); }
.notif-backdrop { position: fixed; inset: 0; z-index: 40; }
.notif-panel { position: absolute; top: 42px; right: 0; width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); z-index: 41; overflow: hidden; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.notif-head b { font-size: 14px; }
.notif-list { max-height: 340px; overflow-y: auto; }
.notif-item { display: flex; gap: 11px; align-items: flex-start; width: 100%; text-align: left; padding: 13px 16px; background: transparent; border: none; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s; }
.notif-item:hover { background: var(--surface-2); }
.notif-foot { padding: 10px 16px; text-align: center; }
.notif-foot a { font-size: 12.5px; font-weight: 600; }

/* multi-hop vertical chain (workflow sidebar) */
.chain-vert { display: flex; flex-direction: column; align-items: stretch; }
.chain-vert .chainnode { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; transition: border-color .12s, background .12s; }
.chain-vert .chainnode b { font-size: 11.5px; display: block; white-space: nowrap; }
.chain-vert .chainnode span { font-size: 10.5px; color: var(--ink-4); }
.chain-vert .chainnode:not(.active):hover { border-color: var(--zen-orange-soft-2); background: var(--zen-orange-soft); }
.chain-vert .chainnode.active { border-color: var(--zen-orange); background: var(--zen-orange-soft); }
.chain-vert-link { display: flex; align-items: center; color: var(--ink-4); padding: 3px 0 3px 9px; }

.doc-frame { background: #fff; border-radius: 6px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); overflow: hidden; }
.doc-frame-scaled .refdoc { padding: 36px 38px; font-size: 12.5px; }

/* inline edit */
.inline-edit { outline: none; border-radius: 4px; padding: 1px 4px; margin: -1px -4px; transition: background .12s, box-shadow .12s; cursor: text; }
.inline-edit:hover { background: var(--zen-orange-soft); }
.inline-edit:focus { background: #fff; box-shadow: 0 0 0 2px var(--zen-orange); }
.inline-edit[data-empty="true"] { color: var(--ink-4); font-style: italic; }

/* ---------- Review ---------- */
.happen-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; }
.happen { display: flex; gap: 11px; align-items: flex-start; padding: 13px; border: 1px solid var(--line); border-radius: var(--r); background: var(--surface-2); }
.happen.off { opacity: .45; }
.happen-ico { width: 32px; height: 32px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex: 0 0 32px; background: var(--bg-2); color: var(--ink-3); }
.happen.done .happen-ico { background: var(--success-soft); color: var(--success); }
.happen.active .happen-ico { background: var(--zen-orange-soft); color: var(--zen-orange-700); }

.channel-col-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; margin-bottom: 12px; letter-spacing: -0.01em; white-space: nowrap; }
.chtoggle { display: flex; align-items: center; gap: 11px; width: 100%; padding: 8px 4px; background: none; border: none; cursor: pointer; }
.chtoggle.card-style { padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); transition: border-color .14s; }
.chtoggle.card-style.on { border-color: var(--zen-orange-soft-2); background: var(--zen-orange-soft); }

.emailcard { border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; background: var(--surface); box-shadow: var(--shadow-sm); }
.emailcard-head { display: flex; align-items: center; gap: 9px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.emailcard-body { padding: 16px; }
.email-linkbtn { display: flex; align-items: center; gap: 11px; margin-top: 14px; padding: 12px 14px; border: 1.5px solid var(--zen-orange-soft-2); border-radius: var(--r); background: var(--zen-orange-soft); }
.email-linkbtn svg:first-child { color: var(--zen-orange-700); }

.phone-preview { border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px; background: var(--surface-2); }
.phone-bubble-head { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-4); text-align: center; margin-bottom: 12px; }
.sms-bubble { background: #e7f0e9; border: 1px solid #cfe3d6; color: #1f2a23; border-radius: 16px 16px 16px 4px; padding: 11px 14px; font-size: 12.5px; line-height: 1.5; margin-bottom: 10px; max-width: 92%; }
.sms-bubble.email { background: var(--info-soft); border-color: #cfe0ef; color: #1a2733; }
.sms-meta { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; opacity: .65; margin-bottom: 5px; display: flex; align-items: center; gap: 4px; }

.confirm-check { width: 76px; height: 76px; border-radius: 50%; background: var(--success-soft); color: var(--success); display: flex; align-items: center; justify-content: center; margin: 0 auto; }

/* ---------- Workflow timeline ---------- */
.tl-item { display: flex; gap: 13px; }
.tl-rail { display: flex; flex-direction: column; align-items: center; flex: 0 0 18px; }
.tl-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); background: var(--surface); display: flex; align-items: center; justify-content: center; color: #fff; flex: 0 0 18px; }
.tl-dot.done { background: var(--success); border-color: var(--success); }
.tl-dot.cur { border-color: var(--zen-orange); box-shadow: 0 0 0 3px var(--zen-orange-soft); }
.tl-dot.cur.done { background: var(--zen-orange); border-color: var(--zen-orange); }
.tl-line { width: 2px; flex: 1; background: var(--line); min-height: 14px; }
.tl-line.done { background: var(--success); }

.sharelink { display: flex; align-items: center; gap: 12px; cursor: pointer; transition: border-color .14s, box-shadow .14s; }
.sharelink:hover { border-color: var(--zen-orange-soft-2); box-shadow: var(--shadow); }

/* ---------- Specialist portal ---------- */
.portal { min-height: 100vh; background: var(--bg); }
.portal-bar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.portal-bar-inner { max-width: 1120px; margin: 0 auto; padding: 13px 28px; display: flex; align-items: center; }
.portal-banner { background: var(--surface); border-bottom: 1px solid var(--line); }
.portal-banner .portal-bar-inner { padding: 18px 28px; display: flex; }
.portal-body { max-width: 1120px; margin: 0 auto; padding: 26px 28px 60px; display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 26px; align-items: start; }
.portal-doc { min-width: 0; }
.portal-side { display: flex; flex-direction: column; gap: 16px; position: sticky; top: 80px; }

/* ---------- Tweaks panel anchor (ensure above content) ---------- */
@media (max-width: 1080px) {
  .spec-grid, .sp-cardgrid { grid-template-columns: repeat(2, 1fr); }
  .happen-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- New referral finder (tiles + map) ---------- */
.finder { display: grid; grid-template-columns: minmax(340px, 410px) minmax(0, 1fr); height: calc(100vh - 60px); min-height: 520px; }
.finder-side { overflow-y: auto; padding: 24px 22px 40px 28px; border-right: 1px solid var(--line); background: var(--bg); }
.finder-intro h2 { margin: 4px 0 4px; font-size: 23px; letter-spacing: -0.02em; }
.finder-intro p { margin: 0 0 18px; font-size: 13.5px; color: var(--ink-3); line-height: 1.45; }
.ftiles { display: grid; grid-template-columns: 1fr; gap: 9px; }
.ftiles.compact { grid-template-columns: repeat(2, 1fr); gap: 7px; }
.ftile { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 15px; border: 1.5px solid var(--line); border-left: 4px solid var(--tone); border-radius: var(--r-lg); background: var(--surface); cursor: pointer; text-align: left; transition: border-color .14s, box-shadow .14s, background .14s; }
.ftile:hover { border-color: var(--line-strong); border-left-color: var(--tone); box-shadow: var(--shadow-sm); }
.ftile.sel { border-color: var(--tone); background: color-mix(in srgb, var(--tone), #fff 92%); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tone), transparent 82%); }
.ftile-text { flex: 1; min-width: 0; }
.ftiles.compact .ftile { padding: 7px 10px 7px 10px; gap: 8px; border-radius: 10px; }
.ftiles.compact .spec-name { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ftile-count { flex: 0 0 auto; font-size: 11px; font-weight: 700; color: var(--tone); background: color-mix(in srgb, var(--tone), #fff 88%); padding: 1px 8px; border-radius: 20px; }
.fdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.flist { overflow: hidden; }
.fitem { transition: background .12s; }
.fitem.hov { background: var(--surface-2); }
.fitem.sel { background: var(--zen-orange-soft); }
.fitem-main { display: flex; align-items: center; gap: 11px; width: 100%; padding: 12px 14px; background: transparent; border: none; cursor: pointer; text-align: left; font: inherit; color: inherit; }
.fitem-name { font-weight: 700; font-size: 13.5px; }
.fitem-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fitem-stats { display: flex; gap: 12px; margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.fitem-stats span { display: inline-flex; align-items: center; gap: 3px; white-space: nowrap; }
.fitem-stats svg { color: var(--ink-4); }
.fitem-detail { padding: 0 14px 14px 61px; }
.fitem-meta { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.fitem-meta svg { color: var(--ink-4); }
.fitem-meta .sep { margin: 0 3px; color: var(--ink-4); }

.finder-map { position: relative; min-width: 0; }
.fmap { position: absolute; inset: 0; overflow: hidden; background: #eef0ea; }
.fmap-svg { width: 100%; height: 100%; display: block; }
.fm-land { fill: #f1f2ec; }
.fm-park { fill: #dfe9d6; }
.fm-road { fill: none; stroke: #dcdcd4; stroke-linecap: round; stroke-linejoin: round; }
.fm-road-in { fill: none; stroke: #ffffff; stroke-linecap: round; stroke-linejoin: round; }
.fm-lake { fill: none; stroke: #c9dcec; stroke-linecap: round; stroke-linejoin: round; }
.fm-water-label { fill: #6f93b4; font-style: italic; text-anchor: middle; font-family: "Source Serif 4", Georgia, serif; }
.fm-label { fill: #8a9097; text-anchor: middle; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.fm-home-halo { fill: rgba(30, 41, 54, 0.12); }
.fm-home-dot { fill: #26313d; stroke: #fff; stroke-width: 2; }
.fm-home-label { font-size: 11px; font-weight: 700; fill: #26313d; paint-order: stroke; stroke: #f1f2ec; stroke-width: 3px; }
.fm-pin { cursor: pointer; }
.fm-pin-body { stroke: #fff; stroke-width: 1.6; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,0.25)); }
.fm-pin-shadow { fill: rgba(0,0,0,0.18); }
.fm-pin.on .fm-pin-body { stroke-width: 2.2; }
.fmap-tip { position: absolute; transform: translate(-50%, -100%); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 7px 11px; pointer-events: none; white-space: nowrap; z-index: 3; display: flex; flex-direction: column; line-height: 1.3; }
.fmap-tip b { font-size: 12.5px; }
.fmap-tip span { font-size: 11.5px; color: var(--ink-3); }
.fmap-head { position: absolute; top: 16px; left: 16px; right: 16px; display: flex; align-items: center; gap: 12px; justify-content: space-between; background: color-mix(in srgb, var(--surface), transparent 6%); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px 12px 10px 16px; box-shadow: var(--shadow-sm); backdrop-filter: blur(4px); }
.fmap-title { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fmap-sub { font-size: 12px; color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fmap-legend { position: absolute; left: 16px; bottom: 16px; display: flex; flex-wrap: wrap; gap: 6px 12px; max-width: calc(100% - 270px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; box-shadow: var(--shadow-sm); font-size: 11.5px; font-weight: 600; color: var(--ink-2); }
.fmap-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.fmap-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.fmap-legend i.home { border-radius: 3px; background: #26313d; }
.fmap-note { position: absolute; right: 12px; bottom: 10px; font-size: 10.5px; color: var(--ink-4); background: rgba(255,255,255,0.7); padding: 2px 7px; border-radius: 6px; }
@media (max-width: 1080px) { .finder { grid-template-columns: 340px minmax(0, 1fr); } .fmap-note { display: none; } }

/* ---------- Review & send — three-column layout ---------- */
.review3 { display: grid; grid-template-columns: minmax(280px, 340px) minmax(0, 1fr) minmax(280px, 340px); gap: 22px; align-items: start; max-width: 1480px; margin: 0 auto; }
.review3-col { min-width: 0; }
.review3-right { display: flex; flex-direction: column; gap: 18px; }
.review3-letter .doc-frame { max-width: 760px; margin: 0 auto; }
.review3-off { opacity: 0.5; }
@media (max-width: 1180px) {
  .review3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .review3-letter { grid-column: 1 / -1; order: -1; }
}
.fmap-svg { cursor: grab; touch-action: none; user-select: none; }
.fmap-svg.dragging { cursor: grabbing; }
.fmap-zoom { position: absolute; right: 16px; top: 96px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-sm); overflow: hidden; z-index: 2; }
.fmap-zoom button { width: 36px; height: 34px; display: flex; align-items: center; justify-content: center; background: none; border: none; cursor: pointer; color: var(--ink-2); }
.fmap-zoom button + button { border-top: 1px solid var(--line); }
.fmap-zoom button:hover { background: var(--surface-2); color: var(--ink); }
.review3-letter .doc-frame-scaled .refdoc { padding: 28px 30px; font-size: 12px; overflow-wrap: anywhere; }

/* ---------- Dentist dashboard — status filter ---------- */
.statusfilter { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px 5px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink-3); }
.statusfilter select { border: none; background: transparent; font: inherit; font-size: 12.5px; font-weight: 600; color: var(--ink-2); outline: none; cursor: pointer; }
.statusfilter:focus-within { border-color: var(--zen-orange); }

/* ---------- Login — view picker ---------- */
.login-roles { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.login-role { display: flex; align-items: center; gap: 12px; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; text-align: left; font: inherit; color: inherit; transition: border-color .14s, background .14s; }
.login-role:hover { border-color: var(--line-strong); }
.login-role.on { border-color: var(--zen-orange); background: var(--zen-orange-soft); }
.login-role-ico { width: 36px; height: 36px; flex: 0 0 36px; border-radius: 9px; display: flex; align-items: center; justify-content: center; background: var(--bg-2); color: var(--ink-3); }
.login-role.on .login-role-ico { background: var(--zen-orange); color: #fff; }
.login-role-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.login-role-text b { font-size: 13.5px; }
.login-role-text span { font-size: 11.5px; color: var(--ink-3); }
.login-role-radio { width: 16px; height: 16px; flex: 0 0 16px; border-radius: 50%; border: 1.5px solid var(--line-strong); }
.login-role.on .login-role-radio { border: 5px solid var(--zen-orange); }

/* ---------- Specialist view ---------- */
.portal.embedded { min-height: 0; }
.portal.embedded .portal-side { top: 16px; }
.sfilter { display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); flex-wrap: wrap; }
.sfilter-search { flex: 1; min-width: 200px; width: auto; background: var(--surface); padding: 6px 12px; }
.sfilter .select { width: auto; min-width: 190px; padding: 6px 28px 6px 10px; font-size: 13px; }
.sempty { text-align: center; color: var(--ink-4); padding: 26px 18px !important; cursor: default; }
.reftable tbody tr.srow-new td:first-child { box-shadow: inset 3px 0 0 var(--info); }
.spr-row { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 0; border: none; border-bottom: 1px solid var(--line); background: none; cursor: pointer; font: inherit; font-size: 13px; color: var(--ink-2); }
.spr-row:last-child { border-bottom: none; }
.spr-row svg { color: var(--ink-4); }
.spr-row:hover { color: var(--ink); }
.srep-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 1.5px solid var(--line); border-radius: var(--r); background: var(--surface); cursor: pointer; font: inherit; color: inherit; }
.srep-row:hover { border-color: var(--line-strong); }
.srep-row > svg { color: var(--zen-orange); flex: 0 0 auto; }


/* ---------- Web app additions ---------- */
.login-error { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); font-size: 13px; font-weight: 600; line-height: 1.35; }
.login-error svg { flex: 0 0 auto; }
.login-demo b { color: var(--ink-2); }
.report-modal { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-xl); box-shadow: var(--shadow-pop); overflow: hidden; }
.report-modal .att-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.report-modal-body { padding: 18px; overflow-y: auto; background: var(--bg-2); }
.boot-splash { min-height: 100vh; display: flex; align-items: center; justify-content: center; color: var(--ink-3); font-size: 14px; }
