/* ============================================================
   Advisory Client Portal — ported near-verbatim from the
   AdvisoryClientPortal2 mockup (portal/styles.css).
   Institutional & editorial: ink + warm neutrals, navy + gold,
   Newsreader + Hanken Grotesk, 268px sidebar.
   Phase-1 scaffolding additions are appended at the end.
   ============================================================ */

:root {
  /* Navy / ink */
  --navy-900: #0a1f33;
  --navy-800: #0f2a43;
  --navy-700: #173a59;
  --navy-600: #234c6e;

  /* Gold */
  --gold-400: #d8b873;
  --gold-500: #c9a35e;
  --gold-600: #ab8743;

  /* Warm neutrals */
  --paper:   #f4efe6;
  --paper-2: #ece5d8;
  --surface: #fffdf9;
  --surface-2: #faf6ee;

  --line:    #e6ddcd;
  --line-2:  #d9cfbb;

  --ink:     #1a232e;
  --ink-2:   #3b4654;
  --muted:   #6e6657;
  --faint:   #978d7b;

  /* Status */
  --green:   #3f7d56;
  --green-bg:#e7efe6;
  --amber:   #b07d2a;
  --amber-bg:#f4ebd7;
  --red:     #a8453a;
  --red-bg:  #f3e2de;
  --blue:    #2f5d8a;
  --blue-bg: #e3ebf2;

  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  /* navy used as FOREGROUND text/number color (flips light in dark mode) */
  --ink-accent: var(--navy-700);

  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(26,35,46,.05), 0 1px 3px rgba(26,35,46,.04);
  --shadow-md: 0 2px 8px rgba(26,35,46,.06), 0 8px 24px rgba(26,35,46,.06);
  --shadow-lg: 0 12px 40px rgba(10,31,51,.16);

  --sidebar-w: 268px;
  --gap: 24px;
}

/* density */
[data-density="compact"] { --gap: 16px; }
[data-density="comfortable"] { --gap: 28px; }

/* dark mode */
[data-theme="dark"] {
  --paper: #14181d;
  --paper-2: #0f1216;
  --surface: #1b2027;
  --surface-2: #20262e;
  --line: #2c333d;
  --line-2: #39414c;
  --ink: #eef1f4;
  --ink-2: #c2cad3;
  --muted: #93a0ac;
  --faint: #6f7a86;
  --green-bg:#1c2c24;
  --amber-bg:#322a18;
  --red-bg:  #341f1d;
  --blue-bg: #18293a;
  --ink-accent: var(--gold-400);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--gold-400); color: var(--navy-900); }

/* ---------- Layout shell ---------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  background: linear-gradient(178deg, var(--navy-800), var(--navy-900));
  color: #e7ecf2;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid rgba(255,255,255,.06);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 22px 20px;
}
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--gold-400), var(--gold-600));
  display: grid; place-items: center;
  color: var(--navy-900);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35);
  flex-shrink: 0;
}
.brand-name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 560;
  letter-spacing: .2px;
  line-height: 1.05;
}
.brand-name span { display: block; font-family: var(--sans); font-size: 10.5px; letter-spacing: 2.2px; text-transform: uppercase; color: var(--gold-400); font-weight: 600; margin-top: 3px; }

.org-switch {
  margin: 4px 16px 14px;
  padding: 11px 13px;
  border-radius: 9px;
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  display: flex; align-items: center; gap: 11px;
  cursor: pointer;
  transition: background .15s;
}
.org-switch:hover { background: rgba(255,255,255,.08); }
.org-logo {
  width: 30px; height: 30px; border-radius: 7px; flex-shrink: 0;
  background: #f4efe6; color: var(--navy-800);
  display: grid; place-items: center; font-weight: 700; font-size: 13px;
}
.org-meta { line-height: 1.25; min-width: 0; }
.org-meta b { font-size: 13.5px; font-weight: 600; display:block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-meta small { font-size: 11px; color: rgba(231,236,242,.55); }
.org-switch svg { margin-left: auto; opacity: .5; flex-shrink: 0; }

.nav { flex: 1; overflow-y: auto; padding: 6px 12px 12px; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.nav-label {
  font-size: 10px; letter-spacing: 1.6px; text-transform: uppercase;
  color: rgba(231,236,242,.4); font-weight: 600;
  padding: 14px 12px 6px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: 8px;
  color: rgba(231,236,242,.78);
  font-size: 13.5px; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  position: relative;
  transition: background .14s, color .14s;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; opacity: .85; }
.nav-item > span:not(.nav-badge) { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-badge { flex-shrink: 0; flex-grow: 0; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(201,163,94,.16); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-500);
}
.nav-badge {
  margin-left: auto; font-size: 11px; font-weight: 600;
  background: var(--gold-500); color: var(--navy-900);
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px;
  display: grid; place-items: center;
}
.nav-badge.muted { background: rgba(255,255,255,.14); color: #e7ecf2; }

.sidebar-foot {
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex; align-items: center; gap: 11px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
  background: linear-gradient(150deg, var(--navy-600), var(--navy-700));
  color: #fff; border: 1px solid rgba(255,255,255,.14);
}
.sidebar-foot .who { line-height: 1.25; min-width: 0; }
.sidebar-foot .who b { font-size: 13px; font-weight: 600; display: block; }
.sidebar-foot .who small { font-size: 11px; color: rgba(231,236,242,.5); }
.icon-btn-ghost { margin-left: auto; background: none; border: none; color: rgba(231,236,242,.6); display:grid; place-items:center; padding:6px; border-radius:6px; }
.icon-btn-ghost:hover { background: rgba(255,255,255,.08); color:#fff; }
/* on light surfaces (doc rows, tables) */
.doc-row .icon-btn-ghost:hover, .list-row .icon-btn-ghost:hover { background: var(--surface-2); color: var(--ink) !important; }
.doc-row .icon-btn-ghost.danger:hover, .list-row .icon-btn-ghost.danger:hover { background: var(--red-bg); color: var(--red) !important; }

/* ---------- Main area ---------- */
.main { display: flex; flex-direction: column; min-width: 0; background: var(--paper); }
.topbar {
  height: 68px; flex-shrink: 0;
  display: flex; align-items: center; gap: 18px;
  padding: 0 36px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 {
  font-family: var(--serif);
  font-size: 23px; font-weight: 540; margin: 0;
  letter-spacing: .2px; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .crumb { font-size: 12.5px; color: var(--muted); margin-bottom: 2px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 360px; }
.topbar > div:first-child { display: flex; flex-direction: column; justify-content: center; min-width: 0; flex: 1 1 auto; }
.search {
  margin-left: auto;
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 13px; width: 270px;
  color: var(--faint); font-size: 13px;
}
.search input { border: none; background: none; outline: none; flex: 1; font-family: inherit; font-size: 13px; color: var(--ink); }
.top-icon {
  width: 39px; height: 39px; border-radius: 9px;
  border: 1px solid var(--line); background: var(--surface);
  display: grid; place-items: center; color: var(--ink-2);
  position: relative;
}
.top-icon:hover { background: var(--surface-2); }
.top-icon .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); border: 1.5px solid var(--surface); }

.content { padding: 32px 36px 56px; max-width: 1320px; width: 100%; }
.content.narrow { max-width: 920px; }

/* ---------- Typography helpers ---------- */
.eyebrow { font-size: 11px; letter-spacing: 1.8px; text-transform: uppercase; color: var(--gold-600); font-weight: 700; }
.section-title { font-family: var(--serif); font-size: 19px; font-weight: 540; margin: 0; color: var(--ink); letter-spacing: .2px; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  border: 1px solid transparent; transition: all .15s; white-space: nowrap;
}
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--navy-800); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--navy-700); }
.btn-gold { background: linear-gradient(160deg, var(--gold-500), var(--gold-600)); color: var(--navy-900); box-shadow: var(--shadow-sm); }
.btn-gold:hover { filter: brightness(1.04); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-2); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--faint); }
.btn-quiet { background: none; color: var(--ink-2); padding: 8px 12px; }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--red); color: #fff; box-shadow: var(--shadow-sm); }
.btn-danger:hover { filter: brightness(1.06); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad { padding: 22px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
}
.card-head h3 { margin: 0; font-family: var(--serif); font-size: 16.5px; font-weight: 540; white-space: nowrap; }
.card-head .link { margin-left: auto; }

.link {
  color: var(--ink-accent); font-size: 13px; font-weight: 600;
  background: none; border: none; display: inline-flex; align-items: center; gap: 5px;
  white-space: nowrap;
}
.link:hover { color: var(--gold-600); }
.link svg { width: 14px; height: 14px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 100px; font-size: 11.5px; font-weight: 600;
  letter-spacing: .2px; white-space: nowrap;
}
.badge .pip { width: 6px; height: 6px; border-radius: 50%; }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.green .pip { background: var(--green); }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.amber .pip { background: var(--amber); }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.red .pip { background: var(--red); }
.badge.blue { background: var(--blue-bg); color: var(--blue); }
.badge.blue .pip { background: var(--blue); }
.badge.neutral { background: var(--paper-2); color: var(--muted); }
.badge.neutral .pip { background: var(--faint); }

.tag {
  display: inline-flex; align-items: center;
  padding: 4px 10px; border-radius: 7px; font-size: 12px; font-weight: 500;
  background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line);
  white-space: nowrap;
}

/* ---------- Grids ---------- */
.grid { display: grid; gap: var(--gap); }
.row { display: flex; gap: var(--gap); }

/* ---------- Stat / KPI tiles ---------- */
.kpi {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.kpi .k-label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .2px; }
.kpi .k-val { font-family: var(--serif); font-size: 33px; font-weight: 540; line-height: 1; margin: 11px 0 7px; color: var(--ink); }
.kpi .k-val small { font-size: 16px; color: var(--muted); font-weight: 500; }
.kpi .k-foot { font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 6px; }
.kpi .k-ic { position: absolute; top: 16px; right: 16px; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; }

/* ---------- Tables / lists ---------- */
.list-row {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.list-row:last-child { border-bottom: none; }
.list-row.click { cursor: pointer; }
.list-row.click:hover { background: var(--surface-2); }

table.tbl { width: 100%; border-collapse: collapse; }
table.tbl th {
  text-align: left; font-size: 11px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line);
}
table.tbl td { padding: 15px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tbody tr.click { cursor: pointer; }
table.tbl tbody tr.click:hover { background: var(--surface-2); }

/* ---------- Avatars (advisors) ---------- */
.adv-av {
  width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 600; font-size: 15px;
  color: #fff; font-family: var(--serif);
}
.adv-av.sm { width: 32px; height: 32px; font-size: 12px; }
.adv-av.lg { width: 64px; height: 64px; font-size: 22px; }

/* ---------- Progress ---------- */
.bar { height: 7px; background: var(--paper-2); border-radius: 100px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, var(--navy-700), var(--navy-600)); border-radius: 100px; }
.bar.gold > i { background: linear-gradient(90deg, var(--gold-600), var(--gold-400)); }

/* ---------- Wizard ---------- */
.stepper { display: flex; flex-direction: column; gap: 2px; }
.step {
  display: flex; gap: 13px; padding: 12px 14px; border-radius: 9px;
  align-items: flex-start;
}
.step.active { background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.step .s-num {
  width: 26px; height: 26px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-size: 12.5px; font-weight: 700;
  background: var(--paper-2); color: var(--muted); border: 1.5px solid transparent;
}
.step.active .s-num { background: var(--navy-800); color: #fff; }
.step.done .s-num { background: var(--green-bg); color: var(--green); border-color: var(--green); }
.step .s-t { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.step .s-d { font-size: 12px; color: var(--faint); margin-top: 2px; }
.step:not(.active) .s-t { color: var(--ink-2); font-weight: 500; }

/* form controls */
.field { margin-bottom: 18px; }
.field > label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 7px; }
.field .hint { font-size: 12px; color: var(--faint); margin-top: 6px; }
.inp, .sel, .ta {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line-2);
  border-radius: 9px; background: var(--surface); font-family: inherit; font-size: 14px; color: var(--ink);
  transition: border .15s, box-shadow .15s;
}
.inp:focus, .sel:focus, .ta:focus { outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(35,76,110,.12); }
.ta { resize: vertical; min-height: 96px; line-height: 1.5; }

.choice-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.choice {
  text-align: left; padding: 16px; border: 1.5px solid var(--line-2); border-radius: 11px;
  background: var(--surface); display: flex; gap: 13px; align-items: flex-start; transition: all .14s;
}
.choice:hover { border-color: var(--navy-600); background: var(--surface-2); }
.choice.sel { border-color: var(--navy-700); background: color-mix(in srgb, var(--blue-bg) 50%, var(--surface)); box-shadow: 0 0 0 3px rgba(35,76,110,.1); }
.choice .c-ic { width: 38px; height: 38px; border-radius: 9px; background: var(--paper-2); display: grid; place-items: center; flex-shrink: 0; color: var(--navy-700); }
.choice.sel .c-ic { background: var(--navy-800); color: #fff; }
.choice .c-t { font-size: 14px; font-weight: 600; color: var(--ink); }
.choice .c-d { font-size: 12.5px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; overflow-x: auto; }
.tab {
  padding: 12px 16px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  background: none; border: none; border-bottom: 2px solid transparent; white-space: nowrap;
  display: flex; align-items: center; gap: 7px;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink-accent); border-bottom-color: var(--gold-500); }
.tab .t-count { font-size: 11px; background: var(--paper-2); color: var(--muted); padding: 1px 7px; border-radius: 8px; font-weight: 600; }
.tab.active .t-count { background: var(--navy-800); color: #fff; }

/* ---------- Messages ---------- */
.msg-shell { display: grid; grid-template-columns: 320px 1fr; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); height: 660px; }
.thread-list { border-right: 1px solid var(--line); overflow-y: auto; }
.thread {
  display: flex; gap: 12px; padding: 15px 18px; border-bottom: 1px solid var(--line); cursor: pointer; transition: background .12s;
}
.thread:hover { background: var(--surface-2); }
.thread.active { background: color-mix(in srgb, var(--blue-bg) 45%, var(--surface)); border-left: 3px solid var(--navy-700); padding-left: 15px; }
.thread .t-top { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.thread .t-name { font-size: 13.5px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .t-time { margin-left: auto; font-size: 11px; color: var(--faint); flex-shrink: 0; }
.thread .t-sub { font-size: 12px; color: var(--gold-600); font-weight: 600; margin: 2px 0; }
.thread .t-prev { font-size: 12.5px; color: var(--muted); line-height: 1.4; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.thread .unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold-500); flex-shrink: 0; margin-top: 6px; }

.msg-pane { display: flex; flex-direction: column; min-width: 0; }
.msg-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.msg-body { flex: 1; overflow-y: auto; padding: 24px 22px; background: var(--surface-2); display: flex; flex-direction: column; gap: 16px; }
.bubble { max-width: 70%; padding: 12px 15px; border-radius: 13px; font-size: 13.5px; line-height: 1.5; box-shadow: var(--shadow-sm); }
.bubble .b-who { font-size: 11.5px; font-weight: 700; margin-bottom: 4px; }
.bubble .b-time { font-size: 10.5px; color: var(--faint); margin-top: 5px; }
.bubble.them { background: var(--surface); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 4px; }
.bubble.me { background: var(--navy-800); color: #eaf0f6; align-self: flex-end; border-bottom-right-radius: 4px; }
.bubble.me .b-who { color: var(--gold-400); }
.bubble.me .b-time { color: rgba(234,240,246,.5); }
.msg-compose { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.msg-compose .inp { flex: 1; }

/* ---------- Documents ---------- */
.doc-row { display: flex; align-items: center; gap: 14px; padding: 13px 20px; border-bottom: 1px solid var(--line); transition: background .12s; }
.doc-row:hover { background: var(--surface-2); }
.doc-ic { width: 38px; height: 44px; border-radius: 6px; display: grid; place-items: center; font-size: 9px; font-weight: 800; color: #fff; flex-shrink: 0; letter-spacing: .3px; }
.doc-ic.pdf { background: #b0463b; }
.doc-ic.docx { background: #2f5d8a; }
.doc-ic.xlsx { background: #3f7d56; }
.doc-ic.pptx { background: #b07d2a; }
.doc-ic.zip { background: #6e6657; }

/* ---------- misc ---------- */
.divider { height: 1px; background: var(--line); border: none; margin: 0; }
.empty { text-align: center; padding: 60px 20px; color: var(--faint); }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 20px; font-size: 13.5px; }
.dl dt { color: var(--muted); font-weight: 500; white-space: nowrap; }
.dl dd { margin: 0; color: var(--ink); font-weight: 500; }

.fade-in { animation: fade .35s ease; }
@media (prefers-reduced-motion: reduce) { .fade-in { animation: none; } }
@keyframes fade { from { transform: translateY(8px); } }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--line-2); }
.tl-item { position: relative; padding-bottom: 22px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ''; position: absolute; left: -23px; top: 3px; width: 11px; height: 11px; border-radius: 50%; background: var(--surface); border: 2px solid var(--navy-600); }
.tl-item.gold::before { border-color: var(--gold-500); background: var(--gold-500); }
.tl-item .tl-time { font-size: 11.5px; color: var(--faint); font-weight: 600; }
.tl-item .tl-txt { font-size: 13px; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }

.scrolly { overflow-y: auto; }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10,31,51,.42);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
  padding: 32px;
}
.modal-card {
  width: 100%; max-height: calc(100vh - 64px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: flex-start; gap: 13px;
  padding: 20px 22px 16px; border-bottom: 1px solid var(--line);
}
.modal-ic {
  width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--navy-700); display: grid; place-items: center;
}
.modal-head h3 { margin: 0; font-family: var(--serif); font-size: 19px; font-weight: 540; letter-spacing: .2px; }
.modal-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.modal-x {
  width: 32px; height: 32px; border-radius: 8px; flex-shrink: 0;
  background: none; border: none; color: var(--faint);
  display: grid; place-items: center;
}
.modal-x:hover { background: var(--surface-2); color: var(--ink); }
.modal-body { padding: 22px; }
.modal-foot {
  padding: 16px 22px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  background: var(--surface-2);
}
.modal-foot .spread { margin-right: auto; }

/* ---------- Toasts ---------- */
.toast-host {
  position: fixed; bottom: 24px; right: 24px; z-index: 300;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
}
.toast {
  display: flex; align-items: center; gap: 11px;
  background: var(--navy-800); color: #eef2f6;
  padding: 13px 16px; border-radius: 11px;
  box-shadow: var(--shadow-lg);
  font-size: 13.5px; font-weight: 500; max-width: 380px;
  border: 1px solid rgba(255,255,255,.08);
  animation: toast-in .24s cubic-bezier(.2,.7,.3,1);
}
@keyframes toast-in { from { transform: translateX(20px); } }
.toast.leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-out { to { transform: translateX(20px); opacity: 0; } }
.toast .t-ic {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center;
}
.toast.success .t-ic { background: var(--green); color: #fff; }
.toast.info .t-ic { background: var(--gold-500); color: var(--navy-900); }
.toast.danger .t-ic { background: var(--red); color: #fff; }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--line-2); border-radius: 12px;
  padding: 30px 20px; text-align: center; background: var(--surface-2);
  cursor: pointer; transition: border .15s, background .15s;
}
.dropzone:hover { border-color: var(--navy-600); background: color-mix(in srgb, var(--blue-bg) 40%, var(--surface)); }
.dropzone .dz-ic { width: 46px; height: 46px; border-radius: 11px; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; margin: 0 auto 12px; color: var(--navy-700); }

/* ---------- Doc preview ---------- */
.doc-preview {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 28px 30px; font-family: var(--serif);
}
.doc-preview .dp-line { height: 9px; border-radius: 4px; background: var(--line-2); margin-bottom: 11px; }
.doc-preview .dp-line.short { width: 55%; }
.doc-preview .dp-line.mid { width: 78%; }

/* ---------- DataTables theming ---------- */
.dt-host { padding: 4px 4px 8px; }
.dt-top { padding: 14px 16px 12px; display: flex; }
.dt-bottom {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px 8px; border-top: 1px solid var(--line);
}
.dataTables_wrapper { font-family: var(--sans); color: var(--ink); }
.dataTables_wrapper .dataTables_filter { margin-left: auto; }
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--line-2); background: var(--surface);
  border-radius: 9px; padding: 9px 13px; font-family: inherit; font-size: 13px;
  color: var(--ink); width: 240px; transition: border .15s, box-shadow .15s; margin: 0;
}
.dataTables_wrapper .dataTables_filter input:focus {
  outline: none; border-color: var(--navy-600); box-shadow: 0 0 0 3px rgba(35,76,110,.12);
}
.dataTables_wrapper .dataTables_filter input::placeholder { color: var(--faint); }
.dataTables_wrapper .dataTables_info {
  font-size: 12.5px; color: var(--muted); padding: 0; font-weight: 500;
}
.dataTables_wrapper .dataTables_paginate { margin-left: auto; padding: 0; }
.dataTables_wrapper .dataTables_paginate .paginate_button {
  min-width: 32px; height: 32px; box-sizing: border-box;
  padding: 0 9px; margin: 0 2px; border-radius: 8px !important;
  border: 1px solid var(--line) !important; background: var(--surface) !important;
  color: var(--ink-2) !important; font-size: 13px; font-weight: 600;
  line-height: 30px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button:hover {
  background: var(--surface-2) !important; border-color: var(--line-2) !important; color: var(--ink) !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current,
.dataTables_wrapper .dataTables_paginate .paginate_button.current:hover {
  background: var(--navy-800) !important; border-color: var(--navy-800) !important; color: #fff !important;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
.dataTables_wrapper .dataTables_paginate .paginate_button.disabled:hover {
  opacity: .4; background: var(--surface) !important; color: var(--faint) !important; cursor: default;
}
/* table itself reuses .tbl; tune sort headers */
table.dt-table { border-collapse: collapse; margin: 0 !important; }
table.dt-table thead th {
  text-align: left; font-size: 11px; letter-spacing: .6px; text-transform: uppercase;
  color: var(--muted); font-weight: 600; padding: 12px 16px; border-bottom: 1px solid var(--line);
  position: relative;
}
table.dt-table thead th.dt-right { text-align: right; }
table.dt-table tbody td { padding: 15px 16px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
table.dt-table tbody tr:last-child td { border-bottom: 1px solid var(--line); }
table.dt-table.no-footer { border-bottom: none; }
table.dt-table td.dt-right { text-align: right; }
/* sort arrows: recolor DataTables defaults */
table.dt-table thead th.sorting,
table.dt-table thead th.sorting_asc,
table.dt-table thead th.sorting_desc { cursor: pointer; padding-right: 26px; }
table.dt-table thead .sorting:before, table.dt-table thead .sorting:after,
table.dt-table thead .sorting_asc:before, table.dt-table thead .sorting_asc:after,
table.dt-table thead .sorting_desc:before, table.dt-table thead .sorting_desc:after {
  right: 8px; opacity: .35; font-size: .9em;
}
table.dt-table thead .sorting_asc:before, table.dt-table thead .sorting_desc:after { opacity: .95; color: var(--navy-700); }
table.dt-table tbody tr:hover td { background: var(--surface-2); }

/* ---------- Notifications popover ---------- */
.notif-pop {
  position: absolute; top: 48px; right: 0; z-index: 50;
  width: 340px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.notif-head { display: flex; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.notif-head b { font-family: var(--serif); font-size: 15px; font-weight: 540; flex: 1; }
.notif-row {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
  padding: 13px 16px; border-bottom: 1px solid var(--line); background: none; border-left: none; border-right: none; border-top: none;
  transition: background .12s;
}
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: var(--surface-2); }
.notif-ic {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--navy-700); display: grid; place-items: center;
}

/* ============================================================
   Phase-1 scaffolding additions (not in the mock stylesheet):
   anchor reset for the PHP shell, hidden-by-default modal overlay,
   blocking loading overlay, login card, toast pill, disabled search.
   The mock's Tweaks panel is NOT rebuilt (no styles existed for it).
   ============================================================ */

/* the PHP shell renders nav items / org switcher / sign-out as anchors */
a { color: inherit; text-decoration: none; }
button.link { cursor: pointer; }

/* modal templates are hidden until openModal() adds .open (js/app.js) */
.modal-overlay { display: none; }
.modal-overlay.open { display: grid; }

/* shared blocking loading overlay (template.php) */
.loading-overlay { position: fixed; inset: 0; background: rgba(10,31,51,.42); backdrop-filter: blur(3px); z-index: 300; display: grid; place-items: center; }
.loading-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 22px 30px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.loading-spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--gold-500); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; color: var(--muted); font-weight: 600; }

/* global search is rendered but not wired until Phase 3 */
.search.search-off { opacity: .65; }
.search input:disabled { background: none; cursor: not-allowed; }

/* ---------- standalone login card (login.php / reset.php) ---------- */
.login-body { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(178deg, var(--paper) 0%, var(--paper-2) 100%); }
.login-wrap { width: 100%; max-width: 440px; padding: 24px; }
.login-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 32px 30px 26px; border-top: 3px solid var(--gold-500); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand .brand-mark { width: 40px; height: 40px; border-radius: 9px; background: linear-gradient(150deg, var(--gold-400), var(--gold-600)); display: grid; place-items: center; color: var(--navy-900); font-family: var(--serif); font-weight: 600; font-size: 22px; box-shadow: inset 0 1px 0 rgba(255,255,255,.35); }
.login-brand-name { font-family: var(--serif); font-weight: 560; font-size: 17px; color: var(--navy-800); line-height: 1.15; }
.login-brand-sub { font-size: 10.5px; letter-spacing: 2.2px; text-transform: uppercase; color: var(--gold-600); font-weight: 600; margin-top: 3px; }
.login-title { font-family: var(--serif); font-size: 27px; font-weight: 540; margin: 0 0 6px; color: var(--ink); letter-spacing: .2px; }
.login-desc { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; line-height: 1.5; }
.login-btn { width: 100%; justify-content: center; height: 44px; font-size: 14px; }
.login-foot { margin-top: 18px; text-align: center; color: var(--faint); font-size: 12.5px; }

/* ---------- toast pill host fallback (UI.toast creates .toast-host) ---------- */
.toast .t-txt { min-width: 0; }

/* gold badge kind (Phase 3 — proposal-ready / recommended chips) */
.badge.gold { background: color-mix(in srgb, var(--gold-500) 18%, var(--surface)); color: var(--gold-600); }
.badge.gold .pip { background: var(--gold-500); }
