/* 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 .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; }

/* ── Discovery result (revamped reveal) ────────────────── */
@keyframes resRise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.res-rise { animation: resRise 520ms var(--ease) both; animation-delay: calc(var(--i) * 90ms); }

.res2-head-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.res2-big { display: flex; align-items: baseline; gap: 11px; }
.res2-big b { font-family: var(--font-mono); font-size: 40px; font-weight: 600; letter-spacing: -0.035em; line-height: 1; color: var(--brand); font-variant-numeric: tabular-nums; }
.res2-big span { font-size: 14.5px; font-weight: 600; color: var(--ink-2); }
.res2-sub { margin-top: 6px; font-size: 12px; color: var(--ink-3); }

/* compact metric rail (replaces the oversized cards) */
.res2-rail { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; margin-top: 16px; }
.res2-stat { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-left: 1px solid var(--border); }
.res2-stat:first-child { border-left: none; }
.res2-stat b { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; display: block; }
.res2-stat b small { font-size: 12px; color: var(--ink-faint); font-weight: 500; }
.res2-stat span { font-size: 11px; color: var(--ink-3); display: block; margin-top: 4px; }
.res2-stat .rs-ic { width: 26px; height: 26px; border-radius: 7px; background: var(--surface-2); color: var(--ink-3); display: grid; place-items: center; flex-shrink: 0; }
.res2-stat.hero b { color: var(--brand); }
.res2-stat.hero .rs-ic { background: var(--accent-soft); color: var(--accent-2); }

/* selected row ⇄ map marker */
.res2-tbl tbody tr.sel { background: var(--brand-soft) !important; box-shadow: inset 3px 0 0 var(--brand); }

.res2-metrics { display: grid; grid-template-columns: 1.5fr 1fr 1fr; gap: 12px; margin: 18px 0; }
.rm2 { background: var(--surface-2); border-radius: 15px; padding: 16px 18px; display: flex; flex-direction: column; }
.rm2-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--surface); color: var(--ink-3); display: grid; place-items: center; margin-bottom: 12px; }
.rm2-big { font-family: var(--font-mono); font-size: 32px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.rm2-big small { font-size: 15px; color: var(--ink-faint); font-weight: 500; }
.rm2-cap { font-size: 12.5px; font-weight: 600; margin-top: 8px; }
.rm2-sub { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.rm2-hero { background: var(--brand); color: #fff; box-shadow: 0 12px 30px rgba(19,35,91,0.22); }
.rm2-hero .rm2-ico { background: rgba(255,255,255,0.14); color: var(--accent); }
.rm2-hero .rm2-big { color: #fff; } .rm2-hero .rm2-big small { color: rgba(255,255,255,0.6); }
.rm2-hero .rm2-sub { color: rgba(255,255,255,0.8); }

.res2-split { display: grid; grid-template-columns: 1.45fr 1fr; gap: 14px; }
.res2-map { height: 296px; border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }
.res2-map .leaflet-container { background: var(--surface-2); }
.leaflet-interactive.disc-hot { filter: drop-shadow(0 0 5px rgba(251,212,0,0.85)); }
.res2-side { background: var(--surface-2); border-radius: 14px; padding: 6px 6px 8px; display: flex; flex-direction: column; }
.res2-side-head { display: flex; align-items: center; justify-content: space-between; padding: 11px 12px 8px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.res2-side-list { overflow-y: auto; max-height: 250px; }
.res2-side-list::-webkit-scrollbar { width: 0; }
.res2-row { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 11px; }
.res2-row:hover { background: var(--surface); }
.res2-av { width: 30px; height: 30px; border-radius: 9px; background: var(--brand-soft); color: var(--brand-text); font-size: 11px; font-weight: 700; display: grid; place-items: center; flex-shrink: 0; }
.res2-main { flex: 1; min-width: 0; } .res2-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res2-meta { font-size: 11px; color: var(--ink-3); display: flex; align-items: center; gap: 6px; }
.res2-cta { width: 100%; height: 52px; margin-top: 18px; font-size: 14.5px; gap: 9px; box-shadow: 0 12px 28px rgba(19,35,91,0.2); }

/* severity badge (shared look with field app) */
.sv-badge { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.sv-badge.sv-must { background: var(--accent-soft); color: #8A6D00; }
.sv-badge.sv-pot { background: var(--warn-bg); color: var(--warn-fg); }
.sv-badge.sv-obs { background: var(--ok-bg); color: var(--ok-fg); }

/* ── Discovery: fixed one-screen (no page scroll) ──────── */
.disc-fit { height: 100%; display: flex; flex-direction: column; padding: 14px 24px 16px; gap: 12px; }
.disc-head { flex-shrink: 0; }
.disc-head .eyebrow { margin-bottom: 2px; }
.disc-head h1 { margin: 2px 0 3px; font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }
.disc-head p { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.disc-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 360px 1fr; gap: 14px; }
.disc-body.collapsed { grid-template-columns: 1fr; }
.disc-body.collapsed .disc-control { display: none; }
.disc-control { min-height: 0; } .disc-control > .card { height: 100%; overflow-y: auto; }
.disc-control > .card::-webkit-scrollbar { width: 0; }
.disc-stage { min-height: 0; } .disc-stage > .card { height: 100%; min-height: 0; overflow: hidden; display: flex; flex-direction: column; }
/* compact form to fit one screen */
.disc-form .f-lbl { margin: 10px 0 5px; } .disc-form .f-lbl:first-of-type { margin-top: 0; }
.disc-form .card-head { margin-bottom: 10px; }
.disc-form .src-toggles { gap: 6px; } .disc-form .src-toggle { height: 38px; }
.disc-form #scan-btn { margin-top: 14px !important; height: 42px !important; }
#stage .disc-idle { height: 100%; justify-content: center; padding: 16px 24px; }
/* result fills the stage height; only the table scrolls */
#stage .res2 { height: 100%; display: flex; flex-direction: column; }
#stage .res2-head { flex-shrink: 0; }
#stage .res2-split2 { flex: 1; min-height: 0; margin: 14px 0 0; }
#stage .res2-cta { flex-shrink: 0; margin-top: 14px; }

/* Collapse the scan form → full-width result with full findings table */
.res2-split2 { display: grid; grid-template-columns: 440px 1fr; gap: 14px; }
.res2-split2 .res2-map { height: 100%; }
.res2-tablewrap { background: var(--surface-2); border-radius: 14px; display: flex; flex-direction: column; overflow: hidden; max-height: 100%; }
.res2-tablehead { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; font-size: 13px; font-weight: 700; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.res2-thead-tools { display: flex; align-items: center; gap: 10px; }
.res2-search { height: 32px; padding: 0 11px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--surface); font-size: 12.5px; width: 210px; outline: none; transition: border-color var(--duration) var(--ease); }
.res2-search:focus { border-color: var(--ink-3); }
.res2-tablescroll { overflow-y: auto; }
.res2-tbl { width: 100%; }
.res2-tbl thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 1; }
.res2-tbl tbody tr { cursor: default; }
.res2-tbl tbody tr:hover { background: var(--surface); }

/* ── 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: #6E7CB0; }
.fn-stage:nth-child(2) .fn-bar { background: #46569C; }
.fn-stage:nth-child(3) .fn-bar { background: #293E84; }
.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); }

/* ── Ringkasan: Opportunity Map ─────────────────────────── */
.ov-wrap { position: relative; height: 100%; overflow: hidden; }
#ov-map { position: absolute; inset: 0; z-index: 1; background: #F2F3F6; }

@keyframes ovRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.ov-rise { animation: ovRise 560ms var(--ease) both; }

.ov-hero { position: absolute; z-index: 12; top: 20px; left: 20px; width: 400px; padding: 22px 24px 20px;
  background: rgba(255,255,255,0.93); backdrop-filter: blur(16px) saturate(1.1); -webkit-backdrop-filter: blur(16px) saturate(1.1);
  border: 1px solid rgba(255,255,255,0.7); border-radius: 18px; box-shadow: 0 18px 50px rgba(19,35,91,0.16); overflow: hidden; }
.ov-hero::before { content: ""; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.ov-eyebrow { display: flex; flex-direction: column; gap: 9px; margin-bottom: 14px; }
.ov-eyebrow > span:last-child { font-size: 12px; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.ov-num b { font-family: var(--font-mono); font-size: 66px; font-weight: 600; letter-spacing: -0.045em; line-height: 0.92; color: var(--brand); font-variant-numeric: tabular-nums; }
.ov-num-sub { margin-top: 9px; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.ov-num-sub::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 7px; vertical-align: middle; box-shadow: 0 0 0 3px var(--accent-soft); }
.ov-delta { display: inline-flex; align-items: center; margin-top: 10px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--ok-fg); background: var(--ok-bg); padding: 3px 10px; border-radius: var(--r-pill); }
.ov-note { margin: 14px 0 18px; font-size: 12.5px; color: var(--ink-3); line-height: 1.6; max-width: 35ch; }
.ov-cta { display: flex; gap: 8px; }

.ov-rail { position: absolute; z-index: 12; bottom: 20px; left: 20px; display: flex;
  background: rgba(255,255,255,0.93); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.7); border-radius: 14px; box-shadow: 0 12px 36px rgba(19,35,91,0.13); overflow: hidden; }
.ov-stat { padding: 13px 18px; border-left: 1px solid var(--border); }
.ov-stat:first-child { border-left: none; }
.ov-stat b { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; display: block; line-height: 1; }
.ov-stat span { font-size: 10.5px; color: var(--ink-3); display: block; margin-top: 5px; }
.ov-stat.gold b { color: var(--accent-2); }

.ov-hot { position: absolute; z-index: 12; top: 20px; right: 20px; width: 322px; max-height: calc(100% - 112px); display: flex; flex-direction: column;
  background: rgba(255,255,255,0.93); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,0.7); border-radius: 16px; box-shadow: 0 14px 40px rgba(19,35,91,0.14); }
.ov-hot-head { display: flex; align-items: center; justify-content: space-between; padding: 15px 17px 11px; border-bottom: 1px solid var(--border); }
.ov-hot-head h3 { margin: 0; font-size: 13.5px; font-weight: 700; }
.ov-hot-list { overflow-y: auto; padding: 5px 9px 9px; }
.ov-hot-list::-webkit-scrollbar { width: 0; }
.ov-hot-row { display: flex; align-items: center; gap: 11px; padding: 10px 8px; border-radius: 10px; cursor: pointer; transition: background var(--duration) var(--ease); }
.ov-hot-row:hover { background: var(--surface-2); }
.ohr-main { flex: 1; min-width: 0; }
.ohr-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ohr-sub { font-size: 11.5px; color: var(--ink-3); }

/* Pulsing opportunity nodes */
.hs-wrap { background: none !important; border: none !important; }
.hsnode { position: absolute; }
.hs-core { position: absolute; left: 0; top: 0; transform: translate(-50%,-50%); width: 13px; height: 13px; border-radius: 50%; background: var(--brand); border: 2.5px solid #fff; box-shadow: 0 2px 6px rgba(19,35,91,0.4); }
.hsnode.hot .hs-core { box-shadow: 0 0 0 4px rgba(251,212,0,0.45), 0 2px 8px rgba(19,35,91,0.5); }
.hs-ring { position: absolute; left: 0; top: 0; transform: translate(-50%,-50%); width: var(--halo); height: var(--halo); border-radius: 50%;
  background: radial-gradient(circle, rgba(251,212,0,0.5) 0%, rgba(251,212,0,0) 68%); animation: hsPulse 2.8s ease-out infinite; animation-delay: var(--d); }
@keyframes hsPulse { 0% { transform: translate(-50%,-50%) scale(0.5); opacity: 0.85; } 70% { opacity: 0; } 100% { transform: translate(-50%,-50%) scale(1.15); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .hs-ring { animation: none; opacity: 0.35; transform: translate(-50%,-50%) scale(0.9); } }
.hs-chip { position: absolute; display: flex; flex-direction: column; line-height: 1.05; white-space: nowrap; background: rgba(255,255,255,0.97); border: 1px solid var(--border-strong); border-radius: 9px; box-shadow: 0 4px 12px rgba(19,35,91,0.16); padding: 5px 9px; }
.hs-chip b { font-family: var(--font-mono); font-size: 13.5px; font-weight: 600; color: var(--brand); }
.hs-chip i { font-style: normal; font-size: 10px; color: var(--ink-3); font-weight: 600; }
.chip-tl { right: 16px; bottom: 16px; } .chip-tr { left: 16px; bottom: 16px; }
.chip-bl { right: 16px; top: 16px; } .chip-br { left: 16px; top: 16px; }
.chip-l { right: 18px; top: -10px; } .chip-r { left: 18px; top: -10px; }
/* Data Process Overview (3.18) */
.dpo-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 10px; }
.dpo-cell { background: var(--surface-2); border-radius: 10px; padding: 12px 10px; text-align: center; }
.dpo-num { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; }
.dpo-lbl { font-size: 10.5px; color: var(--ink-3); margin-top: 3px; line-height: 1.2; }
@media (max-width: 1200px) { .dpo-grid { grid-template-columns: repeat(5, 1fr); } }

/* Rejection Reason Breakdown (3.5) */
.rej-list { display: flex; flex-direction: column; gap: 11px; }
.rej-row { display: grid; grid-template-columns: 120px 1fr 26px; align-items: center; gap: 11px; font-size: 12.5px; }
.rej-name { color: var(--ink-2); }
.rej-bar { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.rej-bar > i { display: block; height: 100%; background: var(--brand); border-radius: 4px; }
.rej-n { text-align: right; color: var(--ink-2); font-weight: 600; }

/* 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); } }

/* --- Rencana kunjungan minggu ini: week board (bounded, no page scroll) --- */
.week-board { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.wb-col { display: flex; flex-direction: column; min-height: 0; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden; }
.wb-col.today { border-color: var(--brand); }
.wb-col-head { display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 9px 11px; border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 700; }
.wb-col-head .c { color: var(--ink-3); font-weight: 600; }
.wb-today { font-size: 9.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  color: #fff; background: var(--brand); border-radius: 999px; padding: 1px 6px; margin-left: 5px; }
/* the scroll lives INSIDE each day column → board height is bounded to one screen */
.wb-list { display: flex; flex-direction: column; gap: 7px; padding: 8px;
  overflow-y: auto; max-height: clamp(170px, calc(100vh - 560px), 460px); }
.wb-item { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: 8px; padding: 7px 9px; }
.wb-item.done { border-left-color: var(--ok-fg); opacity: 0.72; }
.wb-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; }
.wb-name { font-size: 12.5px; font-weight: 600; line-height: 1.25; }
.wb-time { font-size: 10.5px; color: var(--ink-3); flex-shrink: 0; }
.wb-meta { font-size: 10.5px; color: var(--ink-3); margin-top: 2px; line-height: 1.3; }
.wb-empty { font-size: 11px; color: var(--ink-faint); text-align: center; padding: 14px 0; }
/* "Belum dijadwalkan" lane → assign source, left of the day columns */
.week-board.has-lane { grid-template-columns: 1.15fr repeat(5, 1fr); }
.wb-col.lane { background: var(--surface); border-style: dashed; border-color: var(--border-strong); }
.wb-col.lane .wb-col-head { color: var(--brand-text); }
.wb-item.unsched { border-left-color: var(--ink-faint); cursor: pointer; transition: border-color .12s, background .12s; }
.wb-item.unsched:hover { border-color: var(--brand); border-left-color: var(--brand); background: var(--brand-soft); }
.wb-score { font-size: 11px; font-weight: 700; color: var(--brand-text); flex-shrink: 0; }
.wb-cta { margin-top: 6px; font-size: 10.5px; font-weight: 700; color: var(--brand-text); letter-spacing: 0.02em; }
@media (max-width: 900px) { .week-board.has-lane { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 900px) { .week-board { grid-template-columns: repeat(2, 1fr); } }

/* one-screen fit for Perencanaan → plan section visible without page scroll */
.plan-fit { height: 100%; display: flex; flex-direction: column; gap: 18px; padding: 16px 22px 18px; }
.plan-fit .page-head.tight { margin: 0; }
.plan-fit .page-head.tight h1 { margin: 2px 0 0; }
/* region cards → single compact horizontal strip (scroll-x) so the plan board gets the screen */
.plan-fit .bento { flex-shrink: 0; margin: 0; display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 10px; padding-bottom: 2px; }
.plan-fit .bento > .col-4 { grid-column: auto; flex: 0 0 214px; }
.plan-fit .plan-card { padding: 11px 13px; }
.plan-fit .plan-card .pc-sub { font-size: 11px; }
.plan-fit .plan-card .scorebar { height: 5px !important; margin: 7px 0 8px !important; }
.plan-fit .plan-card .pc-stats { font-size: 11px; }
.plan-fit .plan-card .pc-btn { height: 30px !important; margin-top: 8px !important; font-size: 12px; }
.plan-fit .plan-board-card { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0; padding: 22px 18px 16px; }
.plan-fit .plan-board-card .card-head { flex-shrink: 0; }
.plan-fit .week-board { flex: 1; min-height: 0; }
.plan-fit .wb-list { max-height: none; flex: 1; }

/* territory triage table (scales to hundreds) + KPI strip + drill-down head */
.kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 11px; flex-shrink: 0; }
.kpi-cell { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 11px 14px; }
.kpi-cell .k-num { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.kpi-cell .k-label { font-size: 11px; color: var(--ink-3); margin-top: 2px; }
.plan-fit .plan-board-card .card-head { margin-bottom: 14px; padding-bottom: 13px; border-bottom: 1px solid var(--border); gap: 16px; }
.terr-search { max-width: 240px; height: 34px; }
.terr-wrap { flex: 1; min-height: 0; overflow: auto; }
.terr-table { width: 100%; }
.terr-table thead th { position: sticky; top: 0; z-index: 1; background: var(--surface); cursor: pointer; white-space: nowrap; user-select: none; }
.terr-table thead th.sorted { color: var(--ink); }
.terr-table thead th.sorted::after { content: " " attr(data-dir); color: var(--brand); }
.terr-table tbody tr { cursor: pointer; }
.terr-table tbody tr:hover { background: var(--surface-2); }
.cov-cell { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.detail-head { display: flex; align-items: center; gap: 14px; }
