/* Future Life — logged-in app dark theme.
   Tokens verbatim from design-reference/design_handoff_advice_app/README.md.
   Public pages (login, /lead, /confirm) keep the light brand in tokens.css. */

:root {
  --bg: #0A141D;
  --card: #12242F;
  --inset: #0F2230;
  --hover: #16303D;
  --border: #1F3948;
  --hairline: #18303E;
  --mid: #2A5570;
  --text: #E8F1F6;
  --text-soft: #C7D8E2;
  --text-2: #8FA9B8;
  --muted: #5D7C8C;
  --disabled: #3E5666;
  --accent: #42A4DC;
  --accent-light: #8FC4DE;
  --navy: #004F70;
  --ok: #43C79A;
  --warn: #E5B04E;
  --warn-text: #E8C9A0;
  --danger: #E0756B;
  --danger-text: #F09A92;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Poppins', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ---- Shell ---- */
.shell { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 24px; border-bottom: 1px solid var(--border);
}
.topbar img { height: 32px; display: block; }
.topbar-user { display: flex; align-items: center; gap: 12px; }
.topbar-user .name { font-size: 13px; font-weight: 600; }
.role-chip {
  font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); background: rgba(66,164,220,0.14);
  border-radius: 5px; padding: 4px 10px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
/* ---- Global client search (topbar) ---- */
.global-search { position: relative; flex: 1; max-width: 420px; margin: 0 24px; }
.global-search input {
  width: 100%; font-family: inherit; font-size: 13px; color: var(--text);
  background: var(--inset); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 12px;
}
.global-search input::placeholder { color: var(--muted); }
.global-search input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(66,164,220,0.2);
}
.gs-results {
  display: none; position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40;
  background: var(--card); border: 1px solid var(--border); border-radius: 10px;
  overflow: hidden; box-shadow: 0 12px 30px rgba(0,0,0,0.45);
  max-height: 380px; overflow-y: auto;
}
.gs-row {
  display: flex; flex-direction: column; gap: 2px; padding: 9px 13px;
  text-decoration: none; border-bottom: 1px solid var(--hairline);
}
.gs-row:last-child { border-bottom: 0; }
.gs-row:hover, .gs-row.active { background: var(--hover); }
.gs-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.gs-dim { font-weight: 400; color: var(--text-2); }
.gs-meta { font-size: 11px; color: var(--muted); }
.gs-empty { padding: 12px 13px; font-size: 12.5px; color: var(--muted); }

.body { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: 224px; flex: none; border-right: 1px solid var(--border); padding: 18px 14px;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-item {
  display: block; padding: 10px 12px; border-radius: 8px; text-decoration: none;
  color: var(--text); cursor: pointer; border: 0; background: none;
  text-align: left; width: 100%; font-family: inherit;
}
.nav-item .lbl { font-size: 13.5px; font-weight: 600; display: block; }
.nav-item .cap { font-size: 10.5px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.06em; }
.nav-item:hover { background: var(--hover); }
.nav-item.active { color: var(--accent); background: rgba(66,164,220,0.14); }
.nav-item.active .lbl { color: var(--accent); }
.sidebar .spacer { flex: 1; }

/* ---- Collapsible nav group ----
   Oversight and setup screens live behind one heading rather than as eight
   more items in a list you scan every day. Opens itself when the page you're
   on is inside it, so you never see a collapsed group hiding the active page. */
.nav-group { display: contents; }
.nav-group-toggle {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 10px 12px; margin-top: 6px; border-radius: 8px;
  border: 0; background: none; color: var(--text-2); cursor: pointer;
  font-family: inherit; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em; text-align: left;
}
.nav-group-toggle:hover { background: var(--hover); color: var(--text); }
.nav-group-toggle .caret {
  margin-left: auto; font-size: 9px; line-height: 1;
  transition: transform 0.15s ease;
}
.nav-group-toggle[aria-expanded="true"] .caret { transform: rotate(90deg); }
/* A dot when the group is shut but something inside it is the current page —
   otherwise the sidebar gives no clue where you are. */
.nav-group-toggle[aria-expanded="false"].has-active::after {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); margin-left: 6px; flex: none;
}
.nav-group-items { display: flex; flex-direction: column; gap: 2px; }
.nav-group-items[hidden] { display: none; }
.nav-group-items .nav-item { padding-left: 22px; }
.content { flex: 1; padding: 24px 28px; display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* ---- Page header ---- */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; font-weight: 600; margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ctx-pill {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-2); background: var(--hover); border-radius: 20px; padding: 5px 12px;
}
.page-head .right { font-size: 13px; color: var(--text-2); padding-top: 6px; }
.one-liner { font-size: 12.5px; color: var(--muted); margin: -12px 0 0; }

/* ---- Cards & widgets ---- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; }
.widget-title {
  font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin: 0 0 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.micro-pill {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-2); background: var(--hover); border-radius: 4px; padding: 3px 8px;
}

/* ---- Pills & tags ---- */
.pill { font-size: 11px; font-weight: 600; border-radius: 20px; padding: 4px 11px; display: inline-block; }
.pill-ok { color: var(--ok); background: rgba(67,199,154,0.14); }
.pill-warn { color: var(--warn-text); background: rgba(229,176,78,0.14); }
.pill-danger { color: var(--danger-text); background: rgba(224,80,70,0.18); }
.pill-info { color: var(--accent); background: rgba(66,164,220,0.14); }
.pill-muted { color: var(--text-2); background: var(--hover); }
.tag-warn {
  font-size: 10.5px; color: var(--warn-text); background: rgba(229,176,78,0.12);
  border: 1px solid rgba(229,176,78,0.25); border-radius: 4px; padding: 2px 8px; display: inline-block;
}

/* ---- Stepper ---- */
.stepper { display: flex; }
/* A <button>, because every stage opens its own history — reset to look
   exactly as it did as a <div>, but keyboard-reachable and obviously
   clickable on hover. */
.step {
  flex: 1; text-align: center; position: relative; padding: 4px 4px 6px;
  border: 0; background: none; font-family: inherit; cursor: pointer;
  border-radius: 8px;
}
.step:hover { background: var(--hover); }
.step:hover .lbl { color: var(--text); }
.step:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.step::before {
  content: ''; position: absolute; top: 20px; left: -50%; width: 100%; height: 2px;
  background: var(--border); z-index: 0;
}
.step:first-child::before { display: none; }
.step.done::before { background: var(--mid); }
.step .circle {
  width: 32px; height: 32px; border-radius: 50%; margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 600; position: relative; z-index: 1;
  border: 2px solid var(--border); color: var(--muted); background: var(--card);
}
.step.done .circle { background: var(--accent); border-color: var(--accent); color: #0A141D; }
.step.current .circle { border-color: var(--accent); color: var(--accent); }
.step .lbl { font-size: 12px; font-weight: 600; margin-top: 8px; color: var(--text-soft); }
.step.locked .lbl { color: var(--muted); }
.step .state { font-size: 9.5px; font-weight: 700; letter-spacing: 0.08em; margin-top: 2px; }
.step.done .state { color: var(--ok); }
.step.current .state { color: var(--accent); }
.step.locked .state { color: var(--disabled); }

/* Copy button on a read-only fact find field. Sits inside the box against its
   right edge — your eye is already on the value when you decide to copy it —
   and stays invisible until the field is hovered, because sixty of these
   shouting at once would drown the answers they belong to. */
.copy-wrap { position: relative; display: block; }
.copy-wrap > .input { padding-right: 54px; }
.copy-btn {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  border: 0; cursor: pointer; font-family: inherit;
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); background: var(--card); border-radius: 4px; padding: 3px 5px;
  opacity: 0; transition: opacity 0.12s ease;
}
/* Textareas grow, so pin to the top rather than a centre that keeps moving. */
.copy-wrap.is-textarea .copy-btn { top: 9px; transform: none; }
/* Clear of the select's own dropdown arrow. */
.copy-wrap.is-select .copy-btn { right: 30px; }
.copy-wrap:hover .copy-btn, .copy-btn:focus-visible { opacity: 1; }
.copy-btn:hover { color: var(--accent); }
.copy-btn.done { opacity: 1; color: var(--ok); }

/* A client name that opens their file — plain until hovered, so a table of
   them doesn't read as a wall of links. */
.client-link { color: inherit; text-decoration: none; }
.client-link:hover { color: var(--accent); text-decoration: underline; }

/* ---- Gate checklist ---- */
.gate-row { display: flex; align-items: center; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--hairline); }
.gate-row:last-child { border-bottom: 0; }
.gate-check {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  border: 2px solid var(--mid); display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #0A141D;
}
.gate-row.done .gate-check { background: var(--ok); border-color: var(--ok); }
.gate-main { flex: 1; min-width: 0; }
.gate-title { font-size: 14.5px; font-weight: 600; }
.gate-row.done .gate-title { color: var(--text-2); }
.gate-note { font-size: 12px; color: var(--muted); }
.progress { height: 6px; border-radius: 4px; background: var(--hover); overflow: hidden; margin: 10px 0 6px; }
.progress > div { height: 100%; background: var(--accent); border-radius: 4px; }
.gate-warning { font-size: 12.5px; color: var(--warn); }

/* ---- Buttons & inputs ---- */
.btn {
  font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer;
  border-radius: 8px; padding: 10px 16px; border: 1px solid transparent;
}
.btn-primary { background: var(--accent); color: #0A141D; }
.btn-primary:hover { background: var(--accent-light); }
.btn-ghost { background: none; color: var(--accent); border-color: var(--mid); }
.btn-ghost:hover { background: var(--hover); }
.btn-danger-ghost { background: none; color: var(--danger-text); border-color: rgba(224,80,70,0.4); }
.btn:disabled { background: var(--hover); color: var(--muted); cursor: not-allowed; border-color: transparent; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 7px; }

label.fld { display: block; font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.input, textarea.input, select.input {
  width: 100%; font-family: inherit; font-size: 15px; color: var(--text);
  background: var(--inset); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 14px;
}
.input:focus, textarea.input:focus, select.input:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(66,164,220,0.22);
}
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field-grid .full { grid-column: 1 / -1; }

/* ---- Tables ---- */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th {
  text-align: left; font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted); background: var(--inset);
  padding: 10px 12px;
}
.tbl td { padding: 13px 12px; border-bottom: 1px solid var(--hairline); font-size: 13.5px; }
.tbl tbody tr:hover { background: var(--hover); cursor: pointer; }
.tbl .num { font-variant-numeric: tabular-nums; }

/* ---- Drag-and-drop upload ---- */
.dropzone {
  margin-top: 8px; padding: 14px 12px; text-align: center;
  border: 1px dashed var(--mid); border-radius: 8px;
  font-size: 12px; color: var(--muted); transition: all 0.12s;
}
.dropzone .dz-active { display: none; }
.dropzone.over {
  border-color: var(--accent); border-style: solid;
  background: rgba(66,164,220,0.1); color: var(--accent);
}
.dropzone.over .dz-idle { display: none; }
.dropzone.over .dz-active { display: inline; font-weight: 600; }
.dropzone.busy { border-color: var(--warn); color: var(--warn-text); }

/* ---- Misc ---- */
.grid-3 { display: grid; grid-template-columns: 290px 1fr 300px; gap: 20px; align-items: start; }
.grid-ff { display: grid; grid-template-columns: 230px 1fr; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .grid-3, .grid-ff { grid-template-columns: 1fr; } }
.stat-num { font-size: 27px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hint { font-size: 11px; color: var(--accent); }
.muted { color: var(--muted); }
.ok { color: var(--ok); }
.warn { color: var(--warn); }
.danger { color: var(--danger); }
.save-pill { display: inline-flex; align-items: center; gap: 6px; }
.save-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.save-pill.saving .dot { background: var(--warn); }
a { color: var(--accent); }
