/* Insightra Management Dashboard — sidebar shell + dense analytics system */

body { background: var(--canvas-2); }

/* ── Shell ──────────────────────────────────────────────── */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px; flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 14px 14px;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 18px; }
.brand-mark-img { height: 30px; width: auto; display: block; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; flex: 1; min-width: 0; }
.brand-name { font-weight: 800; font-size: 15.5px; letter-spacing: -0.01em; }
.brand-sub { font-size: 10.5px; color: var(--ink-3); font-weight: 500; }
.side-collapse { width: 26px; height: 26px; border-radius: 7px; color: var(--ink-faint); display: grid; place-items: center; }
.side-collapse:hover { background: var(--surface-2); color: var(--ink-2); }

.side-nav { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.side-nav::-webkit-scrollbar { width: 0; }
.side-group { display: flex; flex-direction: column; gap: 2px; }
.side-label {
  font-size: 10.5px; font-weight: 600; color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.1em; padding: 0 8px 6px;
}
.side-item {
  display: flex; align-items: center; gap: 11px; height: 38px; padding: 0 10px;
  border-radius: 10px; font-size: 13.5px; font-weight: 500; color: var(--ink-2); width: 100%; text-align: left;
  transition: background var(--duration) var(--ease), color var(--duration) var(--ease);
}
.side-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--ink-3); }
.side-item span { flex: 1; min-width: 0; }
.side-item:hover { background: var(--surface-2); color: var(--ink); }
.side-item.active { background: var(--brand); color: #fff; font-weight: 600; }
.side-item.active svg { color: #fff; }
.side-badge {
  flex: none !important; font-family: var(--font-mono); font-size: 10.5px; font-weight: 600;
  background: var(--surface-3); color: var(--ink-3); padding: 1px 7px; border-radius: 999px;
}
.side-item.active .side-badge { background: rgba(255,255,255,0.22); color: #fff; }

.side-folder {
  display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 12px;
  border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--ink-2); width: 100%; text-align: left;
}
.side-folder:hover { background: var(--surface-2); color: var(--ink); }
.side-folder.dim { color: var(--ink-faint); font-size: 12.5px; }
.side-folder .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-faint); flex-shrink: 0; }
.side-folder .dot.pilot { background: var(--brand); }
.side-tag { margin-left: auto; font-size: 10px; font-weight: 600; color: var(--brand-text); background: var(--brand-soft); padding: 1px 7px; border-radius: 999px; }

.side-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.side-profile { display: flex; align-items: center; gap: 10px; padding: 8px 8px 2px; }
.side-profile .avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-text); font-weight: 700; font-size: 13px; display: grid; place-items: center; }
.sp-text { line-height: 1.2; } .sp-name { font-size: 13px; font-weight: 600; } .sp-sub { font-size: 11px; color: var(--ink-3); }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: 60px; display: flex; align-items: center; gap: 16px;
  padding: 0 26px; background: rgba(250,250,249,0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border);
}
.search {
  display: flex; align-items: center; gap: 9px; height: 36px; padding: 0 12px; width: 340px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; color: var(--ink-3); font-size: 12.5px;
}
.search kbd { margin-left: auto; font-size: 11px; padding: 1px 6px; background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 5px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.collab { display: flex; align-items: center; }
.collab .cl {
  width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700;
  display: grid; place-items: center; margin-left: -7px; border: 2px solid var(--canvas-2);
}
.collab .cl:first-child { margin-left: 0; }
.collab .cl.more { background: var(--surface-3); color: var(--ink-2); }
.icon-btn { position: relative; width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; color: var(--ink-2); transition: background var(--duration) var(--ease); }
.icon-btn:hover { background: var(--surface-2); }
.notif-dot { position: absolute; top: 7px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); border: 1.5px solid var(--canvas-2); }
.add-btn { width: 36px; height: 36px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; }
.add-btn:hover { background: var(--brand-2); }

.main { padding: 22px 26px 56px; }

/* ── Page head (shared by all routes) ──────────────────── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.page-head h1 { margin: 6px 0 0; font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.page-head p { margin: 4px 0 0; color: var(--ink-3); font-size: 13px; max-width: 56ch; }
.page-head .actions { display: flex; gap: 9px; flex-shrink: 0; }

/* ── Card + bento ──────────────────────────────────────── */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-card); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head h3 { margin: 0; font-size: 14px; font-weight: 700; letter-spacing: -0.01em; }
.card-head .more { font-size: 12px; font-weight: 600; color: var(--ink-3); }
.card-head .more:hover { color: var(--ink); }

.bento { display: grid; grid-template-columns: repeat(12, 1fr); gap: 13px; }
.col-3 { grid-column: span 3; } .col-4 { grid-column: span 4; } .col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; } .col-7 { grid-column: span 7; } .col-8 { grid-column: span 8; }
.col-9 { grid-column: span 9; } .col-12 { grid-column: span 12; }

/* ── Hero report card ──────────────────────────────────── */
.hero { padding: 22px; display: flex; flex-direction: column; height: 100%; }
.hero .hero-eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.hero .hero-eyebrow .he-name { font-size: 13px; color: var(--ink-3); }
.hero h2 { margin: 0 0 14px; font-size: 16px; font-weight: 700; }
.hero .hero-figure { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.hero .hero-num { font-family: var(--font-mono); font-weight: 600; font-size: 40px; letter-spacing: -0.03em; line-height: 1; }
.delta { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; font-family: var(--font-mono); }
.delta.up { background: var(--ok-bg); color: var(--ok-fg); }
.delta.brand { background: var(--brand-soft); color: var(--brand-text); }
.hero .hero-sub { font-size: 12.5px; color: var(--ink-3); margin-bottom: 18px; }
.hero .timeframe { margin-top: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tf-pill { height: 30px; padding: 0 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 7px; }
.tf-pill.dark { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; font-weight: 600; }
.tf-pill .mono { font-size: 11.5px; }

/* segmented progress bar in hero */
.seg-bar { display: flex; height: 8px; border-radius: 6px; overflow: hidden; gap: 2px; margin: 4px 0 16px; }
.seg-bar span { display: block; height: 100%; }

/* ── Small stat cards (right of hero) ──────────────────── */
.mini { padding: 14px 15px; display: flex; flex-direction: column; gap: 4px; height: 100%; }
.mini .m-top { display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: var(--ink-3); }
.mini .m-num { font-family: var(--font-mono); font-weight: 600; font-size: 26px; letter-spacing: -0.02em; }
.mini .m-foot { font-size: 11.5px; color: var(--ink-3); margin-top: auto; }
.mini.dark { background: var(--surface); color: var(--ink); border-color: var(--border); }
.mini.dark .m-num { color: var(--brand); }
.mini.brand { background: var(--brand); color: #fff; border-color: var(--brand); }
.mini.brand .m-top, .mini.brand .m-foot { color: rgba(255,255,255,0.78); }
.avatar-xs { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--ink-2); font-size: 10px; font-weight: 700; display: inline-grid; place-items: center; }

/* ── KPI mini-metric row ───────────────────────────────── */
.metric { padding: 15px 16px; display: flex; flex-direction: column; gap: 9px; }
.metric .me-label { font-size: 12px; color: var(--ink-3); font-weight: 500; display: flex; align-items: center; gap: 7px; }
.metric .me-ico { width: 26px; height: 26px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink-2); }
.metric .me-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.metric .me-num { font-family: var(--font-mono); font-weight: 600; font-size: 27px; letter-spacing: -0.02em; line-height: 1; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 30px; width: 78px; }
.spark span { flex: 1; background: var(--surface-3); border-radius: 2px 2px 0 0; min-height: 3px; }
.spark span.hot { background: var(--brand); }

/* ── Source list (platforms) ───────────────────────────── */
.src-row { display: flex; align-items: center; gap: 12px; padding: 11px 4px; border-top: 1px solid var(--border); }
.src-row:first-child { border-top: none; }
.src-ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; flex-shrink: 0; }
.src-main { flex: 1; min-width: 0; }
.src-name { font-weight: 600; font-size: 13px; }
.src-sub { font-size: 11.5px; color: var(--ink-3); }
.src-val { font-family: var(--font-mono); font-weight: 600; font-size: 13.5px; }
.src-pct { font-size: 11px; font-weight: 600; color: var(--ok-fg); }

/* ── Donut ─────────────────────────────────────────────── */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { position: relative; width: 128px; height: 128px; flex-shrink: 0; }
.donut svg { transform: rotate(-90deg); }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.donut-center b { font-family: var(--font-mono); font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.donut-center span { font-size: 10.5px; color: var(--ink-3); }
.legend-list { display: flex; flex-direction: column; gap: 9px; flex: 1; }
.legend-list .lg { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.legend-list .lg .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.legend-list .lg .lg-val { margin-left: auto; font-family: var(--font-mono); font-weight: 600; color: var(--ink-2); }

/* ── Line chart ────────────────────────────────────────── */
.linechart { width: 100%; height: 132px; display: block; }
.lc-grid line { stroke: var(--border); stroke-width: 1; }
.lc-area { fill: rgba(214,0,13,0.07); }
.lc-line { fill: none; stroke: var(--brand); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.lc-dot { fill: #fff; stroke: var(--brand); stroke-width: 2.4; }
.lc-dot.pos { stroke: var(--ok-fg); }

/* ── Crimson activity card ─────────────────────────────── */
.crimson { background: var(--brand); color: #fff; border: none; padding: 18px; }
.crimson .card-head h3 { color: #fff; }
.crimson .seg-toggle { display: flex; gap: 4px; background: rgba(255,255,255,0.16); border-radius: 9px; padding: 3px; }
.crimson .seg-toggle button { flex: 1; height: 28px; border-radius: 7px; font-size: 11.5px; font-weight: 600; color: rgba(255,255,255,0.8); }
.crimson .seg-toggle button.on { background: #fff; color: var(--brand); }
.crimson .bars { display: flex; align-items: flex-end; gap: 9px; height: 100px; margin-top: 16px; }
.crimson .bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; }
.crimson .bars .bar i { width: 100%; background: rgba(255,255,255,0.32); border-radius: 5px 5px 0 0; transition: height var(--duration) var(--ease); }
.crimson .bars .bar i.hot { background: #fff; }
.crimson .bars .bar small { font-size: 10.5px; color: rgba(255,255,255,0.75); }
.crimson .c-figure { font-family: var(--font-mono); font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin-top: 4px; }
.crimson .c-sub { font-size: 12px; color: rgba(255,255,255,0.8); }

/* ── Leads table (compact) ─────────────────────────────── */
.lead-row { display: flex; align-items: center; gap: 11px; padding: 10px 4px; border-top: 1px solid var(--border); cursor: pointer; transition: background var(--duration) var(--ease); }
.lead-row:first-child { border-top: none; }
.lead-row:hover { background: var(--surface-2); }
.lead-av { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-text); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.lead-main { flex: 1; min-width: 0; }
.lead-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lead-sub { font-size: 11px; color: var(--ink-3); }
.pill-num { font-family: var(--font-mono); font-size: 11px; font-weight: 600; background: var(--brand-soft); color: var(--brand-text); padding: 2px 8px; border-radius: 999px; }
.pill-num.soft { background: var(--surface-3); color: var(--ink-2); }

/* ── Mini map card ─────────────────────────────────────── */
.minimap { position: relative; height: 168px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--border); }
.minimap .leaflet-container { background: var(--surface-2); }

/* ── Reusable bits kept from before ────────────────────── */
.row-list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-top: 1px solid var(--border); cursor: pointer; transition: background var(--duration) var(--ease); }
.list-row:first-child { border-top: none; }
.list-row:hover { background: var(--surface-2); }
.list-row .rl-main { min-width: 0; flex: 1; }
.list-row .rl-title { font-weight: 600; font-size: 13.5px; }
.list-row .rl-sub { font-size: 12px; color: var(--ink-3); margin-top: 1px; }

.scorebar { position: relative; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.scorebar > i { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: var(--ink-2); }
.scorebar.hi > i { background: var(--brand); }
.score-num { font-family: var(--font-mono); font-weight: 600; font-size: 13px; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; padding: 9px 12px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 12px; border-bottom: 1px solid var(--border); font-size: 13px; }
.tbl tbody tr { cursor: pointer; transition: background var(--duration) var(--ease); }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-family: var(--font-mono); }

.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chip { height: 30px; padding: 0 12px; border-radius: var(--r-pill); font-size: 12.5px; font-weight: 500; color: var(--ink-2); background: var(--surface); border: 1px solid var(--border-strong); display: inline-flex; align-items: center; gap: 6px; transition: all var(--duration) var(--ease); }
.chip:hover { background: var(--surface-2); }
.chip.on { background: var(--brand-soft); color: var(--brand-text); border-color: transparent; font-weight: 600; }
.chip.on.brand { background: var(--brand); border-color: var(--brand); color: #fff; }

input.field, select.field, textarea.field { width: 100%; height: 38px; padding: 0 11px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md); font-size: 13.5px; color: var(--ink); outline: none; transition: border-color var(--duration) var(--ease); }
textarea.field { height: auto; padding: 10px 11px; resize: vertical; min-height: 78px; line-height: 1.45; }
.field:focus { border-color: var(--ink-3); }

/* ── Map (full Peta route) ─────────────────────────────── */
.map-wrap { position: relative; height: calc(100vh - 60px - 82px - 56px); min-height: 480px; }
#map { position: absolute; inset: 0; border-radius: var(--r-lg); border: 1px solid var(--border); }
.leaflet-container { font-family: var(--font-sans); background: var(--surface-2); }
.map-overlay { position: absolute; z-index: 500; top: 14px; left: 14px; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.map-overlay > * { pointer-events: auto; }
.map-panel { background: rgba(255,255,255,0.96); border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px 13px; box-shadow: var(--shadow-card); min-width: 210px; }
.map-panel h4 { margin: 0 0 3px; font-size: 13px; font-weight: 700; }
.map-panel .meta { font-size: 11.5px; color: var(--ink-3); }
.back-btn { align-self: flex-start; background: rgba(255,255,255,0.96); border: 1px solid var(--border-strong); border-radius: var(--r-md); height: 32px; padding: 0 12px; font-size: 12.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; box-shadow: var(--shadow-card); }
.legend { display: flex; flex-direction: column; gap: 7px; font-size: 12px; }
.legend .lg { display: flex; align-items: center; gap: 8px; }
.legend .dot { width: 11px; height: 11px; border-radius: 50%; }
.legend .dot.cust { background: var(--brand); }
.legend .dot.prosp { background: #fff; border: 2px solid var(--ink-2); }

/* ── Drawer ─────────────────────────────────────────────── */
/* Centered dialog popup — sits above Leaflet (panes/controls reach ~z1000) */
.drawer-backdrop { position: fixed; inset: 0; z-index: 1190; background: rgba(20,18,16,0.34); opacity: 0; pointer-events: none; transition: opacity var(--duration) var(--ease); }
.drawer-backdrop.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; left: 50%; top: 50%; z-index: 1200;
  width: 460px; max-width: 92vw; max-height: 86vh;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px;
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; pointer-events: none;
  transform: translate(-50%, -48%) scale(0.97);
  transition: opacity 200ms var(--ease), transform 220ms var(--ease);
  box-shadow: var(--shadow-pop);
}
.drawer.open { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--border); }
.drawer-head-text { flex: 1; min-width: 0; }
.drawer-head h2 { margin: 5px 0 0; font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px; }
.drawer-foot { padding: 14px 18px; border-top: 1px solid var(--border); display: flex; gap: 9px; }
.drawer-foot:empty { display: none; }
.kv { display: flex; flex-direction: column; gap: 11px; }
.kv-row { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.kv-row .k { color: var(--ink-3); }
.kv-row .v { font-weight: 600; text-align: right; }
.sub-head { font-size: 11px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; margin: 20px 0 10px; }
.sub-head:first-child { margin-top: 0; }
.breakdown { display: flex; flex-direction: column; gap: 11px; }
.bd-row { display: grid; grid-template-columns: 64px 1fr 34px; align-items: center; gap: 11px; font-size: 12.5px; }
.bd-row .bd-label { color: var(--ink-2); }
.bd-row .bd-val { font-family: var(--font-mono); text-align: right; color: var(--ink-2); }

/* ── AI insight ────────────────────────────────────────── */
.ai-insight .ai-kind { margin-bottom: 12px; }
.ai-insight .ai-title { margin: 0 0 8px; font-size: 18px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; max-width: 32ch; }
.ai-insight .ai-body { margin: 0 0 14px; color: var(--ink-2); font-size: 13px; max-width: 56ch; }
.ai-rec { background: var(--surface-2); border-radius: var(--r-md); border-left: 3px solid var(--brand); padding: 12px 14px; margin-bottom: 14px; }
.ai-rec p { margin: 4px 0 0; font-size: 12.5px; font-weight: 500; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: var(--r-md); font-size: 13.5px; font-weight: 600; transition: background var(--duration) var(--ease); }
.btn-primary { background: var(--brand); color: #fff; } .btn-primary:hover { background: var(--brand-2); }
.btn-ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--border-strong); } .btn-ghost:hover { background: var(--surface-2); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-dark { background: var(--brand); color: #fff; } .btn-dark:hover { background: var(--brand-2); }

/* ── Single-screen (no-scroll) overview ────────────────── */
.main.flush { padding: 0; height: calc(100vh - 60px); overflow: hidden; }
.dash-fit { height: 100%; display: flex; flex-direction: column; gap: 11px; padding: 13px 22px 15px; }
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-shrink: 0; }
.dash-head .dh-eyebrow { font-size: 10.5px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.1em; }
.dash-head h1 { margin: 1px 0 0; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.dash-head .actions { display: flex; gap: 8px; }

.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; flex-shrink: 0; }
.dash-body { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(12, 1fr); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 11px; }
.dash-body > *, .g-stack > * { min-height: 0; }
.dash-body .card { height: 100%; overflow: hidden; display: flex; flex-direction: column; }

.g-hero { grid-column: span 5; } .g-insight { grid-column: span 4; }
.g-stack { grid-column: span 3; display: flex; flex-direction: column; gap: 11px; }
.g-src { grid-column: span 4; } .g-line { grid-column: span 4; }
.g-leads { grid-column: span 2; } .g-map { grid-column: span 2; }
.g-stack .card { flex: 1; }

/* compact internals for the fit view */
.dash-fit .card-pad { padding: 14px; }
.dash-fit .card-head { margin-bottom: 9px; }
.dash-fit .hero { padding: 16px; }
.dash-fit .hero h2 { display: none; }
.dash-fit .hero .hero-eyebrow { margin-bottom: 9px; }
.dash-fit .hero-num { font-size: 33px; }
.dash-fit .hero-sub { margin-bottom: 11px; font-size: 12px; }
.dash-fit .seg-bar { margin: 0 0 11px; }
.dash-fit .metric { padding: 12px 14px; gap: 6px; }
.dash-fit .metric .me-num { font-size: 23px; }
.dash-fit .spark { height: 24px; }
.dash-fit .ai-insight .ai-title { font-size: 15px; margin-bottom: 6px; -webkit-line-clamp: 2; }
.dash-fit .ai-insight .ai-body { font-size: 12px; margin-bottom: 10px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.dash-fit .ai-insight .ai-rec { padding: 9px 11px; margin-bottom: 0; }
.dash-fit .ai-insight .ai-rec p { font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dash-fit .donut { width: 92px; height: 92px; }
.dash-fit .donut-wrap { gap: 12px; }
.dash-fit .src-scroll { flex: 1; overflow: hidden; }
.dash-fit .src-row { padding: 7px 2px; }
.dash-fit .mini { padding: 12px 14px; }
.dash-fit .mini .m-num { font-size: 22px; }
.dash-fit .lead-row { padding: 7px 2px; }
.dash-fit .minimap { flex: 1; height: auto; min-height: 0; }
.dash-fit .linechart { height: 100%; flex: 1; }
.dash-fit .body-scroll { flex: 1; min-height: 0; overflow: hidden; }

/* ── Discovery AI ──────────────────────────────────────── */
.f-lbl { display: block; font-size: 12px; font-weight: 600; color: var(--ink-2); margin: 14px 0 6px; }
.f-lbl:first-of-type { margin-top: 0; }
.field:disabled { background: var(--surface-2); color: var(--ink-faint); cursor: not-allowed; }
select.field { 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='%23797B80' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }

.src-toggles { display: flex; flex-direction: column; gap: 7px; }
.src-toggle { display: flex; align-items: center; gap: 9px; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--ink-2); width: 100%; text-align: left; transition: all var(--duration) var(--ease); }
.src-toggle .st-ico { width: 24px; height: 24px; border-radius: 7px; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.src-toggle::after { content: ""; margin-left: auto; width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--border-strong); }
.src-toggle.on { border-color: var(--ink); }
.src-toggle.on::after { background: var(--brand); border-color: var(--brand); content: "✓"; color: #fff; font-size: 11px; display: grid; place-items: center; }

/* idle */
.disc-idle { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 36px 24px; }
.disc-illus { width: 64px; height: 64px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin-bottom: 18px; }
.disc-idle h2 { margin: 0 0 5px; font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.disc-idle > p { margin: 0 0 24px; color: var(--ink-3); font-size: 13.5px; max-width: 40ch; }
.disc-steps { display: flex; gap: 12px; width: 100%; max-width: 560px; margin-bottom: 22px; }
.disc-steps .ds { flex: 1; display: flex; gap: 10px; align-items: flex-start; text-align: left; background: var(--surface-2); border-radius: 12px; padding: 13px; }
.disc-steps .ds-n { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.disc-steps .ds b { font-size: 13px; display: block; } .disc-steps .ds span { font-size: 11.5px; color: var(--ink-3); }
.disc-pilot { display: flex; align-items: center; gap: 14px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--border); border-radius: 14px; padding: 15px 18px; max-width: 560px; font-size: 13px; }
.disc-pilot .ai-chip { flex-shrink: 0; } .disc-pilot .mono { font-size: 18px; color: var(--brand); } .disc-pilot b { color: var(--ink); }

/* scan */
.scan { padding: 14px 6px; }
.scan-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.scan-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--brand-soft); border-top-color: var(--brand); animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
.scan-title { font-size: 15px; font-weight: 700; } .scan-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.scan-counter { margin-left: auto; text-align: right; } .scan-counter b { font-family: var(--font-mono); font-size: 30px; font-weight: 600; color: var(--brand); display: block; line-height: 1; } .scan-counter span { font-size: 10.5px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.scan-bar { height: 7px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-bottom: 16px; }
.scan-bar i { display: block; height: 100%; width: 0; background: var(--brand); border-radius: 4px; transition: width 0.6s var(--ease); }
.scan-srcs { display: flex; gap: 9px; margin-bottom: 18px; flex-wrap: wrap; }
.scan-srcs .ss { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 600; color: var(--ink-faint); background: var(--surface-2); border-radius: 999px; padding: 6px 12px; transition: all var(--duration) var(--ease); }
.scan-srcs .ss-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-faint); }
.scan-srcs .ss.on { color: var(--ok-fg); background: var(--ok-bg); } .scan-srcs .ss.on .ss-dot { background: var(--ok-fg); }
.scan-log { display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow: hidden; font-size: 12.5px; }
.scan-log .lg-line { color: var(--ink-2); animation: rise 300ms var(--ease); }
.scan-log .lg-tick { color: var(--brand); font-weight: 700; }

/* result */
.res { padding: 4px 2px; }
.res-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.res-fig { font-size: 15px; color: var(--ink-3); margin-top: 8px; } .res-fig b { font-size: 34px; color: var(--ink); letter-spacing: -0.02em; margin-right: 6px; }
.res-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }
.res-cards { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.res-omzet { background: var(--brand); color: #fff; border-radius: 14px; padding: 16px 18px; }
.res-omzet .ro-label { font-size: 12px; color: rgba(255,255,255,0.82); } .res-omzet .ro-fig { font-family: var(--font-mono); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 6px 0 3px; } .res-omzet .ro-fig span { font-size: 14px; opacity: 0.8; } .res-omzet .ro-year { font-size: 11.5px; color: rgba(255,255,255,0.82); }
.res-mini { background: var(--surface-2); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; justify-content: center; } .res-mini .rm-num { font-size: 26px; font-weight: 600; letter-spacing: -0.02em; } .res-mini .rm-num small { font-size: 13px; color: var(--ink-3); } .res-mini .rm-lbl { font-size: 11.5px; color: var(--ink-3); margin-top: 2px; }
.res-split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.res-list { max-height: 230px; overflow-y: auto; }

/* ── Perencanaan Teritori ──────────────────────────────── */
.plan-card { padding: 16px; }
.pc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.pc-name { font-weight: 700; font-size: 14.5px; }
.pc-sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.pc-cov { text-align: right; flex-shrink: 0; } .pc-cov .mono { font-size: 18px; font-weight: 600; } .pc-cov small { display: block; font-size: 10px; color: var(--ink-3); }
.pc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pc-stats > div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; }
.pc-stats b { font-size: 18px; display: block; } .pc-stats span { font-size: 11px; color: var(--ink-3); }

/* ── Funnel ────────────────────────────────────────────── */
.funnel { display: flex; flex-direction: column; gap: 12px; }
.fn-stage { display: flex; align-items: center; gap: 14px; }
.fn-bar { height: 46px; border-radius: 10px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; min-width: 120px; transition: width 0.5s var(--ease); }
.fn-stage:nth-child(1) .fn-bar { background: #E06169; }
.fn-stage:nth-child(2) .fn-bar { background: #DB4D56; }
.fn-stage:nth-child(3) .fn-bar { background: #D6353F; }
.fn-stage:nth-child(4) .fn-bar { background: var(--brand); }
.fn-stage:nth-child(5) .fn-bar { background: var(--brand-2); }
.fn-label { font-size: 13px; font-weight: 600; } .fn-n { font-size: 17px; font-weight: 600; }
.fn-conv { font-size: 12px; color: var(--ink-3); white-space: nowrap; flex-shrink: 0; width: 86px; }

/* ── Inbox (notifications + approvals) ─────────────────── */
.inbox-claim { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; margin-bottom: 9px; background: var(--surface-2); border-radius: 12px; }
.inbox-notif { display: flex; align-items: flex-start; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--border); }
.inbox-notif:first-of-type { border-top: none; }
.in-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; flex-shrink: 0; background: var(--ink-faint); }
.in-dot.assign { background: var(--info-fg); } .in-dot.report { background: var(--ok-fg); }
.in-dot.claim { background: var(--warn-fg); } .in-dot.approve { background: var(--brand); }
.in-dot.discover { background: var(--brand); }

/* Quick-add menu (topbar +) */
.quick-menu {
  position: fixed; z-index: 1300; min-width: 210px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: 12px;
  box-shadow: var(--shadow-pop); animation: rise 160ms var(--ease);
}
.quick-menu .qm-label { font-size: 10.5px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.08em; padding: 6px 10px 4px; }
.qm-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; height: 38px; padding: 0 10px; border-radius: 9px; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.qm-item svg { color: var(--ink-3); }
.qm-item:hover { background: var(--surface-2); }
.qm-item:hover svg { color: var(--brand); }

.reveal { opacity: 0; transform: translateY(7px); animation: rise 460ms var(--ease) forwards; }
@keyframes rise { to { opacity: 1; transform: translateY(0); } }
