:root {
  --bg: #F1F4EF; --surface: #FFFFFF; --surface-2: #F6F8F5; --surface-3: #ECF0EA; --ink: #141C26; --ink-2: #2B3643; --muted: #5E6A76; --line: #DFE4DC; --line-2: #CBD3C8;
  --teal: #0F5257; --teal-hover: #0B3F43; --teal-soft: #DDECE8; --teal-2: #1F8A7E; --on-teal: #FFFFFF;
  --pin: #F2B705; --pin-soft: #FDF1C7; --pin-ink: #6B4F00;
  --danger: #B3261E; --danger-soft: #FAE4E2; --ok: #1F7A4C; --ok-soft: #DDF1E5;
  --side: #111A23; --side-2: #172431; --side-ink: #A9B5C0; --side-active: #213142;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --r: 10px; --r-lg: 16px;
  --shadow: 0 1px 2px rgba(20, 28, 38, .04), 0 2px 8px rgba(20, 28, 38, .04);
  --shadow-lg: 0 10px 30px rgba(20, 28, 38, .10);
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0D1319; --surface: #151E27; --surface-2: #1A2530; --surface-3: #202C38; --ink: #E7ECEA; --ink-2: #C9D2D0; --muted: #95A1AC; --line: #26323D; --line-2: #33414E;
  --teal: #5FB3A9; --teal-hover: #7CC7BD; --teal-soft: #173432; --teal-2: #5FB3A9; --on-teal: #0D1319;
  --pin-soft: #3A3212; --pin-ink: #F2C94C;
  --danger: #F08A80; --danger-soft: #3A1E1C; --ok: #6FD19B; --ok-soft: #173326;
  --side: #090E13; --side-2: #0F161D; --side-active: #1A2530;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3); --shadow-lg: 0 10px 30px rgba(0, 0, 0, .45);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.5 var(--body); -webkit-font-smoothing: antialiased; }
a { color: var(--teal); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
h1, h2, h3 { margin: 0; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
.muted { color: var(--muted); }
[hidden] { display: none !important; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }

/* Inputs and buttons */
input, select, textarea {
  width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: 9px; padding: 9px 11px;
  transition: border-color .15s, box-shadow .15s;
}
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--teal); }
textarea { resize: vertical; line-height: 1.55; }
label { display: block; font-size: 13px; font-weight: 500; color: var(--muted); margin: 0 0 5px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 9px;
  padding: 9px 14px; font-weight: 500; text-decoration: none; cursor: pointer; box-shadow: var(--shadow);
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn .ico { width: 16px; height: 16px; }
.btn.primary { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }
.btn.primary:hover { background: var(--teal-hover); border-color: var(--teal-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
.btn.ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn.sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; margin-top: 18px; padding: 11px; }
.btn.block-sm { width: 100%; margin-top: 12px; }
.btn:disabled { opacity: .55; cursor: wait; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--teal); cursor: pointer; font-weight: 500; text-decoration: underline; }
.inline { display: flex; gap: 8px; align-items: center; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.money-in { display: flex; align-items: center; border: 1px solid var(--line-2); border-radius: 9px; background: var(--surface); overflow: hidden; }
.money-in span { padding: 0 4px 0 11px; color: var(--muted); font-weight: 500; }
.money-in input { border: 0; box-shadow: none !important; padding-left: 4px; }
.money-in:focus-within { border-color: var(--teal); box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent); }
.money-in.sm input { padding: 6px 8px 6px 2px; }
.money-in.sm { max-width: 130px; }

/* Shell */
.side {
  position: fixed; inset: 0 auto 0 0; width: 244px; z-index: 1200; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--side) 0%, var(--side-2) 100%); color: var(--side-ink); padding: 20px 12px 14px; transition: transform .2s ease;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 20px; color: #fff; padding: 0 10px 18px; letter-spacing: -.01em; }
.brand.dark { color: var(--ink); padding: 0 0 18px; }
.pin { width: 14px; height: 14px; border-radius: 50% 50% 50% 0; background: var(--pin); transform: rotate(-45deg); border: 2px solid currentColor; flex: none; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #6C7A87; padding: 14px 10px 6px; }
.nav-label:first-child { padding-top: 0; }
.nav a { display: flex; align-items: center; gap: 11px; color: var(--side-ink); text-decoration: none; padding: 8px 10px; border-radius: 9px; font-weight: 500; font-size: 14.5px; }
.nav a:hover { background: var(--side-active); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 3px 0 0 var(--pin); }
.nav a.active .ico { color: var(--pin); }
.ico { width: 18px; height: 18px; flex: none; }
.badge { margin-left: auto; background: var(--pin); color: #17202B; font-size: 12px; font-weight: 600; border-radius: 99px; padding: 0 7px; min-width: 22px; text-align: center; }
.side-foot { margin-top: auto; border-top: 1px solid #243140; padding-top: 14px; display: grid; gap: 8px; }
.me { padding: 0 8px; display: flex; gap: 10px; align-items: center; }
.me > span:last-child { display: grid; line-height: 1.3; }
.me b { color: #fff; font-weight: 600; font-size: 14px; }
.me small { font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--pin); color: #17202B; font-weight: 700; font-size: 13px; flex: none; }
.side-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.side-btn { white-space: nowrap; display: flex; align-items: center; gap: 6px; background: none; border: 0; text-align: left; color: var(--side-ink); padding: 7px 8px; border-radius: 8px; cursor: pointer; text-decoration: none; font-size: 13px; }
.side-btn .ico { width: 16px; height: 16px; }
.side-btn:hover { background: var(--side-active); color: #fff; }
.main { margin-left: 244px; min-height: 100vh; }
.top {
  position: sticky; top: 0; z-index: 1100; display: flex; align-items: center; gap: 12px; padding: 12px 32px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.qs { position: relative; flex: 1; max-width: 540px; }
.qs .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.qs input { padding-left: 34px; padding-right: 36px; background: var(--surface); }
.qs kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font: 12px var(--body); color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 6px; }
.top-actions { margin-left: auto; display: flex; gap: 8px; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 8px; width: 40px; height: 38px; padding: 10px; cursor: pointer; flex-direction: column; justify-content: space-between; }
.menu-btn span { display: block; height: 2px; background: var(--ink); border-radius: 2px; }
.scrim { display: none; }
.view { padding: 28px 32px 72px; max-width: 1380px; outline: none; }

/* Page elements */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { font-family: var(--display); font-size: 34px; font-weight: 700; letter-spacing: -.025em; line-height: 1.05; }
.sub { color: var(--muted); margin: 6px 0 0; max-width: 760px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.head-actions select { width: auto; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 15px; font-weight: 600; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.card-head h2 { margin-right: auto; }
.card-head a { font-size: 13px; font-weight: 500; text-decoration: none; }
.card.narrow { max-width: 760px; }
.stack { display: grid; gap: 16px; align-content: start; }
.loading { color: var(--muted); padding: 80px 0; display: flex; gap: 12px; justify-content: center; align-items: center; }
.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty-ico { width: 56px; height: 56px; border-radius: 16px; background: var(--pin-soft); display: grid; place-items: center; margin: 0 auto 14px; color: var(--ink); }
.empty h2 { font-family: var(--display); font-size: 22px; color: var(--ink); margin-bottom: 6px; }
.empty p { margin: 0 0 16px; }
.empty-sm { color: var(--muted); font-size: 14px; padding: 8px 0; margin: 0; }
.error { color: var(--danger); background: var(--danger-soft); border-color: transparent; }

/* Pills and scores */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; white-space: nowrap; vertical-align: middle; }
.s-new { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.s-contacted { background: var(--teal-soft); color: var(--teal); }
.s-replied { background: var(--pin-soft); color: var(--pin-ink); }
.s-meeting { background: var(--pin); color: #17202B; }
.s-won { background: var(--teal); color: var(--on-teal); }
.s-lost { background: var(--line); color: var(--muted); }
.s-dnc { background: var(--danger-soft); color: var(--danger); }
.q-draft { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.q-sent { background: var(--pin-soft); color: var(--pin-ink); }
.q-accepted { background: var(--ok-soft); color: var(--ok); }
.q-declined { background: var(--danger-soft); color: var(--danger); }
.score { display: inline-grid; place-items: center; min-width: 40px; height: 32px; padding: 0 6px; border-radius: 9px; font-family: var(--display); font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; flex: none; }
.t-hot { background: var(--pin); color: #17202B; }
.t-warm { background: var(--teal-soft); color: var(--teal); }
.t-cold { background: var(--surface-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.tag { font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.tag.new { background: var(--pin-soft); color: var(--pin-ink); border-color: transparent; }
.val { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ok); font-size: 13px; }
.val.big { font-size: 15px; background: var(--ok-soft); padding: 2px 10px; border-radius: 99px; }
.who { font-size: 13px; }
.free { color: var(--ok); font-style: normal; font-weight: 600; font-size: 12px; }

/* Dashboard */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 16px; }
.metric { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 16px 18px; text-decoration: none; color: inherit; display: block; box-shadow: var(--shadow); position: relative; overflow: hidden; }
a.metric:hover { border-color: var(--ink); }
.metric .m-label { display: block; color: var(--muted); font-size: 13px; font-weight: 500; }
.metric b { display: block; font-family: var(--display); font-size: 38px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.metric small { display: block; color: var(--muted); font-size: 12.5px; }
.metric.accent { background: linear-gradient(135deg, #F7C51E 0%, var(--pin) 60%, #E9A800 100%); border-color: transparent; color: #17202B; }
.metric.accent .m-label, .metric.accent small { color: #45360A; }
.metric.on { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-soft); }
.metrics.q b { font-size: 30px; }
.dash { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; }
.dash > *, .calc > *, .find-grid > *, .add-grid > * { min-width: 0; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.funnel { display: grid; gap: 8px; }
.frow { display: grid; grid-template-columns: 118px 1fr 40px 80px; align-items: center; gap: 12px; text-decoration: none; color: inherit; font-size: 14px; }
.frow:hover span:first-child { color: var(--teal); }
.frow em { font-style: normal; color: var(--ok); font-size: 13px; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.fbar { height: 22px; background: var(--surface-2); border-radius: 6px; overflow: hidden; }
.fbar i { display: block; height: 100%; border-radius: 6px; }
.frow b { text-align: right; font-variant-numeric: tabular-nums; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 130px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; gap: 1px; }
.bar i { display: block; width: 100%; background: var(--teal); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars.duo .bar i.a { background: var(--teal); }
.bars.duo .bar i.b { background: var(--pin); }
.bars-legend { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 6px; }
.bars-legend .lg { display: flex; align-items: center; gap: 5px; }
.bars-legend .lg i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; background: var(--teal); }
.bars-legend .lg i.b { background: var(--pin); margin-left: 6px; }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rows li > a { display: flex; align-items: center; gap: 12px; padding: 7px 8px; margin: 0 -8px; border-radius: 9px; text-decoration: none; color: inherit; }
.rows li > a:hover { background: var(--surface-2); }
.rows b { display: block; font-weight: 600; }
.rows small { color: var(--muted); font-size: 13px; }
.rows .right { margin-left: auto; font-size: 13px; color: var(--muted); white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.lr { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.lr > :first-child { margin-right: auto; }
.lr span { display: grid; }
.mini { width: 100%; border-collapse: collapse; font-size: 14px; }
.mini th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 0 0 6px; }
.mini td { padding: 6px 0; border-top: 1px solid var(--line); }
.mini td + td, .mini th + th { text-align: right; }
.usage { display: grid; gap: 10px; margin-top: 14px; }
.usage div { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding-bottom: 8px; font-size: 14px; }
.usage b { font-variant-numeric: tabular-nums; }
.spend b { font-family: var(--display); font-size: 32px; letter-spacing: -.02em; display: block; line-height: 1.1; }
.spend span { color: var(--muted); font-size: 13px; }
.meter { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--teal-2); border-radius: 99px; }
.meter.warn i { background: var(--pin); }
.meter.over i { background: var(--danger); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 20px; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--teal); }
.timeline li::after { content: ""; position: absolute; left: 7px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.a-reply_in::before, .timeline li.a-sent::before { background: var(--pin); }
.timeline li.a-quote::before, .timeline li.a-value::before { background: var(--ok); }
.timeline small { display: block; color: var(--muted); font-size: 12px; }

/* Find and maps */
.find-grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; margin-bottom: 18px; align-items: stretch; }
.find-form { display: grid; gap: 16px; align-content: start; }
.find-form .btn.block { margin-top: 0; }
.map-card { padding: 0; overflow: hidden; position: relative; }
.map { width: 100%; height: 100%; min-height: 420px; background: var(--surface-2); z-index: 1; }
.map.small { min-height: 220px; height: 220px; }
.map-card.tall .map { height: calc(100vh - 290px); min-height: 460px; }
.map-off { padding: 40px; text-align: center; color: var(--muted); }
.hint.pad { padding: 10px 14px 12px; margin: 0; }
[data-theme="dark"] .leaflet-tile-pane { filter: brightness(.72) contrast(1.15) saturate(.7) invert(.92) hue-rotate(180deg); }
.leaflet-container { font: inherit; }
.leaflet-popup-content-wrapper { border-radius: 12px; }
.pop { display: grid; gap: 4px; min-width: 180px; }
.pop b { font-size: 14px; }
.pop small { color: #5E6A76; }
.pop-row { display: flex; gap: 6px; align-items: center; margin: 4px 0 6px; }
.pop .btn { color: #fff; }
.mpin { background: none; border: 0; }
.mpin i { display: block; width: 100%; height: 100%; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); background: #8A96A3; }
.mpin.t-hot i { background: #E9A800; }
.mpin.t-warm i { background: #1F8A7E; }
.mpin.big i { border-width: 3px; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(15, 82, 87, .25) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: #0F5257 !important; color: #fff; font: 600 12px var(--body); }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.scanning { display: flex; align-items: center; gap: 12px; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--teal); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.result-sum { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 0 0 12px; flex-wrap: wrap; }
.rs-stats { display: flex; gap: 8px; flex-wrap: wrap; }
.rs-stats div { background: var(--surface-2); border-radius: 10px; padding: 8px 14px; display: grid; min-width: 110px; }
.rs-stats b { font-family: var(--display); font-size: 24px; line-height: 1.1; }
.rs-stats span { font-size: 12px; color: var(--muted); }
.rs-stats .hl { background: var(--teal-soft); }
.rs-stats .hl b { color: var(--teal); }
.rs-stats .hl2 { background: var(--pin-soft); }

/* Tables */
.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow-x: auto; box-shadow: var(--shadow); }
.tbl-wrap.flat { box-shadow: none; border-radius: var(--r); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; letter-spacing: .02em; padding: 11px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr[data-id] { cursor: pointer; }
.tbl tbody tr:hover td { background: var(--surface-2); }
.tbl tr.sel td { background: var(--teal-soft); }
.tbl .nm b { display: block; font-weight: 600; }
.tbl .nm small { color: var(--muted); }
.tbl input[type="checkbox"] { width: 16px; height: 16px; }
.tbl .c-check { width: 36px; }
.tbl td.acts { white-space: nowrap; text-align: right; }
.tbl td.acts .btn + .btn { margin-left: 4px; }
.tbl select { width: auto; padding: 5px 8px; font-size: 13px; }
.due { color: var(--danger); font-weight: 600; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; padding: 12px; }
.filters > select { flex: 1 1 150px; width: auto; }
.filters > input[type=search] { flex: 2 1 280px; width: auto; }
.filters > .check { flex: none; padding: 0 4px; }
.filters > .btn { flex: none; }
.filters.slim > select { flex: 0 1 200px; }
.check { display: flex; align-items: center; gap: 6px; margin: 0; white-space: nowrap; color: var(--ink); font-size: 14px; cursor: pointer; }
.check input { width: auto; }
.bulk { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--ink); color: var(--bg); border-radius: var(--r); padding: 8px 12px; margin-bottom: 12px; position: sticky; top: 64px; z-index: 5; }
.bulk select { width: auto; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; color: var(--muted); font-size: 14px; flex-wrap: wrap; gap: 8px; }
.pager select { width: auto; padding: 5px 8px; }
.hbar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.hbar i { display: block; height: 100%; background: var(--teal-2); border-radius: 99px; }

/* Pipeline */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.col { background: var(--surface-3); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 10px; min-height: 300px; }
.col.over { border-color: var(--teal); background: var(--teal-soft); }
.col header { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 2px; }
.col .n { color: var(--muted); font-size: 13px; font-weight: 600; }
.col-val { font-size: 13px; color: var(--ok); font-weight: 600; padding: 0 4px 10px; font-variant-numeric: tabular-nums; }
.drop { display: grid; gap: 8px; min-height: 60px; }
.kcard { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; cursor: grab; display: grid; gap: 4px; box-shadow: var(--shadow); }
.kcard:hover { border-color: var(--muted); }
.kcard.dragging { opacity: .45; }
.kc-top { display: flex; align-items: center; gap: 8px; }
.kc-top a { color: var(--ink); font-weight: 600; text-decoration: none; line-height: 1.25; }
.kc-top a:hover { color: var(--teal); }
.kc-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.kcard small { color: var(--muted); font-size: 12px; }
.kcard .fu.due { color: var(--danger); }
.kmove { font-size: 12px; padding: 4px 6px; margin-top: 4px; }

/* Lead detail */
.back { display: inline-flex; gap: 6px; margin-bottom: 14px; background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 14px; }
.back::before { content: "←"; }
.back:hover { color: var(--ink); }
.lead-head { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 16px; }
.big-score { width: 92px; height: 92px; border-radius: 20px; display: grid; place-content: center; text-align: center; flex: none; }
.big-score b { font-family: var(--display); font-size: 44px; line-height: 1; letter-spacing: -.04em; }
.big-score span { font-size: 12px; font-weight: 600; text-transform: capitalize; }
.lh-main { flex: 1; min-width: 0; }
.lh-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lh-main h1 { font-family: var(--display); font-size: 32px; font-weight: 700; letter-spacing: -.025em; line-height: 1.08; }
.lh-actions { flex: none; }
.links { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; font-size: 13px; }
.chip { white-space: nowrap; display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-weight: 500; }
a.chip:hover { border-color: var(--teal); color: var(--teal); }
.chip.muted { color: var(--muted); }
.hours { margin: 10px 0 0; font-size: 13px; color: var(--muted); }
.hours b { color: var(--ink); margin-right: 6px; }
.lead-grid { display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; align-items: start; }
.lead-grid > * { min-width: 0; }
.reasons { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.reasons li { display: grid; grid-template-columns: 44px 1fr; font-size: 14px; }
.reasons b { color: var(--teal); font-variant-numeric: tabular-nums; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 9px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: none; padding: 8px 13px; cursor: pointer; font-size: 14px; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--bg); }
.c-opts { display: grid; grid-template-columns: auto 1fr 1fr auto; gap: 8px; margin: 10px 0; align-items: center; }
.hint { color: var(--muted); font-size: 13px; margin: 8px 0 0; }
.msg { border: 1px solid var(--line); border-radius: 12px; padding: 12px; display: grid; gap: 8px; background: var(--surface-2); }
.msg + .msg { margin-top: 12px; }
.msg header { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.msg header .muted { margin-left: auto; }
.msg.sent { border-left: 3px solid var(--pin); }
.m-subj { font-weight: 600; }
.m-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.side-form { display: grid; gap: 4px; }
.side-form label { margin-top: 10px; }
.side-form label:first-child, .side-form > div:first-child label { margin-top: 0; }
.fu-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 4px; }
.saved-state { font-size: 12px; color: var(--muted); }
.details-card summary { display: flex; justify-content: space-between; align-items: baseline; cursor: pointer; list-style: none; }
.details-card summary::-webkit-details-marker { display: none; }
.details-card[open] summary { margin-bottom: 10px; }

/* Add lead */
.add-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.add-grid .map { min-height: 380px; height: calc(100% - 40px); }

/* Follow-ups */
.fu-list li { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.fu-list li > a { flex: 1; min-width: 220px; }
.fu-acts { display: flex; gap: 6px; }

/* Calculator */
.calc { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.step { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 16px !important; }
.step span { width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 13px; font-weight: 700; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.opt { position: relative; margin: 0; cursor: pointer; }
.opt input { position: absolute; opacity: 0; pointer-events: none; }
.opt > span { display: grid; gap: 2px; padding: 12px 14px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--surface); transition: border-color .15s, background .15s; height: 100%; }
.opt b { color: var(--ink); font-size: 15px; }
.opt small { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.opt:hover > span { border-color: var(--muted); }
.opt input:checked + span { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 0 0 1px var(--teal); }
.opt input:focus-visible + span { outline: 2px solid var(--teal); outline-offset: 2px; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 8px; }
.feat { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); cursor: pointer; color: var(--ink); }
.feat:has(input:checked) { border-color: var(--teal); background: var(--teal-soft); }
.feat > span { display: grid; flex: 1; }
.feat b { font-weight: 500; font-size: 14px; }
.feat small { color: var(--muted); font-size: 12.5px; }
.feat.qty input { width: 64px; text-align: center; padding: 6px; }
.feat.wide { grid-column: span 1; }
.custom-row { display: grid; grid-template-columns: 1fr 140px auto; gap: 8px; margin-bottom: 8px; }
.custom-row .money-in.sm { max-width: none; }
.rec-list { display: grid; gap: 8px; }
.rec { display: grid; grid-template-columns: 1fr 130px 80px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.calc-sum { position: sticky; top: 80px; padding: 20px; }
.sum-total b { font-family: var(--display); font-size: 44px; letter-spacing: -.03em; line-height: 1; display: block; }
.sum-total span { color: var(--muted); font-size: 13px; }
.sum-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.sum-kpis div { background: var(--surface-2); border-radius: 10px; padding: 8px 12px; display: grid; }
.sum-kpis b { font-size: 18px; font-variant-numeric: tabular-nums; }
.sum-kpis span { font-size: 12px; color: var(--muted); }
.sum-lines { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.sum-lines li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sum-lines li span { display: grid; }
.sum-lines small { color: var(--muted); font-size: 12px; }
.sum-lines b { font-variant-numeric: tabular-nums; white-space: nowrap; }
.sum-lines .neg b { color: var(--ok); }
.sum-rec { margin-top: 14px; display: grid; gap: 6px; font-size: 14px; }
.sum-rec div { display: flex; justify-content: space-between; }
.sum-rec .fy { border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.sum-actions .two { margin-top: 8px; }
.sum-actions .btn.block { margin-top: 16px; }

/* Quote paper */
.paper { background: #fff; color: #141C26; border: 1px solid var(--line); border-radius: 16px; padding: 48px 56px; max-width: 860px; box-shadow: var(--shadow-lg); }
.paper .brand.dark { color: #141C26; font-size: 22px; padding-bottom: 8px; }
.paper .muted { color: #5E6A76; }
.paper-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 24px; border-bottom: 2px solid #141C26; }
.paper-head p { margin: 0; font-size: 14px; }
.paper-meta { text-align: right; }
.paper-meta h1 { font-family: var(--display); font-size: 40px; letter-spacing: -.03em; margin-bottom: 8px; }
.paper-meta dl { display: grid; grid-template-columns: auto auto; gap: 2px 14px; margin: 0; font-size: 14px; }
.paper-meta dt { color: #5E6A76; }
.paper-meta dd { margin: 0; font-weight: 600; }
.paper-to { padding: 24px 0; display: grid; gap: 2px; }
.paper-to .eyebrow { color: #5E6A76; }
.paper-to b { font-size: 18px; }
.paper-to h2 { font-family: var(--display); font-size: 24px; margin-top: 14px; }
.paper-tbl { width: 100%; border-collapse: collapse; font-size: 15px; }
.paper-tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #5E6A76; border-bottom: 1px solid #CBD3C8; padding: 8px 0; }
.paper-tbl td { padding: 11px 0; border-bottom: 1px solid #E5E9E3; vertical-align: top; }
.paper-tbl td small { display: block; color: #5E6A76; font-size: 13px; }
.paper-tbl .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.paper-tbl tfoot td { border-bottom: 0; padding: 6px 0; color: #2B3643; }
.paper-tbl tfoot tr:first-child td { padding-top: 16px; }
.paper-tbl tfoot .grand td { font-family: var(--display); font-size: 24px; font-weight: 700; color: #141C26; border-top: 2px solid #141C26; padding-top: 12px; }
.paper-rec { margin-top: 28px; background: #F6F8F5; border-radius: 12px; padding: 16px 20px; display: grid; gap: 6px; font-size: 15px; }
.paper-rec h3, .paper-foot h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: #5E6A76; margin-bottom: 4px; }
.paper-rec div { display: flex; justify-content: space-between; }
.paper-foot { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; margin-top: 28px; font-size: 14px; }
.paper-foot p { margin: 0; }

/* Reports */
.vbars { display: flex; align-items: flex-end; gap: 8px; }
.vbar { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.vbar i { display: block; width: 100%; max-width: 56px; border-radius: 6px 6px 2px 2px; }
.vbar .vv { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.vlabels { display: flex; gap: 8px; margin-top: 6px; }
.vlabels span { flex: 1; text-align: center; font-size: 12px; color: var(--muted); }
.funnel2 { display: grid; gap: 6px; }
.fstep { position: relative; display: grid; grid-template-columns: 1fr auto 48px; gap: 10px; align-items: center; padding: 8px 10px; font-size: 14px; }
.fs-bar { position: absolute; inset: 0 auto 0 0; background: var(--teal-soft); border-radius: 8px; z-index: 0; }
.fstep > :not(.fs-bar) { position: relative; z-index: 1; }
.fstep em { font-style: normal; color: var(--muted); font-size: 12px; text-align: right; }

/* Settings */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--muted); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); border-color: var(--pin); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; max-width: 760px; }
.form-grid.wide { grid-template-columns: repeat(3, 1fr); max-width: 980px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.keys { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.key { font-size: 13px; padding: 6px 10px; border-radius: 8px; background: var(--teal-soft); color: var(--teal); font-weight: 500; }
.key.missing { background: var(--danger-soft); color: var(--danger); }
.wgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.wgrid .w { display: grid; grid-template-columns: 1fr 72px; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 9px; padding: 8px 10px; }
.wgrid .w label { margin: 0; color: var(--ink); font-size: 14px; }
.wgrid .w input { text-align: right; }
.max-note { font-size: 14px; color: var(--muted); margin: 12px 0 0; }
.max-note b { color: var(--ink); }
.form-error { color: var(--danger); font-size: 14px; margin: 10px 0 0; }
h3.sec { font-size: 14px; font-weight: 600; margin: 26px 0 10px; padding-top: 18px; border-top: 1px solid var(--line); }
.ptable { display: grid; gap: 6px; max-width: 980px; }
.prow { display: grid; grid-template-columns: minmax(180px, 2fr) repeat(3, minmax(90px, 1fr)) 84px; gap: 8px; align-items: center; }
.ptable[data-key="designs"] .prow { grid-template-columns: minmax(180px, 2fr) minmax(90px, 1fr) 84px; }
.ptable[data-key="features"] .prow, .ptable[data-key="recurring"] .prow { grid-template-columns: minmax(180px, 2fr) minmax(90px, 1fr) minmax(110px, 1fr) 84px; }
#mp-table .prow { grid-template-columns: minmax(160px, 1.4fr) minmax(140px, 1.4fr) minmax(80px, .6fr) minmax(80px, .6fr) 84px; }
#cmp td:first-child { white-space: nowrap; }
.prow.phead span { font-size: 12px; font-weight: 600; color: var(--muted); }
.prow .n { text-align: right; }
.ptable > .btn { justify-self: start; margin-top: 4px; }
.est-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.est-out { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.est-out div { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; display: grid; }
.est-out span { font-size: 12.5px; color: var(--muted); }
.est-out b { font-family: var(--display); font-size: 24px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.est-out small { font-size: 12px; color: var(--muted); }
.est-out .hl { background: var(--teal); color: var(--on-teal); }
.est-out .hl span, .est-out .hl small { color: inherit; opacity: .85; }
.free-note { margin-top: 14px; background: var(--ok-soft); color: var(--ink); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.free-note b { color: var(--ok); }

/* Toasts */
.toasts { position: fixed; bottom: 20px; right: 20px; display: grid; gap: 8px; z-index: 2000; }
.toast { background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: 14px; max-width: 380px; animation: pop .18s ease-out; box-shadow: var(--shadow-lg); }
.toast.err { background: var(--danger); color: #fff; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth.solo { grid-template-columns: 1fr; place-items: center; padding: 20px; }
.auth > .auth-card { align-self: center; justify-self: center; margin: 20px; }
.auth-art { position: relative; overflow: hidden; background: radial-gradient(circle at 30% 20%, #1B3A44 0%, #111A23 60%); color: #fff; display: flex; align-items: flex-end; padding: 48px; }
.auth-grid { position: absolute; inset: 0; background-image: linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px); background-size: 44px 44px; }
.auth-pins i { position: absolute; width: 22px; height: 22px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--pin); border: 3px solid #fff; box-shadow: 0 4px 14px rgba(0, 0, 0, .4); }
.auth-pins i:nth-child(1) { top: 18%; left: 22%; }
.auth-pins i:nth-child(2) { top: 32%; left: 58%; background: #5FB3A9; }
.auth-pins i:nth-child(3) { top: 50%; left: 36%; }
.auth-pins i:nth-child(4) { top: 24%; left: 78%; background: #8A96A3; }
.auth-pins i:nth-child(5) { top: 60%; left: 70%; background: #5FB3A9; }
.auth-copy { position: relative; display: grid; gap: 8px; max-width: 420px; }
.auth-copy b { font-family: var(--display); font-size: 34px; line-height: 1.1; letter-spacing: -.02em; }
.auth-copy span { color: #B9C3CC; }
.auth-card { width: 100%; max-width: 390px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow-lg); }
.auth-card h1 { font-family: var(--display); font-size: 28px; margin-bottom: 4px; letter-spacing: -.02em; }
.auth-card label { margin-top: 12px; }

@media (max-width: 1200px) {
  .calc { grid-template-columns: minmax(0, 1fr) 320px; }
}
@media (max-width: 1100px) {
  .dash { grid-template-columns: 1fr 1fr; }
  .span-3 { grid-column: 1 / -1; }
  .lead-grid, .find-grid, .add-grid { grid-template-columns: 1fr; }
  .find-grid .map { min-height: 340px; }
  .form-grid.wide, .est-grid, .est-out { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 960px) {
  .side { transform: translateX(-100%); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(10, 15, 20, .45); z-index: 1150; }
  .main { margin-left: 0; }
  .menu-btn { display: flex; }
  .top { padding: 10px 16px; }
  .qs kbd { display: none; }
  .view { padding: 20px 16px 60px; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .calc { grid-template-columns: 1fr; }
  .calc-sum { position: static; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
}
@media (max-width: 640px) {
  .dash, .form-grid, .form-grid.wide, .est-grid, .est-out { grid-template-columns: 1fr; }
  .filters > select, .filters.slim > select { flex: 1 1 100%; }
  .span-2 { grid-column: auto; }
  .page-head h1, .lh-main h1 { font-size: 27px; }
  .metric b { font-size: 30px; }
  .c-opts { grid-template-columns: 1fr 1fr; }
  .lead-head { flex-wrap: wrap; gap: 14px; }
  .lh-main { flex: 1 1 180px; }
  .lh-actions { flex-basis: 100%; }
  .lh-actions .btn { width: 100%; }
  .big-score { width: 72px; height: 72px; border-radius: 14px; }
  .big-score b { font-size: 34px; }
  .top-actions .btn:first-child { display: none; }
  .frow { grid-template-columns: 90px 1fr 32px; }
  .frow em { display: none; }
  .paper { padding: 24px 20px; }
  .paper-head { flex-direction: column; }
  .paper-meta { text-align: left; }
  .prow, .ptable .prow, #mp-table .prow { grid-template-columns: 1fr 1fr; }
  .prow.phead { display: none; }
  .custom-row, .rec { grid-template-columns: 1fr 1fr; }
}
@media print {
  .side, .top, .no-print, .toasts, .scrim { display: none !important; }
  .main { margin: 0; }
  .view { padding: 0; max-width: none; }
  body { background: #fff; }
  .paper { border: 0; box-shadow: none; padding: 0; max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

.diag { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); max-width: 760px; }
.diag-list { margin: 10px 0 0; padding-left: 18px; display: grid; gap: 4px; color: var(--ink); }
.okc { color: var(--ok); font-weight: 600; }

/* Composer modes and templates */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.modes button { display: grid; gap: 1px; text-align: left; padding: 9px 12px; border: 1.5px solid var(--line-2); border-radius: 12px; background: var(--surface); cursor: pointer; }
.modes button b { font-size: 14px; }
.modes button small { color: var(--muted); font-size: 12px; }
.modes button:hover { border-color: var(--muted); }
.modes button[aria-pressed="true"] { border-color: var(--teal); background: var(--teal-soft); box-shadow: 0 0 0 1px var(--teal); }
.c-panel { margin-top: 12px; }
.t-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.t-prev { margin-top: 10px; background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 10px; padding: 12px 14px; font-size: 14px; line-height: 1.55; max-height: 260px; overflow: auto; unicode-bidi: plaintext; }
.t-prev b { display: block; margin-bottom: 6px; }
.chat-steps { margin: 0; padding-left: 20px; display: grid; gap: 14px; }
.chat-steps li { display: grid; gap: 8px; }
.chat-steps li > span { font-weight: 500; }
.tpl-top { display: grid; grid-template-columns: minmax(160px, 2fr) repeat(3, minmax(110px, 1fr)) auto; gap: 8px; align-items: center; }
.tpl-name { font-weight: 600; }
.tpl textarea { unicode-bidi: plaintext; }
.ph-list { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.ph-list .chip { cursor: pointer; font: 500 12.5px ui-monospace, Menlo, Consolas, monospace; }
@media (max-width: 640px) {
  .modes { grid-template-columns: 1fr; }
  .tpl-top { grid-template-columns: 1fr 1fr; }
  .tpl-top .tpl-name { grid-column: 1 / -1; }
}

/* ---------- 3.2: Free AI and Assistant ---------- */
.okc { color: var(--ok); font-weight: 600; }
.auto-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); margin-left: 4px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 30%, transparent); }
.auto-dot.busy { animation: pulse 1s ease-in-out infinite; }
.nav a .auto-dot + .badge, .nav a .auto-dot:not([hidden]) { margin-left: auto; }
.nav a .auto-dot:not([hidden]) + .badge { margin-left: 8px; }
@keyframes pulse { 50% { opacity: .3; } }
.live-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); margin-right: 8px; animation: pulse 1.6s ease-in-out infinite; }
.metric b .of { font-size: 18px; color: var(--muted); font-weight: 500; }
.warnbox { background: var(--pin-soft); border-color: transparent; color: var(--pin-ink); margin-bottom: 16px; }
.warnbox ul { margin: 6px 0 10px; padding-left: 18px; }
.asst-grid { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: 16px; align-items: start; }
.asst-grid > * { min-width: 0; }
.card-head.flat { margin: 2px 2px 0; }
.adraft { display: grid; gap: 10px; }
.adraft.done { opacity: .85; }
.ad-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ad-title { margin-right: auto; min-width: 0; }
.ad-title a { color: inherit; text-decoration: none; }
.ad-title a:hover b { text-decoration: underline; }
.ad-title small { display: block; color: var(--muted); font-size: 13px; }
.ad-why { margin: 0; font-size: 14px; }
.ad-contact { margin: -4px 0 0; font-size: 13px; }
.ad-contact:empty { display: none; }
.ad-panel { border-top: 1px dashed var(--line-2); padding-top: 10px; display: grid; gap: 8px; }
.ad-panel[hidden] { display: none; }
.ad-panel label { margin: 0; }
.ad-done { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chipbtn { border: 1px solid var(--line-2); background: var(--surface); color: var(--ink); border-radius: 99px; padding: 5px 11px; font-size: 13px; cursor: pointer; }
.chipbtn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
label.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 400; font-size: 14px; margin: 0; }
.tag.asst { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.auto-state { margin: 0 0 6px; display: flex; align-items: center; gap: 8px; font-weight: 500; }
.mini-h { font-size: 13px; font-weight: 600; color: var(--muted); margin: 16px 0 6px; text-transform: uppercase; letter-spacing: .05em; }
.alog { list-style: none; margin: 0; padding: 0; max-height: 280px; overflow: auto; font-size: 13px; display: grid; gap: 5px; }
.alog li { display: grid; grid-template-columns: 44px 1fr; gap: 6px; }
.alog small { color: var(--muted); }
.alog li.ok span { color: var(--ok); }
.alog li.err span { color: var(--danger); }
.lessons { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: 14px; }
.lessons li span { margin-right: 8px; }
.lessons .linkbtn { font-size: 12px; color: var(--muted); }
.runs li { font-size: 13px; }
.prov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; margin-bottom: 16px; }
.prov { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-2); border-radius: 12px; padding: 12px; cursor: pointer; color: var(--ink); font-size: 14px; margin: 0; }
.prov:has(input:checked) { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-soft); }
.prov input { margin-top: 3px; }
.prov b { font-weight: 600; margin-right: 6px; }
.prov small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; font-weight: 400; }
.prov-panel[hidden] { display: none; }
.steps { background: var(--surface-2); border-radius: 10px; padding: 12px 14px; font-size: 14px; }
.steps ol { margin: 6px 0 0; padding-left: 20px; display: grid; gap: 4px; }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; background: var(--surface-3); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
hr.sep { border: 0; border-top: 1px solid var(--line); margin: 22px 0 18px; }
.catgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 14px; }
@media (max-width: 1100px) { .asst-grid { grid-template-columns: 1fr; } }
.asst-grid .mini th + th, .asst-grid .mini td + td { padding-left: 10px; }

/* ---------- 4.0: platform, playbooks, audits, billing ---------- */
.small-center { display: block; text-align: center; margin-top: 14px; font-size: 14px; }
.lock { grid-template-columns: 1fr; place-items: center; }
.lock-card { max-width: 460px; width: 100%; }
.lock-card h1 { margin-top: 12px; }
.lock-badge { display: inline-block; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 4px 10px; border-radius: 99px; background: var(--pin-soft); color: var(--pin-ink); margin-top: 10px; }
.lb-suspended, .lb-cancelled, .lb-expired { background: var(--danger-soft); color: var(--danger); }
.godbar { display: flex; align-items: center; gap: 12px; padding: 10px 24px; background: #1B1400; color: #FFE7A0; font-size: 14px; flex-wrap: wrap; }
.godbar .ico { color: var(--pin); }
.godbar .btn { margin-left: auto; }
.godbar.warn { background: var(--pin-soft); color: var(--pin-ink); }
.nav-label.owner { color: var(--pin); }
.hbadge { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 7px; border-radius: 6px; margin-left: 6px; background: var(--surface-3); color: var(--muted); vertical-align: middle; text-transform: capitalize; }
.hbadge.h-ok { background: var(--ok-soft); color: var(--ok); } .hbadge.h-mid { background: var(--pin-soft); color: var(--pin-ink); } .hbadge.h-bad { background: var(--danger-soft); color: var(--danger); }
.hgauge { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; align-content: center; flex: none; border: 4px solid var(--c, var(--line)); }
.hgauge b { font: 800 22px var(--display); line-height: 1; } .hgauge small { font-size: 10px; color: var(--muted); }
.hgauge.h-ok { --c: var(--ok); } .hgauge.h-mid { --c: var(--pin); } .hgauge.h-bad { --c: var(--danger); }
.au-top { display: flex; gap: 14px; align-items: center; margin-bottom: 12px; }
.au-top a { font-weight: 600; word-break: break-all; }
.au-top p { margin: 4px 0 0; font-size: 13.5px; }
.au-checks { list-style: none; margin: 0 0 12px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; font-size: 13.5px; }
.au-checks li.ok { color: var(--ok); } .au-checks li.no { color: var(--danger); }
.au-issues { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 8px; }
.au-issues li { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; align-items: baseline; font-size: 14px; }
.au-issues .hbadge { margin: 0; grid-row: span 2; }
.au-issues small { color: var(--muted); grid-column: 2; }
.okbox { background: var(--ok-soft); color: var(--ok); border-color: transparent; font-weight: 500; }
.pbk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.pbk.on { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal-soft); }
.pbk-mode { margin: -6px 0 10px; font-size: 13.5px; }
.pbk-offer { font-size: 14px; margin: 0 0 12px; color: var(--ink-2); }
.pbk-w { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 5px; font-size: 13.5px; }
.pbk-w li { display: flex; justify-content: space-between; gap: 10px; } .pbk-w b { color: var(--teal); }
.pb-edit { margin-bottom: 18px; }
.feat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px 16px; margin-bottom: 8px; }
.feat { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.feat select { width: auto; padding: 6px 8px; font-size: 13px; }
.eff { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 13.5px; }
.eff .on { color: var(--ink); } .eff .off { color: var(--muted); }
.danger-zone { border-color: var(--danger-soft); }
.danger-zone h2 { color: var(--danger); margin-bottom: 6px; }
.lnk-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 6px 0; }
.lnk-row b { display: block; } .lnk-row small { color: var(--muted); }
.avatar.sm { width: 30px; height: 30px; font-size: 12px; }
.pill.o-awaiting, .pill.o-confirming { background: var(--pin-soft); color: var(--pin-ink); }
.pill.o-review { background: var(--danger-soft); color: var(--danger); }
.pill.o-paid, .pill.c-active { background: var(--ok-soft); color: var(--ok); }
.pill.o-expired, .pill.o-cancelled, .pill.c-cancelled { background: var(--surface-3); color: var(--muted); }
.pill.c-pending { background: var(--pin); color: #17202B; }
.pill.c-suspended, .pill.c-expired { background: var(--danger-soft); color: var(--danger); }
.txid { display: block; color: var(--muted); font-size: 11.5px; }
.sub-tabs { margin-top: -8px; }
.sub-tabs a { font-size: 13.5px; }
.cms { display: grid; grid-template-columns: 240px 1fr; gap: 16px; align-items: start; }
.cms-nav { display: grid; gap: 2px; padding: 8px; position: sticky; top: 80px; }
.cms-nav a { padding: 9px 12px; border-radius: 8px; text-decoration: none; color: var(--ink-2); font-size: 14px; }
.cms-nav a.active, .cms-nav a:hover { background: var(--surface-2); color: var(--ink); }
.cms-nav a.active { box-shadow: inset 3px 0 0 var(--pin); font-weight: 600; }
.cms-list { display: grid; gap: 10px; }
.cms-item { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--surface-2); }
.cms-item-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.cms-item-head b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cms-group { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin: 0; }
.cms-group legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
.up-btn { cursor: pointer; flex: none; }
.mono-area { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13.5px; }
.nowrap { white-space: nowrap; font-size: 13px; }
.plan-admin { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.plan-admin .hi { border-color: var(--pin); }
.bill-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.bill-grid .span-2 { grid-column: span 2; }
.use-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; margin-bottom: 12px; font-size: 14px; }
.use-row .meter, .use-row small { grid-column: 1 / -1; }
.up-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.up { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: grid; gap: 6px; align-content: start; }
.up.cur { border-color: var(--teal); background: var(--teal-soft); }
.up span { font-size: 14px; } .up small { color: var(--muted); }
.up ul { margin: 4px 0 8px; padding-left: 18px; font-size: 13.5px; color: var(--ink-2); }
.inbox-msg.done { opacity: .6; }
.msg-text { white-space: normal; background: var(--surface-2); padding: 12px 14px; border-radius: 10px; margin: 10px 0; }
.btcpay { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 12px; }
.btcpay summary { cursor: pointer; }
.danger-tag { background: var(--danger-soft); color: var(--danger); }
.sticky-save { position: sticky; bottom: 0; background: var(--bg); padding: 12px 0; z-index: 2; }
.warnbox p { margin: 0 0 6px; }
@media (max-width: 960px) { .cms { grid-template-columns: 1fr; } .cms-nav { position: static; } .bill-grid { grid-template-columns: 1fr; } .bill-grid .span-2 { grid-column: auto; } }
.cms-form .form-grid, .pb-edit .form-grid { max-width: none; }
.side { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #2B3643 transparent; }
a.brand { text-decoration: none; }
.nav a { padding-top: 7px; padding-bottom: 7px; }

/* ---------- 4.0.1: installable app ---------- */
.glyph { width: 22px; height: auto; flex: none; }
.brand .glyph { width: 24px; }
.install-btn { display: flex; justify-content: center; align-items: center; gap: 10px; margin-top: 10px; }
.install-btn img { border-radius: 6px; }
.side-actions .install-side { grid-column: 1 / -1; color: var(--pin); }
.install-sheet { position: fixed; inset: 0; z-index: 3000; background: rgba(8,12,16,.55); display: grid; align-items: end; justify-items: center; padding: 16px; padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
.is-card { background: var(--surface); color: var(--ink); border-radius: 22px; padding: 24px; width: min(420px, 100%); box-shadow: var(--shadow); text-align: center; }
.is-card img { border-radius: 16px; margin: 0 auto 12px; }
.is-card h2 { font-size: 20px; margin-bottom: 12px; }
.is-card ol { text-align: left; margin: 0 0 18px; padding-left: 22px; display: grid; gap: 8px; }
.is-card svg { vertical-align: -3px; }
/* Full-screen app on phones: keep clear of the notch and home bar */
.standalone .top { padding-top: calc(10px + env(safe-area-inset-top)); }
.standalone .side { padding-top: calc(20px + env(safe-area-inset-top)); padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
.standalone .toasts { bottom: calc(16px + env(safe-area-inset-bottom)); }
.standalone .auth { padding-top: env(safe-area-inset-top); }
@media (display-mode: standalone) { body { overscroll-behavior-y: none; -webkit-tap-highlight-color: transparent; } }

/* Demo websites (4.1) */
.demo-card .card-head { flex-wrap: wrap; }
.dm-views { font-size: 13px; color: var(--muted); margin-left: auto; }
.dm-views.on { color: var(--ok); font-weight: 600; background: var(--ok-soft); padding: 2px 10px; border-radius: 99px; }
.dm-thumb { display: block; position: relative; height: 230px; overflow: hidden; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 12px; }
.dm-thumb iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 900px; border: 0; transform: scale(var(--dm-scale, .42)); transform-origin: 0 0; pointer-events: none; }
.dm-thumb::after { content: "Open"; position: absolute; right: 10px; bottom: 10px; font-size: 12px; font-weight: 600; background: var(--ink); color: var(--surface); padding: 3px 10px; border-radius: 99px; opacity: 0; transition: opacity .15s; }
.dm-thumb:hover::after { opacity: .9; }
.dm-url { display: flex; gap: 8px; margin-bottom: 10px; }
.dm-url input { font-size: 13px; color: var(--muted); }
.demo-card .m-actions { flex-wrap: wrap; align-items: center; }
.dm-ai { display: inline-flex; gap: 6px; align-items: center; }
.dm-ai select { width: auto; max-width: 160px; padding: 6px 8px; font-size: 13px; }
.dm-form { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.dm-form input[type="color"] { padding: 2px; height: 40px; cursor: pointer; }
.dm-hl { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.timeline li.a-demo_view::before { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.timeline li.a-demo_view { font-weight: 600; }
.tbl tr.fresh td { background: var(--ok-soft); }
@media (max-width: 700px) { .dm-hl { grid-template-columns: 1fr; } .dm-thumb { height: 180px; } }

/* ==========================================================================
   4.2 "Midnight" look: black surfaces, violet accent, Inter, quiet borders.
   Dark is the default (light stays available from the sidebar or Settings).
   ========================================================================== */
:root {
  --display: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --teal: #6D28D9; --teal-hover: #5B21B6; --teal-soft: #EDE9FE; --teal-2: #7C3AED; --on-teal: #FFFFFF;
  --violet: #7C3AED; --violet-2: #A78BFA; --violet-3: #4C1D95;
  --bg: #F7F7FA; --surface-2: #F4F4F7; --surface-3: #ECECF1; --line: #E4E4EA; --line-2: #D4D4DC; --ink: #0B0B10; --muted: #6B6B78;
  --side: #08080B; --side-2: #08080B; --side-ink: #A1A1AA; --side-active: rgba(139, 92, 246, .14);
  --r: 10px; --r-lg: 14px;
}
[data-theme="dark"] {
  --bg: #000000; --surface: #0D0D11; --surface-2: #141419; --surface-3: #1A1A21; --ink: #F4F4F5; --ink-2: #D4D4D8; --muted: #8B8B97; --line: #1E1E26; --line-2: #2B2B35;
  --teal: #A78BFA; --teal-hover: #C4B5FD; --teal-soft: rgba(139, 92, 246, .16); --teal-2: #8B5CF6; --on-teal: #0B0B10;
  --side: #050507; --side-2: #050507; --side-active: rgba(139, 92, 246, .15);
  --shadow: none; --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, .85);
}
body { letter-spacing: -.005em; }
[data-theme="dark"] .main { background: radial-gradient(1100px 420px at 55% -180px, rgba(124, 58, 237, .22), transparent 70%) no-repeat; }

/* Buttons: white pill-ish primary on black, violet on light */
.btn { border-radius: 10px; box-shadow: none; font-weight: 600; }
.btn.primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.btn.primary:hover { background: var(--violet-3); border-color: var(--violet-3); }
[data-theme="dark"] .btn { background: var(--surface-2); border-color: var(--line-2); }
[data-theme="dark"] .btn:hover { border-color: #3F3F4C; background: var(--surface-3); }
[data-theme="dark"] .btn.primary { background: #FFFFFF; border-color: #FFFFFF; color: #09090B; }
[data-theme="dark"] .btn.primary:hover { background: #E4E4E7; border-color: #E4E4E7; }
[data-theme="dark"] .btn.ghost { background: transparent; border-color: transparent; }
[data-theme="dark"] .btn.ghost:hover { background: var(--surface-2); }
[data-theme="dark"] .btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }

/* Sidebar */
.side { border-right: 1px solid #16161C; }
.brand { font-weight: 800; letter-spacing: -.02em; }
.nav-label { color: #5B5B66; }
.nav a { border-radius: 10px; color: var(--side-ink); }
.nav a:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.nav a.active { background: var(--side-active); color: #fff; box-shadow: inset 0 0 0 1px rgba(139, 92, 246, .28); }
.nav a.active .ico { color: var(--violet-2); }
.badge { background: var(--violet); color: #fff; }
.side-foot { border-top-color: #18181F; }
.avatar { background: linear-gradient(135deg, #A78BFA, #6D28D9); color: #fff; }
.side-btn:hover { background: rgba(255, 255, 255, .05); }

/* Top bar */
[data-theme="dark"] .top { background: rgba(0, 0, 0, .72); }
[data-theme="dark"] .qs input { background: var(--surface); }

/* Cards, metrics, headings */
.page-head h1 { font-weight: 800; letter-spacing: -.035em; }
.card, .metric, .tbl-wrap, .kcard { box-shadow: none; }
[data-theme="dark"] .card, [data-theme="dark"] .metric, [data-theme="dark"] .tbl-wrap { background: linear-gradient(180deg, rgba(255, 255, 255, .025), transparent 120px), var(--surface); }
.metric b { font-weight: 800; letter-spacing: -.04em; }
.metric.accent { background: linear-gradient(140deg, #8B5CF6 0%, #6D28D9 55%, #4C1D95 100%); color: #fff; border-color: transparent; box-shadow: 0 18px 50px -24px rgba(124, 58, 237, .9); }
.metric.accent .m-label, .metric.accent small { color: rgba(255, 255, 255, .78); }
a.metric:hover { border-color: var(--violet-2); }
.metric.on { border-color: var(--violet-2); box-shadow: 0 0 0 2px var(--teal-soft); }
.empty-ico { background: var(--teal-soft); color: var(--teal); }
.tag.new { background: var(--teal-soft); color: var(--teal); }
[data-theme="dark"] .tbl th { background: transparent; color: #75757F; text-transform: uppercase; font-size: 11px; letter-spacing: .06em; }
[data-theme="dark"] .tbl tbody tr:hover td { background: rgba(255, 255, 255, .025); }
.bars.duo .bar i.b, .bars-legend .lg i.b { background: #F59E0B; }
.marker-cluster-small, .marker-cluster-medium, .marker-cluster-large { background: rgba(124, 58, 237, .28) !important; }
.marker-cluster-small div, .marker-cluster-medium div, .marker-cluster-large div { background: #7C3AED !important; }
[data-theme="dark"] .leaflet-popup-content-wrapper, [data-theme="dark"] .leaflet-popup-tip { background: #15151B; color: #F4F4F5; }
[data-theme="dark"] .pop small { color: #A1A1AA; }
[data-theme="dark"] input, [data-theme="dark"] select, [data-theme="dark"] textarea { background: #0A0A0E; border-color: var(--line-2); }
[data-theme="dark"] input:hover, [data-theme="dark"] select:hover, [data-theme="dark"] textarea:hover { border-color: #3F3F4C; }
input:focus, select:focus, textarea:focus { border-color: var(--violet-2); box-shadow: 0 0 0 3px rgba(139, 92, 246, .22); }
:focus-visible { outline-color: var(--violet-2); }

/* Sign-in and lock screens: black with a violet horizon */
.auth-art { background: linear-gradient(180deg, #000 0%, #0B0614 45%, #2A1060 100%); }
.auth-art::after { content: ""; position: absolute; left: -30%; right: -30%; bottom: -82%; height: 95%; border-radius: 50%; background: #000;
  box-shadow: 0 -2px 0 rgba(196, 181, 253, .75), 0 -40px 120px rgba(139, 92, 246, .6), inset 0 40px 80px rgba(139, 92, 246, .22); }
.auth-grid { opacity: .5; mask-image: linear-gradient(180deg, #000 30%, transparent 75%); }
.auth-copy { z-index: 1; }
.auth-pins i { border-color: #000; }
.auth-pins i:nth-child(2), .auth-pins i:nth-child(5) { background: #A78BFA; }
.auth-pins i:nth-child(4) { background: #6D28D9; }
.auth-copy span { color: #C4C4CF; }
[data-theme="dark"] .auth { background: #000; }
[data-theme="dark"] .auth-card { background: #0D0D11; border-color: #1E1E26; }
.nav-label.owner { color: var(--violet-2); }

/* ==========================================================================
   4.3 App shell: black top bar, slim icon rail with tooltips, avatar menu.
   ========================================================================== */
:root { --bar-h: 56px; --rail-w: 72px; }
[data-theme="dark"] {
  --bg: #111113; --surface: #09090B; --surface-2: #161619; --surface-3: #1C1C20; --line: #1F1F23; --line-2: #2A2A2F;
}
[data-theme="dark"] .main { background: var(--bg); }
[data-theme="dark"] .card, [data-theme="dark"] .metric, [data-theme="dark"] .tbl-wrap { background: var(--surface); }

/* Top bar across the whole width */
.top { position: fixed; top: 0; left: 0; right: 0; height: var(--bar-h); padding: 0 16px 0 12px; gap: 12px; z-index: 1300;
  background: #000; border-bottom: 1px solid #1A1A1E; backdrop-filter: none; }
[data-theme="dark"] .top { background: #000; }
.app-logo { width: 36px; height: 36px; flex: none; border-radius: 10px; background: #fff; display: grid; place-items: center; box-shadow: 0 0 0 1px rgba(255,255,255,.15); }
.app-logo img { width: 16px; height: auto; }
.app-title { color: #fff; font-size: 15px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.top .qs { max-width: 340px; margin-left: 20px; }
.top .qs input { height: 36px; padding-top: 6px; padding-bottom: 6px; background: #0E0E10; border-color: #232327; color: #F4F4F5; }
.top .qs input::placeholder { color: #71717A; }
.top .qs kbd { border-color: #2A2A2F; color: #71717A; }
.top-actions { margin-left: auto; }
.top .btn { background: #111114; border-color: #26262B; color: #F4F4F5; }
.top .btn:hover { background: #1A1A1E; border-color: #3A3A40; }
.top .btn.primary { background: #fff; border-color: #fff; color: #09090B; }
.top .btn.primary:hover { background: #E4E4E7; }
.theme-pill { display: flex; gap: 2px; padding: 3px; border-radius: 99px; background: #111114; border: 1px solid #26262B; }
.theme-pill button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: none; color: #8A8A93; display: grid; place-items: center; cursor: pointer; }
.theme-pill button .ico { width: 15px; height: 15px; }
.theme-pill button[aria-pressed="true"] { background: #2A2A30; color: #fff; }
.theme-pill button:hover { color: #fff; }
.acct { position: relative; }
.acct summary { list-style: none; cursor: pointer; width: 34px; height: 34px; font-size: 12px;
  background: radial-gradient(circle at 30% 25%, #F0ABFC, #A78BFA 45%, #6D28D9); box-shadow: 0 0 0 2px #000, 0 0 0 3px rgba(167,139,250,.6); }
.acct summary::-webkit-details-marker { display: none; }
.acct-menu { position: absolute; right: 0; top: calc(100% + 10px); width: 250px; background: #0E0E10; border: 1px solid #26262B; border-radius: 14px; padding: 6px;
  box-shadow: 0 24px 60px -16px rgba(0,0,0,.9); display: grid; gap: 2px; color: #E4E4E7; }
.acct-menu a, .acct-menu button { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; text-decoration: none; color: inherit; background: none; border: 0; font: inherit; font-size: 14px; cursor: pointer; text-align: left; }
.acct-menu a:hover, .acct-menu button:hover { background: #18181C; }
.acct-menu .ico { width: 16px; height: 16px; color: #A1A1AA; }
.acct-me { padding: 10px 10px 12px; border-bottom: 1px solid #1F1F23; margin-bottom: 4px; display: grid; gap: 2px; }
.acct-me b { color: #fff; font-size: 14px; } .acct-me small { color: #8A8A93; font-size: 12px; word-break: break-all; }

/* Slim icon rail */
.side { top: var(--bar-h); width: var(--rail-w); padding: 12px 10px 12px; background: #000; border-right: 0; overflow: visible; align-items: center; }
.side > .brand { display: none; }
.side .nav { align-items: center; gap: 4px; width: 100%; }
.side > .nav { flex: 1; background: #18181B; border-radius: 26px; padding: 10px 0; overflow-y: auto; overflow-x: visible; scrollbar-width: none; }
.side > .nav::-webkit-scrollbar { display: none; }
.side .nav a { position: relative; width: 44px; height: 44px; padding: 0; justify-content: center; border-radius: 50%; color: #D4D4D8; box-shadow: none; gap: 0; }
.side .nav a .ico { width: 19px; height: 19px; }
.side .nav a .lbl { display: none; }
.side .nav a:hover { background: #26262B; color: #fff; }
.side .nav a.active { background: #000; color: #fff; box-shadow: 0 0 0 1px #2E2E34, 0 6px 18px -6px rgba(0,0,0,.9); }
.side .nav a.active .ico { color: #fff; }
.side .nav-label { display: block; width: 24px; height: 1px; padding: 0; margin: 6px 0; background: #2C2C31; font-size: 0; overflow: hidden; }
.side .nav-label:first-child { display: none; }
.side .nav-label.owner { background: #6D28D9; height: 2px; border-radius: 2px; }
.side .nav a .badge { position: absolute; top: 3px; right: 1px; margin: 0; min-width: 17px; height: 17px; padding: 0 4px; font-size: 10.5px; line-height: 17px; border-radius: 99px; box-shadow: 0 0 0 2px #18181B; }
.side .nav a .auto-dot { position: absolute; top: 6px; left: 6px; margin: 0; }
.side-foot.nav { margin-top: 12px; border: 0; padding: 0; background: #18181B; border-radius: 26px; padding: 6px 0; display: flex; }
/* Tooltip with the page name */
.side .nav a::after { content: attr(data-tip); position: absolute; left: calc(100% + 14px); top: 50%; transform: translate(-4px, -50%); white-space: nowrap; pointer-events: none;
  background: #fff; color: #09090B; font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 8px; opacity: 0; transition: opacity .12s, transform .12s; z-index: 5; box-shadow: 0 8px 24px -8px rgba(0,0,0,.6); }
.side .nav a:hover::after, .side .nav a:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
.main { margin-left: var(--rail-w); padding-top: var(--bar-h); }
.view { padding: 26px 28px 72px; }

/* Light mode keeps the black bar and rail, light content */
[data-theme="light"] .main, :root:not([data-theme]) .main { background: var(--bg); }

/* Phones and small tablets: the rail becomes a full menu with names */
@media (max-width: 960px) {
  .top { padding: 0 10px; gap: 8px; }
  .menu-btn { display: flex; border-color: #2A2A2F; }
  .menu-btn span { background: #fff; }
  .top .qs { display: none; }
  .top-actions .btn span { display: none; }
  .top-actions .btn { padding: 7px 9px; }
  .app-logo { display: none; }
  .side { width: 264px; align-items: stretch; padding: 12px; transform: translateX(-100%); }
  body.nav-open .side { transform: none; }
  .side > .nav, .side-foot.nav { border-radius: 18px; padding: 8px; }
  .side .nav { align-items: stretch; }
  .side .nav a { width: auto; height: 42px; padding: 0 12px; justify-content: flex-start; gap: 12px; border-radius: 12px; }
  .side .nav a .lbl { display: inline; }
  .side .nav a::after { display: none; }
  .side .nav a .badge { position: static; margin-left: auto; box-shadow: none; }
  .side .nav-label { width: auto; height: auto; background: none; font-size: 11px; color: #6B6B75; padding: 12px 12px 4px; margin: 0; }
  .side .nav-label:first-child { display: block; padding-top: 4px; }
  .side .nav-label.owner { color: var(--violet-2); background: none; height: auto; }
  .main { margin-left: 0; }
}
@media (max-width: 640px) { .theme-pill { display: none; } .app-title { font-size: 14px; } }
.standalone .top { padding-top: env(safe-area-inset-top); height: calc(var(--bar-h) + env(safe-area-inset-top)); }
.standalone .side { top: calc(var(--bar-h) + env(safe-area-inset-top)); }
.standalone .main { padding-top: calc(var(--bar-h) + env(safe-area-inset-top)); }
.bulk { top: calc(var(--bar-h) + 8px); }
.side .nav a { flex: none; }
.side-foot.nav { flex: none; }
[data-theme="dark"] .metric.accent { background: linear-gradient(140deg, #8B5CF6 0%, #6D28D9 55%, #4C1D95 100%); }
.side .nav a::after { display: none; }
.rail-tip { position: fixed; z-index: 1400; pointer-events: none; background: #fff; color: #09090B; font-size: 12.5px; font-weight: 600; padding: 5px 10px; border-radius: 8px;
  box-shadow: 0 8px 24px -8px rgba(0,0,0,.6); transform: translateY(-50%); white-space: nowrap; opacity: 0; transition: opacity .12s; }
.rail-tip.on { opacity: 1; }
.rail-tip::before { content: ""; position: absolute; left: -4px; top: 50%; width: 8px; height: 8px; background: inherit; transform: translateY(-50%) rotate(45deg); border-radius: 1px; }
.side .nav-label { flex: none; }
