:root {
  --ground: #eceff0;
  --panel: #f8f9f9;
  --ink: #12181c;
  --ink-2: #4a565d;
  --line: #cfd6d9;
  --accent: #0e5a68;
  --accent-ink: #ffffff;
  --accent-soft: #d6e8eb;
  --warn: #b3261e;
  --warn-soft: #f6dedc;
  --ok: #1f6b3a;
  --ok-soft: #dcefe2;
  --amber: #8a5a00;
  --amber-soft: #f5e8c8;
  --radius: 6px;
  --font: "Avenir Next", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --ground: #101517; --panel: #181f22; --ink: #e8eef0; --ink-2: #9fb0b7; --line: #2c373c;
    --accent: #5fb7c6; --accent-ink: #06191d; --accent-soft: #17343b;
    --warn: #ff8a80; --warn-soft: #3a1d1b; --ok: #7fd49a; --ok-soft: #173424; --amber: #e8b75a; --amber-soft: #3a2d10;
  }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 15px/1.5 var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
p { margin: 0 0 .75rem; max-width: 70ch; }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .88em; }

/* shell */
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.rail { background: var(--panel); border-right: 1px solid var(--line); padding: 1.25rem .75rem; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: .25rem; overflow: auto; }
.brand { font-weight: 700; padding: 0 .5rem 1rem; line-height: 1.2; }
.brand small { display: block; font-weight: 400; color: var(--ink-2); }
.rail a { display: block; padding: .45rem .6rem; border-radius: var(--radius); color: var(--ink); text-decoration: none; }
.rail a:hover { background: var(--accent-soft); }
.rail a[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.rail .spacer { flex: 1; }
.rail .who { font-size: .85rem; color: var(--ink-2); padding: .5rem; word-break: break-all; }
main { padding: 1.75rem clamp(1rem, 3vw, 2.5rem) 4rem; min-width: 0; max-width: 1200px; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }

/* controls */
.btn { background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: var(--radius); padding: .45rem .9rem; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.quiet:hover { background: var(--accent-soft); }
.btn.danger { background: transparent; color: var(--warn); border-color: var(--warn); }
.btn.small { padding: .2rem .55rem; font-size: .85rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .2rem; }
.field { margin-bottom: .85rem; }
.field .hint { font-weight: 400; color: var(--ink-2); font-size: .85rem; display: block; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .45rem .6rem;
}
textarea { min-height: 14rem; font-family: var(--mono); font-size: .85rem; line-height: 1.45; resize: vertical; }
textarea.short { min-height: 6rem; }
.row { display: flex; gap: .75rem; flex-wrap: wrap; align-items: flex-start; }
details { margin: .25rem 0 .85rem; }
summary { cursor: pointer; color: var(--ink-2); margin-bottom: .5rem; }
.row > .field { flex: 1 1 12rem; margin-bottom: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1rem; }

/* surfaces */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem 1.15rem; margin-bottom: 1.25rem; }
.panel > h2:first-child { margin-top: 0; }
table { width: 100%; border-collapse: collapse; }
.tablewrap { overflow-x: auto; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .85rem; color: var(--ink-2); font-weight: 600; white-space: nowrap; }
td.r, th.r { text-align: right; }
tr:last-child td { border-bottom: 0; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; }
.pill { display: inline-block; padding: .05rem .5rem; border-radius: 99px; font-size: .8rem; background: var(--accent-soft); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.bad { background: var(--warn-soft); color: var(--warn); }
.pill.mid { background: var(--amber-soft); color: var(--amber); }
.empty { padding: 1.25rem .25rem; color: var(--ink-2); }

/* the film-cost gauge: where an average film lands against the target */
.gauge { margin: .25rem 0 .5rem; }
.gauge .scale { position: relative; height: 14px; background: var(--accent-soft); border-radius: 99px; overflow: hidden; }
.gauge .fill { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 99px; }
.gauge.over .fill { background: var(--warn); }
.gauge .tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); }
.gauge .caption { display: flex; justify-content: space-between; font-size: .85rem; margin-top: .35rem; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem 1rem; }
.tile b { display: block; font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.tile span { color: var(--ink-2); font-size: .88rem; }
.checks { display: flex; gap: .5rem; flex-wrap: wrap; }

/* prompts */
.versions { list-style: none; margin: 0; padding: 0; }
.versions li { display: flex; gap: .75rem; justify-content: space-between; align-items: center; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.keys { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1rem; }
.keys button { background: var(--panel); border: 1px solid var(--line); border-radius: 99px; padding: .25rem .8rem; cursor: pointer; }
.keys button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* secret reveal */
.secret { background: var(--amber-soft); border: 1px solid var(--amber); border-radius: var(--radius); padding: .75rem 1rem; margin-bottom: 1rem; }
.secret code { display: block; margin: .4rem 0; font-family: var(--mono); word-break: break-all; font-size: 1rem; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login form { width: min(24rem, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; }
.login h1 { margin-bottom: 1rem; }

/* toasts */
#toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: .5rem; z-index: 10; max-width: min(26rem, calc(100vw - 2rem)); }
.toast { background: var(--ink); color: var(--ground); border-radius: var(--radius); padding: .6rem .9rem; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.toast.error { background: var(--warn); color: #fff; }
.toast small { display: block; opacity: .85; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); padding: .6rem; }
  .brand { width: 100%; padding-bottom: .25rem; }
  .rail .spacer { display: none; }
  .rail .who { width: 100%; }
}
@media (prefers-reduced-motion: no-preference) {
  .gauge .fill { transition: width .5s ease; }
}

/* credential checks */
.checks-list { display: grid; }
.check { display: grid; grid-template-columns: 4.5rem 1fr; gap: .75rem; padding: .6rem 0; border-bottom: 1px solid var(--line); }
.check:last-child { border-bottom: 0; }
.check .detail { color: var(--ink-2); overflow-wrap: anywhere; }
.check .fix { margin-top: .2rem; color: var(--warn); }
.check pre { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--ground); border: 1px solid var(--line); border-radius: var(--radius); padding: .6rem .75rem; margin: .5rem 0 0; font-size: .8rem; }
.panel > .head { margin-bottom: .5rem; }
