/* =========================================================================
   Mortgage Advisory Group — Advisor Portal
   Editorial-premium design system: navy + gold, warm neutrals, serif heads
   ========================================================================= */

:root {
  /* Brand */
  --ink-900: #0c2138;
  --ink-800: #0f2740;
  --ink-700: #163655;
  --ink-600: #265279;
  --navy: #14385c;
  --gold: #b8901f;
  --gold-bright: #c9a227;
  --gold-soft: #e7d8a6;

  /* Warm neutrals */
  --cream: #f6f2ea;
  --cream-2: #efe9dd;
  --paper: #ffffff;
  --paper-2: #fbf9f4;
  --line: #e7e0d2;
  --line-strong: #d8cfbc;

  /* Text */
  --text: #23211c;
  --text-2: #504c43;
  --muted: #756f63;
  --muted-2: #9b9486;

  /* Status (muted, editorial) */
  --green: #3d7d6a;
  --green-bg: #e7efe9;
  --amber: #a6781f;
  --amber-bg: #f3ead2;
  --red: #9a3b34;
  --red-bg: #f1e2df;
  --blue: #3b6797;
  --blue-bg: #e3eaf2;
  --violet: #6a5797;
  --violet-bg: #eae5f1;

  /* Effects */
  --shadow-sm: 0 1px 2px rgba(20,30,45,.05), 0 1px 3px rgba(20,30,45,.04);
  --shadow-md: 0 2px 8px rgba(20,30,45,.06), 0 8px 24px rgba(20,30,45,.05);
  --shadow-lg: 0 12px 40px rgba(12,33,56,.16);
  --radius: 10px;
  --radius-sm: 7px;
  --radius-lg: 16px;

  --sidebar-w: 268px;
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Hanken Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
::selection { background: var(--gold-soft); }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 500; color: var(--ink-900); margin: 0; letter-spacing: -.01em; }

/* Scrollbars */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: #cfc6b4; border-radius: 8px; border: 3px solid var(--cream); }
::-webkit-scrollbar-thumb:hover { background: #bcb29d; }

/* =========================================================================
   App layout
   ========================================================================= */
.app { display: flex; min-height: 100vh; }

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--ink-900);
  color: #d8d2c4;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #0a1b2e;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,.06);
}
.brand-mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  border: 1px solid var(--gold);
  border-radius: 8px;
  display: grid; place-items: center;
  color: var(--gold-bright);
  font-family: var(--font-serif);
  font-size: 20px; font-weight: 600;
  background: linear-gradient(160deg, rgba(201,162,39,.14), rgba(201,162,39,.02));
}
.brand-name { font-family: var(--font-serif); font-size: 16px; color: #f3eee2; line-height: 1.2; font-weight: 500; white-space: nowrap; }
.brand-sub { font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--gold); margin-top: 3px; }

.nav { flex: 1; overflow-y: auto; padding: 14px 12px 20px; }
.nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-color: var(--ink-900); }
.nav-group-label {
  font-size: 10px; letter-spacing: .16em; text-transform: uppercase;
  color: #6f7f93; padding: 16px 12px 7px; font-weight: 600;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 8px;
  color: #c3bdaf; font-size: 14px; font-weight: 500;
  margin-bottom: 2px; position: relative;
  transition: background .15s, color .15s;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: #ece7da; }
.nav-item.active { background: rgba(201,162,39,.13); color: #fbf3df; }
.nav-item.active::before {
  content: ""; position: absolute; left: -12px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--gold-bright); border-radius: 0 3px 3px 0;
}
.nav-item svg { width: 18px; height: 18px; flex: 0 0 18px; stroke-width: 1.6; opacity: .9; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--gold); color: var(--ink-900);
  font-size: 11px; font-weight: 700; min-width: 19px; height: 19px;
  border-radius: 10px; display: grid; place-items: center; padding: 0 6px;
  font-family: var(--font-sans);
}
.nav-item .nav-dot { margin-left: auto; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }

.sidebar-foot { padding: 14px; border-top: 1px solid rgba(255,255,255,.06); }
.adv-card {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border-radius: 10px; background: rgba(255,255,255,.04);
}
.adv-card:hover { background: rgba(255,255,255,.07); }
.adv-card .avatar { width: 36px; height: 36px; flex: 0 0 36px; }
.adv-meta { min-width: 0; }
.adv-name { font-size: 13.5px; color: #f1ecdf; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adv-role { font-size: 11px; color: #8a93a3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Main ---- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: 64px; flex: 0 0 64px;
  background: rgba(246,242,234,.85);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 18px;
  padding: 0 32px; position: sticky; top: 0; z-index: 30;
}
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.crumbs .sep { color: var(--muted-2); }
.crumbs .cur { color: var(--text); font-weight: 600; }
.topbar-spacer { flex: 1; }
.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 13px; width: 280px; color: var(--muted);
  font-size: 13.5px; box-shadow: var(--shadow-sm); position: relative;
}
.search:focus-within { border-color: var(--gold); }
.search input { border: 0; outline: 0; background: transparent; flex: 1; font-family: inherit; font-size: 13.5px; color: var(--text); min-width: 0; }
.search kbd {
  font-family: var(--font-sans); font-size: 11px; color: var(--muted-2);
  border: 1px solid var(--line-strong); border-radius: 4px; padding: 1px 5px; background: var(--cream);
}

/* search dropdown */
.search-results {
  position: absolute; top: calc(100% + 8px); left: 0; right: 0;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 60; max-height: 60vh; overflow-y: auto;
  display: none; width: 380px;
}
.search-results.open { display: block; animation: fade .14s ease; }
.sr-item {
  display: flex; align-items: center; gap: 12px; padding: 9px 11px;
  border-radius: 8px; cursor: pointer; color: var(--text);
}
.sr-item.sel { background: var(--cream-2); }
.sr-ic {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 7px;
  display: grid; place-items: center; background: var(--cream); color: var(--ink-700);
}
.sr-ic svg { width: 16px; height: 16px; stroke-width: 1.8; }
.sr-main { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.sr-title { font-size: 13.5px; font-weight: 600; color: var(--ink-900); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-title mark { background: var(--gold-soft); color: inherit; padding: 0 1px; border-radius: 2px; }
.sr-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sr-type { font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); font-weight: 700; flex: 0 0 auto; }
.sr-empty { padding: 18px 14px; text-align: center; font-size: 13px; color: var(--muted); }

/* notifications */
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute; top: calc(100% + 10px); right: 0;
  width: 400px; max-height: 70vh; overflow: hidden;
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow-lg);
  z-index: 60; display: none; flex-direction: column;
}
.notif-panel.open { display: flex; animation: fade .14s ease; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 18px; border-bottom: 1px solid var(--line); }
.notif-head h3 { font-size: 17px; }
.notif-count { font-size: 11px; font-weight: 700; color: var(--gold); background: var(--amber-bg); padding: 2px 8px; border-radius: 100px; }
.notif-readall { background: none; border: 0; color: var(--navy); font-size: 12.5px; font-weight: 600; font-family: inherit; }
.notif-readall:hover:not(:disabled) { color: var(--gold); }
.notif-readall:disabled { color: var(--muted-2); cursor: default; }
.notif-list { overflow-y: auto; overflow-x: hidden; flex: 1; }
.notif-item { display: flex; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative; transition: background .12s; }
.notif-item:hover { background: var(--paper-2); }
.notif-item.unread { background: #fbf8ef; }
.notif-item.unread:hover { background: #f7f2e3; }
.notif-ic { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; display: grid; place-items: center; }
.notif-ic svg { width: 17px; height: 17px; stroke-width: 1.8; }
.tone-blue { background: var(--blue-bg); color: var(--blue); }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-amber { background: var(--amber-bg); color: var(--amber); }
.tone-violet { background: var(--violet-bg); color: var(--violet); }
.tone-ink { background: #e6ebf0; color: var(--ink-700); }
.notif-main { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.notif-title { font-size: 13.5px; font-weight: 600; color: var(--ink-900); }
.notif-body { font-size: 12.5px; color: var(--text-2); line-height: 1.45; }
.notif-time { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.notif-bullet { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); flex: 0 0 8px; margin-top: 6px; }
.notif-foot { padding: 12px 18px; text-align: center; border-top: 1px solid var(--line); background: var(--paper-2); }
.notif-foot a { font-size: 13px; font-weight: 600; color: var(--navy); }
.notif-foot a:hover { color: var(--gold); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--paper); display: grid; place-items: center; color: var(--text-2);
  position: relative; box-shadow: var(--shadow-sm);
}
.icon-btn:hover { border-color: var(--line-strong); color: var(--ink-800); }
.icon-btn svg { width: 18px; height: 18px; stroke-width: 1.7; }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); border: 1.5px solid var(--paper); }

.content { padding: 36px 40px 64px; max-width: 1240px; width: 100%; margin: 0 auto; }
.content.wide { max-width: 1420px; }

/* =========================================================================
   Page header
   ========================================================================= */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head > div:first-child { flex: 1 1 380px; min-width: 300px; }
.eyebrow { font-size: 11px; letter-spacing: .15em; text-transform: uppercase; color: var(--gold); font-weight: 600; margin-bottom: 9px; }
.page-title { font-size: 34px; line-height: 1.08; color: var(--ink-900); font-weight: 500; }
.page-sub { color: var(--muted); font-size: 15px; margin-top: 9px; max-width: 60ch; }
.head-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

/* =========================================================================
   Buttons
   ========================================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-sans); font-size: 14px; font-weight: 600;
  padding: 9px 17px; border-radius: 9px; border: 1px solid transparent;
  transition: all .14s; white-space: nowrap; line-height: 1;
}
.btn svg { width: 16px; height: 16px; stroke-width: 1.9; }
.btn-primary { background: var(--ink-800); color: #fbf6ea; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--ink-900); }
.btn-gold { background: var(--gold); color: #2a2107; box-shadow: var(--shadow-sm); }
.btn-gold:hover { background: var(--gold-bright); }
.btn-outline { background: var(--paper); border-color: var(--line-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.btn-outline:hover { border-color: var(--ink-700); color: var(--ink-800); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--cream-2); color: var(--ink-800); }
.btn-danger { background: var(--paper); border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-bg); }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 12px 22px; font-size: 15px; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* =========================================================================
   Cards & surfaces
   ========================================================================= */
.card {
  background: var(--paper); 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; justify-content: space-between; gap: 14px;
  padding: 17px 22px; border-bottom: 1px solid var(--line);
}
.card-head h3 { font-size: 18px; }
.card-head .ch-sub { font-size: 12.5px; color: var(--muted); font-family: var(--font-sans); margin-top: 2px; }
.card-title-link { font-size: 13px; color: var(--navy); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.card-title-link:hover { color: var(--gold); }
.card-body { padding: 22px; }

.grid { display: grid; gap: 20px; }
.g-2 { grid-template-columns: repeat(2, 1fr); }
.g-3 { grid-template-columns: repeat(3, 1fr); }
.g-4 { grid-template-columns: repeat(4, 1fr); }
.col-span-2 { grid-column: span 2; }
@media (max-width: 1100px){ .g-4 { grid-template-columns: repeat(2,1fr);} .g-3{grid-template-columns:repeat(2,1fr);} }

.section-label { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 14px; }

/* =========================================================================
   Stat tiles
   ========================================================================= */
.stat {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 19px 20px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-label { font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: .02em; display: flex; align-items: center; gap: 7px; }
.stat-label svg { width: 15px; height: 15px; color: var(--gold); stroke-width: 1.8; }
.stat-value { font-family: var(--font-serif); font-size: 32px; font-weight: 500; color: var(--ink-900); margin-top: 11px; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-value .unit { font-size: 16px; color: var(--muted); font-family: var(--font-sans); }
.stat-foot { font-size: 12.5px; color: var(--muted); margin-top: 9px; display: flex; align-items: center; gap: 6px; }
.trend { font-weight: 700; display: inline-flex; align-items: center; gap: 3px; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }

/* =========================================================================
   Badges / pills
   ========================================================================= */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 100px;
  background: var(--cream-2); color: var(--text-2); line-height: 1.5; white-space: nowrap;
}
.pill .pdot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--green-bg); color: var(--green); }
.pill-amber { background: var(--amber-bg); color: var(--amber); }
.pill-red { background: var(--red-bg); color: var(--red); }
.pill-blue { background: var(--blue-bg); color: var(--blue); }
.pill-violet { background: var(--violet-bg); color: var(--violet); }
.pill-ink { background: #e6ebf0; color: var(--ink-700); }
.pill-gold { background: var(--amber-bg); color: var(--gold); }
.pill-lg { font-size: 13px; padding: 5px 13px; }

.tag {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500;
  padding: 4px 11px; border-radius: 7px; background: var(--cream-2); color: var(--text-2);
  border: 1px solid var(--line);
}
.tag.selectable { cursor: pointer; transition: all .14s; }
.tag.selectable:hover { border-color: var(--line-strong); }
.tag.on { background: var(--ink-800); color: #f3eee2; border-color: var(--ink-800); }
.tag.on::before { content: "✓"; font-size: 11px; }

.dropzone {
  border: 1.5px dashed var(--line-strong); border-radius: var(--radius);
  background: var(--paper-2); padding: 30px 24px; text-align: center; cursor: pointer;
  transition: border .15s, background .15s;
}
.dropzone:hover { border-color: var(--gold); background: var(--cream); }
.dropzone svg { width: 30px; height: 30px; color: var(--gold); stroke-width: 1.5; margin-bottom: 10px; }

.terms-box {
  border: 1px solid var(--line); border-radius: 10px; background: var(--paper-2);
  padding: 20px 22px; max-height: 240px; overflow-y: auto; font-size: 13.5px; line-height: 1.65; color: var(--text-2);
}
.terms-box h5 { font-family: var(--font-serif); font-size: 15px; color: var(--ink-900); margin: 16px 0 6px; font-weight: 600; }
.terms-box h5:first-child { margin-top: 0; }

/* =========================================================================
   Avatars
   ========================================================================= */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 600; font-size: 14px;
  color: #fff; background: var(--navy); font-family: var(--font-sans); overflow: hidden;
}
.avatar.sq { border-radius: 9px; }
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 56px; height: 56px; font-size: 19px; }
.avatar-xl { width: 84px; height: 84px; font-size: 28px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--paper); margin-left: -10px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.av-c1{background:#3b6797;} .av-c2{background:#3d7d6a;} .av-c3{background:#a6781f;} .av-c4{background:#9a3b34;} .av-c5{background:#6a5797;} .av-c6{background:#14385c;}

/* =========================================================================
   Tables / lists
   ========================================================================= */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; padding: 11px 16px; border-bottom: 1px solid var(--line);
  background: var(--paper-2);
}
.table td { padding: 14px 16px; border-bottom: 1px solid var(--line); font-size: 14px; vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .12s; }
.table.rows tbody tr:hover { background: var(--paper-2); cursor: pointer; }
.td-num { font-variant-numeric: tabular-nums; text-align: right; }
.td-strong { font-weight: 600; color: var(--ink-900); }
.cell-stack { display: flex; flex-direction: column; gap: 2px; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.cell-flex { display: flex; align-items: center; gap: 11px; }

/* =========================================================================
   DataTables integration (self-styled, no vendor CSS)
   ========================================================================= */
.dataTables_wrapper { font-family: var(--font-sans); position: relative; }
.dt-top { display: flex; justify-content: flex-end; padding: 14px 22px 4px; }
.dt-scroll { overflow-x: auto; }
.dt-bottom { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 22px; border-top: 1px solid var(--line); flex-wrap: wrap; }

/* search box */
.dataTables_filter label { display: flex; align-items: center; gap: 8px; font-size: 0; color: var(--muted); }
.dataTables_filter input {
  font-family: var(--font-sans); font-size: 13.5px; color: var(--text);
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 8px 13px 8px 32px; width: 240px; transition: border .14s, box-shadow .14s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%23756f63' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 10px center;
}
.dataTables_filter input:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.14); }

/* info */
.dataTables_info { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* pagination */
.dataTables_paginate { display: flex; align-items: center; gap: 5px; }
.dataTables_paginate .paginate_button {
  font-family: var(--font-sans); font-size: 13px; font-weight: 600; color: var(--text-2);
  padding: 6px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--paper);
  cursor: pointer; user-select: none; transition: all .12s; min-width: 34px; text-align: center; white-space: nowrap;
}
.dataTables_paginate .paginate_button:hover:not(.disabled):not(.current) { border-color: var(--ink-700); color: var(--ink-800); background: var(--paper-2); }
.dataTables_paginate .paginate_button.current { background: var(--ink-800); border-color: var(--ink-800); color: #fbf6ea; }
.dataTables_paginate .paginate_button.disabled { color: var(--muted-2); cursor: default; opacity: .55; }

/* sorting indicators on our own table headers */
table.dataTable thead th { position: relative; cursor: pointer; user-select: none; }
table.dataTable thead th.sorting_disabled { cursor: default; }
table.dataTable thead th.sorting:not(.sorting_disabled),
table.dataTable thead th.sorting_asc,
table.dataTable thead th.sorting_desc { padding-right: 26px; }
table.dataTable thead th.sorting::after,
table.dataTable thead th.sorting_asc::after,
table.dataTable thead th.sorting_desc::after {
  position: absolute; right: 11px; top: 50%; transform: translateY(-50%);
  font-size: 9px; line-height: 1; color: var(--muted-2);
}
table.dataTable thead th.sorting::after { content: "\2195"; opacity: .45; }
table.dataTable thead th.sorting_asc::after { content: "\2191"; color: var(--gold); opacity: 1; }
table.dataTable thead th.sorting_desc::after { content: "\2193"; color: var(--gold); opacity: 1; }
table.dataTable thead th.right.sorting,
table.dataTable thead th.right.sorting_asc,
table.dataTable thead th.right.sorting_desc { padding-right: 26px; }

/* keep our table chrome; neutralise any stray DataTables defaults */
table.dataTable { width: 100% !important; margin: 0 !important; border-collapse: collapse; }
table.dataTable tbody tr.odd, table.dataTable tbody tr.even { background: transparent; }
.dataTables_empty { text-align: center; color: var(--muted); padding: 28px 16px !important; }
@media (max-width: 600px){
  .dataTables_filter input { width: 150px; }
  .dt-bottom { justify-content: center; }
}

/* row list (non-table) */
.rlist { display: flex; flex-direction: column; }
.rlist .ritem {
  display: flex; align-items: center; gap: 14px; padding: 15px 0;
  border-bottom: 1px solid var(--line);
}
.rlist .ritem:last-child { border-bottom: 0; }
.ritem-main { min-width: 0; flex: 1; }
.ritem-title { font-weight: 600; color: var(--ink-900); font-size: 14.5px; }
.ritem-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* =========================================================================
   Tabs
   ========================================================================= */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 26px; }
.tab {
  padding: 11px 16px; font-size: 14px; font-weight: 600; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .14s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--ink-900); border-bottom-color: var(--gold); }
.tab .tab-count { font-size: 12px; color: var(--muted-2); margin-left: 6px; font-weight: 600; }

.subtabs { display: inline-flex; background: var(--cream-2); border-radius: 9px; padding: 3px; gap: 3px; }
.subtab { padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--muted); border-radius: 7px; }
.subtab.active { background: var(--paper); color: var(--ink-900); box-shadow: var(--shadow-sm); }

/* =========================================================================
   Progress
   ========================================================================= */
.bar { height: 7px; border-radius: 6px; background: var(--cream-2); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--gold); border-radius: 6px; }
.bar.ink > span { background: var(--ink-700); }
.bar.green > span { background: var(--green); }
.ring { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .track { stroke: var(--cream-2); }
.ring .val { stroke: var(--gold); stroke-linecap: round; transition: stroke-dashoffset .6s; }

/* =========================================================================
   Forms
   ========================================================================= */
.field { margin-bottom: 18px; }
.label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 7px; }
.label .opt { color: var(--muted-2); font-weight: 500; }
.help { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.input, .select, .textarea {
  width: 100%; font-family: inherit; font-size: 14px; color: var(--text);
  background: var(--paper); border: 1px solid var(--line-strong); border-radius: 9px;
  padding: 10px 13px; transition: border .14s, box-shadow .14s;
}
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,162,39,.14); }
.textarea { resize: vertical; min-height: 96px; line-height: 1.55; }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23756f63' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 36px; }
.input-row { display: flex; gap: 12px; }
.checkline { display: flex; align-items: flex-start; gap: 11px; padding: 12px 0; }
.checkline input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--gold); }

/* toggle */
.toggle { position: relative; width: 42px; height: 24px; flex: 0 0 42px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track { position: absolute; inset: 0; background: var(--line-strong); border-radius: 100px; transition: background .18s; }
.toggle .track::before { content:""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.toggle input:checked + .track { background: var(--green); }
.toggle input:checked + .track::before { transform: translateX(18px); }

/* =========================================================================
   Misc components
   ========================================================================= */
.divider { height: 1px; background: var(--line); margin: 24px 0; border: 0; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--muted); }
.kv .v { font-weight: 600; color: var(--ink-900); text-align: right; }

.note {
  display: flex; gap: 12px; padding: 14px 16px; border-radius: 10px;
  background: var(--amber-bg); border: 1px solid var(--gold-soft); font-size: 13.5px; color: #6f5414;
}
.note svg { width: 19px; height: 19px; flex: 0 0 19px; color: var(--gold); stroke-width: 1.8; margin-top: 1px; }
.note.info { background: var(--blue-bg); border-color: #c5d4e6; color: #2d4d72; }
.note.info svg { color: var(--blue); }
.note.red { background: var(--red-bg); border-color: #e4c8c4; color: #7a322c; }
.note.red svg { color: var(--red); }
.note strong { color: inherit; }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty svg { width: 38px; height: 38px; color: var(--muted-2); margin-bottom: 14px; stroke-width: 1.4; }
.empty h4 { font-size: 18px; margin-bottom: 6px; }

/* timeline */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px; width: 1.5px; background: var(--line-strong); }
.tl-item { position: relative; padding-bottom: 22px; }
.tl-item:last-child { padding-bottom: 0; }
.tl-dot { position: absolute; left: -26px; top: 2px; width: 13px; height: 13px; border-radius: 50%; background: var(--paper); border: 2px solid var(--gold); }
.tl-dot.done { background: var(--gold); }
.tl-dot.ink { border-color: var(--ink-700); }
.tl-time { font-size: 12px; color: var(--muted-2); }
.tl-title { font-weight: 600; color: var(--ink-900); font-size: 14px; margin: 2px 0; }
.tl-text { font-size: 13px; color: var(--muted); }

/* meta line */
.metaline { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.metaline .mi { display: inline-flex; align-items: center; gap: 6px; }
.metaline svg { width: 15px; height: 15px; stroke-width: 1.7; opacity: .8; }

/* =========================================================================
   Opportunity / engagement cards
   ========================================================================= */
.opp-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow-sm); transition: box-shadow .16s, border-color .16s, transform .16s;
}
.opp-card:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.opp-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 13px; }
.opp-title { font-size: 19px; line-height: 1.25; }
.opp-client { font-size: 13px; color: var(--muted); margin-top: 5px; display: flex; align-items: center; gap: 7px; }

/* kanban */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: start; }
.kcol { background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--radius); }
.kcol-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.kcol-head .kt { font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--text-2); }
.kcol-head .kc { font-size: 12px; color: var(--muted); font-weight: 700; background: var(--cream-2); border-radius: 20px; padding: 1px 9px; }
.kcol-body { padding: 12px; display: flex; flex-direction: column; gap: 11px; min-height: 60px; }
.kcard { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; padding: 13px; box-shadow: var(--shadow-sm); }
.kcard:hover { border-color: var(--line-strong); }
.kcard-title { font-size: 13.5px; font-weight: 600; color: var(--ink-900); line-height: 1.35; }
.kcard-meta { display: flex; align-items: center; justify-content: space-between; margin-top: 11px; }

/* messages */
.msg-wrap { display: grid; grid-template-columns: 320px 1fr; height: calc(100vh - 64px - 100px); min-height: 540px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); box-shadow: var(--shadow-sm); }
.thread-list { border-right: 1px solid var(--line); overflow-y: auto; background: var(--paper-2); }
.thread-item { padding: 15px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.thread-item:hover { background: var(--cream); }
.thread-item.active { background: var(--paper); box-shadow: inset 3px 0 0 var(--gold); }
.thread-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.thread-name { font-weight: 600; font-size: 14px; color: var(--ink-900); }
.thread-time { font-size: 11.5px; color: var(--muted-2); }
.thread-prev { font-size: 13px; color: var(--muted); margin-top: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-panel { display: flex; flex-direction: column; min-width: 0; }
.msg-head { padding: 15px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.msg-body { flex: 1; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; background: var(--cream); }
.bubble { max-width: 64%; }
.bubble .b-meta { font-size: 11.5px; color: var(--muted); margin-bottom: 5px; }
.bubble .b-text { padding: 12px 15px; border-radius: 12px; font-size: 14px; line-height: 1.5; background: var(--paper); border: 1px solid var(--line); color: var(--text); }
.bubble.me { align-self: flex-end; }
.bubble.me .b-meta { text-align: right; }
.bubble.me .b-text { background: var(--ink-800); color: #f3eee2; border-color: var(--ink-800); }
.msg-compose { border-top: 1px solid var(--line); padding: 14px 18px; display: flex; gap: 12px; align-items: flex-end; background: var(--paper); }

/* calendar */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.cal .dow { padding: 10px; text-align: center; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: var(--paper-2); border-bottom: 1px solid var(--line); }
.cal .day { min-height: 96px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 7px 8px; font-size: 13px; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .daynum { color: var(--muted); font-weight: 600; font-size: 12.5px; }
.cal .day.out .daynum { color: var(--muted-2); opacity: .5; }
.cal .day.today { background: var(--paper-2); }
.cal .day.today .daynum { background: var(--ink-800); color: #fff; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.cal-ev { font-size: 11.5px; padding: 3px 7px; border-radius: 5px; margin-top: 5px; font-weight: 600; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev.g { background: var(--green-bg); color: var(--green); }
.cal-ev.b { background: var(--blue-bg); color: var(--blue); }
.cal-ev.a { background: var(--amber-bg); color: var(--amber); }
.cal-ev.v { background: var(--violet-bg); color: var(--violet); }

/* file rows */
.file-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); margin-bottom: 10px; transition: border .14s; }
.file-row:hover { border-color: var(--line-strong); }
.file-ic { width: 40px; height: 40px; border-radius: 8px; display: grid; place-items: center; flex: 0 0 40px; font-size: 11px; font-weight: 700; color: #fff; }
.fi-pdf { background: #9a3b34; } .fi-doc { background: #3b6797; } .fi-xls { background: #3d7d6a; } .fi-img { background: #6a5797; } .fi-ppt{background:#a6781f;}

/* progress steps (onboarding) */
.steps { display: flex; flex-direction: column; gap: 2px; }
.step { display: flex; gap: 14px; padding: 14px 16px; border-radius: 10px; cursor: pointer; }
.step:hover { background: var(--paper-2); }
.step.active { background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-sm); }
.step-ic { width: 30px; height: 30px; border-radius: 50%; flex: 0 0 30px; display: grid; place-items: center; font-size: 13px; font-weight: 700; border: 1.5px solid var(--line-strong); color: var(--muted); background: var(--paper); }
.step.done .step-ic { background: var(--green); border-color: var(--green); color: #fff; }
.step.active .step-ic { border-color: var(--gold); color: var(--gold); }
.step-name { font-weight: 600; font-size: 14px; color: var(--ink-900); }
.step-sub { font-size: 12.5px; color: var(--muted); }

/* utility */
.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; } .gap-20{gap:20px;} .gap-24{gap:24px;}
.flex-col { flex-direction: column; } .flex-wrap { flex-wrap: wrap; } .flex-1 { flex: 1; }
.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; } .mt-32{margin-top:32px;}
.mb-8{margin-bottom:8px;} .mb-12{margin-bottom:12px;} .mb-16{margin-bottom:16px;} .mb-20{margin-bottom:20px;} .mb-24{margin-bottom:24px;}
.text-muted { color: var(--muted); } .text-sm { font-size: 13px; } .text-xs{font-size:12px;} .fw6 { font-weight: 600; } .fw7{font-weight:700;}
.serif { font-family: var(--font-serif); }
.tnum { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.right { text-align: right; } .center { text-align: center; }

.set-nav { color: var(--text-2); border-radius: 8px; }
.set-nav:hover { background: var(--paper-2); color: var(--ink-800); }
.set-nav.set-on { background: var(--cream-2); color: var(--ink-900); font-weight: 600; }
.set-nav.set-on svg { color: var(--gold); }

.kcard-move { display: flex; gap: 4px; }
.kbtn {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--paper); display: grid; place-items: center; color: var(--text-2);
}
.kbtn:hover { border-color: var(--ink-700); color: var(--ink-800); background: var(--paper-2); }
.kbtn:disabled { opacity: .35; pointer-events: none; }
.kbtn svg { width: 14px; height: 14px; stroke-width: 2; }

/* modal — hidden DOM templates (§3.7): openModal() adds .open, closeModal()
   removes it (the mock created modal nodes dynamically; the portal keeps them
   in the page and toggles visibility instead) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(12,33,56,.42);
  display: none; place-items: center; z-index: 150; padding: 20px;
  animation: ovin .18s ease;
}
.modal-overlay.open { display: grid; }
@keyframes ovin { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--paper); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 480px; max-width: 100%; overflow: hidden; animation: mdin .22s ease;
}
@keyframes mdin { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 19px; }
.modal-body { padding: 22px; }
.modal-foot { padding: 16px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; background: var(--paper-2); }

.row-actions { display: inline-flex; gap: 6px; opacity: .5; transition: opacity .12s; }
tr:hover .row-actions { opacity: 1; }
.rbtn {
  width: 28px; height: 28px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--paper); display: grid; place-items: center; color: var(--text-2);
  transition: all .12s;
}
.rbtn:hover { border-color: var(--ink-700); color: var(--ink-800); background: var(--paper-2); }
.rbtn.rbtn-danger:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.rbtn svg { width: 15px; height: 15px; stroke-width: 2; }

/* fade in */
@keyframes fade { from { transform: translateY(7px); } to { transform: none; } }
.view { animation: fade .28s ease; }

@media (max-width: 880px){
  .sidebar { display: none; }
  .content { padding: 24px 18px 48px; }
  .g-2,.col-span-2 { grid-template-columns: 1fr; grid-column: auto; }
  .msg-wrap { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
}

/* =========================================================================
   Portal chrome additions (Phase 1 — not in the mockup stylesheet):
   login/status standalone cards, sidebar footer sign-out, dimmed
   applicant-restricted nav items, toast pill, blocking loading overlay.
   ========================================================================= */

/* sidebar brand text overflow guard (settings-driven platform names) */
.brand-text { min-width: 0; }
.brand-name { overflow: hidden; text-overflow: ellipsis; }

/* applicant-restricted nav items (§6.1 — dimmed + tooltip until approval) */
.nav-item.dim { opacity: .45; }
.nav-item.dim:hover { background: transparent; color: #c3bdaf; }

/* sidebar footer: mini-card + sign-out */
.adv-foot-row { display: flex; align-items: center; gap: 8px; }
.adv-foot-row .adv-card { flex: 1; min-width: 0; }
.adv-signout {
  width: 34px; height: 34px; flex: 0 0 34px; border-radius: 8px;
  display: grid; place-items: center; color: #8a93a3;
  transition: background .15s, color .15s;
}
.adv-signout:hover { background: rgba(255,255,255,.07); color: #ece7da; }
.adv-signout svg { width: 16px; height: 16px; }

/* ---- standalone login / status pages ---- */
.login-body {
  background: var(--cream);
  background-image: radial-gradient(1100px 500px at 80% -10%, rgba(201,162,39,.10), transparent),
                    radial-gradient(900px 480px at -10% 110%, rgba(20,56,92,.07), transparent);
  min-height: 100vh; margin: 0; display: grid; place-items: center;
}
.login-wrap { width: 100%; max-width: 440px; padding: 24px; }
.login-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md); padding: 36px 34px 30px;
}
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.login-brand-name { font-family: var(--font-serif); font-size: 17px; color: var(--ink-900); font-weight: 500; line-height: 1.2; }
.login-brand-sub { font-size: 10px; letter-spacing: .15em; text-transform: uppercase; color: var(--gold); margin-top: 3px; font-weight: 600; }
.login-title { font-size: 27px; margin-bottom: 8px; }
.login-desc { font-size: 14px; color: var(--muted); margin: 0 0 22px; line-height: 1.55; }
.login-btn { width: 100%; padding: 12px 22px; font-size: 15px; margin-top: 4px; }
.login-foot { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); text-align: center; font-size: 12.5px; color: var(--muted); }
.login-tagline { margin-top: 7px; font-family: var(--font-serif); font-style: italic; color: var(--muted-2); }
.status-ic {
  width: 44px; height: 44px; border-radius: 11px; display: grid; place-items: center;
  margin-bottom: 16px;
}
.status-ic svg { width: 22px; height: 22px; stroke-width: 1.8; }

/* ---- toast pill (success feedback — §8.7 front-end contract) ---- */
.toast-pill {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 9px;
  background: var(--ink-900); color: #f3eee2;
  font-family: var(--font-sans); font-size: 13.5px; font-weight: 600;
  padding: 11px 18px; border-radius: 100px; box-shadow: var(--shadow-lg);
  z-index: 300; animation: fade .2s ease;
}
.toast-pill svg { width: 16px; height: 16px; color: var(--gold-bright); }

/* ---- blocking loading overlay ---- */
.loading-overlay {
  position: fixed; inset: 0; background: rgba(246,242,234,.72);
  backdrop-filter: blur(2px); z-index: 400; place-items: center; display: grid;
}
.loading-box {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-lg); padding: 26px 34px; text-align: center;
}
.loading-spinner {
  width: 30px; height: 30px; margin: 0 auto 12px;
  border: 3px solid var(--cream-2); border-top-color: var(--gold);
  border-radius: 50%; animation: advspin .8s linear infinite;
}
@keyframes advspin { to { transform: rotate(360deg); } }
.loading-text { font-size: 13.5px; color: var(--muted); font-weight: 600; }
