/* Densilo web console — authenticated app shell. Builds on styles.css tokens. */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side {
  border-right: 1px solid var(--border); background: var(--surface);
  padding: 18px 14px; display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
}
.side .brand { padding: 6px 8px 18px; }
.side nav { display: flex; flex-direction: column; gap: 2px; }
.side nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 9px;
  color: var(--ink-2); font-size: 14.5px; font-weight: 500; cursor: pointer;
}
.side nav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.side nav a.on { background: var(--surface-2); color: var(--ink); font-weight: 600; }
.side nav a svg { width: 17px; height: 17px; flex: none; opacity: .8; }
.side .spacer { flex: 1; }
.side .who { padding: 10px 11px; border-top: 1px solid var(--border); margin-top: 8px; }
.side .who .em { font-size: 13px; color: var(--ink); font-weight: 600; word-break: break-all; }
.side .who .ti { font-size: 12px; color: var(--muted); font-family: ui-monospace, Menlo, monospace; }
.side .signout { margin-top: 8px; font-size: 13px; color: var(--muted); cursor: pointer; padding: 6px 11px; }
.side .signout:hover { color: var(--critical); }

.main { padding: 0; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 16px 28px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: color-mix(in oklab, var(--page) 90%, transparent); backdrop-filter: blur(8px); z-index: 5;
}
.topbar h1 { font-size: 20px; margin: 0; }
.topbar .plan-badge {
  margin-left: auto; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--ink-2);
}
.plan-badge.active { color: var(--good); border-color: color-mix(in oklab, var(--good) 40%, var(--border)); }
.plan-badge.free { color: var(--accent-ink); }
.view { padding: 28px; max-width: 1000px; }
.view.hidden { display: none; }
.section-title { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 4px 0 14px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.kpi .label { font-size: 12.5px; color: var(--ink-2); }
.kpi .value { font-size: 30px; font-weight: 650; line-height: 1.15; margin: 6px 0 2px; letter-spacing: -0.01em; }
.kpi .sub { font-size: 12.5px; color: var(--muted); }
.kpi .sub.good { color: var(--good); font-weight: 600; }

.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 20px 22px; margin-bottom: 20px; }
.panel > h3 { font-size: 15.5px; margin: 0 0 4px; }
.panel .hint { font-size: 12.5px; color: var(--muted); margin: 0 0 16px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }

.chart-wrap { position: relative; }
.chart { display: block; width: 100%; height: 260px; }
.chart text { font: 11px system-ui, sans-serif; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .axisline { stroke: var(--baseline); stroke-width: 1; }
.chart .sent { fill: var(--series-1); }
.chart .saved { fill: var(--series-2); }
.legend { display: flex; gap: 18px; margin-top: 12px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.sw.s1 { background: var(--series-1); } .sw.s2 { background: var(--series-2); }
.empty-state { text-align: center; color: var(--muted); padding: 40px 20px; font-size: 14px; }
.empty-state code { background: var(--code-bg); color: var(--code-ink); padding: 3px 7px; border-radius: 6px; font-size: 12.5px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th, .tbl td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--grid); }
.tbl th { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }

.rows { display: grid; gap: 0; }
.row { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--grid); }
.row:last-child { border-bottom: 0; }
.row .k { color: var(--ink-2); font-size: 14px; }
.row .v { font-size: 14px; text-align: right; }
.row .v.mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; word-break: break-all; }

.keyfield { display: flex; gap: 8px; align-items: center; }
.keyfield input { flex: 1; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
.plan-cta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.callout { border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; background: var(--surface-2); font-size: 13.5px; color: var(--ink-2); }

.authwrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.authcard { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 30px; }
.authcard .brand { justify-content: center; margin-bottom: 18px; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .side nav { flex-direction: row; flex-wrap: wrap; }
  .side .spacer, .side .who { display: none; }
  .view { padding: 20px 16px; }
}
