/* Admin console layout + view styles. Tokens live in shared/base.css. */
:root {
  --side: 224px;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
}
:root[data-theme="dark"] {
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
  }
}

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

/* ---------- shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: 100vh;
}
.side {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface-2);
  overflow-y: auto;
}
.side .brand {
  flex: none;
  padding: 12px 16px 8px;
  color: inherit;
}
.side .brand:hover {
  text-decoration: none;
}
.side nav {
  flex: 1;
  padding: 2px 8px 10px;
}
.nav-pools {
  margin: 6px 0;
  padding: 6px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.nav-pools > h4 {
  padding: 0 10px 2px;
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
}
.nav-group {
  margin-top: 2px;
}
.nav-group > h5 {
  margin: 0;
  padding: 3px 10px 1px;
  color: var(--text-3);
  font-size: 11px;
  font-weight: 500;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 29px;
  padding: 0 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13.5px;
  text-decoration: none;
  cursor: pointer;
}
.nav-item:hover {
  background: var(--surface-3);
  color: var(--text);
  text-decoration: none;
}
.nav-item[aria-current="page"] {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border);
}
.nav-item .i {
  color: var(--text-3);
}
.nav-item[aria-current="page"] .i {
  color: var(--text);
}
.nav-item .grow {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-group .nav-item .dot,
.nav-retired .nav-item .dot {
  margin: 0 4px 0 5px;
}
.pill {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--bad);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  line-height: 18px;
  text-align: center;
}
.pill.warn {
  background: var(--warn);
}
.pill.muted {
  background: var(--surface-3);
  color: var(--text-2);
}
.nav-retired {
  margin-top: 4px;
}
.nav-retired > summary {
  padding: 3px 10px;
  color: var(--text-3);
  font-size: 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.nav-retired > summary::before {
  content: "▸";
  display: inline-block;
  width: 14px;
  transition: transform 0.15s;
}
.nav-retired[open] > summary::before {
  transform: rotate(90deg);
}
.nav-retired .nav-item {
  color: var(--text-3);
}
.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
}
.dot.good {
  background: var(--good);
}
.dot.warn {
  background: var(--warn);
}
.dot.bad {
  background: var(--bad);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.chrome {
  position: sticky;
  top: 0;
  z-index: 10;
}
.banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 28px;
  font-size: 12.5px;
  color: var(--text);
}
.banner.bad {
  background: #b3261e;
  color: #fff;
}
.banner.bad a {
  color: #fff;
  text-decoration: underline;
  white-space: nowrap;
}
.banner.warn {
  background: var(--warn-soft);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 48px;
  padding: 0 20px 0 28px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.search-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(380px, 100%);
  min-width: 0;
  height: 32px;
  padding: 0 8px 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-3);
  font-size: 13px;
  text-align: left;
  cursor: text;
}
.search-btn:hover {
  border-color: var(--text-3);
}
.search-btn .grow {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
kbd {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-3);
  font: 11px var(--font);
  white-space: nowrap;
}
.todo-btn .pill {
  margin-right: -4px;
}
.top {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 12px 28px 0;
}
.top h1 {
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.top .sub {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 8px;
  color: var(--text-3);
  font-size: 12.5px;
}
.top .sub:empty {
  display: none;
}
.top .title {
  min-width: 0;
}
.top .actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.menu-toggle {
  display: none;
}
.page-errors {
  padding: 12px 28px 0;
}
.page-errors:empty {
  display: none;
}
.content {
  padding: 14px 28px 48px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 1600px;
  width: 100%;
}
.err-bar {
  align-items: center;
}
.sec,
.sec-body {
  min-width: 0;
}
.sec-bar:not(:empty) {
  padding: 10px 12px 0;
}
.sec:not(.card) > .sec-bar:not(:empty) {
  padding: 0 0 10px;
}
.sec > .sec-body > .err-bar {
  margin: 12px;
}
.sec:not(.card) > .sec-body > .err-bar {
  margin: 0;
}
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 36px 16px;
  font-size: 13px;
  text-align: center;
}
.empty-state > .i {
  width: 22px;
  height: 22px;
  color: var(--text-3);
}
.empty-state .row {
  margin-top: 8px;
}

/* switch */
.switch-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  font-size: 13px;
  cursor: pointer;
}
.switch-row + .switch-row {
  border-top: 1px solid var(--border);
}
.switch-row .grow {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}
.switch-row b {
  font-weight: 500;
}
.switch-row small {
  font-size: 12px;
  line-height: 1.5;
}
.switch-row input {
  position: absolute;
  right: 0;
  width: 34px;
  height: 20px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.switch {
  flex: none;
  position: relative;
  width: 34px;
  height: 20px;
  border-radius: 10px;
  background: var(--border-strong);
  transition: background 0.12s;
}
.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.12s;
}
.switch-row input:checked + .switch {
  background: var(--good);
}
.switch-row input:checked + .switch::after {
  transform: translateX(14px);
}
.switch-row input:focus-visible + .switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.switch-row input:disabled + .switch {
  opacity: 0.5;
}

/* search palette */
.layer.center.top {
  align-items: flex-start;
  padding-top: 12vh;
}
.palette {
  gap: 8px;
}
.palette .search,
.palette .palette-input {
  width: 100%;
}
.palette-input {
  height: 38px;
  font-size: 14px;
}
.palette-results {
  max-height: 52vh;
  overflow-y: auto;
  margin: 0 -8px;
}
.palette-note {
  padding: 18px 8px;
  color: var(--text-3);
  font-size: 13px;
  text-align: center;
}
.palette-group h4 {
  padding: 8px 8px 3px;
  color: var(--text-3);
  font-size: 11.5px;
  font-weight: 500;
}
.palette-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}
.palette-row:hover,
.palette-row[aria-selected="true"] {
  background: var(--surface-3);
  text-decoration: none;
}
.palette-row .i {
  color: var(--text-3);
}
.palette-sub {
  flex: 0 1 45%;
  font-size: 12px;
  text-align: right;
}

/* to-do popover */
.popover {
  position: absolute;
  z-index: 60;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.todo-pop-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.todo-pop-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}
.todo-pop-row:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.todo-pop-row .faint {
  font-size: 12px;
}
.todo-pop-more {
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

/* ---------- common blocks ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 0;
  border-right: 1px solid var(--border);
  background: transparent;
  text-align: left;
  min-width: 0;
}
.kpi:last-child {
  border-right: 0;
}
button.kpi {
  cursor: pointer;
}
button.kpi:hover {
  background: var(--surface-2);
}
.kpi.active {
  background: var(--surface-2);
  box-shadow: inset 0 -2px 0 var(--text);
}
.kpi-label {
  color: var(--text-2);
  font-size: 12.5px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: nowrap;
}
.kpi-sub {
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.4;
  /* r103: wrap to two lines instead of cutting explanations off */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kpi.bad .kpi-value {
  color: var(--bad);
}
.kpi.warn .kpi-value {
  color: var(--warn);
}
.kpi.good .kpi-value {
  color: var(--good);
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
.toolbar .count {
  color: var(--text-3);
  font-size: 12.5px;
}
.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  font-size: 12.5px;
}
.pager .faint {
  margin-right: 6px;
}
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}
.section-title .faint {
  font-weight: 400;
  font-size: 12.5px;
}
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

/* quota cell */
.q {
  min-width: 150px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.q-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}
.q-est {
  margin-left: 6px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11.5px;
  font-weight: 600;
}
.q-top b {
  font-weight: 600;
}
.q-5h {
  color: var(--text-3);
  font-size: 11.5px;
}
.q-5h.bad,
.q-5h.warn {
  color: var(--warn);
}
.quota-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.quota-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12px;
}
.quota-box b {
  font-size: 16px;
}

/* facts */
.facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0;
  font-size: 13px;
}
.facts dt {
  color: var(--text-3);
}
.facts dd {
  margin: 0;
  min-width: 0;
  word-break: break-word;
}

/* expandable row detail */
.detail {
  padding: 14px 16px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-left: 2px solid var(--text);
}
.detail h4 {
  font-size: 12.5px;
  color: var(--text-2);
  font-weight: 600;
}
.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.step {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 120px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 12px;
}
.step.bad {
  border-color: color-mix(in srgb, var(--bad) 40%, var(--border));
  background: var(--bad-soft);
}
.step.good b::before {
  content: "✓ ";
  color: var(--good);
}
.step.skip {
  opacity: 0.55;
}

/* timeline */
.timeline {
  display: flex;
  flex-direction: column;
  font-size: 13px;
}
.timeline > div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border);
}
.timeline > div:last-child {
  border-bottom: 0;
}

/* pool table on overview */
.pool-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}
.pool-name small {
  color: var(--text-3);
  font-weight: 400;
}
.ratio {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
}
.ratio span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}
.stackbar {
  display: flex;
  height: 6px;
  border-radius: 3px;
  overflow: hidden;
  background: var(--meter-track);
  gap: 2px;
}
.stackbar i {
  display: block;
  height: 100%;
}
.stackbar .s-good {
  background: var(--good);
}
.stackbar .s-warn {
  background: var(--warn);
}
.stackbar .s-bad {
  background: var(--bad);
}
.stackbar .s-mute {
  background: var(--border-strong);
}
.legend-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  color: var(--text-2);
}
.legend-inline span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend-inline i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
}
.chip b {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.chip:hover {
  border-color: var(--border-strong);
}
.chip[aria-pressed="true"] {
  border-color: var(--text);
  color: var(--text);
}

/* list rows (jobs, alerts, events) */
.list {
  display: flex;
  flex-direction: column;
}
.list-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  min-width: 0;
}
.list-row:last-child {
  border-bottom: 0;
}
.list-row .meta {
  color: var(--text-3);
  font-size: 12px;
}
a.list-row,
button.list-row {
  width: 100%;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  background: transparent;
  text-align: left;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
}
button.list-row:hover,
a.list-row:hover {
  background: var(--surface-2);
}

/* charts */
.chart {
  position: relative;
}
.chart-canvas {
  width: 100%;
}
.chart svg {
  display: block;
  overflow: visible;
}
.chart .grid {
  stroke: var(--border);
  stroke-width: 1;
}
.chart .axis {
  fill: var(--text-3);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.chart .cross {
  stroke: var(--border-strong);
}
.chart .dot {
  stroke: var(--surface);
  stroke-width: 2;
}
.legend {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--text-2);
  margin-bottom: 6px;
  min-height: 4px;
}
.legend span,
.chart-tip div {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.legend i,
.chart-tip i {
  width: 10px;
  height: 3px;
  border-radius: 2px;
}
.chart-tip {
  position: absolute;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: 12px;
  pointer-events: none;
  white-space: nowrap;
}
.spark {
  color: var(--text-2);
  display: block;
}
.bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
}
.bars i {
  position: relative;
  flex: 1;
  min-height: 1px;
  border-radius: 2px 2px 0 0;
  background: var(--s1);
  opacity: 0.75;
}
.bars i:hover {
  opacity: 1;
}
.bars b {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bad);
  border-radius: 0;
}

/* ---------- overlays ---------- */
.layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  justify-content: flex-end;
}
.layer.center {
  justify-content: center;
  align-items: center;
}
.scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.32);
  opacity: 0;
  transition: opacity 0.15s;
}
.layer.in .scrim {
  opacity: 1;
}
.drawer {
  position: relative;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  transform: translateX(24px);
  opacity: 0;
  transition:
    transform 0.18s ease-out,
    opacity 0.18s;
}
.layer.in .drawer {
  transform: none;
  opacity: 1;
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h2 {
  font-size: 16px;
  font-weight: 650;
}
.drawer-head p {
  font-size: 12.5px;
  margin-top: 2px;
}
.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.drawer-foot,
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
}
.drawer-foot:empty,
.modal-foot:empty {
  display: none;
}
.modal {
  position: relative;
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.98);
  opacity: 0;
  transition:
    transform 0.15s,
    opacity 0.15s;
}
.layer.in .modal {
  transform: none;
  opacity: 1;
}
.modal-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 6px 20px;
}
.modal-head h2 {
  font-size: 15px;
  font-weight: 650;
}
.modal-body {
  padding: 6px 20px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13.5px;
}
.menu {
  position: absolute;
  z-index: 60;
  min-width: 200px;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 32px;
  padding: 0 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}
.menu button:hover:not(:disabled) {
  background: var(--surface-3);
}
.menu button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.menu-sep {
  height: 1px;
  margin: 4px 0;
  background: var(--border);
}
.menu-heading {
  padding: 6px 10px 2px;
  font-size: 11.5px;
  color: var(--text-3);
}
.caret {
  width: 14px;
  height: 14px;
  margin-right: -4px;
  color: var(--text-3);
}

/* ---------- split layout (intake / assist) ---------- */
.split {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.side-list {
  position: sticky;
  top: 76px;
  max-height: calc(100vh - 96px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.side-list .list {
  overflow-y: auto;
}
.side-list .list-row {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.side-list .list-row[aria-current="true"] {
  background: var(--surface-2);
  box-shadow: inset 2px 0 0 var(--text);
}
.mini-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
  font-size: 12px;
  color: var(--text-3);
}
.mini-counts b {
  font-weight: 600;
  color: var(--text-2);
}
.mini-counts .good b {
  color: var(--good);
}
.mini-counts .bad b {
  color: var(--bad);
}
.mini-counts .warn b {
  color: var(--warn);
}

.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  overflow-x: auto;
}
.tabs button,
.tabs a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  margin-bottom: -1px;
  text-decoration: none;
}
.tabs button:hover,
.tabs a:hover {
  color: var(--text);
  text-decoration: none;
}
.tabs button[aria-selected="true"],
.tabs a[aria-selected="true"] {
  color: var(--text);
  border-bottom-color: var(--text);
}
.tabs .n {
  min-width: 20px;
  padding: 0 6px;
  border-radius: 9px;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 11.5px;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}
.tabs .n.bad {
  background: var(--bad-soft);
  color: var(--bad);
}
.tabs .n.good {
  background: var(--good-soft);
  color: var(--good);
}
.tabs .n.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.tabs .n.info {
  background: var(--info-soft);
  color: var(--info);
}

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
}
.drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.file-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
}
.file-list div {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ---------- workbench ---------- */
.home {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  grid-template-areas: "todo events" "pools pools";
  gap: 16px;
  align-items: start;
}
.home-todo {
  grid-area: todo;
  min-width: 0;
}
.home-events {
  grid-area: events;
  min-width: 0;
}
.home-pools {
  grid-area: pools;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.todo-list {
  display: flex;
  flex-direction: column;
}
.todo-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 50px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
}
.todo-row:last-child {
  border-bottom: 0;
}
.todo-row:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.todo-row::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 3px;
  border-radius: 0 2px 2px 0;
  background: var(--border-strong);
}
.todo-row.bad::before {
  background: var(--bad);
}
.todo-row.warn::before {
  background: var(--warn);
}
.todo-row > .i {
  color: var(--text-3);
}
.todo-row.bad > .i {
  color: var(--bad);
}
.todo-row.warn > .i {
  color: var(--warn);
}
.todo-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  font-size: 13px;
}
.todo-main b {
  font-weight: 600;
}
.todo-main .faint {
  font-size: 12px;
}
.todo-row.info .todo-main b {
  font-weight: 500;
}
.todo-when {
  font-size: 12px;
}
.todo-go {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent);
  font-size: 12.5px;
}
.todo-go .i {
  width: 14px;
  height: 14px;
}
.todo-more {
  padding: 9px;
  border: 0;
  background: transparent;
  color: var(--text-2);
  font-size: 12.5px;
  cursor: pointer;
}
.todo-more:hover {
  color: var(--text);
  background: var(--surface-2);
}
.pool-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: 10px;
}
.pool-card {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  color: var(--text);
  text-decoration: none;
}
.pool-card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
  text-decoration: none;
}
.pool-card.bad {
  border-color: color-mix(in srgb, var(--bad) 45%, var(--border));
}
.pool-card.warn {
  border-color: color-mix(in srgb, var(--warn) 40%, var(--border));
}
.pc-head {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
}
.pc-head > b {
  font-weight: 600;
  min-width: 0;
}
.pc-count {
  font-size: 12.5px;
  color: var(--text-2);
}
.pc-count b {
  color: var(--text);
  font-size: 20px;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.pc-none {
  padding: 6px 0;
  font-size: 12.5px;
}
.pc-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text-3);
  font-size: 12px;
}
.pc-line > span:first-child:not(.nowrap) {
  flex: 1;
}
.pc-line b {
  color: var(--text-2);
  font-weight: 500;
}
.pc-line b.warn {
  color: var(--warn);
}
.pc-line b.bad {
  color: var(--bad);
}
.pc-line b.good {
  color: var(--text-2);
}
.tier.kind-fallback {
  border-color: color-mix(in srgb, var(--info) 45%, var(--border));
  color: var(--info);
}
.tier.kind-delegated {
  border-color: var(--border-strong);
  color: var(--text-3);
}
.tier.kind-ultra {
  border-color: #c9a227;
  color: #a07c06;
  background: rgba(201, 162, 39, 0.1);
}
:root[data-theme="dark"] .tier.kind-ultra {
  color: #e0bf55;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tier.kind-ultra {
    color: #e0bf55;
  }
}

/* ---------- tabbed pages ---------- */
.page-tabs .tabs {
  padding: 0;
}
.stack > div:empty,
.rec > div:empty,
.pool-todo:empty {
  display: none;
}
.top .actions:empty {
  display: none;
}
.sec.card > .sec-body > .kpis {
  border: 0;
  background: transparent;
}
.pool-todo {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.pool-todo .notice {
  align-items: center;
  color: var(--text);
  text-decoration: none;
}
.pool-todo .notice:hover {
  box-shadow: inset 0 0 0 1px var(--border-strong);
  text-decoration: none;
}
.pool-todo .notice .i:last-child {
  margin: 0;
  color: var(--text-3);
}
.tab-panel {
  min-width: 0;
}
.switches {
  padding-top: 6px;
  padding-bottom: 6px;
}
.switches > div + div {
  border-top: 1px solid var(--border);
}
.form-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.ep-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr) 130px 120px 26px;
  gap: 6px;
  align-items: center;
}
.field .textarea {
  width: 100%;
}
.field .input {
  width: 100%;
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .home {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "todo" "pools" "events";
  }
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
  .split {
    grid-template-columns: minmax(0, 1fr);
  }
  .side-list {
    position: static;
    max-height: 320px;
  }
}
@media (max-width: 860px) {
  .shell {
    grid-template-columns: 1fr;
  }
  .side {
    position: fixed;
    z-index: 40;
    left: 0;
    width: 272px;
    transform: translateX(-100%);
    transition: transform 0.18s;
    box-shadow: var(--shadow-lg);
  }
  .nav-item {
    height: 34px;
  }
  .shell.nav-open .side {
    transform: none;
  }
  .shell.nav-open::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(0, 0, 0, 0.3);
  }
  .menu-toggle {
    display: inline-flex;
  }
  .topbar {
    gap: 4px;
    padding: 0 10px;
  }
  .search-btn {
    flex: 1;
    width: auto;
  }
  .search-btn kbd,
  .topbar > .grow,
  .todo-label {
    display: none;
  }
  .banner {
    padding: 6px 16px;
  }
  .top {
    padding: 12px 16px 0;
    flex-wrap: wrap;
  }
  .top .actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
  .page-errors {
    padding: 12px 16px 0;
  }
  .content {
    padding: 12px 16px 40px;
  }
  .grid-2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .quota-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .kpi {
    border-bottom: 1px solid var(--border);
  }
  .kpi:nth-child(2n) {
    border-right: 0;
  }
  .search .input {
    width: 100%;
  }
  .search {
    flex: 1 1 100%;
  }
  .tbl.cards thead {
    display: none;
  }
}

/* Tables collapse into stacked cards on phones. Each td carries data-label. */
@media (max-width: 640px) {
  .table-wrap.stackable .tbl,
  .table-wrap.stackable tbody,
  .table-wrap.stackable tr,
  .table-wrap.stackable td {
    display: block;
    width: 100%;
  }
  .table-wrap.stackable thead,
  .table-wrap.stackable .hm {
    display: none !important;
  }
  .table-wrap.stackable tr {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
  }
  .table-wrap.stackable td.lead {
    order: -1;
  }
  .table-wrap.stackable td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 3px 0;
    border: 0;
    text-align: right;
  }
  .table-wrap.stackable td::before {
    content: attr(data-label);
    color: var(--text-3);
    font-size: 12px;
    text-align: left;
    flex: none;
  }
  .table-wrap.stackable td.lead {
    font-weight: 600;
    text-align: left;
  }
  .table-wrap.stackable td.lead::before {
    display: none;
  }
  .table-wrap.stackable tr.detail-row {
    padding: 0;
  }
  .table-wrap.stackable tr.detail-row > td {
    display: block;
    text-align: left;
  }
  .table-wrap.stackable tr.detail-row > td::before {
    display: none;
  }
  .table-wrap.stackable .q {
    min-width: 120px;
  }
  .form-2,
  .ep-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .todo-when {
    display: none;
  }
  .card-head {
    flex-wrap: wrap;
  }
  .card-head h2,
  .card-head h3 {
    white-space: nowrap;
  }
  /* Two compact columns: nine pools on one screen, one quota line each. */
  .pool-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .pool-card {
    padding: 9px 10px;
  }
  .pool-card .tier,
  .pool-card .pc-line + .pc-line {
    display: none;
  }
  .pc-count b {
    font-size: 18px;
  }
  .palette-row {
    flex-wrap: wrap;
    height: auto;
    padding: 6px 8px;
    gap: 0 8px;
  }
  .palette-sub {
    flex: 1 0 100%;
    padding-left: 24px;
    text-align: left;
  }
  .pc-line {
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
  }
  .facts {
    grid-template-columns: 1fr;
    gap: 0 0;
  }
  .facts dd {
    margin-bottom: 6px;
  }
}

/* ---------- r103: import wizard, folds, compact status ---------- */
.notice.good {
  background: var(--good-soft);
  color: var(--text);
}
.notice.good .i {
  color: var(--good);
}
.notice > .grow {
  flex: 1;
  min-width: 0;
}
.notice > .btn {
  flex: none;
  margin: -3px 0;
}
.steps {
  display: flex;
  gap: 6px;
  margin: 0 0 4px;
  padding: 0;
  list-style: none;
  counter-reset: s;
}
.steps li {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--border);
  color: var(--text-3);
  font-size: 12.5px;
  white-space: nowrap;
}
.steps li b {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-3);
  font-size: 11px;
}
.steps li.on {
  color: var(--text);
  border-color: var(--text);
  font-weight: 600;
}
.steps li.on b {
  background: var(--text);
  color: var(--surface);
}
.steps li.done {
  color: var(--text-2);
  border-color: var(--good);
}
.steps li.done b {
  background: var(--good-soft);
  color: var(--good);
}
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
}
.tile {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 12.5px;
  color: var(--text-2);
}
.tile b {
  font-size: 22px;
  font-weight: 650;
  color: var(--text);
  line-height: 1.25;
}
.tile small {
  color: var(--text-3);
  font-size: 11.5px;
  line-height: 1.35;
}
.tile.good b {
  color: var(--good);
}
.tile.warn b {
  color: var(--warn);
}
.tile.bad b {
  color: var(--bad);
}
details.fold > summary,
details.fold-card > summary {
  cursor: pointer;
  color: var(--text-2);
  font-size: 12.5px;
  list-style: none;
  user-select: none;
}
details.fold > summary::before,
details.fold-card > summary::before {
  content: "▸";
  display: inline-block;
  width: 14px;
  color: var(--text-3);
  transition: transform 0.15s;
}
details[open].fold > summary::before,
details[open].fold-card > summary::before {
  transform: rotate(90deg);
}
details.fold-card > summary {
  padding: 12px 16px;
  font-size: 13.5px;
}
details.fold-card[open] > summary {
  border-bottom: 1px solid var(--border);
}
.rules {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--text-2);
  font-size: 12.5px;
  line-height: 1.7;
}
.strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 12.5px;
}
button.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
}
button.link:hover {
  text-decoration: underline;
}
.rec-pools {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12.5px;
}
.add-pool p {
  margin: 8px 0 0;
  font-size: 12.5px;
  line-height: 1.7;
}
.add-pool ul {
  margin: 2px 0;
  padding-left: 16px;
}
.add-pool code {
  overflow-wrap: anywhere;
}
@media (max-width: 640px) {
  .steps li {
    font-size: 0;
    gap: 0;
    justify-content: center;
  }
  .steps li b {
    font-size: 11px;
  }
  .steps li.on {
    font-size: 12px;
    gap: 6px;
  }
}
