/* ============================================================
   Mortgage Executive Advisory Network — Admin Portal
   Design system: conservative / institutional / finance-grade
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,500;0,8..60,600;0,8..60,700;1,8..60,400&family=Public+Sans:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  /* Brand navy ramp */
  --navy-950: #0b1c2e;
  --navy-900: #0f2840;
  --navy-800: #15334f;
  --navy-700: #1c4163;
  --navy-600: #275179;
  --navy-500: #356292;
  --navy-400: #5b81a8;

  /* Brass accent (premium, used sparingly) */
  --brass-700: #8a6a30;
  --brass-600: #a9824a;
  --brass-500: #c19a5b;
  --brass-300: #e3cfa6;
  --brass-100: #f6efe0;

  /* Neutral slate */
  --bg: #eef1f5;
  --surface: #ffffff;
  --surface-2: #f7f9fb;
  --surface-3: #eff3f7;
  --border: #dde3ea;
  --border-strong: #c8d1db;
  --ink: #18222e;
  --ink-2: #3f4c5a;
  --muted: #61707f;
  --faint: #8493a2;

  /* Status */
  --success: #1f7a52; --success-bg: #e4f1ea; --success-bd:#bfe0cf;
  --warning: #9a6610; --warning-bg: #fbf0db; --warning-bd:#f0dcb4;
  --danger:  #b23a26; --danger-bg:  #fbe7e2; --danger-bd:#f1cabf;
  --info:    #2a5e8f; --info-bg:    #e7f0f8; --info-bd:#c9ddee;
  --neutral: #5a6675; --neutral-bg: #eceff3; --neutral-bd:#d8dee6;
  --purple:  #6b4a93; --purple-bg:  #efe9f6; --purple-bd:#ddd0ec;

  /* Sidebar */
  --side-bg: #102a44;
  --side-bg-2: #0d2238;
  --side-ink: #c5d3e2;
  --side-ink-dim: #7f95ac;
  --side-active-bg: rgba(193,154,91,0.12);
  --side-hover: rgba(255,255,255,0.05);

  --radius: 8px;
  --radius-sm: 6px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(15,40,64,0.06), 0 1px 1px rgba(15,40,64,0.04);
  --shadow: 0 2px 8px rgba(15,40,64,0.08), 0 1px 2px rgba(15,40,64,0.05);
  --shadow-lg: 0 12px 32px rgba(11,28,46,0.18), 0 4px 12px rgba(11,28,46,0.10);

  --sans: 'Public Sans', system-ui, -apple-system, sans-serif;
  --serif: 'Source Serif 4', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;

  --sidebar-w: 256px;
  --sidebar-w-collapsed: 68px;
  --topbar-h: 60px;

  /* density */
  --row-h: 46px;
  --pad-card: 20px;
  --fs-table: 13.5px;
}

[data-density="compact"] {
  --row-h: 38px;
  --pad-card: 16px;
  --fs-table: 13px;
}

/* Dark theme */
[data-theme="dark"] {
  --bg: #0c1722;
  --surface: #122131;
  --surface-2: #16273a;
  --surface-3: #1b2f44;
  --border: #23364b;
  --border-strong: #2e455d;
  --ink: #e7eef5;
  --ink-2: #b6c4d2;
  --muted: #8699aa;
  --faint: #6a7d8f;
  --success-bg:#11302a; --success-bd:#1f4a3a;
  --warning-bg:#33270f; --warning-bd:#5a431a;
  --danger-bg: #3a201b; --danger-bd:#5e3329;
  --info-bg:   #15293c; --info-bd:#274867;
  --neutral-bg:#1c2a3a; --neutral-bd:#2d3f53;
  --purple-bg: #261f38; --purple-bd:#3c2f57;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 2px 10px rgba(0,0,0,0.35);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.5);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--brass-300); color: var(--navy-900); }

/* Scrollbars */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================ LAYOUT */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
  transition: grid-template-columns .18s ease;
}
.app[data-collapsed="true"] { grid-template-columns: var(--sidebar-w-collapsed) 1fr; }

/* ============================================================ SIDEBAR */
.sidebar {
  background: linear-gradient(180deg, var(--side-bg) 0%, var(--side-bg-2) 100%);
  color: var(--side-ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid rgba(0,0,0,0.2);
}
.brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
  flex-shrink: 0;
}
.brand-mark {
  width: 34px; height: 34px; flex-shrink: 0;
  border-radius: 7px;
  background: linear-gradient(150deg, var(--brass-500), var(--brass-700));
  display: grid; place-items: center;
  font-family: var(--serif);
  font-weight: 700; font-size: 17px; color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.25);
}
.brand-text { overflow: hidden; }
.brand-name {
  font-family: var(--serif);
  font-weight: 600; font-size: 14.5px; color: #fff;
  white-space: nowrap; line-height: 1.1;
}
.brand-sub {
  font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--side-ink-dim); white-space: nowrap; margin-top: 2px;
}
.app[data-collapsed="true"] .brand-text { display: none; }

.nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 12px 12px 20px; }
.nav::-webkit-scrollbar { width: 8px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); }
.nav-group { margin-top: 16px; }
.nav-group:first-child { margin-top: 4px; }
.nav-group-label {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--side-ink-dim); padding: 6px 10px 6px; font-weight: 600;
}
.app[data-collapsed="true"] .nav-group-label { opacity: 0; height: 8px; padding: 0; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--radius-sm);
  color: var(--side-ink); font-size: 13.5px; font-weight: 500;
  cursor: pointer; position: relative; margin-bottom: 1px;
  white-space: nowrap;
}
.nav-item:hover { background: var(--side-hover); color: #fff; }
.nav-item.active { background: var(--side-active-bg); color: #fff; }
.nav-item.active::before {
  content: ''; position: absolute; left: -12px; top: 6px; bottom: 6px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--brass-500);
}
.nav-item .ic { flex-shrink: 0; width: 18px; height: 18px; opacity: 0.85; }
.nav-item.active .ic { opacity: 1; }
.nav-item .nav-label { flex: 1; overflow: hidden; }
.nav-badge {
  background: var(--brass-600); color: #fff; font-size: 11px; font-weight: 600;
  min-width: 19px; height: 19px; border-radius: 10px; padding: 0 6px;
  display: grid; place-items: center;
}
.nav-badge.alert { background: var(--danger); }
.app[data-collapsed="true"] .nav-label,
.app[data-collapsed="true"] .nav-badge { display: none; }
.app[data-collapsed="true"] .nav-item { justify-content: center; padding: 9px; }

.side-foot {
  border-top: 1px solid rgba(255,255,255,0.07); padding: 10px 12px;
  flex-shrink: 0;
}
.side-user {
  display: flex; align-items: center; gap: 10px; padding: 7px 8px;
  border-radius: var(--radius-sm); cursor: pointer;
}
.side-user:hover { background: var(--side-hover); }
.side-user .avatar { flex-shrink: 0; }
.side-user-info { overflow: hidden; }
.side-user-name { font-size: 13px; color: #fff; font-weight: 600; white-space: nowrap; }
.side-user-role { font-size: 11px; color: var(--side-ink-dim); white-space: nowrap; }
.app[data-collapsed="true"] .side-user-info, 
.app[data-collapsed="true"] .side-user .chev { display: none; }

/* ============================================================ MAIN */
.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
}
.topbar-toggle {
  width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; color: var(--muted); flex-shrink: 0;
}
.topbar-toggle:hover { background: var(--surface-2); color: var(--ink); }
.crumbs { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); min-width: 0; }
.crumbs .sep { color: var(--faint); }
.crumbs .cur { color: var(--ink); font-weight: 600; }
.topbar-search {
  margin-left: 6px; flex: 1; max-width: 420px; position: relative;
}
.topbar-search input {
  width: 100%; height: 38px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2);
  padding: 0 12px 0 38px; font-family: inherit; font-size: 13.5px; color: var(--ink);
  outline: none;
}
.topbar-search input:focus { border-color: var(--navy-500); background: var(--surface); box-shadow: 0 0 0 3px rgba(53,98,146,0.12); }
.topbar-search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.topbar-search kbd {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 11px; color: var(--faint);
  border: 1px solid var(--border); border-radius: 4px; padding: 1px 6px; background: var(--surface);
}
.topbar-spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  display: grid; place-items: center; color: var(--muted); position: relative;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 1.5px solid var(--surface); }
.role-pill {
  display: flex; align-items: center; gap: 7px; height: 38px; padding: 0 12px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  font-size: 13px; font-weight: 600; color: var(--ink-2);
}
.role-pill .swatch { width: 8px; height: 8px; border-radius: 50%; background: var(--brass-500); }

.content { flex: 1; overflow-y: auto; }
.page { padding: 24px 28px 60px; max-width: 1500px; margin: 0 auto; animation: fade .25s ease both; }
@keyframes fade { from { transform: translateY(5px); } to { transform: none; } }

/* ============================================================ PAGE HEADER */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-title { font-family: var(--serif); font-size: 26px; font-weight: 600; color: var(--ink); letter-spacing: -0.01em; margin: 0; }
.page-desc { color: var(--muted); font-size: 14px; margin-top: 4px; max-width: 640px; }
.page-head-actions { display: flex; gap: 9px; align-items: center; }

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 7px; height: 38px; padding: 0 15px;
  border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--ink); font-size: 13.5px; font-weight: 600;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--navy-700); border-color: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-600); border-color: var(--navy-700); }
.btn-accent { background: var(--brass-600); border-color: var(--brass-700); color: #fff; }
.btn-accent:hover { background: var(--brass-500); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn-danger { background: var(--surface); border-color: var(--danger-bd); color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn-icon { padding: 0; width: 38px; justify-content: center; }
.btn-icon.btn-sm { width: 32px; }

/* ============================================================ CARDS / SURFACES */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.card-pad { padding: var(--pad-card); }
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 15px var(--pad-card); border-bottom: 1px solid var(--border);
}
.card-title { font-weight: 600; font-size: 14.5px; color: var(--ink); display: flex; align-items: center; gap: 9px; }
.card-title .ic { color: var(--navy-500); width: 17px; height: 17px; }
.card-sub { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.card-link { font-size: 12.5px; color: var(--navy-600); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.card-link:hover { color: var(--navy-500); }

.grid { display: grid; gap: 18px; }
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1180px) { .grid-4 { grid-template-columns: repeat(2,1fr); } .grid-3 { grid-template-columns: repeat(2,1fr);} }

/* ============================================================ KPI */
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 600; letter-spacing: 0.01em; }
.kpi-ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--navy-600); }
.kpi-val { font-family: var(--serif); font-size: 30px; font-weight: 600; color: var(--ink); margin-top: 9px; letter-spacing: -0.02em; line-height: 1; }
.kpi-foot { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 12px; color: var(--muted); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 12px; }
.trend.up { color: var(--success); }
.trend.down { color: var(--danger); }
.trend.flat { color: var(--muted); }

/* ============================================================ BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 6px; font-size: 12px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent;
}
.badge .bdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.success { color: var(--success); background: var(--success-bg); border-color: var(--success-bd); }
.badge.warning { color: var(--warning); background: var(--warning-bg); border-color: var(--warning-bd); }
.badge.danger  { color: var(--danger);  background: var(--danger-bg);  border-color: var(--danger-bd); }
.badge.info    { color: var(--info);    background: var(--info-bg);    border-color: var(--info-bd); }
.badge.neutral { color: var(--neutral); background: var(--neutral-bg); border-color: var(--neutral-bd); }
.badge.purple  { color: var(--purple);  background: var(--purple-bg);  border-color: var(--purple-bd); }
.badge.brass   { color: var(--brass-700); background: var(--brass-100); border-color: var(--brass-300); }
.badge-lg { height: 26px; font-size: 12.5px; padding: 0 11px; }

/* pill tag */
.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 10px;
  border-radius: 14px; font-size: 12px; font-weight: 500; color: var(--ink-2);
  background: var(--surface-3); border: 1px solid var(--border);
}
.tag .ic { width: 13px; height: 13px; color: var(--faint); }

/* ============================================================ AVATAR */
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 600; font-size: 13px; color: #fff;
  background: var(--navy-600); letter-spacing: 0.01em; overflow: hidden;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11.5px; }
.avatar.lg { width: 52px; height: 52px; font-size: 18px; }
.avatar.xl { width: 76px; height: 76px; font-size: 26px; font-family: var(--serif); }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ============================================================ TABLES */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: var(--fs-table); }
table.tbl th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 11.5px;
  letter-spacing: 0.04em; text-transform: uppercase; padding: 11px 14px;
  border-bottom: 1px solid var(--border); background: var(--surface-2);
  position: sticky; top: 0; white-space: nowrap;
}
table.tbl td { padding: 0 14px; height: var(--row-h); border-bottom: 1px solid var(--border); color: var(--ink-2); vertical-align: middle; }
table.tbl tbody tr { transition: background .1s; }
table.tbl tbody tr:hover { background: var(--surface-2); }
table.tbl tbody tr.clickable { cursor: pointer; }
table.tbl tbody tr:last-child td { border-bottom: none; }
.td-strong { color: var(--ink); font-weight: 600; }
.td-mono { font-family: var(--mono); font-size: 12.5px; color: var(--muted); }
.td-2 { display: flex; flex-direction: column; gap: 1px; }
.td-2 .t1 { color: var(--ink); font-weight: 600; }
.td-2 .t2 { color: var(--muted); font-size: 12px; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.num { font-variant-numeric: tabular-nums; }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ============================================================ FILTER BAR */
.toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 16px; }
.search-box { position: relative; flex: 1; min-width: 200px; max-width: 340px; }
.search-box input {
  width: 100%; height: 38px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 0 12px 0 36px; font-family: inherit; font-size: 13.5px; color: var(--ink); outline: none;
}
.search-box input:focus { border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(53,98,146,0.10); }
.search-box .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.select {
  height: 38px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface);
  padding: 0 30px 0 12px; font-family: inherit; font-size: 13.5px; color: var(--ink-2); font-weight: 500;
  appearance: none; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2361707f' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
}
.select:focus { border-color: var(--navy-500); }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.seg button { height: 36px; padding: 0 13px; border: none; background: transparent; font-size: 13px; font-weight: 600; color: var(--muted); border-right: 1px solid var(--border); }
.seg button:last-child { border-right: none; }
.seg button.active { background: var(--navy-700); color: #fff; }
.seg button:not(.active):hover { background: var(--surface-2); color: var(--ink); }

/* ============================================================ TABS */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tab {
  padding: 11px 15px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  background: transparent; border: none; border-bottom: 2px solid transparent;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  white-space: nowrap; margin-bottom: -1px; display: flex; align-items: center; gap: 7px;
  transition: color .12s ease, background .12s ease, border-color .12s ease;
}
.tab:hover { color: var(--ink); background: var(--surface-2); }
.tab.active { color: var(--navy-700); border-bottom-color: var(--brass-500); }
.tab .cnt { font-size: 11px; background: var(--surface-3); color: var(--muted); border-radius: 9px; padding: 1px 6px; font-weight: 600; }
.tab.active .cnt { background: var(--brass-100); color: var(--brass-700); }

/* ============================================================ MISC LIST ITEMS */
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.list-row:last-child { border-bottom: none; }
.list-row .lr-main { flex: 1; min-width: 0; }
.lr-title { font-weight: 600; color: var(--ink); font-size: 13.5px; }
.lr-sub { color: var(--muted); font-size: 12.5px; margin-top: 1px; }

/* progress */
.bar { height: 7px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 5px; background: var(--navy-500); }
.bar.brass > span { background: var(--brass-500); }
.bar.success > span { background: var(--success); }
.bar.warning > span { background: var(--warning); }
.bar.danger > span { background: var(--danger); }

/* divider */
.hr { height: 1px; background: var(--border); border: none; margin: 18px 0; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; font-size: 13.5px; }
.dl dt { color: var(--muted); font-weight: 500; }
.dl dd { margin: 0; color: var(--ink); font-weight: 500; }

/* timeline */
.timeline { position: relative; padding-left: 6px; }
.tl-item { position: relative; padding: 0 0 18px 24px; border-left: 2px solid var(--border); }
.tl-item:last-child { border-left-color: transparent; padding-bottom: 0; }
.tl-dot { position: absolute; left: -7px; top: 1px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface); border: 2px solid var(--navy-500); }
.tl-dot.brass { border-color: var(--brass-500); }
.tl-dot.success { border-color: var(--success); }
.tl-dot.danger { border-color: var(--danger); }
.tl-time { font-size: 11.5px; color: var(--faint); font-family: var(--mono); }
.tl-text { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.tl-text b { color: var(--ink); font-weight: 600; }

/* empty / callout */
.callout { display: flex; gap: 12px; padding: 14px 16px; border-radius: var(--radius); border: 1px solid; align-items: flex-start; font-size: 13px; }
.callout.info { background: var(--info-bg); border-color: var(--info-bd); color: var(--info); }
.callout.warning { background: var(--warning-bg); border-color: var(--warning-bd); color: var(--warning); }
.callout.danger { background: var(--danger-bg); border-color: var(--danger-bd); color: var(--danger); }
.callout .ic { flex-shrink: 0; margin-top: 1px; }
.callout b { display: block; margin-bottom: 2px; }
.callout-body { color: var(--ink-2); }

/* mini stat strip */
.statstrip { display: flex; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.statstrip .st { flex: 1; padding: 14px 18px; border-right: 1px solid var(--border); }
.statstrip .st:last-child { border-right: none; }
.st-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.st-val { font-family: var(--serif); font-size: 22px; font-weight: 600; color: var(--ink); margin-top: 4px; }

/* ============================================================ KANBAN */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; align-items: flex-start; }
.kan-col { flex: 0 0 280px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.kan-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.kan-title { font-weight: 600; font-size: 13px; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.kan-cnt { font-size: 11.5px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 1px 8px; font-weight: 600; }
.kan-body { padding: 10px; display: flex; flex-direction: column; gap: 9px; min-height: 60px; }
.kan-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow-sm); cursor: pointer; }
.kan-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.kan-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 7px; }
.kan-org { font-weight: 600; font-size: 13px; color: var(--ink); }
.kan-meta { font-size: 12px; color: var(--muted); margin-top: 6px; display: flex; align-items: center; gap: 10px; }

/* ============================================================ DRAWER / MODAL */
.scrim { position: fixed; inset: 0; background: rgba(11,28,46,0.45); backdrop-filter: blur(2px); z-index: 80; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 560px; max-width: 92vw; z-index: 90;
  background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  transform: translateX(100%); animation: slideIn .25s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes slideIn { to { transform: none; } }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.drawer-foot { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* modal */
.modal {
  position: relative; max-width: 94vw; max-height: 88vh; z-index: 95;
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(8px) scale(.99); animation: modalIn .2s cubic-bezier(.2,.8,.2,1) forwards;
}
@keyframes modalIn { to { transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 10px; background: var(--surface-2); }
.scrim { display: grid; place-items: center; }

/* form fields */
.ff { display: flex; flex-direction: column; gap: 6px; }
.ff-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ff-hint { font-size: 12px; color: var(--muted); }
.inp {
  width: 100%; min-height: 38px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 8px 12px; font-family: inherit; font-size: 13.5px; color: var(--ink); outline: none;
}
.inp:focus { border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(53,98,146,0.12); }
select.inp { appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2361707f' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }

/* table empty state */
.tbl-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 20px; color: var(--muted); font-size: 14px; }
.tbl-empty svg { color: var(--faint); }

/* ============================================================ DataTables.net theming */
.dataTables_wrapper { position: relative; width: 100%; }
.dt-top { display: flex; justify-content: flex-end; padding: 12px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.dt-bot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); }
.dataTables_filter label { display: flex; align-items: center; gap: 8px; margin: 0; }
.dataTables_filter input {
  min-width: 250px; height: 36px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); padding: 0 12px; font-family: inherit; font-size: 13.5px; color: var(--ink); outline: none;
}
.dataTables_filter input:focus { border-color: var(--navy-500); box-shadow: 0 0 0 3px rgba(53,98,146,0.12); }
.dataTables_info { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dataTables_paginate { display: flex; align-items: center; gap: 4px; }
.dataTables_paginate .paginate_button {
  display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 9px;
  border: 1px solid var(--border); border-radius: 6px; background: var(--surface);
  color: var(--ink-2) !important; font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
}
.dataTables_paginate .paginate_button:hover { background: var(--surface-3); border-color: var(--border-strong); }
.dataTables_paginate .paginate_button.current { background: var(--navy-700); border-color: var(--navy-800); color: #fff !important; }
.dataTables_paginate .paginate_button.disabled { opacity: .4; cursor: default; }
.dataTables_paginate .paginate_button.disabled:hover { background: var(--surface); border-color: var(--border); }
td.dataTables_empty { text-align: center; padding: 36px 20px; color: var(--muted); font-size: 13.5px; }

/* sortable header affordance + direction arrows */
table.tbl thead th.sorting, table.tbl thead th.sorting_asc, table.tbl thead th.sorting_desc { cursor: pointer; user-select: none; padding-right: 26px; position: relative; }
table.tbl thead th.sorting::after, table.tbl thead th.sorting_asc::after, table.tbl thead th.sorting_desc::after {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 10px; line-height: 1; font-weight: 700;
}
table.tbl thead th.sorting::after { content: '\2195'; opacity: .35; }
table.tbl thead th.sorting_asc::after { content: '\2191'; color: var(--navy-600); }
table.tbl thead th.sorting_desc::after { content: '\2193'; color: var(--navy-600); }
table.tbl thead th.text-right.sorting, table.tbl thead th.text-right.sorting_asc, table.tbl thead th.text-right.sorting_desc { padding-right: 26px; }

/* dropzone */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); padding: 28px; text-align: center; color: var(--navy-500); cursor: pointer; background: var(--surface-2); }
.dropzone:hover { border-color: var(--navy-500); background: var(--surface-3); }

/* preferences popover */
.pop { position: absolute; top: calc(var(--topbar-h) - 6px); right: 22px; width: 290px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); z-index: 70; padding: 14px; }
.pop h4 { margin: 0 0 4px; font-size: 13px; }
.pref-row { padding: 11px 0; border-bottom: 1px solid var(--border); }
.pref-row:last-child { border-bottom: none; }
.pref-label { font-size: 13px; font-weight: 600; color: var(--ink); margin-bottom: 8px; }
.swatches { display: flex; gap: 8px; }
.swatch-btn { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.swatch-btn.sel { border-color: var(--ink); box-shadow: 0 0 0 2px var(--surface) inset; }

/* helpers */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.serif { font-family: var(--serif); }
.mono { font-family: var(--mono); }
.fw6 { font-weight: 600; }
.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-6 { gap: 6px; } .gap-8 { gap: 8px; } .gap-10 { gap: 10px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24{margin-top:24px;}
.mb-0 { margin-bottom: 0; } .mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; } .mb-20{margin-bottom:20px;}
.fs-12 { font-size: 12px; } .fs-13 { font-size: 13px; } .fs-18 { font-size: 18px; }
.wrap { flex-wrap: wrap; }
.col { display: flex; flex-direction: column; }
.grow { flex: 1; min-width: 0; }
.nowrap { white-space: nowrap; }
.tags-row { display: flex; flex-wrap: wrap; gap: 6px; }
.sectn-title { font-family: var(--serif); font-size: 17px; font-weight: 600; color: var(--ink); margin: 0 0 12px; }

/* chart helpers */
.spark { display: flex; align-items: flex-end; gap: 3px; height: 44px; }
.spark > i { flex: 1; background: var(--navy-400); border-radius: 2px 2px 0 0; min-height: 3px; display: block; opacity: 0.85; }
.spark > i.hi { background: var(--brass-500); opacity: 1; }
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: 12px; font-size: 13px; }
.bar-row .bl { color: var(--ink-2); font-weight: 500; }
.bar-row .bv { text-align: right; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

.donut { width: 132px; height: 132px; border-radius: 50%; display: grid; place-items: center; }
.donut::after { content: ''; width: 84px; height: 84px; border-radius: 50%; background: var(--surface); }
.donut-center { position: absolute; text-align: center; }

.legend { display: flex; flex-direction: column; gap: 9px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.legend-dot { width: 11px; height: 11px; border-radius: 3px; flex-shrink: 0; }
.legend-val { margin-left: auto; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }

/* line chart container */
.linechart { width: 100%; height: 220px; }
.linechart svg { width: 100%; height: 100%; overflow: visible; }

/* toggle switch */
.switch { display: inline-flex; cursor: pointer; }
.switch .track { width: 40px; height: 23px; border-radius: 13px; background: var(--border-strong); position: relative; transition: background .18s; display: block; }
.switch .track.on { background: var(--navy-600); }
.switch .knob { position: absolute; top: 2px; left: 2px; width: 19px; height: 19px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: left .18s; }
.switch .track.on .knob { left: 19px; }

/* ============================================================
   PHP-PORTAL ADDITIONS (Phase 1 port — AdvisoryAdminPortal3)
   The SPA shell selectors above are class-based and map 1:1 onto
   the server-rendered template (.app / .sidebar / .main); only
   the blocks below are new.
   ============================================================ */

/* sidemenu footer sign-out */
.side-signout { margin-left: auto; color: var(--side-ink-dim); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; flex-shrink: 0; }
.side-signout:hover { background: var(--side-hover); color: #fff; }
.app[data-collapsed="true"] .side-signout { display: none; }

/* hidden DOM-template modals — shown/hidden by openModal()/closeModal() (js/app.js) */
.modal-overlay { position: fixed; inset: 0; background: rgba(11,28,46,0.45); backdrop-filter: blur(2px); z-index: 90; display: none; place-items: center; }
.modal-overlay.open { display: grid; }

/* shared blocking loading overlay (template.php) */
.loading-overlay { position: fixed; inset: 0; background: rgba(11,28,46,0.35); z-index: 300; display: grid; place-items: center; }
.loading-box { background: var(--surface); 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(--border); border-top-color: var(--brass-600); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13px; color: var(--muted); font-weight: 600; }

/* toast pill (js/app.js UI.toast) */
.toast-pill { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--navy-800); color: #fff; padding: 11px 18px; border-radius: 8px; font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg); z-index: 400; display: flex; align-items: center; gap: 9px; animation: fade .2s; }

/* login page (standalone — no template) */
.login-body { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(180deg, var(--bg) 0%, #e3e9f0 100%); }
.login-wrap { width: 100%; max-width: 430px; padding: 24px; }
.login-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 30px 28px 26px; border-top: 3px solid var(--brass-600); }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 24px; }
.login-brand-name { font-family: var(--serif); font-weight: 600; font-size: 15px; color: var(--navy-700); line-height: 1.15; }
.login-brand-sub { font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.login-title { font-family: var(--serif); font-size: 25px; font-weight: 600; margin: 0 0 6px; color: var(--ink); letter-spacing: -0.01em; }
.login-desc { color: var(--muted); font-size: 13.5px; margin: 0 0 22px; }
.login-btn { width: 100%; justify-content: center; height: 42px; font-size: 14px; }
.login-foot { margin-top: 18px; text-align: center; color: var(--faint); font-size: 12px; }

/* ============================================================
   PHASE-2 CHROME ADDITIONS (template.php topbar — search dropdown,
   notifications bell panel, unread count bubble)
   ============================================================ */

/* unread count bubble on the bell icon-btn */
.icon-btn .cnt {
  position: absolute; top: -6px; right: -6px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 9px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  display: grid; place-items: center; border: 1.5px solid var(--surface); line-height: 1;
}

/* global search typed dropdown (SEARCH-001) */
.search-drop {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 80;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); max-height: 420px; overflow-y: auto; display: none;
}
.search-drop.open { display: block; }
.search-drop .sg-label {
  padding: 9px 14px 4px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--faint);
}
.search-drop .sr {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px; cursor: pointer;
}
.search-drop .sr:hover, .search-drop .sr.sel { background: var(--surface-2); }
.search-drop .sr-ic {
  width: 28px; height: 28px; border-radius: 7px; background: var(--surface-3);
  display: grid; place-items: center; color: var(--navy-600); flex-shrink: 0;
}
.search-drop .sr-main { min-width: 0; display: flex; flex-direction: column; flex: 1; }
.search-drop .sr-title { font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-drop .sr-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-drop .sr-code { font-size: 11px; color: var(--faint); flex-shrink: 0; }

/* notifications bell panel (400px .pop variant) */
.bell-pop { width: 400px; right: 110px; }
.bell-list { max-height: 430px; overflow-y: auto; margin: 0 -14px -14px; border-top: 1px solid var(--border); }
.notif-row {
  display: flex; align-items: flex-start; gap: 11px; padding: 11px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.notif-row:last-child { border-bottom: none; }
.notif-row:hover { background: var(--surface-2); }
.notif-row.unread { background: var(--navy-50, rgba(53,98,146,0.06)); }
.notif-ic {
  width: 30px; height: 30px; border-radius: 8px; background: var(--surface-3);
  display: grid; place-items: center; color: var(--navy-600); flex-shrink: 0; margin-top: 1px;
}
.notif-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; flex: 1; }
.notif-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.notif-sub { font-size: 12px; color: var(--muted); }
.notif-when { font-size: 11px; color: var(--faint); margin-top: 2px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brass-500); flex-shrink: 0; margin-top: 6px; }
