/* ============================================================
   Headlands Console — design system ("the bridge")
   A sleek, professional operations console: dark hull, coastal-teal
   instrument glow, monospace data, fixed-viewport app shell (minimal
   scroll — you navigate panels, you don't scroll a page).
   This file is the shared look & feel across all Headlands products.
   ============================================================ */

:root {
  /* hull */
  --hull:      #0c1312;   /* app background */
  --panel:     #111d1b;   /* panel surface */
  --panel-2:   #0e1817;   /* inset / rows */
  --rail:      #0a1110;   /* nav rail */
  /* lines */
  --line:        rgba(110, 200, 184, 0.13);
  --line-strong: rgba(110, 200, 184, 0.26);
  /* ink */
  --ink:       #e8f1ef;   /* primary text */
  --ink-dim:   #8ba6a0;   /* labels / secondary */
  --ink-faint: #5a716c;   /* tertiary */
  /* signature glow + status */
  --teal:      #46c8b3;   /* the glow */
  --teal-bri:  #6fe0cd;
  --teal-deep: #2e5b54;
  --teal-soft: rgba(70, 200, 179, 0.10);
  --ok:        #5fd08a;
  --warn:      #e3ad55;
  --alert:     #e26a4d;
  /* type */
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 7px;
  --bar-h: 52px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; } /* the hidden attribute must beat any display rule */
html, body { height: 100%; }
body {
  margin: 0; background: var(--hull); color: var(--ink);
  font-family: var(--sans); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  /* faint instrument vignette */
  background-image:
    radial-gradient(120% 80% at 100% 0%, rgba(70, 200, 179, 0.05), transparent 55%),
    radial-gradient(90% 70% at 0% 100%, rgba(46, 91, 84, 0.06), transparent 55%);
  overflow: hidden; /* the shell manages its own scroll regions */
}
a { color: var(--teal); text-decoration: none; }
::selection { background: rgba(70, 200, 179, 0.25); }

/* thin instrument scrollbars */
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: rgba(110, 200, 184, 0.22); border-radius: 6px; }
*::-webkit-scrollbar-thumb:hover { background: rgba(110, 200, 184, 0.4); }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- app shell: header / [nav | stage], full viewport ---------- */
.console { display: grid; grid-template-rows: var(--bar-h) 1fr; height: 100vh; }
.shell { display: grid; grid-template-columns: 208px 1fr; min-height: 0; }

/* ---------- status bar ---------- */
.statusbar {
  display: flex; align-items: center; gap: 18px;
  padding: 0 16px 0 18px;
  background: linear-gradient(180deg, #0f1c1a, #0b1413);
  border-bottom: 1px solid var(--line-strong);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: 0.18em; font-size: 13px; }
.brand .mark { color: var(--teal); filter: drop-shadow(0 0 6px rgba(70,200,179,.55)); font-size: 15px; }
.brand b { color: var(--teal); font-weight: 600; }
.status-cluster { display: flex; align-items: center; gap: 16px; margin-left: auto; }
.stat { display: inline-flex; align-items: center; gap: 7px; font-family: var(--mono);
  font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.clock { font-family: var(--mono); font-size: 13px; color: var(--ink); letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums; }
.btn-icon { background: none; border: 1px solid var(--line); color: var(--ink-dim);
  border-radius: var(--radius); padding: 6px 10px; cursor: pointer; font-size: 12px; font-family: var(--mono); }
.btn-icon:hover { color: var(--teal); border-color: var(--line-strong); }

/* status LED */
.led { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); flex: none; }
.led-ok    { background: var(--ok);    box-shadow: 0 0 7px rgba(95,208,138,.7); }
.led-teal  { background: var(--teal);  box-shadow: 0 0 7px rgba(70,200,179,.7); }
.led-warn  { background: var(--warn);  box-shadow: 0 0 7px rgba(227,173,85,.6); }
.led-alert { background: var(--alert); box-shadow: 0 0 7px rgba(226,106,77,.6); }
.led-off   { background: var(--ink-faint); }

/* ---------- nav rail ---------- */
.nav { background: var(--rail); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  background: none; border: 0; border-left: 2px solid transparent; cursor: pointer;
  color: var(--ink-dim); font-family: var(--sans); font-size: 13px; font-weight: 500;
  padding: 10px 12px; border-radius: 0 var(--radius) var(--radius) 0; letter-spacing: 0.02em;
}
.nav-item:hover { color: var(--ink); background: var(--teal-soft); }
.nav-item.active { color: var(--teal); background: var(--teal-soft); border-left-color: var(--teal);
  box-shadow: inset 0 0 18px rgba(70,200,179,.06); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; opacity: .7; }
.nav-foot { margin-top: auto; font-family: var(--mono); font-size: 10px; color: var(--ink-faint);
  letter-spacing: 0.1em; text-transform: uppercase; padding: 10px 12px; }

/* ---------- stage + views ---------- */
.stage { min-width: 0; min-height: 0; padding: 16px; overflow: hidden; }
.view { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.view[hidden] { display: none; }
.view-head { display: flex; align-items: baseline; gap: 12px; }
.view-title { font-size: 17px; font-weight: 600; letter-spacing: 0.01em; margin: 0; }
.view-sub { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); letter-spacing: 0.06em; text-transform: uppercase; }

/* tile row (the "instrument readouts") */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; flex: none; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; position: relative; overflow: hidden; }
.tile::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 2px; background: linear-gradient(90deg, var(--teal), transparent 70%); opacity: .5; }
.tile-label { font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.tile-value { font-family: var(--mono); font-size: 26px; font-weight: 600; color: var(--ink); line-height: 1.1; margin-top: 6px; font-variant-numeric: tabular-nums; }
.tile-value .unit { font-size: 12px; color: var(--ink-dim); margin-left: 3px; }
.tile-value.accent { color: var(--teal); text-shadow: 0 0 12px rgba(70,200,179,.35); }

/* panel grid that fills remaining height */
.grid { display: grid; gap: 14px; flex: 1; min-height: 0; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-1 { grid-template-columns: 1fr; }

/* ---------- panel ---------- */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.13em; text-transform: uppercase; color: var(--ink-dim); flex: none; }
.panel-head .led { margin-right: 0; }
.panel-head .right { margin-left: auto; color: var(--ink-faint); font-size: 10px; }
.panel-body { padding: 12px 14px; overflow-y: auto; flex: 1; min-height: 0; }
.panel-body.pad-0 { padding: 0; }

/* rows / lists */
.row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--panel-2); }
.row-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.row-main strong { color: var(--ink); font-weight: 600; font-size: 13.5px; }
.row-main .sub { color: var(--ink-dim); font-size: 12px; font-family: var(--mono); }
.row-meta { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.time { font-family: var(--mono); color: var(--teal); font-size: 13px; letter-spacing: 0.04em; }
.muted { color: var(--ink-dim); }
.empty { color: var(--ink-faint); font-family: var(--mono); font-size: 12px; padding: 14px; letter-spacing: 0.04em; }

/* tags / pills */
.tag { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 5px; border: 1px solid var(--line-strong); color: var(--ink-dim); }
.tag-ok { color: var(--ok); border-color: rgba(95,208,138,.4); }
.tag-warn { color: var(--warn); border-color: rgba(227,173,85,.4); }
.tag-teal { color: var(--teal); border-color: rgba(70,200,179,.4); }

/* buttons */
.btn { font-family: var(--sans); font-size: 13px; font-weight: 600; cursor: pointer; border-radius: var(--radius);
  padding: 9px 16px; border: 1px solid var(--teal-deep); background: var(--teal-soft); color: var(--teal); letter-spacing: 0.02em; }
.btn:hover { border-color: var(--teal); box-shadow: 0 0 14px rgba(70,200,179,.15); color: var(--teal-bri); }
.btn:disabled { opacity: .45; cursor: default; box-shadow: none; }
.btn-solid { background: var(--teal); color: #07110f; border-color: var(--teal); }
.btn-solid:hover { background: var(--teal-bri); color: #07110f; }
.link-btn { background: none; border: 0; color: var(--teal); font-family: var(--mono); font-size: 12px;
  cursor: pointer; padding: 0; text-transform: uppercase; letter-spacing: 0.06em; }
.link-btn:hover { color: var(--teal-bri); }

/* forms */
label.fld { display: flex; flex-direction: column; gap: 5px; font-family: var(--mono); font-size: 10.5px;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); }
input, select, textarea {
  font-family: var(--mono); font-size: 13px; color: var(--ink); background: var(--panel-2);
  border: 1px solid var(--line-strong); border-radius: 6px; padding: 9px 11px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
input[type=checkbox] { width: auto; accent-color: var(--teal); }
.field-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.ok-msg { color: var(--ok); font-family: var(--mono); font-size: 12px; }
.err-msg { color: var(--alert); font-family: var(--mono); font-size: 12px; min-height: 1em; }

/* availability editor rows */
.avail-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.avail-row:last-child { border-bottom: 0; }
.avail-day { display: flex; align-items: center; gap: 8px; min-width: 150px; color: var(--ink); font-size: 13px; }
.avail-times { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.avail-times input, .avail-times select { width: auto; }

/* modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(4,9,8,.7); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 8vh 16px; z-index: 50; }
.modal { position: relative; width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius); box-shadow: 0 24px 70px rgba(0,0,0,.6); padding: 22px 24px 26px; max-height: 80vh; overflow-y: auto; }
.modal-close { position: absolute; top: 10px; right: 12px; background: none; border: 0; color: var(--ink-dim); font-size: 22px; cursor: pointer; }
.modal h2 { font-size: 15px; font-family: var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal); margin: 0 0 14px; }
.kv { padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border-bottom: 0; }
.kv .k { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); margin-bottom: 3px; }
.kv .v { color: var(--ink); white-space: pre-wrap; font-size: 13.5px; }
.demo-banner { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.05em; color: var(--warn); }

/* ---------- calendar ---------- */
.cal-nav { margin-left: auto; display: flex; gap: 6px; }
.cal-panel { flex: 1; min-height: 0; }
.cal-dow { display: grid; grid-template-columns: repeat(7, 1fr); padding: 9px 0; border-bottom: 1px solid var(--line); flex: none; }
.cal-dow span { text-align: center; font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-dim); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-auto-rows: 1fr; flex: 1; min-height: 0; }
.cal-cell { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 5px 6px; min-height: 0; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.dim { opacity: 0.38; }
.cal-cell.today { background: var(--teal-soft); }
.cal-daynum { font-family: var(--mono); font-size: 11px; color: var(--ink-dim); flex: none; }
.cal-cell.today .cal-daynum { color: var(--teal); font-weight: 700; }
.cal-appts { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; }
.cal-appt { font-size: 10.5px; padding: 2px 6px; border-radius: 4px; background: var(--teal-soft); color: var(--teal);
  border-left: 2px solid var(--teal); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.cal-appt:hover { background: rgba(70, 200, 179, 0.2); }
.cal-appt.past { color: var(--ink-dim); border-left-color: var(--ink-dim); background: transparent; }
.cal-appt.cancelled { color: var(--ink-faint); border-left-color: var(--ink-faint); background: transparent; text-decoration: line-through; }

/* ---------- weekly slot template (therapist) ---------- */
.tmpl-day { display: flex; gap: 14px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.tmpl-day:last-child { border-bottom: 0; }
.tmpl-day-name { width: 92px; flex: none; color: var(--ink-dim); font-size: 13px; padding-top: 4px; }
.tmpl-slots { display: flex; flex-wrap: wrap; gap: 6px; flex: 1; align-items: center; }
.slot-chip { font-family: var(--mono); font-size: 11.5px; padding: 4px 5px 4px 9px; border-radius: 5px;
  border: 1px solid var(--teal-deep); background: var(--teal-soft); color: var(--teal); display: inline-flex; align-items: center; gap: 7px; }
.chip-x { background: none; border: 0; color: var(--ink-dim); cursor: pointer; font-size: 14px; padding: 0 2px; line-height: 1; }
.chip-x:hover { color: var(--alert); }

/* ---------- practices (between-session work) ---------- */
.practice-row { display: flex; gap: 12px; align-items: flex-start; padding: 11px 0; border-bottom: 1px solid var(--line); }
.practice-row:last-child { border-bottom: 0; }
.practice-check { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--panel-2); color: var(--teal); cursor: pointer; font-size: 13px; line-height: 1; margin-top: 1px; }
.practice-check.checked { background: var(--teal-soft); border-color: var(--teal); box-shadow: 0 0 8px rgba(70,200,179,.18); }
.practice-text { min-width: 0; }
.practice-text strong { color: var(--ink); font-size: 14px; }
.practice-text .sub { color: var(--ink-dim); font-size: 12.5px; margin-top: 2px; white-space: pre-wrap; }
.practice-row.done .practice-text strong { text-decoration: line-through; color: var(--ink-dim); }

/* ---------- embedded video session ---------- */
.video-overlay { position: fixed; inset: 0; background: #05090a; z-index: 100; display: flex; flex-direction: column; }
.video-bar { display: flex; align-items: center; justify-content: space-between; padding: 9px 16px; border-bottom: 1px solid var(--line-strong); flex: none; }
.video-bar span { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-dim); }
.video-frame { flex: 1; min-height: 0; }
.video-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-msg { color: var(--ink-dim); padding: 28px; font-family: var(--mono); font-size: 13px; }
.video-msg.err { color: var(--alert); }

/* ---------- messages (client + future therapist) ---------- */
.msg-panel { flex: 1; min-height: 0; }
.msg-list { display: flex; flex-direction: column; gap: 8px; padding: 14px; overflow-y: auto; flex: 1; min-height: 0; }
.msg-row { display: flex; }
.msg-row.mine { justify-content: flex-end; }
.msg-row > div { max-width: 74%; }
.msg-bubble { padding: 8px 12px; border-radius: 10px; font-size: 13px; background: var(--panel-2); border: 1px solid var(--line); white-space: pre-wrap; }
.msg-row.mine .msg-bubble { background: var(--teal-soft); border-color: var(--teal-deep); }
.msg-time { font-family: var(--mono); font-size: 9px; color: var(--ink-faint); margin-top: 3px; }
.msg-row.mine .msg-time { text-align: right; }
.msg-compose { display: flex; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); flex: none; align-items: flex-end; }
.msg-compose textarea { flex: 1; resize: none; min-height: 38px; max-height: 120px; }
.msg-compose .btn { flex: none; }

/* ---------- booking slots ---------- */
.slot-day { margin-bottom: 14px; }
.slot-day h4 { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-dim); margin: 0 0 7px; }
.slot-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.slot-btn { font-family: var(--mono); font-size: 12px; padding: 6px 11px; border-radius: 6px; border: 1px solid var(--teal-deep); background: var(--teal-soft); color: var(--teal); cursor: pointer; }
.slot-btn:hover { border-color: var(--teal); color: var(--teal-bri); box-shadow: 0 0 12px rgba(70, 200, 179, 0.12); }
.slot-btn:disabled { opacity: 0.4; cursor: default; }
.upload-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.upload-row input[type=file] { flex: 1; min-width: 160px; }

/* ---------- client detail page ---------- */
.view-detail .view-head { align-items: center; }
.detail-scroll { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding-right: 3px; }
.grid-detail { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.grid-detail .panel-body { max-height: 320px; }
.client-link { cursor: pointer; }
.client-link:hover { color: var(--teal); text-decoration: underline; }
.note-compose { display: flex; gap: 8px; align-items: flex-end; margin-bottom: 12px; }
.note-compose textarea { flex: 1; resize: vertical; min-height: 38px; }
.note-compose .btn { padding: 8px 14px; flex: none; }
.note-item { padding: 9px 0; border-bottom: 1px solid var(--line); }
.note-item:last-child { border-bottom: 0; }
.note-time { font-family: var(--mono); font-size: 9.5px; color: var(--ink-faint); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 3px; }
.note-body { color: var(--ink); white-space: pre-wrap; font-size: 13px; }

@media (max-width: 760px) {
  .grid-detail { grid-template-columns: 1fr; }
  .shell { grid-template-columns: 1fr; }
  .nav { flex-direction: row; overflow-x: auto; padding: 8px; border-right: 0; border-bottom: 1px solid var(--line); }
  .nav-item { border-left: 0; border-bottom: 2px solid transparent; border-radius: var(--radius); white-space: nowrap; }
  .nav-item.active { border-left: 0; border-bottom-color: var(--teal); }
  .nav-foot { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  body { overflow: auto; }
  .console { height: auto; min-height: 100vh; }
}
