/* ===========================================================================
   Additional dashboard views: billing console, accounts, hourly, breakup,
   reservations, budgets. Uses the tokens already defined in index.html.
   ======================================================================== */

/* ---- secondary navigation inside a tab ---- */
.subnav {
  display: flex; gap: 3px; padding: 4px; margin-bottom: 16px;
  background: var(--page); border: 1px solid var(--border);
  border-radius: 10px; overflow-x: auto; scrollbar-width: none;
}
.subnav::-webkit-scrollbar { display: none; }
.subnav button {
  border: none; background: none; border-radius: 7px; padding: 7px 13px;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--text-secondary);
  cursor: pointer; white-space: nowrap; transition: all .18s ease;
}
.subnav button:hover { color: var(--text-primary); }
.subnav button[aria-pressed="true"] {
  background: var(--surface-1); color: var(--text-primary);
  box-shadow: 0 1px 2px rgba(0,0,0,.09);
}

/* ---- toolbar ---- */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 auto; }
.chip-row { display: flex; gap: 5px; flex-wrap: wrap; }
.chip-btn {
  border: 1px solid var(--border); background: var(--surface-1);
  color: var(--text-secondary); border-radius: 999px; padding: 5px 12px;
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  transition: all .16s ease; white-space: nowrap;
}
.chip-btn:hover { border-color: var(--axis); color: var(--text-primary); }
.chip-btn[aria-pressed="true"] {
  background: var(--series-1); border-color: var(--series-1); color: #fff;
}
.filter-pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  background: var(--brand-wash, color-mix(in srgb, var(--series-1) 12%, transparent));
  border: 1px solid color-mix(in srgb, var(--series-1) 35%, transparent);
  color: var(--text-primary); border-radius: 7px; padding: 3px 7px 3px 9px;
}
.filter-pill button {
  border: none; background: none; cursor: pointer; color: var(--text-secondary);
  font-size: 14px; line-height: 1; padding: 0 2px;
}
.filter-pill button:hover { color: var(--critical); }

/* ---- expandable grid ---- */
table.breakdown {
  display: table; width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: 13px;
}
table.breakdown thead { display: table-header-group; }
table.breakdown tbody { display: table-row-group; }
table.breakdown tfoot { display: table-footer-group; }
table.breakdown tr { display: table-row; }
table.breakdown thead th {
  position: sticky; top: 0; z-index: 3; background: var(--series-1); color: #fff;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  font-weight: 650; padding: 9px 11px; text-align: right; white-space: nowrap;
}
table.breakdown thead th:first-child { text-align: left; }
table.breakdown td {
  padding: 8px 11px; text-align: right; border-bottom: 1px solid var(--border);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
table.breakdown td.name { text-align: left; font-variant-numeric: normal; min-width: 230px; }
table.breakdown tr.parent { cursor: pointer; }
table.breakdown tr.parent:hover td { background: color-mix(in srgb, var(--series-1) 6%, transparent); }
table.breakdown tr.child td { background: var(--page); font-size: 12.5px; }
table.breakdown tr.child td.name { padding-left: 34px; color: var(--text-secondary); }
table.breakdown tfoot td {
  position: sticky; bottom: 0; background: var(--surface-1); font-weight: 700;
  border-top: 2px solid var(--border); padding: 9px 11px; text-align: right;
  font-variant-numeric: tabular-nums;
}
table.breakdown tfoot td:first-child { text-align: left; }
.twisty {
  display: inline-block; width: 15px; color: var(--text-muted);
  transition: transform .2s ease; font-size: 10px;
}
tr.open .twisty { transform: rotate(90deg); }
.loading-row td { color: var(--text-muted); font-style: italic; text-align: center; }

/* ---- charts ---- */
.chart-host { width: 100%; }
.chart-legend { display: flex; gap: 13px; flex-wrap: wrap; font-size: 12px; color: var(--text-secondary); margin-top: 10px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.chart-legend span.off { opacity: .38; }
.chart-legend i { width: 9px; height: 9px; border-radius: 2px; }

/* ---- heatmap ---- */
.heat-wrap { overflow-x: auto; }
table.heat { border-collapse: separate; border-spacing: 2px; font-size: 10.5px; }
table.heat th {
  color: var(--text-muted); font-weight: 600; padding: 2px 4px;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
table.heat th.row-head { text-align: right; position: sticky; left: 0; background: var(--surface-1); z-index: 2; }
table.heat td {
  width: 20px; height: 18px; border-radius: 3px; padding: 0;
  background: var(--series-1); cursor: crosshair;
}
.heat-scale { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text-muted); margin-top: 10px; }
.heat-scale .ramp { display: flex; gap: 2px; }
.heat-scale .ramp i { width: 16px; height: 11px; border-radius: 2px; background: var(--series-1); }

/* ---- stat strip ---- */
.strip { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(168px,100%),1fr)); margin-bottom: 16px; }
.strip .cell {
  border: 1px solid var(--border); border-radius: 10px; padding: 13px 14px;
  background: var(--surface-1);
}
.strip .cell .lbl { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }
.strip .cell .val { font-size: 23px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.strip .cell .hint { font-size: 11.5px; color: var(--text-secondary); margin-top: 2px; }
.strip .cell.good { border-color: color-mix(in srgb, var(--good) 38%, transparent); }
.strip .cell.warn { border-color: color-mix(in srgb, var(--warning) 48%, transparent); }
.strip .cell.bad  { border-color: color-mix(in srgb, var(--critical) 42%, transparent); }

/* ---- meters ---- */
.meter-lg { height: 9px; border-radius: 999px; background: var(--neutral-fill); overflow: hidden; margin-top: 7px; }
.meter-lg > span { display: block; height: 100%; border-radius: 999px; background: var(--series-1); width: 0; transition: width .8s cubic-bezier(.16,1,.3,1); }
.meter-lg.good > span { background: var(--good); }
.meter-lg.warn > span { background: var(--warning); }
.meter-lg.bad  > span { background: var(--critical); }

/* ---- budget cards ---- */
.budget-card {
  border: 1px solid var(--border); border-radius: 11px; padding: 15px 16px;
  background: var(--surface-1); margin-bottom: 11px;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.budget-card:hover { box-shadow: 0 5px 16px rgba(0,0,0,.07); }
.budget-card.state-breached { border-color: color-mix(in srgb, var(--warning) 55%, transparent); }
.budget-card.state-over { border-color: color-mix(in srgb, var(--critical) 55%, transparent); }
.budget-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.budget-head .amt { font-variant-numeric: tabular-nums; font-weight: 650; }
.budget-meta { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.empty-cta { padding: 48px 20px; text-align: center; }
.empty-cta .ic { font-size: 30px; opacity: .55; margin-bottom: 10px; }
.empty-cta h3 { margin: 0 0 6px; font-size: 16px; }
.empty-cta p { color: var(--text-secondary); font-size: 14px; max-width: 46ch; margin: 0 auto 18px; }

/* A callout inside a card: an explanation attached to the numbers above it,
   never the only place a status is stated -- the badge beside it carries that. */
.note {
  font-size: 12.5px; line-height: 1.55; padding: 11px 13px; border-radius: 9px;
  background: var(--page); border: 1px solid var(--border);
  color: var(--text-secondary);
}
.note b { color: var(--text-primary); }
.note.warn {
  background: color-mix(in srgb, var(--warning) 9%, var(--surface-1));
  border-color: color-mix(in srgb, var(--warning) 34%, var(--border));
}
.note.bad {
  background: color-mix(in srgb, var(--critical) 8%, var(--surface-1));
  border-color: color-mix(in srgb, var(--critical) 32%, var(--border));
}

/* A period that has not finished yet. It carries no movement band, because
   half a month against a whole one reads as a fall that has not happened. */
table.breakdown th.partial { background: color-mix(in srgb, #000 16%, var(--series-1)); }
table.breakdown th.partial .sofar {
  display: block; font-size: 9px; letter-spacing: .04em; opacity: .85;
  font-weight: 500; text-transform: none;
}
table.breakdown td.partial { color: var(--text-secondary); font-style: italic; }

/* The explorer's own grid carries the same marking, so the two grids under
   the Cost tab never disagree about which column is still filling up. */
table.matrix th.partial { background: color-mix(in srgb, #000 16%, var(--series-1)); }
table.matrix th.partial .sofar {
  display: block; font-size: 9px; letter-spacing: .04em; opacity: .85;
  font-weight: 500; text-transform: none;
}
table.matrix td.partial { color: var(--text-secondary); font-style: italic; }

/* Exactly two columns once there is room. `auto-fit` would fit three or four
   here and leave the last card orphaned on its own row. */
.grid.pair { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .grid.pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
