:root {
  --bg: #071018;
  --bg-2: #0b1620;
  --elev: #101d2a;
  --elev-2: #162636;
  --line: rgba(212, 196, 164, 0.12);
  --line-2: rgba(255, 255, 255, 0.06);
  --text: #eef3f7;
  --muted: #8a9aab;
  --faint: #5d6e80;
  --teal: #3ad4c5;
  --teal-dim: rgba(58, 212, 197, 0.14);
  --gold: #c9b07a;
  --gold-dim: rgba(201, 176, 122, 0.14);
  --rose: #e07a7a;
  --rose-dim: rgba(224, 122, 122, 0.14);
  --ok: #6fcf97;
  --ok-dim: rgba(111, 207, 151, 0.14);
  --warn: #e0b45a;
  --blue: #7ab0e0;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  --radius: 16px;
  --radius-sm: 10px;
  --nav-w: 268px;
  --top: 64px;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Manrope", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  letter-spacing: -0.01em;
  overflow: auto;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
a { color: var(--teal); text-decoration: none; }
img { max-width: 100%; display: block; }

.app { display: flex; height: 100%; }

/* Sidebar */
.sidebar {
  width: var(--nav-w);
  background: linear-gradient(180deg, #0c1824 0%, #08131c 100%);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  flex-shrink: 0;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 10px 22px;
}
.mark {
  width: 36px; height: 36px; border-radius: 11px;
  background: linear-gradient(145deg, #3ad4c5, #1a7a74);
  display: grid; place-items: center;
  box-shadow: 0 8px 20px rgba(58, 212, 197, 0.22);
}
.brand h1 {
  font-family: var(--serif);
  font-size: 22px; font-weight: 400;
  letter-spacing: 0.02em;
}
.brand span { display: block; font-size: 11px; color: var(--muted); letter-spacing: 0.14em; text-transform: uppercase; }

.nav-group { margin-bottom: 18px; }
.nav-label {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--faint); padding: 6px 12px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 10px;
  width: 100%; border: 0; background: transparent;
  color: var(--muted); padding: 9px 12px;
  border-radius: 10px; cursor: pointer;
  font-size: 13.5px; font-weight: 500;
  text-align: left; transition: 0.15s ease;
}
.nav-item:hover { background: var(--line-2); color: var(--text); }
.nav-item.active {
  background: var(--teal-dim); color: var(--teal);
}
.nav-item svg { width: 18px; height: 18px; opacity: 0.85; flex-shrink: 0; }

.sidebar-foot {
  margin-top: auto; padding: 12px;
  border-top: 1px solid var(--line);
}
.disclaimer {
  font-size: 11px; line-height: 1.45; color: var(--faint);
}

/* Main */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: var(--top);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 24, 0.78);
  backdrop-filter: blur(16px);
}
.crumb { font-size: 13px; color: var(--muted); }
.crumb strong { color: var(--text); font-weight: 600; }
.top-search {
  margin-left: auto;
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  display: flex; align-items: center; gap: 8px;
  min-width: 240px;
}
.top-search input {
  background: none; border: 0; outline: none;
  width: 100%; font-size: 13px; color: var(--text);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold), #8a6d3b);
  display: grid; place-items: center;
  font-size: 12px; font-weight: 700; color: #1a140c;
}

.view {
  flex: 1; overflow: auto; padding: 28px 32px 48px;
  background:
    radial-gradient(1200px 400px at 80% -10%, rgba(58, 212, 197, 0.06), transparent 50%),
    var(--bg);
}

/* Typography */
.page-kicker {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold); margin-bottom: 8px;
}
.page-title {
  font-family: var(--serif);
  font-size: 36px; font-weight: 400; line-height: 1.15;
  margin-bottom: 8px;
}
.page-lead { color: var(--muted); max-width: 620px; margin-bottom: 28px; line-height: 1.55; }

/* Cards */
.grid { display: grid; gap: 16px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.card {
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}
.card h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.card p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.stat-val {
  font-family: var(--serif);
  font-size: 32px; margin: 8px 0 4px;
}
.stat-sub { font-size: 12px; color: var(--faint); }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer;
  border-radius: 11px; padding: 10px 16px;
  font-size: 13.5px; font-weight: 600;
  transition: 0.15s ease;
}
.btn-primary { background: var(--teal); color: #06211e; }
.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--elev-2); }
.btn-gold { background: var(--gold); color: #1a140c; }
.btn-danger { background: var(--rose-dim); color: var(--rose); }
.btn-sm { padding: 7px 12px; font-size: 12px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 600; }
.field input, .field select, .field textarea {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
  font-size: 14px;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: rgba(58, 212, 197, 0.45);
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--muted);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12.5px;
  cursor: pointer;
}
.chip.on { background: var(--teal-dim); color: var(--teal); border-color: transparent; }

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  text-align: left; color: var(--faint); font-weight: 600;
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 10px 8px; border-bottom: 1px solid var(--line);
}
.table td { padding: 12px 8px; border-bottom: 1px solid var(--line-2); }
.badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
}
.badge-ok { background: var(--ok-dim); color: var(--ok); }
.badge-warn { background: rgba(224, 180, 90, 0.16); color: var(--warn); }
.badge-teal { background: var(--teal-dim); color: var(--teal); }
.badge-gold { background: var(--gold-dim); color: var(--gold); }

.row { display: flex; gap: 12px; flex-wrap: wrap; }
.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; }

/* Symptom */
.body-map { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.body-btn {
  background: var(--elev-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px; cursor: pointer;
  color: var(--text); text-align: left;
}
.body-btn.on { border-color: var(--teal); background: var(--teal-dim); }

/* Calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { font-size: 11px; color: var(--faint); text-align: center; padding: 4px; }
.cal .day {
  aspect-ratio: 1; border-radius: 10px; border: 1px solid transparent;
  background: var(--bg-2); color: var(--muted); cursor: pointer; font-size: 13px;
}
.cal .day:hover { border-color: var(--line); color: var(--text); }
.cal .day.on { background: var(--teal); color: #06211e; font-weight: 700; }
.cal .day.has { box-shadow: inset 0 -3px 0 var(--gold); }
.slots { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.slot {
  border: 1px solid var(--line); background: var(--bg-2);
  border-radius: 8px; padding: 8px 12px; cursor: pointer; font-size: 13px;
}
.slot.on { background: var(--gold-dim); border-color: var(--gold); color: var(--gold); }

/* Charts */
.spark {
  width: 100%; height: 120px;
}
.legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 6px; }

/* Telehealth */
.video-stage {
  position: relative;
  background: #050a10;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  min-height: 420px;
  overflow: hidden;
}
.video-stage video {
  width: 100%; height: 420px; object-fit: cover; background: #000;
}
.video-pip {
  position: absolute; right: 16px; bottom: 16px;
  width: 180px; height: 120px; border-radius: 12px;
  overflow: hidden; border: 1px solid var(--line);
  background: #000;
}
.video-pip video { width: 100%; height: 100%; object-fit: cover; }
.video-overlay {
  position: absolute; left: 16px; top: 16px;
  background: rgba(0,0,0,0.5); padding: 8px 12px; border-radius: 8px;
  font-size: 12px;
}
.call-bar {
  display: flex; justify-content: center; gap: 10px; margin-top: 14px;
}
.call-btn {
  width: 46px; height: 46px; border-radius: 50%;
  border: 0; cursor: pointer;
  background: var(--elev-2); color: var(--text);
}
.call-btn.end { background: var(--rose); color: white; }

/* Imaging */
.imager {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 16px;
  min-height: 560px;
}
.canvas-wrap {
  background: #000;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  position: relative;
  min-height: 560px;
  display: grid; place-items: center;
  overflow: hidden;
}
#dicomCanvas { max-width: 100%; max-height: 560px; cursor: crosshair; }
.dropzone {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  color: var(--muted); text-align: center; padding: 24px;
  border: 1px dashed rgba(201,176,122,0.25);
  margin: 16px; border-radius: 12px;
}
.dropzone.hidden { display: none; }
.meta-row {
  display: flex; justify-content: space-between;
  font-size: 12px; padding: 6px 0;
  border-bottom: 1px solid var(--line-2);
  gap: 12px;
}
.meta-row span:first-child { color: var(--faint); }
.meta-row span:last-child { color: var(--text); font-family: var(--mono); font-size: 11px; text-align: right; }

.range { width: 100%; accent-color: var(--teal); }

/* Quiz */
.q-card { padding: 8px 0 16px; }
.opt {
  display: block; width: 100%; text-align: left;
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
  cursor: pointer; color: var(--text);
}
.opt.correct { border-color: var(--ok); background: var(--ok-dim); }
.opt.wrong { border-color: var(--rose); background: var(--rose-dim); }

/* Doctors */
.doc {
  display: flex; gap: 14px; align-items: flex-start;
}
.avatar-lg {
  width: 56px; height: 56px; border-radius: 16px; flex-shrink: 0;
  display: grid; place-items: center;
  font-weight: 700; color: #0b1620;
}

/* Mood */
.moods { display: flex; gap: 8px; }
.mood {
  flex: 1; border: 1px solid var(--line); background: var(--bg-2);
  border-radius: 12px; padding: 14px 8px; cursor: pointer;
  text-align: center; font-size: 22px;
}
.mood.on { border-color: var(--gold); background: var(--gold-dim); }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  background: var(--elev-2); border: 1px solid var(--line);
  padding: 12px 16px; border-radius: 12px;
  box-shadow: var(--shadow); z-index: 50;
  font-size: 13px;
}

/* Welcome overlay */
.gate {
  position: fixed; inset: 0; z-index: 80;
  background:
    radial-gradient(800px 400px at 20% 0%, rgba(58,212,197,0.12), transparent),
    radial-gradient(600px 400px at 90% 80%, rgba(201,176,122,0.1), transparent),
    #060d14;
  display: grid; place-items: center;
}
.gate-card { max-width: 520px; text-align: center; padding: 24px; }
.gate-card h2 {
  font-family: var(--serif); font-size: 48px; font-weight: 400; margin: 16px 0 10px;
}
.gate-card p { color: var(--muted); margin-bottom: 28px; line-height: 1.6; }

.hidden { display: none !important; }

@media (max-width: 1100px) {
  .grid-4, .grid-3, .split, .imager { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .grid-2 { grid-template-columns: 1fr; }
  .top-search { display: none; }
  .view { padding: 18px; }
}

.menu-btn {
  display: none;
  width: 36px; height: 36px;
  border: 1px solid var(--line);
  background: var(--elev);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
}
.foot-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.worklist { display: flex; flex-direction: column; gap: 8px; }
.work-row {
  width: 100%;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  text-align: left;
  background: var(--elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  color: inherit;
}
.work-row:hover { border-color: rgba(58,212,197,0.35); }
.work-title { font-size: 15px; font-weight: 600; margin-top: 4px; }
.search-drop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: var(--elev-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  z-index: 40;
  overflow: hidden;
}
.top-search { position: relative; }
.search-drop button {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; color: var(--text);
  padding: 10px 14px; cursor: pointer;
}
.search-drop button:hover { background: var(--teal-dim); }
.cal .day.past { opacity: 0.28; cursor: not-allowed; }
.cal .day:disabled { opacity: 0.28; cursor: not-allowed; }
.emergency {
  background: var(--rose-dim);
  border: 1px solid rgba(224,122,122,0.35);
  border-radius: 14px;
  padding: 16px;
}
.emergency h3 { color: var(--rose); }
.path-block { margin-top: 16px; padding-top: 12px; border-top: 1px solid var(--line-2); }
.path-block ul { margin: 8px 0 0 18px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.vitals-chip {
  background: var(--teal-dim);
  color: var(--teal);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
}
.phi-warn {
  background: rgba(224,122,122,0.16);
  color: var(--rose);
  border: 1px solid rgba(224,122,122,0.35);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 14px;
}
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.series-list { display: flex; flex-direction: column; gap: 6px; }
.series-btn {
  display: flex; justify-content: space-between;
  background: var(--bg-2); border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 8px 10px; cursor: pointer; font-size: 12px;
}
.series-btn.on { border-color: var(--teal); background: var(--teal-dim); color: var(--teal); }
.read-card { font-size: 13px; color: var(--muted); line-height: 1.5; }

@media (max-width: 1100px) {
  .menu-btn { display: grid; place-items: center; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    z-index: 60;
    transform: translateX(-110%);
    width: min(280px, 86vw);
    padding: 16px 14px;
    transition: transform 0.2s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .brand h1, .nav-label, .nav-item span, .sidebar-foot, .brand span { display: revert; }
  .nav-item { justify-content: flex-start; padding: 9px 12px; }
  .sidebar-foot { display: block; }
}
@media (max-width: 720px) {
  .top-search { display: flex; min-width: 0; flex: 1; }
  body { overflow: auto; }
  .app { min-height: 100%; height: auto; }
}

/* ------------------------------------------------------------- THE ESTATE
   One mark at the foot of the app's own rail. This property is a desk with a
   sidebar of its own, so a house navbar across the top would be a second set of
   controls arguing with the first; a single way back is the whole of it. */
.labs-home {
  display: block;
  margin: 0 0 14px;
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .48);
  text-decoration: none;
}
.labs-home:hover { color: rgba(255, 255, 255, .82); }
