/* Edgebox panel. Cool steel ground, slate ink, cobalt for actions; green and plum say on/off.
   The capability switches are the one loud thing; everything else stays quiet. */
:root {
  --ground: #e8ecef; --surface: #ffffff; --ink: #1e2a36; --muted: #5d6c7b; --rule: #d3d9df;
  --action: #2c56c9; --action-ink: #ffffff; --on: #2d7a57; --off: #9b3557; --idle: #a8b3bd;
  --banner: #f3e6c4; --banner-ink: #5a4410; --warn: #b7791f;
  --radius: 6px; --gap: 16px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #12181e; --surface: #1a222a; --ink: #e2e8ee; --muted: #93a1ae; --rule: #2b3640;
    --action: #7d9cf0; --action-ink: #0f1620; --on: #5cc495; --off: #e07a9b; --idle: #4a5763;
    --banner: #3a321c; --banner-ink: #f0dca8; --warn: #e0b45c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #12181e; --surface: #1a222a; --ink: #e2e8ee; --muted: #93a1ae; --rule: #2b3640;
  --action: #7d9cf0; --action-ink: #0f1620; --on: #5cc495; --off: #e07a9b; --idle: #4a5763;
  --banner: #3a321c; --banner-ink: #f0dca8; --warn: #e0b45c; color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--font); }
a { color: var(--action); }
code { font: 13px/1.4 var(--mono); }
h1 { font-size: 26px; line-height: 1.2; font-weight: 650; margin: 0 0 4px; letter-spacing: -0.01em; }
h2 { font-size: 17px; font-weight: 650; margin: 0 0 6px; }
h3 { font-size: 15px; font-weight: 650; margin: 0; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.error { color: var(--off); }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

button, .button {
  font: inherit; font-weight: 550; padding: 7px 14px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--action); background: var(--action); color: var(--action-ink); text-decoration: none; display: inline-block;
}
button:disabled { opacity: .5; cursor: default; }
button.ghost, .button.ghost { background: transparent; color: var(--ink); border-color: var(--rule); }
button.ghost:hover:not(:disabled) { border-color: var(--muted); }
button.danger, button.ghost.danger { color: var(--off); border-color: color-mix(in srgb, var(--off) 45%, transparent); }
button.danger:not(.ghost) { background: var(--off); color: var(--surface); }
.wide { display: block; width: 100%; text-align: center; }
input {
  font: inherit; padding: 7px 10px; border-radius: var(--radius); border: 1px solid var(--rule);
  background: var(--surface); color: var(--ink); min-width: 0;
}
label { display: block; font-size: 13px; color: var(--muted); margin: 0 0 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row input { flex: 1 1 140px; }

/* sign in: one card, like the box's login page on auth.<domain> */
.signin { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 24px 16px; }
.signin-brand { display: flex; align-items: center; gap: 8px; font-weight: 650; letter-spacing: -0.01em; }
.signin-brand svg { width: 22px; height: 22px; color: var(--action); }
.signin main { width: min(380px, 100%); background: var(--surface); border: 1px solid var(--rule); border-radius: 12px; padding: 32px 30px 28px;
  box-shadow: 0 1px 2px rgb(0 0 0 / .04), 0 8px 24px rgb(20 30 40 / .06); }
.signin h1 { font-size: 22px; }
.signin main > p.muted { margin: 0 0 22px; }
.signin .small { font-size: 12px; margin: 0; }
.signin-error { color: var(--off); background: color-mix(in srgb, var(--off) 12%, transparent); border-radius: 8px; padding: 9px 12px; font-size: 14px; }
.signin a.google { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-weight: 600; text-decoration: none; }
.signin a.google:hover { border-color: var(--muted); }
.signin a.google svg { width: 18px; height: 18px; flex: none; }
.signin .button.wide { padding: 11px 14px; border-radius: 8px; }
.signin .or { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; margin: 20px 0; }
.signin .or::before, .signin .or::after { content: ""; flex: 1; border-top: 1px solid var(--rule); }
.signin input { display: block; width: 100%; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.signin form button { padding: 11px 14px; border-radius: 8px; background: transparent; color: var(--ink); border-color: var(--rule); }

/* shell: top bar, rail, page */
.shell { display: grid; grid-template-columns: 260px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
.top { grid-column: 1 / -1; min-width: 0; display: flex; align-items: center; gap: 14px; padding: 10px 20px; border-bottom: 1px solid var(--rule); background: var(--surface); }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; }
.shell.no-rail { grid-template-columns: minmax(0, 1fr); }

/* sections, and the server's health on every one of them */
.tabs { display: flex; gap: 2px; align-self: stretch; margin: -10px 0 -10px 12px; }
.tabs a { display: flex; align-items: center; padding: 0 12px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; font-weight: 550; }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--action); }
.health { margin-left: auto; display: flex; gap: 14px; padding: 5px 10px; border-radius: var(--radius); color: var(--muted); font-size: 12px; text-decoration: none; }
.health:hover, .health[aria-current="page"] { background: var(--ground); }
.gauge { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.gauge b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.bar, .mini { display: inline-block; width: 40px; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.bar span, .mini span { display: block; height: 100%; background: var(--on); }
.bar.warn span { background: var(--warn); }
.bar.high span { background: var(--off); }
.mini { width: 54px; height: 5px; margin-right: 6px; vertical-align: middle; }
.mini span { background: var(--action); }

/* resources */
.page.roomy { max-width: 1080px; }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 8px; }
.meter-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 14px 16px; }
.meter-card .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.meter-card .v { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.meter-card .v small { font-size: 14px; font-weight: 400; color: var(--muted); }
.split { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin: 8px 0 6px; background: var(--rule); }
.split span { display: block; height: 100%; }
.split .boxes, .legend i.boxes { background: var(--action); }
.split .workers, .legend i.workers { background: var(--on); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 5px; background: var(--rule); }
/* templates */
.template-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.template-card { background: var(--surface); border: 1px solid var(--rule); border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.template-card[aria-current] { border-color: var(--action); }
.template-card ul { margin: 4px 0; padding-left: 18px; font-size: 14px; }
.template-card p { margin: 0; }
.template-card button { margin-top: auto; }
.template-card.add { border-style: dashed; justify-content: center; }
.template-form { background: var(--surface); border: 1px solid var(--action); border-radius: 8px; padding: 16px; margin-bottom: 18px; max-width: 560px; display: flex; flex-direction: column; gap: 10px; }
.template-form h3 { margin: 0; }
.template-form input, .template-form select { width: 100%; font: inherit; padding: 7px 10px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); color: var(--ink); }
.template-form p { margin: 0; }
h2 .count { font-weight: 400; font-size: 14px; margin-left: 6px; }
.dot.starting { background: var(--warn); }
.small { font-size: 13px; }
.brand span { font-weight: 400; color: var(--muted); margin-left: 6px; }
.who { color: var(--muted); font-size: 14px; }

.rail { border-right: 1px solid var(--rule); padding: 18px 12px; display: flex; flex-direction: column; gap: 14px; }
.rail .new { padding: 0 6px; }
.rail .new button { padding: 7px 10px; }
.rail ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; max-height: calc(100vh - 230px); }
.rail .filter { margin: 0 6px; }
.rail li a { display: grid; grid-template-columns: 10px 1fr auto; column-gap: 10px; align-items: baseline; padding: 6px 8px; border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.rail li a:hover { background: color-mix(in srgb, var(--ground) 60%, var(--surface)); }
.rail li a[aria-current="page"] { background: var(--ground); box-shadow: inset 3px 0 0 var(--action); border-radius: 0 var(--radius) var(--radius) 0; }
.rail li.single a:hover, .rail li.single a[aria-current="page"] { background: var(--surface); }
.rail li + li { margin-top: 6px; }
.rail li.project { background: var(--surface); border-radius: 8px; padding: 4px; }
.rail li.single a.title { grid-template-columns: 10px 1fr; }
.rail .name { font-weight: 550; overflow-wrap: anywhere; }
.rail .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.rail li.single .when { grid-column: 2; }
.rail li.project a.title { display: block; padding: 6px 8px 2px; font-weight: 650; overflow-wrap: anywhere; }
.rail a.role { padding-left: 12px; }
.rail a.role { padding-top: 3px; padding-bottom: 3px; }
.rail a.role .name { font-size: 13px; font-weight: 600; letter-spacing: .02em; color: var(--muted); }
.rail a.role[aria-current="page"] .name { color: var(--ink); }
.rail a.role .dot { width: 8px; height: 8px; }
.rail .empty { color: var(--muted); font-size: 14px; padding: 8px; }
.rail .empty a { display: inline; padding: 0; color: var(--action); }
td .dot { display: inline-block; margin-right: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; align-self: center; background: var(--idle); }
.dot.on { background: var(--on); }
.dot.off { background: var(--off); }
.dot.preview { background: transparent; box-shadow: inset 0 0 0 2px var(--action); }
.crumb { margin: 0 0 2px; color: var(--muted); }
.crumb a { color: inherit; }
.page section.preview-card { border: 1px solid var(--rule); border-radius: var(--radius); padding: 14px 16px; }
.page section.preview-card h2 { margin-top: 0; }

.page { padding: 28px 32px 60px; max-width: 920px; }
.page > section { padding: 24px 0; border-top: 1px solid var(--rule); }
.env-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.banner { background: var(--banner); color: var(--banner-ink); padding: 10px 14px; border-radius: var(--radius); }
.welcome { margin-top: 10vh; }
.welcome h1 { font-size: 40px; font-weight: 600; }

/* capabilities: the switches are the point of the page */
.caps { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.cap { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 16px; padding: 14px 0; }
.cap + .cap { border-top: 1px dashed var(--rule); }
.cap-head { display: flex; gap: 10px; align-items: baseline; }
.cap .state { font-size: 13px; font-weight: 600; color: var(--muted); }
.cap.enabled .state { color: var(--on); }
.cap.disabled .state, .cap.error .state { color: var(--off); }
.switch {
  position: relative; width: 74px; height: 38px; padding: 0; border-radius: 19px; border: 2px solid var(--rule);
  background: var(--ground); transition: background-color .18s, border-color .18s;
}
.switch span {
  position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 2px rgb(0 0 0 / .25), inset 0 0 0 1px var(--rule); transition: transform .18s;
}
.switch[aria-checked="true"] { background: var(--on); border-color: var(--on); }
.switch[aria-checked="true"] span { transform: translateX(36px); box-shadow: 0 1px 2px rgb(0 0 0 / .3); }
.cap.disabled .switch { border-color: var(--off); }
.cap.error .switch { border-color: var(--off); border-style: dashed; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 6px 0 8px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions:empty { display: none; }
.secret { background: var(--ground); padding: 6px 8px; border-radius: var(--radius); overflow-wrap: anywhere; }
.mqtt .row, .guard .row { margin: 8px 0 4px; }
.usage { font-size: 14px; margin: 4px 0 8px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.meter { display: inline-block; width: 120px; height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--on); }
.meter.full span { background: var(--off); }
.model p.using { margin: 8px 0; padding: 10px 12px; border: 1px solid var(--rule); border-radius: var(--radius); font-size: 14px; }
.model p.using.box, .model p.using.own { border-color: var(--action); }
.model .facts .meter { vertical-align: middle; margin-left: 6px; }
.model form.limits { margin: 10px 0 4px; align-items: flex-end; }
.model form.limits label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); flex: 0 1 150px; }
.model form.limits label.grow { flex: 1 1 260px; }
.model form.limits input { flex: none; width: 100%; }
.quota { margin-bottom: 6px; }
.quota label { margin: 0; }
.quota input { flex: 0 1 120px; }
.confirm { margin-top: 10px; padding: 12px; border: 1px solid color-mix(in srgb, var(--off) 45%, transparent); border-radius: var(--radius); }
.confirm label { color: var(--ink); font-size: 14px; }
.confirm.clone { border-color: var(--rule); margin-bottom: 16px; }

/* deploy line, tables, lists */
.line { display: flex; gap: 8px; align-items: center; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 8px 8px 8px 12px; margin: 8px 0 12px; }
.line code { flex: 1; overflow-x: auto; white-space: nowrap; }
.note { color: var(--on); font-weight: 550; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; font-size: 14px; }
th { text-align: left; font-weight: 600; color: var(--muted); padding: 6px 8px 6px 0; border-bottom: 1px solid var(--rule); }
td { padding: 8px 8px 8px 0; border-bottom: 1px solid var(--rule); vertical-align: middle; }
td:last-child, th:last-child { text-align: right; padding-right: 0; }
tr.current td { font-weight: 550; }
.nowrap { white-space: nowrap; }
details summary { cursor: pointer; color: var(--action); }
.applist { margin: 6px 0 0; color: var(--muted); max-width: 52ch; }
.tag { margin-left: 8px; font-size: 12px; font-weight: 600; color: var(--on); }
.chips { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius); padding: 4px 4px 4px 10px; }
.chips button { padding: 3px 8px; font-size: 13px; }
.events { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.events li { display: grid; grid-template-columns: 96px 1fr; gap: 10px; padding: 4px 0; }
.events time { color: var(--muted); }

.back { display: none; }
@media (max-width: 720px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; }
  /* One thing at a time: the list on the home view, the page once something is chosen. */
  .shell.has-page .rail { display: none; }
  .shell.has-page .back { display: block; padding: 12px 16px 0; }
  .rail ul { max-height: none; }
  .rail { border-right: 0; border-bottom: 1px solid var(--rule); }
  .health, .tabs a { font-size: 13px; }
  .health .gauge b { display: none; }
  .top { flex-wrap: wrap; }
  .page { padding: 20px 16px 48px; }
  .env-head { flex-direction: column; }
  .who { display: none; }
  table { display: block; overflow-x: auto; }
}
@media (prefers-reduced-motion: reduce) { .switch, .switch span { transition: none; } }

/* the login guard: how visitors sign in */
.guard { display: grid; gap: 10px; margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 13px; font-weight: 550; padding: 5px 12px; border-radius: 999px; background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.chip:hover:not(:disabled) { border-color: var(--muted); }
.chip.on { background: var(--action); color: var(--action-ink); border-color: var(--action); }
.chip.on::before { content: "✓ "; }
.chip:disabled { color: var(--idle); cursor: not-allowed; }
textarea { font: 13px/1.5 var(--mono); width: 100%; padding: 7px 10px; border-radius: var(--radius); border: 1px solid var(--rule); background: var(--surface); color: var(--ink); resize: vertical; margin-bottom: 8px; }
