/* SiltLoop operations dashboard, light theme. Scoped under .db-root; tokens come from css/app.css. */
.db-root {
  position: relative; height: 100%; min-height: 660px;
  display: flex; flex-direction: column; gap: 12px;
  color: var(--text, #16181b); font-family: var(--font, "Inter", "Segoe UI", sans-serif); font-size: 12.5px;
}
.db-root[hidden] { display: none; }
.db-root *, .db-root *::before, .db-root *::after { box-sizing: border-box; }
.db-root h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -.6px; }
.db-root h2 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -.2px; }
.db-muted { color: var(--muted, #74777c); }

.db-card { background: var(--surface, #fff); border-radius: var(--radius, 22px); box-shadow: var(--shadow, 0 10px 30px rgba(20,22,26,.07)); padding: 16px 18px; min-width: 0; min-height: 0; }
.db-card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }

/* header */
.db-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 2px 4px 0; }
.db-title { display: flex; align-items: baseline; gap: 12px; }
.db-sub { color: var(--muted, #74777c); font-size: 12.5px; }
.db-actions { display: flex; align-items: center; gap: 8px; }
.db-key { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #3b3e43; margin-right: 6px; }
.db-key i { width: 9px; height: 9px; border-radius: 50%; }
.db-pill { border: 0; background: var(--surface, #fff); color: var(--text, #16181b); font: inherit; font-weight: 500; font-size: 12.5px; padding: 9px 15px; border-radius: 999px; cursor: pointer; box-shadow: var(--shadow); }
.db-pill:hover { background: var(--surface-2, #f6f4f0); }
.db-pill.db-dark { background: var(--text, #16181b); color: #fff; box-shadow: none; }
.db-pill.db-dark:hover { background: #2a2d31; }

.db-tag { display: inline-block; font-size: 10.5px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft, #eeedff); color: var(--accent, #5b4ff5); white-space: nowrap; }
.db-tag-soft { background: var(--surface-2, #f6f4f0); color: #3b3e43; }
.db-tag-live { background: var(--good-soft, #e3f5ea); color: var(--good, #1f9d55); }
.db-tag-snap { background: var(--surface-2, #f6f4f0); color: var(--muted, #74777c); }

/* KPI row */
.db-kpis { flex: 0 0 auto; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.db-kpi { position: relative; overflow: hidden; height: 128px; padding: 15px 18px; }
.db-kpi-h { display: flex; justify-content: space-between; align-items: center; color: #3b3e43; font-size: 13px; font-weight: 500; }
.db-kpi-v { display: flex; align-items: baseline; gap: 6px; margin-top: 10px; position: relative; z-index: 1; }
.db-kpi-v b { font-size: 40px; font-weight: 500; letter-spacing: -1.8px; line-height: 1; font-variant-numeric: tabular-nums; }
.db-kpi-v small { font-size: 12.5px; color: var(--muted, #74777c); }
.db-kpi-b { margin-top: 8px; font-size: 12px; color: var(--muted, #74777c); position: relative; z-index: 1; }
.db-kpi-b span { color: #3b3e43; font-weight: 500; }
.db-spark { position: absolute; right: 0; bottom: 0; width: 46%; height: 58px; pointer-events: none; }
.db-delta { font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 999px; margin-left: 4px; align-self: center; }
.db-delta.good { background: var(--good-soft, #e3f5ea); color: var(--good, #1f9d55); }
.db-delta.bad { background: var(--bad-soft, #fdecec); color: var(--bad, #e5484d); }
.db-delta.flat { background: var(--surface-2, #f6f4f0); color: var(--muted, #74777c); }

/* rows */
.db-row2 { flex: 1.35 1 0; min-height: 270px; display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1.25fr) minmax(0, .95fr); gap: 12px; }
.db-row3 { flex: 1 1 0; min-height: 214px; display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.05fr) minmax(0, 1.2fr) minmax(0, 1.15fr); gap: 12px; }
.db-chartcard, .db-mapcard, .db-aq, .db-orders, .db-bodies, .db-gates { display: flex; flex-direction: column; }
.db-cv { position: relative; flex: 1 1 auto; min-height: 0; }
.db-cv canvas { position: absolute; inset: 0; }
.db-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; color: var(--muted, #74777c); font-size: 11.5px; }

.db-tabs, .db-seg { display: inline-flex; background: var(--surface-2, #f6f4f0); border-radius: 999px; padding: 3px; }
.db-tabs button, .db-seg button { border: 0; background: transparent; font: inherit; font-size: 12px; font-weight: 500; color: #3b3e43; padding: 6px 12px; border-radius: 999px; cursor: pointer; }
.db-tabs button.on, .db-seg button.on { background: var(--text, #16181b); color: #fff; }

/* map */
.db-mapwrap { position: relative; flex: 1 1 auto; min-height: 0; border-radius: 14px; overflow: hidden; background: #f4f1ec; }
.db-map { position: absolute; inset: 0; display: block; }
.db-tip { position: absolute; z-index: 2; pointer-events: none; background: #fff; border-radius: 10px; padding: 7px 10px; box-shadow: var(--shadow-lg, 0 20px 50px rgba(20,22,26,.12)); font-size: 11.5px; line-height: 1.45; max-width: 220px; }
.db-tip b { display: block; font-weight: 600; }
.db-tip span { color: var(--muted, #74777c); }
.db-maplegend { display: flex; align-items: center; gap: 6px; margin-top: 9px; font-size: 11px; color: var(--muted, #74777c); }
.db-ramp { width: 64px; height: 7px; border-radius: 999px; background: linear-gradient(90deg, rgb(133,201,155), rgb(240,207,98), rgb(240,156,84), rgb(229,72,77)); order: 1; }
.db-maplegend > span:nth-child(2) { order: 0; }
.db-maplegend > span:nth-child(4) { order: 2; }
.db-grow { flex: 1 1 auto; order: 3; }
.db-lg { order: 4; display: inline-flex; align-items: center; gap: 5px; margin-left: 6px; }
.db-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.db-tri { width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid var(--today, #e8833a); display: inline-block; }

/* bodies */
.db-blist { display: flex; flex-direction: column; justify-content: space-between; flex: 1 1 auto; min-height: 0; overflow: auto; }
.db-brow { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line, #e9e5df); }
.db-brow:last-child { border-bottom: 0; }
.db-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 12px; }
.db-bn { font-weight: 500; font-size: 13px; }
.db-br { color: var(--muted, #74777c); font-size: 11px; }
.db-brow b { font-size: 18px; font-weight: 600; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }

/* insight */
.db-insight { background: linear-gradient(135deg, #7c6cf7 0%, #5b4ff5 55%, #4f7ef7 100%); color: #fff; display: flex; flex-direction: column; }
.db-ins-h { display: flex; align-items: center; gap: 8px; font-size: 13px; opacity: .92; }
.db-spk { font-size: 14px; }
.db-ins-t { font-size: 24px; line-height: 1.22; letter-spacing: -.5px; font-weight: 500; margin-top: auto; padding-top: 12px; }
.db-hl { background: #fff; color: var(--accent, #5b4ff5); border-radius: 999px; padding: 0 10px; font-weight: 600; }
.db-ins-bar { display: grid; grid-template-columns: repeat(10, 1fr); gap: 5px; margin-top: 16px; }
.db-ins-bar i { height: 14px; border-radius: 5px; background: rgba(255,255,255,.2); }
.db-ins-bar i.on { background: #fff; }

/* orders */
.db-olist { flex: 1 1 auto; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 7px; }
.db-oi { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 12.5px; }
.db-on { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-obar { height: 6px; border-radius: 999px; background: var(--surface-2, #f6f4f0); overflow: hidden; }
.db-obar i { display: block; height: 100%; background: var(--accent, #5b4ff5); border-radius: 999px; }
.db-oi b { font-weight: 600; font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }
.db-ostats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.db-ostats div { background: var(--surface-2, #f6f4f0); border-radius: 12px; padding: 8px 10px; }
.db-ostats b { display: block; font-size: 18px; font-weight: 600; letter-spacing: -.4px; }
.db-ostats span { font-size: 11px; color: var(--muted, #74777c); }
.db-empty { color: var(--muted, #74777c); font-size: 12px; padding: 6px 0; }

/* real air data */
.db-aqsub { color: var(--muted, #74777c); font-size: 11.5px; margin: -6px 0 6px; }

.db-note { flex: 0 0 auto; color: var(--faint, #a3a6aa); font-size: 11px; padding: 0 4px; }

/* sources popover */
.db-pop-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 14px; }
.db-x { border: 0; background: var(--surface-2, #f6f4f0); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 16px; line-height: 1; color: #3b3e43; }
.db-sources { position: absolute; top: 46px; right: 120px; z-index: 20; width: 520px; background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg, 0 22px 50px rgba(20,22,26,.12)); padding: 14px 16px; }
.db-sources[hidden] { display: none; }
.db-srow { display: grid; grid-template-columns: 1.1fr 1.3fr auto; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid var(--line, #e9e5df); font-size: 12px; }
.db-srow a { color: var(--accent, #5b4ff5); }
.db-st { font-size: 10.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.db-st-published, .db-st-real { background: var(--good-soft, #e3f5ea); color: var(--good, #1f9d55); }
.db-st-press { background: #eef2f6; color: #47607a; }
.db-st-unverified { background: var(--today-soft, #fdf1e6); color: #b85d1c; }

/* assumptions drawer */
.db-drawer { position: absolute; top: 46px; right: 0; bottom: 0; width: 320px; z-index: 19; background: #fff; border-radius: 20px; box-shadow: var(--shadow-lg, 0 22px 50px rgba(20,22,26,.12)); padding: 16px 18px; overflow-y: auto; transform: translateX(calc(100% + 30px)); opacity: 0; transition: transform .25s ease, opacity .25s ease; pointer-events: none; }
.db-drawer.open { transform: none; opacity: 1; pointer-events: auto; }
.db-params { display: flex; flex-direction: column; gap: 12px; margin: 6px 0 12px; }
.db-param { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; font-size: 12.5px; color: #3b3e43; }
.db-param output { font-weight: 600; color: var(--text, #16181b); font-variant-numeric: tabular-nums; }
.db-param input[type=range] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent, #5b4ff5); margin: 0; }
.db-row-in select { border: 0; background: var(--surface-2, #f6f4f0); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 12px; }
.db-check { display: flex; align-items: center; gap: 8px; margin: 12px 0 14px; font-size: 12.5px; color: #3b3e43; }
.db-check input { accent-color: var(--accent, #5b4ff5); width: 16px; height: 16px; }
.db-drawer-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.db-drawer-btns .db-pill:not(.db-dark) { background: var(--surface-2, #f6f4f0); box-shadow: none; }
.db-runmsg { margin-top: 10px; color: var(--muted, #74777c); font-size: 11.5px; min-height: 16px; }

@media (max-width: 1360px) {
  .db-kpi-v b { font-size: 34px; }
  .db-ins-t { font-size: 20px; }
  .db-row2 { grid-template-columns: minmax(0, 1.8fr) minmax(0, 1.2fr) minmax(0, 1fr); }
  .db-tabs button { padding: 6px 9px; }
}

/* shorter screens (e.g. 1280x800) */
@media (max-height: 860px) {
  .db-root { gap: 10px; }
  .db-kpis, .db-row2, .db-row3 { gap: 10px; }
  .db-kpi { height: 114px; padding: 13px 16px; }
  .db-kpi-v { margin-top: 6px; }
  .db-kpi-v b { font-size: 34px; }
  .db-card { padding: 14px 16px; }
  .db-card-h { margin-bottom: 8px; }
  .db-brow { padding: 5px 0; grid-template-columns: 28px 1fr auto; }
  .db-av { width: 28px; height: 28px; font-size: 11px; }
  .db-bn { font-size: 12.5px; }
  .db-brow b { font-size: 16px; }
  .db-olist { gap: 5px; }
  .db-oi { font-size: 12px; }
  .db-ostats { margin-top: 8px; }
  .db-ostats div { padding: 6px 9px; }
  .db-ostats b { font-size: 16px; }
  .db-ins-t { font-size: 20px; }
}

/* construction gates */
.db-root .db-glist { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; margin-top: 2px; flex: 1 1 auto; align-content: start; }
.db-root .db-gi { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; padding: 5px 0; border-bottom: 1px solid var(--line, #e9e5df); }
.db-root .db-gn { min-width: 0; line-height: 1.2; }
.db-root .db-gn b { display: block; font-size: 12.5px; font-weight: 600; }
.db-root .db-gn span { display: block; font-size: 10.5px; color: var(--muted, #74777c); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-root .db-gpill { font-size: 10px; font-weight: 600; padding: 3px 7px; border-radius: 999px; white-space: nowrap; flex: none; }
.db-root .db-gfoot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.db-root .db-gtoday { font-size: 10.5px; color: var(--faint, #a3a6aa); white-space: nowrap; }
.db-root .db-tag-green { background: var(--good-soft, #e3f5ea); color: var(--good, #1f9d55); }
.db-root .db-glg { gap: 2px; }
.db-root .db-glg .db-dot:last-of-type { margin-right: 3px; }
.db-root .db-fixed { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #3b3e43; margin: 4px 0 14px; padding: 8px 10px; background: var(--surface-2, #f6f4f0); border-radius: 12px; }
.db-root .db-fixed b { margin-left: auto; font-weight: 600; color: var(--text, #16181b); }
@media (max-width: 1360px) {
  .db-row3 { grid-template-columns: minmax(0, .75fr) minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 1.05fr); }
  .db-root .db-gn span { display: none; }
  .db-root .db-oi:nth-child(n+5) { display: none; }
}
@media (max-height: 860px) {
  .db-root .db-gi { padding: 3px 0; }
  .db-root .db-gfoot { margin-top: 5px; }
}.db-root .db-fixed span, .db-root .db-fixed b { white-space: nowrap; }
.db-root .db-fixed { font-size: 12px; gap: 6px; }
