:root {
  --bg: #f7f7f8; --panel: #ffffff; --ink: #18181b; --muted: #5b5b66; --line: #e4e4e7; --line-2: #d4d4d8;
  --accent: #4338ca; --accent-ink: #ffffff; --focus: #6366f1;
  --ok: #166534; --ok-bg: #f0fdf4; --warn: #854d0e; --warn-bg: #fefce8; --bad: #991b1b; --bad-bg: #fef2f2; --info: #3730a3; --info-bg: #eef2ff;
  --radius: 10px;
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; color: var(--ink); background: var(--bg);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111114; --panel: #1a1a1f; --ink: #ececf1; --muted: #a1a1aa; --line: #2a2a31; --line-2: #3a3a42; --accent: #818cf8; --accent-ink: #111114;
    --ok: #86efac; --ok-bg: #0f2a1a; --warn: #fde68a; --warn-bg: #2a230b; --bad: #fca5a5; --bad-bg: #2d1212; --info: #c7d2fe; --info-bg: #1e1b4b; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--panel); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.boot { padding: 40px; color: var(--muted); }
h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; } h2 { font-size: 16px; margin: 0 0 10px; } h3 { font-size: 14px; margin: 0 0 8px; }
.muted { color: var(--muted); } .small { font-size: 13px; }
code, .mono { font-family: ui-monospace, Consolas, monospace; }

/* layout */
.shell { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.side { border-right: 1px solid var(--line); background: var(--panel); padding: 16px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 650; font-size: 15px; padding: 2px 8px 14px; }
.brand img { width: 26px; height: 26px; }
.nav { list-style: none; margin: 0; padding: 0; }
.nav a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.nav a:hover { background: var(--bg); }
.nav a[aria-current="page"] { background: var(--info-bg); color: var(--info); font-weight: 600; }
.who { margin-top: auto; display: flex; flex-direction: column; gap: 2px; padding: 10px 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.who small { color: var(--muted); text-transform: capitalize; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; text-align: left; text-decoration: underline; }
.main { padding: 22px 28px 64px; min-width: 0; outline: none; }
.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.top p { margin: 4px 0 0; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; } .row.end { justify-content: flex-end; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0 16px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0; min-width: 0; }
fieldset.panel { padding-top: 8px; }
fieldset.panel > legend { font-weight: 650; padding: 0 4px; }
.plainfs { border: 0; padding: 0; margin: 0; } .plainfs legend { font-weight: 600; margin-bottom: 6px; }

/* "working on" bar: who every action on this screen is for */
.acting { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-left: 6px solid var(--c); border-radius: var(--radius); background: var(--panel); margin-bottom: 14px; flex-wrap: wrap; }
.acting .av { width: 34px; height: 34px; border-radius: 50%; background: var(--c); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.acting .t { flex: 1; min-width: 150px; display: flex; flex-direction: column; } .acting .t small { color: var(--muted); font-size: 12px; } .acting .t b { font-size: 17px; }
.acting .switch select { width: auto; min-width: 160px; }
dialog .acting { margin: 0 0 12px; }

/* status text (never colour alone) */
.status { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--bg); border: 1px solid var(--line-2); white-space: nowrap; margin-left: 4px; }
.status.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.status.warn { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.status.bad { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.status.info { background: var(--info-bg); color: var(--info); border-color: transparent; }
.warn-text { color: var(--warn); }
.chip { display: inline-block; padding: 1px 8px 1px 6px; border-left: 4px solid var(--c); background: var(--bg); border-radius: 6px; font-size: 13px; margin: 0 4px 4px 0; color: var(--ink); text-decoration: none; white-space: nowrap; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); margin-right: 8px; }

/* overview queue */
.queue { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.qitem { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-top: 1px solid var(--line); }
.qitem:first-child { border-top: 0; }
.qitem .chip { margin-top: 2px; } .qbody { flex: 1; min-width: 0; }
.qaction { font-weight: 650; text-decoration: none; } .qaction:hover { text-decoration: underline; }

/* tables */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { text-align: left; padding: 9px 12px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl thead th { border-top: 0; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.tbl tbody th { font-weight: 600; }
.scrollbox { max-height: 50vh; overflow: auto; }
.bulkbar { padding: 4px 0; }
.row > select, .row > input[type=search] { width: auto; min-width: 200px; } .filters select, .filters input { width: auto; min-width: 180px; }

/* forms */
label.f { display: block; margin-bottom: 12px; } label.f > span { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.hint { display: block; color: var(--muted); font-size: 12.5px; margin-top: 3px; } .hint.bad { color: var(--bad); font-weight: 600; }
.req { color: var(--bad); }
label.f.missing input, label.f.missing select { border-color: var(--bad); }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); min-height: 38px;
}
.check { display: flex; gap: 8px; align-items: center; margin: 6px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; }
.entries { display: grid; gap: 10px; margin-bottom: 8px; }
.entry { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px 2px; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 10px; align-items: end; }
.entry > button { margin-bottom: 12px; justify-self: start; }
.savestate { font-size: 13px; font-weight: 600; color: var(--muted); } .savestate.ok { color: var(--ok); } .savestate.bad { color: var(--bad); }
.sticky { position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 3; }

.btn { border: 1px solid var(--line-2); background: var(--panel); border-radius: 8px; padding: 7px 14px; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--ink); display: inline-block; min-height: 36px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn.small { padding: 3px 10px; font-size: 13px; min-height: 30px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* tabs and readiness */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: 6px 0 16px; overflow-x: auto; }
.tabs a { padding: 9px 12px; border-bottom: 3px solid transparent; color: var(--muted); text-decoration: none; font-weight: 600; white-space: nowrap; }
.tabs a[aria-selected="true"] { color: var(--ink); border-color: var(--accent); }
.readiness ul { list-style: none; margin: 0 0 4px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13.5px; }
.readiness li { display: flex; gap: 6px; } .readiness .mark { font-weight: 700; width: 1em; text-align: center; }
.readiness .ok { color: var(--ok); } .readiness .todo { color: var(--warn); font-weight: 600; } .readiness .bad { color: var(--bad); font-weight: 600; flex-basis: 100%; }

.banner { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 14px; font-weight: 500; border: 1px solid transparent; }
.banner.bad { background: var(--bad-bg); color: var(--bad); } .banner.warn { background: var(--warn-bg); color: var(--warn); }
.banner.info { background: var(--info-bg); color: var(--info); } .banner.ok { background: var(--ok-bg); color: var(--ok); }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; border: 1px dashed var(--line-2); border-radius: var(--radius); background: var(--panel); }
.empty p { margin: 4px 0; } .empty p:first-child { color: var(--ink); font-weight: 600; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 14px; margin: 0; } .kv dt { color: var(--muted); } .kv dd { margin: 0; word-break: break-word; }
.plain { margin: 0; padding-left: 18px; } .plain li { margin: 4px 0; }
.timeline { list-style: none; margin: 0; padding: 0; } .timeline li { padding: 6px 0 6px 14px; border-left: 2px solid var(--line); }
.timeline time { color: var(--muted); font-size: 13px; }
.danger-zone { border-color: var(--bad-bg); }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 20px; max-width: 640px; width: calc(100% - 24px); background: var(--panel); color: var(--ink); }
dialog::backdrop { background: rgba(10, 10, 15, .45); }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #18181b; color: #fff; padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .15s; pointer-events: none; max-width: calc(100% - 32px); z-index: 50; }
#toast.show { opacity: 1; } #toast.err { background: #991b1b; }
.login { max-width: 360px; margin: 12vh auto; padding: 0 16px; }
.login .brand { justify-content: center; font-size: 18px; padding-bottom: 18px; }
.error { color: var(--bad); min-height: 1.2em; margin: 0 0 10px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 8px 12px; min-width: 0; }
  .brand { padding: 0 8px 0 0; }
  .nav { display: flex; gap: 2px; overflow-x: auto; width: 100%; min-width: 0; order: 3; }
  .nav a { white-space: nowrap; padding: 7px 9px; }
  .who { margin: 0 0 0 auto; flex-direction: row; gap: 8px; border: 0; padding: 0; align-items: center; }
  .main { padding: 14px 14px 64px; }
  .kv { grid-template-columns: 1fr; } .kv dt { margin-top: 6px; }
  .filters select, .filters input { min-width: 0; flex: 1 1 140px; }
  .qitem { flex-wrap: wrap; }
}

[hidden] { display: none !important; }

/* Get started: one step at a time */
ol.setup { list-style: none; padding: 0; margin: 12px 0 0; }
.setup-step { border: 1px solid var(--line, #e4e4e7); border-radius: 14px; padding: 14px 16px; margin-top: 10px; }
.setup-step h3 { margin: 0; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.setup-step .num { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #e4e4e7; color: #3f3f46; font-size: 14px; font-weight: 700; flex: none; }
.setup-step.current { border-color: #4338ca; box-shadow: 0 0 0 3px rgba(67, 56, 202, .12); padding: 18px 20px; }
.setup-step.current .num { background: #4338ca; color: #fff; }
.setup-step.current > .stack { margin-top: 14px; }
.setup-step.done .num { background: #166534; color: #fff; }
.setup-step.done h3, .setup-step.later h3 { color: #71717a; font-weight: 600; }
.setup-step.later { opacity: .7; }
.btn.big { font-size: 16px; padding: 12px 22px; }
.progress { height: 8px; background: #e4e4e7; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.progress > span { display: block; height: 100%; background: #4338ca; border-radius: 99px; transition: width .3s; }
.howto { background: #f4f4f5; border-radius: 10px; padding: 12px 16px; }
.howto ol { margin: 6px 0; padding-left: 20px; }
.ready { border-color: #166534; }
