/* ============================================================
   Main Street Acquisition OS — BuyABoringBusiness
   ============================================================ */
:root {
  --navy-900: #0b1c30;
  --navy-800: #0e2340;
  --navy-700: #14304f;
  --navy-600: #1d3f63;
  --ink: #12263f;
  --ink-soft: #3d5570;
  --muted: #64748b;
  --faint: #94a3b8;
  --gold: #e8a33d;
  --gold-soft: #f6c66b;
  --gold-bg: #fdf3e0;
  --cream: #f6f4ee;
  --card: #ffffff;
  --line: #e6e2d8;
  --line-soft: #eef0f4;
  --green: #1e8e3e;
  --green-bg: #e6f4ea;
  --amber: #b45309;
  --amber-bg: #fef3e2;
  --red: #d93025;
  --red-bg: #fdeceb;
  --blue: #1f5fa8;
  --blue-bg: #e8f0fb;
  --purple: #7c3aed;
  --purple-bg: #f1eafd;
  --teal: #0e7490;
  --teal-bg: #e0f2f7;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(18, 38, 63, .06), 0 4px 14px rgba(18, 38, 63, .05);
  --shadow-lg: 0 8px 32px rgba(11, 28, 48, .18);
  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, "Inter", Roboto, Helvetica, Arial, sans-serif;
  --sidebar-w: 248px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  background: var(--cream);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.45;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: 13px; color: var(--ink); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
[hidden] { display: none !important; }

.app { display: flex; min-height: 100vh; }

/* ============ SIDEBAR ============ */
.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, var(--navy-800), var(--navy-900));
  color: #cfd9e6;
  display: flex;
  flex-direction: column;
  padding: 18px 14px;
  gap: 14px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  flex-shrink: 0;
  z-index: 40;
  scrollbar-width: thin;
  scrollbar-color: var(--navy-600) transparent;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 12px; border-bottom: 1px solid rgba(255,255,255,.08); position: relative; }
.brand-mark { color: var(--gold); display: flex; }
.brand-name { font-weight: 700; font-size: 15px; color: #fff; letter-spacing: .2px; }
.sidebar-close { display: none; position: absolute; right: 0; top: 0; font-size: 22px; color: #cfd9e6; padding: 2px 8px; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 9px;
  color: #b9c6d6; font-size: 13.5px; font-weight: 500;
  width: 100%; text-align: left; transition: background .15s, color .15s;
}
.nav-item svg { flex-shrink: 0; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active { background: rgba(232,163,61,.16); color: #fff; box-shadow: inset 0 0 0 1px rgba(232,163,61,.35); }
.nav-item.active svg { color: var(--gold); opacity: 1; }
.nav-badge { margin-left: auto; background: var(--gold); color: var(--navy-900); font-size: 10.5px; font-weight: 700; border-radius: 99px; padding: 1px 7px; }

.sidebar-framework {
  margin-top: auto;
  border: 1px solid rgba(232,163,61,.4);
  border-radius: 10px;
  padding: 13px 14px;
  background: rgba(232,163,61,.06);
}
.sidebar-framework .fw-title { display: flex; align-items: center; gap: 8px; color: var(--gold); font-weight: 700; font-size: 13px; margin-bottom: 8px; }
.sidebar-framework .fw-line { font-size: 12.5px; color: #b9c6d6; padding: 2.5px 0; }
.sidebar-help {
  display: flex; align-items: center; gap: 9px; justify-content: center;
  border: 1px solid rgba(255,255,255,.18); border-radius: 9px;
  padding: 9px; color: #d7e0ea; font-size: 13px; font-weight: 500;
}
.sidebar-help:hover { background: rgba(255,255,255,.07); }
.sidebar-scrim { display: none; }

/* ============ MAIN / TOPBAR ============ */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--navy-900);
  padding: 10px 20px;
  position: sticky; top: 0; z-index: 30;
  color: #cfd9e6;
}
.hamburger { display: none; color: #fff; padding: 4px; }
.global-search {
  flex: 1; max-width: 520px; position: relative;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 9px; padding: 7px 12px;
  color: #93a5ba;
}
.global-search input { flex: 1; background: transparent; border: none; outline: none; color: #eef2f7; font-size: 13px; min-width: 0; }
.global-search input::placeholder { color: #7d90a8; }
.global-search kbd { font-size: 10.5px; background: rgba(255,255,255,.1); border-radius: 5px; padding: 2px 6px; color: #93a5ba; font-family: inherit; }
.search-results {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #fff; border-radius: 10px; box-shadow: var(--shadow-lg);
  max-height: 340px; overflow-y: auto; z-index: 60; padding: 6px;
}
.search-result { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px; border-radius: 8px; color: var(--ink); }
.search-result:hover { background: var(--line-soft); }
.search-result .sr-type { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); background: var(--line-soft); border-radius: 5px; padding: 2px 6px; flex-shrink: 0; }
.search-result .sr-sub { color: var(--muted); font-size: 12px; }
.search-empty { padding: 14px; color: var(--muted); font-size: 13px; text-align: center; }

.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.workspace-pill {
  display: flex; align-items: center; gap: 7px;
  color: #d7e0ea; font-size: 12.5px; font-weight: 500;
  padding: 7px 11px; border-radius: 8px; border: 1px solid transparent;
  white-space: nowrap;
}
.workspace-pill:hover { background: rgba(255,255,255,.08); }
.org-pill { border-color: rgba(255,255,255,.14); }
.icon-btn { position: relative; padding: 8px; border-radius: 8px; color: #d7e0ea; display: flex; }
.icon-btn:hover { background: rgba(255,255,255,.08); }
.bell-badge {
  position: absolute; top: 1px; right: 0;
  background: var(--gold); color: var(--navy-900);
  font-size: 9.5px; font-weight: 800; min-width: 16px; height: 16px;
  border-radius: 99px; display: flex; align-items: center; justify-content: center; padding: 0 4px;
}
.user-chip { display: flex; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 9px; }
.user-chip:hover { background: rgba(255,255,255,.08); }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold); color: var(--navy-900);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 11.5px; flex-shrink: 0;
}
.user-meta { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.2; }
.user-name { color: #fff; font-size: 12.5px; font-weight: 600; }
.user-role { color: #93a5ba; font-size: 10.5px; }

/* ============ VIEW SHELL ============ */
.view { padding: 22px 24px 48px; max-width: 1480px; width: 100%; margin: 0 auto; }
.view:focus { outline: none; }

.view-head { display: flex; align-items: flex-start; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.view-head .vh-text { flex: 1; min-width: 240px; }
.view-title { font-size: 22px; font-weight: 700; letter-spacing: -.2px; display: flex; align-items: center; gap: 9px; }
.view-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.view-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--blue); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border-radius: 9px; padding: 8px 14px;
  font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  transition: box-shadow .15s, background .15s;
  white-space: nowrap;
}
.btn:hover { box-shadow: var(--shadow); }
.btn-primary { background: var(--navy-800); border-color: var(--navy-800); color: #fff; }
.btn-primary:hover { background: var(--navy-700); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy-900); }
.btn-gold:hover { background: var(--gold-soft); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--line-soft); box-shadow: none; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 7px; }
.btn-danger-ghost { color: var(--red); border-color: transparent; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.card-head h3 { font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-head .spacer { flex: 1; }
.card-link { font-size: 12px; font-weight: 600; color: var(--blue); background: none; }
.card-link:hover { text-decoration: underline; }

/* Chips & badges */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; border-radius: 99px; padding: 2.5px 9px; white-space: nowrap; }
.chip-green { background: var(--green-bg); color: var(--green); }
.chip-amber { background: var(--amber-bg); color: var(--amber); }
.chip-red { background: var(--red-bg); color: var(--red); }
.chip-blue { background: var(--blue-bg); color: var(--blue); }
.chip-purple { background: var(--purple-bg); color: var(--purple); }
.chip-teal { background: var(--teal-bg); color: var(--teal); }
.chip-gray { background: var(--line-soft); color: var(--muted); }
.chip-gold { background: var(--gold-bg); color: #9a6512; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-green { background: var(--green); } .dot-red { background: var(--red); } .dot-amber { background: #e37400; }

.delta { font-size: 11.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.delta.up { color: var(--green); } .delta.down { color: var(--red); } .delta.flat { color: var(--muted); }

.avatar-sm { width: 24px; height: 24px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 9.5px; font-weight: 700; flex-shrink: 0; }
.owner-cell { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; }

/* KPI grid */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 13px; margin-bottom: 18px; }
.kpi-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); position: relative; }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi-sub { font-size: 10.5px; color: var(--faint); }
.kpi-icon { width: 32px; height: 32px; border-radius: 9px; background: var(--gold-bg); color: #9a6512; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.kpi-value { font-size: 24px; font-weight: 750; letter-spacing: -.4px; margin: 6px 0 4px; }
.kpi-foot { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.kpi-progress { height: 5px; background: var(--line-soft); border-radius: 99px; margin-top: 9px; overflow: hidden; }
.kpi-progress i { display: block; height: 100%; background: var(--green); border-radius: 99px; }
.kpi-spark { margin-top: 6px; }

/* Progress bars */
.bar { height: 7px; background: var(--line-soft); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--green); transition: width .35s ease; }
.bar.amber i { background: var(--gold); }
.bar.blue i { background: var(--blue); }

/* ============ DASHBOARD ============ */
.journey-card { margin-bottom: 18px; }
.journey-track { display: flex; align-items: flex-start; padding: 18px 10px 14px; overflow-x: auto; }
.journey-step { flex: 1; min-width: 92px; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; cursor: pointer; background: none; }
.journey-step::before {
  content: ""; position: absolute; top: 13px; left: -50%; width: 100%; height: 3px;
  background: var(--line); z-index: 0;
}
.journey-step:first-child::before { display: none; }
.journey-step.done::before, .journey-step.current::before { background: var(--green); }
.journey-node {
  width: 27px; height: 27px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700; z-index: 1; position: relative;
  background: #fff; border: 2px solid var(--line); color: var(--muted);
}
.journey-step.done .journey-node { background: var(--green); border-color: var(--green); color: #fff; }
.journey-step.current .journey-node { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 0 0 4px var(--blue-bg); }
.journey-label { font-size: 12.5px; font-weight: 700; margin-top: 8px; }
.journey-count { font-size: 11px; color: var(--muted); }
.journey-step:hover .journey-label { color: var(--blue); }

.dash-grid { display: grid; grid-template-columns: 1.25fr 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.nba-card { border: 1px solid var(--gold); background: linear-gradient(180deg, #fffdf8, #fdf6e9); }
.nba-inner { border: 1px solid var(--gold-soft); background: #fff8ec; border-radius: 10px; padding: 14px; margin: 14px 18px; }
.nba-title { font-weight: 700; font-size: 14px; margin-bottom: 3px; }
.nba-meta { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.nba-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.nba-why { display: flex; gap: 9px; padding: 0 18px 16px; color: var(--ink-soft); font-size: 12.5px; align-items: flex-start; }
.nba-why b { display: block; font-size: 12px; }

.task-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); }
.task-row:last-of-type { border-bottom: none; }
.task-check { margin-top: 2px; width: 16px; height: 16px; accent-color: var(--green); cursor: pointer; flex-shrink: 0; }
.task-row .t-main { flex: 1; min-width: 0; }
.task-row .t-title { font-size: 13px; font-weight: 600; }
.task-row.done .t-title { text-decoration: line-through; color: var(--faint); }
.task-row .t-sub { font-size: 11.5px; color: var(--muted); }
.task-row .t-due { font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.due-today { color: var(--red); } .due-soon { color: var(--amber); } .due-later { color: var(--muted); }

.activity-row { display: flex; gap: 11px; padding: 10px 18px; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.activity-row:last-child { border-bottom: none; }
.activity-ic { width: 30px; height: 30px; border-radius: 9px; background: var(--blue-bg); color: var(--blue); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.activity-row .a-title { font-size: 12.5px; font-weight: 600; }
.activity-row .a-sub { font-size: 11.5px; color: var(--muted); }
.activity-row .a-when { margin-left: auto; font-size: 11px; color: var(--faint); white-space: nowrap; }

/* Tables */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 720px; }
.data-table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px;
  color: var(--muted); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line);
  white-space: nowrap; background: #fbfaf7;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background .12s; }
.data-table tbody tr:hover { background: #fbf8f1; }
.deal-cell b { display: block; font-size: 13px; color: var(--navy-800); }
.deal-cell span { font-size: 11.5px; color: var(--muted); }
.health-cell { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }

/* ============ PIPELINE ============ */
.stats-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); border: 1px solid var(--line); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 14px; overflow: hidden; }
.stat-cell { padding: 13px 16px; border-right: 1px solid var(--line-soft); }
.stat-cell:last-child { border-right: none; }
.stat-cell .s-label { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.stat-cell .s-value { font-size: 20px; font-weight: 750; letter-spacing: -.3px; margin: 2px 0; }

.filter-bar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-bar .f-search { display: flex; align-items: center; gap: 7px; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 11px; color: var(--muted); min-width: 170px; }
.filter-bar .f-search input { border: none; outline: none; background: none; width: 120px; }
.filter-bar select { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; font-weight: 600; color: var(--ink-soft); cursor: pointer; }

.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kanban-col { min-width: 250px; width: 250px; flex-shrink: 0; background: #efece4; border-radius: var(--radius); padding: 10px; }
.kanban-col.drag-over { outline: 2px dashed var(--gold); outline-offset: -2px; }
.kanban-col-head { display: flex; align-items: center; gap: 7px; padding: 4px 6px 10px; }
.kanban-col-head .kc-dot { width: 8px; height: 8px; border-radius: 50%; }
.kanban-col-head .kc-name { font-weight: 700; font-size: 13px; }
.kanban-col-head .kc-meta { font-size: 11px; color: var(--muted); margin-left: auto; white-space: nowrap; }
.kanban-cards { display: flex; flex-direction: column; gap: 9px; min-height: 40px; }
.deal-card {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; cursor: pointer; box-shadow: 0 1px 2px rgba(18,38,63,.05);
  transition: box-shadow .15s, transform .15s; text-align: left; width: 100%;
  position: relative;
}
.deal-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.deal-card.selected { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232,163,61,.35); }
.deal-card.dragging { opacity: .5; }
.deal-card .dc-name { font-weight: 700; font-size: 13px; color: var(--navy-800); }
.deal-card .dc-sub { font-size: 11px; color: var(--muted); margin-bottom: 8px; }
.deal-card .dc-nums { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-bottom: 7px; }
.deal-card .dc-nums b { display: block; font-size: 13px; color: var(--ink); }
.deal-card .dc-outcome { position: absolute; top: 10px; right: 10px; }
.deal-card .dc-foot { display: flex; align-items: center; gap: 7px; margin-top: 8px; font-size: 11px; color: var(--muted); flex-wrap: wrap; }
.deal-card .dc-next { display: flex; justify-content: space-between; gap: 6px; font-size: 11px; color: var(--muted); border-top: 1px dashed var(--line); margin-top: 9px; padding-top: 7px; }
.deal-card .dc-next .overdue { color: var(--red); font-weight: 700; }
.kanban-add { width: 100%; padding: 8px; border: 1px dashed var(--faint); color: var(--muted); border-radius: 9px; font-size: 12px; font-weight: 600; margin-top: 9px; }
.kanban-add:hover { border-color: var(--gold); color: #9a6512; background: var(--gold-bg); }

/* ============ DRAWER ============ */
.drawer-scrim { position: fixed; inset: 0; background: rgba(11,28,48,.35); z-index: 70; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 400px; max-width: 94vw;
  background: #fff; z-index: 71; box-shadow: -12px 0 40px rgba(11,28,48,.25);
  display: flex; flex-direction: column; overflow-y: auto;
  animation: drawerIn .22s ease;
}
@keyframes drawerIn { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { padding: 16px 18px 12px; border-bottom: 1px solid var(--line-soft); position: sticky; top: 0; background: #fff; z-index: 2; }
.drawer-head .dh-top { display: flex; align-items: flex-start; gap: 8px; }
.drawer-head h3 { font-size: 16px; font-weight: 750; flex: 1; }
.drawer-close { color: var(--muted); font-size: 20px; padding: 2px 8px; border-radius: 7px; }
.drawer-close:hover { background: var(--line-soft); }
.drawer-body { padding: 16px 18px 30px; display: flex; flex-direction: column; gap: 16px; }
.drawer-section h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 8px; }
.kv-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; font-size: 12.5px; border-bottom: 1px dashed var(--line-soft); }
.kv-row:last-child { border-bottom: none; }
.kv-row .k { color: var(--muted); }
.kv-row .v { font-weight: 600; text-align: right; }
.drawer-tabs { display: flex; gap: 2px; margin-top: 12px; border-bottom: 1px solid var(--line-soft); }
.drawer-tab { padding: 7px 12px; font-size: 12.5px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; }
.drawer-tab.active { color: var(--navy-800); border-bottom-color: var(--gold); }
.hl-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.hl-list li { display: flex; gap: 8px; font-size: 12.5px; align-items: flex-start; }
.hl-list li::before { content: "✓"; color: var(--green); font-weight: 800; }
.doc-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 9px; margin-bottom: 7px; font-size: 12.5px; }
.doc-ic { width: 30px; height: 30px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 800; color: #fff; flex-shrink: 0; }
.doc-ic.xlsx { background: #1e8e3e; } .doc-ic.pdf { background: #d93025; } .doc-ic.docx { background: #1f5fa8; }
.doc-row .d-meta { color: var(--muted); font-size: 11px; }
.subtask-row { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 12.5px; }
.subtask-row input { accent-color: var(--green); width: 15px; height: 15px; cursor: pointer; }
.subtask-row.done label { text-decoration: line-through; color: var(--faint); }
.subtask-row label { cursor: pointer; }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============ ANALYZER ============ */
.analyzer-grid { display: grid; grid-template-columns: 190px minmax(320px, 1.15fr) minmax(300px, 1fr) minmax(320px, 1.1fr); gap: 14px; align-items: start; }
.section-rail { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 70px; }
.section-rail button { text-align: left; font-size: 12.5px; padding: 8px 11px; border-radius: 8px; color: var(--ink-soft); font-weight: 500; }
.section-rail button:hover { background: #efece4; }
.section-rail button.active { background: var(--gold-bg); color: #9a6512; font-weight: 700; box-shadow: inset 0 0 0 1px var(--gold-soft); }

.input-group { margin-bottom: 4px; }
.input-group h4 { font-size: 12px; font-weight: 700; color: var(--ink); padding: 12px 0 6px; }
.inp-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5.5px 0; font-size: 12.5px; border-bottom: 1px dashed var(--line-soft); }
.inp-row label { color: var(--ink-soft); }
.inp-row input {
  width: 118px; text-align: right; border: 1px solid var(--line); border-radius: 7px;
  padding: 5.5px 9px; font-weight: 600; background: #fbfaf7;
}
.inp-row input:focus { outline: 2px solid rgba(232,163,61,.4); border-color: var(--gold); background: #fff; }
.inp-row .computed { font-weight: 750; color: var(--blue); }

.waterfall-row { display: flex; justify-content: space-between; padding: 7.5px 0; font-size: 12.5px; border-bottom: 1px dashed var(--line-soft); }
.waterfall-row .neg { color: var(--red); }
.waterfall-row.total { font-weight: 750; border-top: 2px solid var(--ink); border-bottom: none; font-size: 13px; }
.waterfall-row.subtotal { font-weight: 700; background: #fbfaf7; }

.slider-block { padding: 9px 0; border-bottom: 1px dashed var(--line-soft); }
.slider-block .sl-head { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 5px; }
.slider-block .sl-val { font-weight: 750; background: var(--line-soft); border-radius: 6px; padding: 1px 8px; }
.slider-block input[type=range] { width: 100%; accent-color: var(--blue); cursor: pointer; }
.slider-block .sl-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); }

.decision-box { border-radius: 10px; padding: 14px; display: flex; gap: 13px; align-items: center; margin-bottom: 14px; }
.decision-box.go { background: var(--green-bg); border: 1px solid #b7dfc3; }
.decision-box.caution { background: var(--amber-bg); border: 1px solid #f3d9ab; }
.decision-box.nogo { background: var(--red-bg); border: 1px solid #f2b8b5; }
.decision-badge { width: 54px; height: 54px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 14px; color: #fff; flex-shrink: 0; }
.decision-box.go .decision-badge { background: var(--green); }
.decision-box.caution .decision-badge { background: #e37400; font-size: 10px; }
.decision-box.nogo .decision-badge { background: var(--red); font-size: 11px; }
.decision-box .d-title { font-weight: 750; font-size: 14px; }
.decision-box .d-sub { font-size: 12.5px; color: var(--ink-soft); }

.returns-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.return-card { border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; background: #fff; }
.return-card .r-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.return-card .r-value { font-size: 20px; font-weight: 750; margin: 3px 0; letter-spacing: -.3px; }
.return-card .r-target { font-size: 11px; display: flex; align-items: center; gap: 5px; font-weight: 600; }
.return-card .r-target.met { color: var(--green); } .return-card .r-target.miss { color: var(--red); }

.risk-row { display: grid; grid-template-columns: 110px 1fr 64px; align-items: center; gap: 10px; font-size: 12px; padding: 5px 0; }
.risk-pips { display: flex; gap: 3px; }
.risk-pips i { height: 8px; flex: 1; border-radius: 3px; background: var(--line-soft); }
.risk-pips i.on-low { background: var(--green); }
.risk-pips i.on-mod { background: var(--gold); }
.risk-pips i.on-high { background: var(--red); }
.risk-row .r-level { text-align: right; color: var(--muted); font-weight: 600; }

.scenario-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 8px; }
.scenario-chip {
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  padding: 10px 14px; min-width: 150px; text-align: left; flex-shrink: 0;
}
.scenario-chip:hover { box-shadow: var(--shadow); }
.scenario-chip.active { border-color: var(--blue); background: var(--blue-bg); box-shadow: inset 0 0 0 1px var(--blue); }
.scenario-chip .sc-name { font-weight: 700; font-size: 12.5px; }
.scenario-chip .sc-sub { font-size: 11px; color: var(--muted); }
.scenario-chip .sc-metric { font-size: 11.5px; font-weight: 700; margin-top: 4px; }
.scenario-chip .sc-metric.pos { color: var(--green); } .scenario-chip .sc-metric.neg { color: var(--red); }

.sens-note { font-size: 11.5px; color: var(--muted); margin-top: 8px; }

/* ============ DILIGENCE ============ */
.dd-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border: 1px solid var(--line); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px; overflow: hidden; }
.dd-sumcell { padding: 14px 16px; border-right: 1px solid var(--line-soft); }
.dd-sumcell:last-child { border-right: none; }
.dd-sumcell .s-label { font-size: 11px; color: var(--muted); font-weight: 600; }
.dd-sumcell .s-value { font-size: 22px; font-weight: 750; margin: 2px 0; }
.dd-sumcell .s-value.red { color: var(--red); } .dd-sumcell .s-value.amber { color: #e37400; } .dd-sumcell .s-value.blue { color: var(--blue); } .dd-sumcell .s-value.green { color: var(--green); }
.dd-sumcell .s-sub { font-size: 11px; color: var(--muted); }

.dd-grid { display: grid; grid-template-columns: 235px minmax(420px, 1fr) 300px; gap: 14px; align-items: start; }
.dd-cat { width: 100%; text-align: left; display: flex; gap: 11px; padding: 12px; border-radius: 10px; border: 1px solid transparent; align-items: flex-start; }
.dd-cat:hover { background: #f6f3ea; }
.dd-cat.active { background: #fff; border-color: var(--gold); box-shadow: var(--shadow); }
.dd-cat .c-ic { width: 34px; height: 34px; border-radius: 9px; background: var(--blue-bg); color: var(--blue); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.dd-cat .c-name { font-weight: 700; font-size: 13px; }
.dd-cat .c-count { font-size: 11px; color: var(--muted); float: right; }
.dd-cat .c-main { flex: 1; min-width: 0; }
.dd-cat .bar { margin-top: 7px; }
.dd-cat .c-pct { font-size: 11px; color: var(--muted); margin-top: 3px; }
.add-cat { width: 100%; margin-top: 8px; padding: 10px; border: 1px dashed var(--faint); border-radius: 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.add-cat:hover { color: #9a6512; border-color: var(--gold); background: var(--gold-bg); }

.dd-task-row { display: grid; grid-template-columns: 24px 1fr 108px 92px 130px 34px; gap: 10px; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); font-size: 12.5px; }
.dd-task-row:hover { background: #fbfaf7; }
.dd-task-row input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--green); cursor: pointer; }
.dd-task-row .d-label { font-weight: 600; }
.dd-task-row.completed .d-label { color: var(--faint); text-decoration: line-through; }
.dd-task-row .d-doc { font-size: 11.5px; color: var(--blue); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-task-row .d-due { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.dd-th { display: grid; grid-template-columns: 24px 1fr 108px 92px 130px 34px; gap: 10px; padding: 9px 16px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--line); background: #fbfaf7; }
.dd-foot { display: flex; align-items: center; justify-content: space-between; padding: 11px 16px; }

.risk-item { display: flex; gap: 9px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); align-items: flex-start; font-size: 12.5px; }
.risk-item:last-child { border-bottom: none; }
.risk-item .r-body b { display: block; font-size: 12.5px; }
.risk-item .r-body span { color: var(--muted); font-size: 11.5px; }
.reqdoc-row { display: flex; align-items: center; gap: 9px; padding: 6px 0; font-size: 12.5px; }
.reqdoc-row .missing { color: var(--red); }
.reqdoc-row .got { color: var(--green); }
.msg-row { display: flex; gap: 9px; padding: 8px 0; align-items: flex-start; }
.msg-row .m-body { background: var(--line-soft); border-radius: 10px; padding: 8px 11px; font-size: 12.5px; flex: 1; }
.msg-row .m-head { font-weight: 700; font-size: 11.5px; margin-bottom: 2px; display: flex; gap: 8px; }
.msg-row .m-head span { color: var(--faint); font-weight: 500; }
.comment-box { display: flex; gap: 8px; margin-top: 10px; }
.comment-box input { flex: 1; border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; }
.comment-box input:focus { outline: 2px solid rgba(232,163,61,.35); }

/* ============ TRANSITION ============ */
.tr-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0; border: 1px solid var(--line); background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 18px; overflow: hidden; }
.tr-sumcell { padding: 15px 18px; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 4px; }
.tr-sumcell:last-child { border-right: none; }
.tr-sumcell .s-label { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.tr-sumcell .s-value { font-size: 19px; font-weight: 750; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.tr-sumcell .s-sub { font-size: 12px; color: var(--muted); }

.tr-grid { display: grid; grid-template-columns: minmax(0, 1fr) 290px; gap: 14px; align-items: start; }
.phase-cols { display: grid; grid-template-columns: repeat(3, minmax(250px, 1fr)); gap: 13px; }
.phase-card { border-top: 4px solid var(--line); }
.phase-card.tone-green { border-top-color: var(--green); }
.phase-card.tone-amber { border-top-color: var(--gold); }
.phase-card.tone-blue { border-top-color: var(--blue); }
.phase-head { padding: 14px 16px 10px; display: flex; gap: 11px; align-items: flex-start; }
.phase-badge { width: 44px; height: 44px; border-radius: 50%; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; font-weight: 800; color: #fff; flex-shrink: 0; line-height: 1.1; }
.tone-green .phase-badge { background: var(--green); }
.tone-amber .phase-badge { background: #e29a2e; }
.tone-blue .phase-badge { background: var(--blue); }
.phase-head .p-days { font-size: 11px; font-weight: 800; letter-spacing: .3px; }
.tone-green .p-days { color: var(--green); } .tone-amber .p-days { color: #b06e0e; } .tone-blue .p-days { color: var(--blue); }
.phase-head h3 { font-size: 15px; font-weight: 750; }
.phase-head .p-sub { font-size: 11.5px; color: var(--muted); }
.phase-stats { display: flex; padding: 0 16px 10px; gap: 16px; font-size: 11px; color: var(--muted); }
.phase-stats b { display: block; font-size: 14px; color: var(--ink); }
.phase-stats .at-risk b { color: var(--red); }
.phase-section { padding: 10px 16px; border-top: 1px solid var(--line-soft); }
.phase-section h4 { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-bottom: 7px; }
.obj-row { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 12.5px; }
.obj-row input { width: 15px; height: 15px; accent-color: var(--green); cursor: pointer; }
.obj-row.done label { color: var(--faint); text-decoration: line-through; }
.obj-row label { cursor: pointer; }
.ktask-row { display: flex; align-items: center; gap: 8px; padding: 4.5px 0; font-size: 12px; }
.ktask-row .k-status { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); flex-shrink: 0; cursor: pointer; padding: 0; }
.ktask-row .k-status.done { background: var(--green); border-color: var(--green); position: relative; }
.ktask-row .k-status.at-risk { border-color: var(--red); background: var(--red-bg); }
.ktask-row .k-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ktask-row.done .k-label { color: var(--faint); text-decoration: line-through; }
.ktask-row .k-due { font-size: 11px; color: var(--muted); white-space: nowrap; }
.ktask-row .k-due.late { color: var(--red); font-weight: 700; }
.phase-foot { padding: 10px 16px; border-top: 1px solid var(--line-soft); }

.side-stack { display: flex; flex-direction: column; gap: 13px; }
.person-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 12.5px; }
.person-row .p-role { color: var(--muted); font-size: 11px; }
.person-row .chip { margin-left: auto; }
.qw-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 12.5px; }
.note-row { padding: 8px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12px; }
.note-row:last-child { border-bottom: none; }
.note-row .n-when { color: var(--faint); font-size: 11px; }

/* ============ CHARTS ============ */
.chart-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.chart-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 14px; }
.chart-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.chart-head .ch-value { font-size: 21px; font-weight: 750; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 11px; color: var(--muted); align-items: center; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 5px; vertical-align: -1px; }
svg.chart { width: 100%; height: auto; display: block; }
.chart-tip { position: fixed; z-index: 90; background: var(--navy-900); color: #fff; font-size: 11.5px; border-radius: 7px; padding: 6px 10px; pointer-events: none; box-shadow: var(--shadow-lg); white-space: nowrap; }

.funnel-row { display: grid; grid-template-columns: 110px 1fr 84px; align-items: center; gap: 10px; padding: 4.5px 0; font-size: 12px; }
.funnel-row .f-bar-track { height: 22px; display: flex; justify-content: center; }
.funnel-row .f-bar { height: 100%; border-radius: 5px; min-width: 8%; transition: width .4s ease; }
.funnel-row .f-nums { text-align: right; font-weight: 700; font-size: 12.5px; }
.funnel-row .f-nums span { color: var(--muted); font-weight: 500; font-size: 11px; margin-left: 5px; }

.driver-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12.5px; font-weight: 600; }
.driver-row:last-child { border-bottom: none; }
.driver-row .d-ic { width: 28px; height: 28px; border-radius: 8px; background: var(--line-soft); color: var(--ink-soft); display: flex; align-items: center; justify-content: center; }
.driver-row .delta { margin-left: auto; }

.insight-row { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px dashed var(--line-soft); align-items: flex-start; }
.insight-row:last-child { border-bottom: none; }
.insight-row .i-ic { width: 30px; height: 30px; border-radius: 50%; background: var(--line-soft); display: flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--ink-soft); }
.insight-row p { font-size: 12.5px; flex: 1; }
.insight-row .card-link { white-space: nowrap; }

.heatmap { border-collapse: collapse; width: 100%; font-size: 11.5px; min-width: 480px; }
.heatmap th { font-size: 10.5px; color: var(--muted); text-transform: uppercase; padding: 6px; font-weight: 700; }
.heatmap td { padding: 3px; }
.heatmap td .cell { border-radius: 5px; text-align: center; padding: 7px 4px; font-weight: 700; color: #fff; font-size: 11px; }
.heatmap .row-name { text-align: left; font-weight: 600; color: var(--ink); white-space: nowrap; padding-right: 8px; }
.heat-legend { display: flex; gap: 12px; font-size: 10.5px; color: var(--muted); margin-top: 9px; flex-wrap: wrap; }

.growth-row { display: grid; grid-template-columns: 150px 1fr 64px; gap: 10px; align-items: center; padding: 6px 0; font-size: 12px; }
.growth-row .g-track { position: relative; height: 16px; background: var(--line-soft); border-radius: 5px; overflow: hidden; }
.growth-row .g-bar { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.growth-row .g-val { font-weight: 700; text-align: right; }
.growth-row .g-val.neg { color: var(--red); }

.aging-row { display: grid; grid-template-columns: 84px 1fr 40px; gap: 10px; align-items: center; padding: 6px 0; font-size: 12px; }
.aging-track { display: flex; height: 20px; border-radius: 5px; overflow: hidden; background: var(--line-soft); }
.aging-track i { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 9.5px; font-weight: 700; min-width: 0; overflow: hidden; }
.aging-row .a-total { font-weight: 700; text-align: right; }

/* ============ TASKS VIEW ============ */
.tasks-grid { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 14px; align-items: start; }
.task-rail { display: flex; flex-direction: column; gap: 2px; position: sticky; top: 70px; }
.task-rail button { display: flex; justify-content: space-between; align-items: center; text-align: left; font-size: 12.5px; padding: 8px 11px; border-radius: 8px; color: var(--ink-soft); font-weight: 600; }
.task-rail button:hover { background: #efece4; }
.task-rail button.active { background: var(--gold-bg); color: #9a6512; box-shadow: inset 0 0 0 1px var(--gold-soft); }
.task-rail .count { font-size: 11px; color: var(--muted); background: var(--line-soft); border-radius: 99px; padding: 1px 7px; }
.task-rail button.active .count { background: #fff; color: #9a6512; }
.tasks-table tbody tr.selected { background: var(--blue-bg); }
.priority-cell { display: inline-flex; align-items: center; gap: 5px; font-weight: 700; font-size: 11.5px; }
.priority-cell.high { color: var(--red); } .priority-cell.medium { color: #e37400; } .priority-cell.low { color: var(--muted); }
.tasks-pager { display: flex; align-items: center; gap: 6px; padding: 12px 16px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.status-select { border: none; border-radius: 99px; font-size: 11px; font-weight: 700; padding: 3px 8px; cursor: pointer; -webkit-appearance: none; appearance: none; text-align: center; }

/* ============ SETTINGS ============ */
.settings-grid { display: grid; grid-template-columns: 210px minmax(380px, 1.4fr) minmax(280px, 1fr); gap: 14px; align-items: start; }
.settings-rail button { width: 100%; text-align: left; padding: 10px 12px; border-radius: 9px; }
.settings-rail button .r-label { font-weight: 700; font-size: 13px; display: block; }
.settings-rail button .r-sub { font-size: 11px; color: var(--muted); }
.settings-rail button:hover { background: #f2efe6; }
.settings-rail button.active { background: var(--gold-bg); box-shadow: inset 0 0 0 1px var(--gold-soft); }
.settings-rail button.active .r-label { color: #9a6512; }

.stage-pills { display: flex; align-items: flex-start; overflow-x: auto; gap: 0; padding: 14px 4px; }
.stage-pill { flex: 1; min-width: 76px; display: flex; flex-direction: column; align-items: center; gap: 5px; background: none; position: relative; padding-top: 2px; }
.stage-pill::before { content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 3px; background: var(--line); }
.stage-pill:first-child::before { display: none; }
.stage-pill .n { width: 27px; height: 27px; border-radius: 50%; background: #fff; border: 2px solid var(--line); color: var(--muted); font-size: 11.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; position: relative; z-index: 1; }
.stage-pill.done .n { background: var(--green); border-color: var(--green); color: #fff; }
.stage-pill.done::before { background: var(--green); }
.stage-pill.current .n { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 0 0 4px var(--blue-bg); }
.stage-pill .s-name { font-size: 12px; font-weight: 700; }
.stage-pill .s-count { font-size: 10.5px; color: var(--muted); }
.stage-pill.current .s-name { color: var(--blue); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field label { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); }
.form-field input, .form-field select, .form-field textarea {
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 11px; background: #fff;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline: 2px solid rgba(232,163,61,.35); border-color: var(--gold); }
.form-field .hint { font-size: 11px; color: var(--faint); }
.form-field.full { grid-column: 1 / -1; }

.switch { position: relative; width: 36px; height: 20px; flex-shrink: 0; display: inline-block; }
.switch input { opacity: 0; width: 100%; height: 100%; position: absolute; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { position: absolute; inset: 0; border-radius: 99px; background: #cbd5e1; transition: background .18s; }
.switch .track::after { content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; background: #fff; top: 2px; left: 2px; transition: left .18s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { left: 18px; }

.rule-row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12px; flex-wrap: wrap; }
.rule-row:last-child { border-bottom: none; }
.rule-row .r-when { flex: 1; min-width: 180px; font-weight: 600; }
.rule-row .r-then { background: var(--line-soft); border-radius: 7px; padding: 4px 9px; font-weight: 600; }
.rule-row .r-notify { color: var(--muted); font-size: 11.5px; }
.perm-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.perm-table th { font-size: 10.5px; text-transform: uppercase; color: var(--muted); padding: 8px 6px; text-align: center; }
.perm-table th:first-child { text-align: left; }
.perm-table td { padding: 8px 6px; text-align: center; border-top: 1px solid var(--line-soft); }
.perm-table td:first-child { text-align: left; font-weight: 600; }
.perm-yes { color: var(--green); font-weight: 800; }
.perm-no { color: var(--faint); }

.tip-card { background: #fffdf5; border: 1px solid var(--gold-soft); }
.change-row { display: flex; gap: 9px; padding: 8px 0; border-bottom: 1px dashed var(--line-soft); font-size: 12px; align-items: center; }
.change-row:last-child { border-bottom: none; }
.impact-nums { display: flex; gap: 12px; margin-top: 10px; }
.impact-nums .n-box { flex: 1; border: 1px solid var(--line); border-radius: 9px; text-align: center; padding: 10px; }
.impact-nums .n-box b { display: block; font-size: 20px; }
.impact-nums .n-box span { font-size: 11px; color: var(--muted); }
.integration-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px dashed var(--line-soft); }
.integration-row:last-child { border-bottom: none; }
.integration-row .i-name { font-weight: 700; font-size: 13px; }
.integration-row .i-sub { font-size: 11.5px; color: var(--muted); }
.integration-row .btn { margin-left: auto; }
.pref-row { display: flex; align-items: center; gap: 11px; padding: 10px 0; border-bottom: 1px dashed var(--line-soft); }
.pref-row:last-child { border-bottom: none; }
.pref-row .p-label { font-weight: 700; font-size: 13px; }
.pref-row .p-sub { font-size: 11.5px; color: var(--muted); }
.pref-row .switch { margin-left: auto; }

/* ============ MODAL ============ */
.modal-scrim { position: fixed; inset: 0; background: rgba(11,28,48,.45); z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal { background: #fff; border-radius: 14px; box-shadow: var(--shadow-lg); width: 520px; max-width: 100%; animation: modalIn .2s ease; }
@keyframes modalIn { from { transform: translateY(14px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-size: 16px; font-weight: 750; flex: 1; }
.modal-body { padding: 16px 20px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 12px 20px 18px; }

/* ============ TOASTS ============ */
.toasts { position: fixed; bottom: 20px; right: 20px; display: flex; flex-direction: column; gap: 9px; z-index: 100; }
.toast {
  background: var(--navy-900); color: #fff; border-radius: 10px; padding: 11px 16px;
  font-size: 13px; box-shadow: var(--shadow-lg); display: flex; align-items: center; gap: 9px;
  animation: toastIn .25s ease; max-width: 340px;
}
.toast.success::before { content: "✓"; color: #6fd08c; font-weight: 800; }
.toast.info::before { content: "ℹ"; color: var(--gold-soft); font-weight: 800; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .3s; }

.empty-state { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13px; }

/* prevent grid/flex min-content blowout on small screens */
.dash-grid > *, .chart-grid-2 > *, .chart-grid-3 > *, .tasks-grid > *, .settings-grid > *,
.dd-grid > *, .analyzer-grid > *, .tr-grid > *, .phase-cols > *, .side-stack > *,
.kpi-grid > *, .lb-grid > * { min-width: 0; }
.lb-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin-bottom: 14px; }
@media (min-width: 1025px) { .lb-grid { grid-template-columns: 1.5fr 1fr; } }
.mt8 { margin-top: 8px; } .mt12 { margin-top: 12px; } .mb14 { margin-bottom: 14px; }
.muted { color: var(--muted); } .small { font-size: 11.5px; }

/* ============ AUTH GATE ============ */
.auth-gate { position: fixed; inset: 0; z-index: 200; display: flex; background: var(--cream); }
.auth-brand-panel {
  flex: 1.1; background: linear-gradient(160deg, var(--navy-800), var(--navy-900));
  color: #d7e0ea; padding: 56px 60px; display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.auth-brand-panel::after {
  content: ""; position: absolute; right: -120px; top: -120px; width: 340px; height: 340px;
  border-radius: 50%; background: radial-gradient(circle, rgba(232,163,61,.18), transparent 70%);
}
.auth-brand { display: flex; align-items: center; gap: 12px; font-size: 19px; font-weight: 800; color: #fff; margin-bottom: 38px; }
.auth-mark { color: var(--gold); display: flex; }
.auth-brand-panel h1 { font-size: 34px; line-height: 1.2; color: #fff; letter-spacing: -.5px; margin-bottom: 14px; }
.auth-tag { font-size: 15px; color: #b9c6d6; max-width: 460px; margin-bottom: 30px; }
.auth-points { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.auth-points li { font-size: 13.5px; color: #cfd9e6; padding-left: 4px; }
.auth-points b { color: var(--gold); font-size: 15px; margin-right: 2px; }
.auth-foot { margin-top: 40px; font-size: 12px; color: #7d90a8; }
.auth-form-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.auth-card { width: 380px; max-width: 100%; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 30px 30px 24px; }
.auth-card h2 { font-size: 22px; letter-spacing: -.3px; }
.auth-sub { color: var(--muted); font-size: 13px; margin: 4px 0 18px; }
.auth-card .form-field { margin-bottom: 13px; }
.auth-remember { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); margin: 4px 0 16px; cursor: pointer; }
.auth-remember input { accent-color: var(--gold); width: 15px; height: 15px; }
.auth-submit { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }
.auth-demo { width: 100%; justify-content: center; margin-top: 10px; padding: 10px; }
.auth-switch { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 16px; }
.auth-switch button { color: var(--blue); font-weight: 700; font-size: 12.5px; }
.auth-switch button:hover { text-decoration: underline; }
.auth-error { background: var(--red-bg); color: var(--red); border-radius: 8px; padding: 9px 12px; font-size: 12.5px; margin-bottom: 13px; font-weight: 600; }
@media (max-width: 900px) {
  .auth-gate { flex-direction: column; overflow-y: auto; }
  .auth-brand-panel { flex: none; padding: 34px 26px; }
  .auth-brand-panel h1 { font-size: 24px; }
  .auth-points, .auth-foot { display: none; }
  .auth-brand { margin-bottom: 20px; }
  .auth-tag { margin-bottom: 0; }
  .auth-form-panel { padding: 24px 16px 40px; align-items: flex-start; }
}

/* ============ USER MENU ============ */
.user-wrap { position: relative; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); width: 220px;
  background: #fff; border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; z-index: 90; border: 1px solid var(--line);
}
.user-menu hr { border: none; border-top: 1px solid var(--line-soft); margin: 5px 4px; }
.user-menu-item { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink); }
.user-menu-item:hover { background: var(--line-soft); }
.user-menu-item.danger { color: var(--red); }

/* market multiple band */
.band-track { position: relative; height: 10px; border-radius: 99px; background: linear-gradient(90deg, #1e8e3e 0%, #8bbf4d 35%, #e8a33d 55%, #e37400 75%, #d93025 100%); margin: 4px 0 3px; }
.band-marker { position: absolute; top: -4px; width: 5px; height: 18px; border-radius: 3px; background: var(--navy-900); box-shadow: 0 0 0 2px #fff; transform: translateX(-50%); }
.band-marker.hot { background: var(--red); }
.band-scale { display: flex; justify-content: space-between; font-size: 10px; color: var(--faint); margin-bottom: 4px; }

/* glossary tooltips */
.gloss { border-bottom: 1px dotted var(--faint); cursor: help; }
.chart-tip { max-width: 300px; white-space: normal; line-height: 1.45; }

/* reminder + note chips */
.reminder-chip { background: var(--gold-bg); color: #9a6512; }
.note-block { background: #fbfaf7; border: 1px solid var(--line-soft); border-radius: 9px; padding: 9px 12px; font-size: 12.5px; margin-top: 8px; }
.note-block .n-when { color: var(--faint); font-size: 11px; margin-top: 3px; }
.menu-list { display: flex; flex-direction: column; gap: 6px; }
.menu-list .btn { justify-content: flex-start; white-space: normal; text-align: left; }
.menu-list .btn span { white-space: normal; }

/* getting started checklist */
.gs-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; border-bottom: 1px dashed var(--line-soft); }
.gs-row:last-child { border-bottom: none; }
.gs-row .gs-check { width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; flex-shrink: 0; }
.gs-row.done .gs-check { background: var(--green-bg); color: var(--green); }
.gs-row:not(.done) .gs-check { background: var(--line-soft); color: var(--faint); }
.gs-row.done .gs-label { color: var(--faint); text-decoration: line-through; }
.gs-row .btn { margin-left: auto; }

/* ============ AI COPILOT ============ */
.ai-fab {
  position: fixed; bottom: 20px; left: 20px; z-index: 95;
  display: flex; align-items: center; gap: 8px;
  background: var(--navy-800); color: #fff; border-radius: 99px;
  padding: 11px 18px; font-weight: 700; font-size: 13.5px;
  box-shadow: var(--shadow-lg); border: 1px solid rgba(232,163,61,.5);
}
.ai-fab svg { color: var(--gold); }
.ai-fab:hover { background: var(--navy-700); transform: translateY(-1px); }
.ai-panel {
  position: fixed; bottom: 20px; left: 20px; z-index: 96;
  width: 400px; max-width: calc(100vw - 32px); height: 560px; max-height: calc(100vh - 40px);
  background: #fff; border-radius: 16px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line);
  animation: modalIn .22s ease;
}
.ai-head {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(135deg, var(--navy-800), var(--navy-900));
  color: #fff; padding: 13px 16px; font-size: 13.5px;
}
.ai-head .drawer-close { margin-left: auto; color: #cfd9e6; }
.ai-head-ic { font-size: 20px; }
.ai-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: #fbfaf7; }
.ai-msg { max-width: 88%; border-radius: 14px; padding: 9px 13px; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.ai-msg.user { align-self: flex-end; background: var(--navy-800); color: #fff; border-bottom-right-radius: 4px; }
.ai-msg.assistant { align-self: flex-start; background: #fff; border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.ai-msg.assistant b { color: var(--navy-800); }
.ai-msg .doc-chip { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.15); border-radius: 6px; padding: 2px 8px; font-size: 11px; margin-bottom: 5px; }
.ai-actions { align-self: flex-start; display: flex; flex-direction: column; gap: 5px; max-width: 88%; }
.ai-action-chip { display: inline-flex; align-items: flex-start; gap: 6px; background: var(--green-bg); color: var(--green); font-size: 11.5px; font-weight: 600; border-radius: 8px; padding: 5px 10px; }
.ai-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; }
.ai-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); animation: aiBlink 1.2s infinite; }
.ai-typing i:nth-child(2) { animation-delay: .2s; } .ai-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes aiBlink { 0%, 60%, 100% { opacity: .3; } 30% { opacity: 1; } }
.ai-inputbar { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line-soft); background: #fff; }
.ai-inputbar textarea {
  flex: 1; border: 1px solid var(--line); border-radius: 12px; padding: 9px 12px;
  resize: none; max-height: 110px; font-size: 13px; line-height: 1.4; outline: none;
}
.ai-inputbar textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(232,163,61,.25); }
.ai-attach { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; color: var(--muted); cursor: pointer; flex-shrink: 0; }
.ai-attach:hover { background: var(--line-soft); color: var(--ink); }
.ai-send { padding: 9px 12px; border-radius: 12px; flex-shrink: 0; }
.ai-send:disabled { opacity: .5; cursor: default; }
.ai-attach-chip { padding: 6px 14px 10px; background: #fff; font-size: 11.5px; color: var(--ink-soft); display: flex; align-items: center; gap: 8px; }
.ai-attach-chip button { color: var(--red); font-weight: 700; }
.ai-welcome { text-align: center; color: var(--muted); font-size: 12.5px; padding: 18px 10px; }
.ai-welcome .ai-suggest { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.ai-welcome .ai-suggest button { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 12px; text-align: left; color: var(--ink); }
.ai-welcome .ai-suggest button:hover { border-color: var(--gold); }
@media (max-width: 560px) {
  .ai-panel { left: 8px; right: 8px; bottom: 8px; width: auto; height: 78vh; }
  .ai-fab span { display: none; }
  .ai-fab { padding: 12px; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1240px) {
  .analyzer-grid { grid-template-columns: minmax(300px, 1fr) minmax(300px, 1fr); }
  .analyzer-grid .section-rail { display: none; }
  .dd-grid { grid-template-columns: 220px minmax(0, 1fr); }
  .dd-side { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 13px; }
  .settings-grid { grid-template-columns: 190px minmax(0, 1fr); }
  .settings-side { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 13px; }
  .tr-grid { grid-template-columns: 1fr; }
  .side-stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
  .chart-grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1024px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-105%);
    transition: transform .25s ease; box-shadow: var(--shadow-lg); height: 100vh; height: 100dvh;
  }
  .sidebar.open { transform: none; }
  .sidebar-close { display: block; }
  .sidebar-scrim.show { display: block; position: fixed; inset: 0; background: rgba(11,28,48,.45); z-index: 39; }
  .hamburger { display: flex; }
  .user-meta { display: none; }
  .workspace-pill:not(.org-pill) { display: none; }
  .dash-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid > :first-child { grid-column: 1 / -1; }
  .phase-cols { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .view { padding: 16px 14px 44px; }
  .org-pill span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; }
  .dash-grid { grid-template-columns: 1fr; }
  .chart-grid-2, .chart-grid-3 { grid-template-columns: 1fr; }
  .analyzer-grid { grid-template-columns: 1fr; }
  .returns-grid { grid-template-columns: 1fr 1fr; }
  .dd-grid { grid-template-columns: 1fr; }
  .dd-cats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
  .dd-th { display: none; }
  .dd-task-row { grid-template-columns: 24px 1fr; grid-auto-rows: auto; row-gap: 4px; }
  .dd-task-row > :nth-child(n+3) { grid-column: 2; }
  .tasks-grid { grid-template-columns: 1fr; }
  .task-rail { position: static; flex-direction: row; overflow-x: auto; padding-bottom: 4px; }
  .task-rail button { white-space: nowrap; flex-shrink: 0; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-rail { display: flex; overflow-x: auto; gap: 6px; }
  .settings-rail button { white-space: nowrap; flex-shrink: 0; width: auto; }
  .settings-rail button .r-sub { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .tr-summary { grid-template-columns: 1fr 1fr; }
  .global-search kbd { display: none; }
  .drawer { width: 100vw; max-width: 100vw; }
}
@media (max-width: 560px) {
  .topbar { padding: 10px 12px; gap: 8px; }
  .org-pill { display: none; }
  .view-title { font-size: 19px; }
  .tr-summary { grid-template-columns: 1fr; }
  .returns-grid { grid-template-columns: 1fr; }
  .kanban-col { min-width: 82vw; width: 82vw; }
}
