:root {
  --bg: #f6f6f4;
  --panel: #ffffff;
  --ink: #1d1f23;
  --muted: #6b6f76;
  --line: #e3e3df;
  --accent: #2b59c3;
  --accent-soft: #e8eefb;
  --ok: #2f8a57;
  --ok-soft: #8cc7a3;
  --warn: #d9822b;
  --bad: #c8423b;
  --queued: #2b59c3;
  --running: #c99a14;
  --expired: #a9adb3;
  --radius: 8px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; }
.muted { color: var(--muted); }
.pad { padding: 24px; }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* top bar */
header.top { display: flex; align-items: center; gap: 24px; padding: 0 24px; height: 52px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
header.top h1 { font-size: 15px; margin: 0; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; }
nav.tabs { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
nav.tabs button { border: 0; background: none; padding: 8px 12px; border-radius: 6px; color: var(--muted); cursor: pointer; white-space: nowrap; }
nav.tabs button:hover { background: var(--bg); color: var(--ink); }
nav.tabs button.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.who { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.demo-flag { background: #fff3cd; color: #7a5a00; padding: 2px 8px; border-radius: 99px; font-size: 12px; }

main { padding: 20px 24px 60px; max-width: 1400px; margin: 0 auto; }
h2 { font-size: 17px; margin: 4px 0 12px; letter-spacing: -0.01em; }
h3 { font-size: 14px; margin: 0 0 8px; }
.row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card.flush { padding: 0; overflow: hidden; }

/* tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile .label { color: var(--muted); font-size: 12px; }
.tile .value { font-size: 24px; font-weight: 650; margin-top: 4px; font-variant-numeric: tabular-nums; }
.tile .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }

/* tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #fafaf8; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #fafaf8; }
td.right, th.right { text-align: right; }

/* progress */
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; display: flex; min-width: 120px; margin-top: 5px; }
.bar span { display: block; height: 100%; }

/* outcome chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--bg); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.c-ok { background: var(--ok); } .c-ok2 { background: var(--ok-soft); } .c-warn { background: var(--warn); }
.c-bad { background: var(--bad); } .c-queued { background: var(--queued); } .c-running { background: var(--running); } .c-expired { background: var(--expired); }
.status-active { color: var(--ok); } .status-paused { color: var(--muted); }

/* timeline */
.tl { display: grid; grid-template-columns: 120px repeat(24, 1fr); font-size: 11px; }
.tl .hcell { color: var(--muted); text-align: center; padding: 4px 0; border-bottom: 1px solid var(--line); }
.tl .dcell { padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tl .dcell.today { font-weight: 650; color: var(--accent); }
.tl .cell { border-bottom: 1px solid var(--line); border-left: 1px solid #f0f0ec; display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 2px; align-content: flex-start; justify-content: center; min-height: 32px; }
.tl .cell.now { background: var(--accent-soft); }
.tl .cell .dot { width: 9px; height: 9px; cursor: pointer; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin: 10px 0 0; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

/* forms */
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
input[type=text], input[type=number], input[type=email], input[type=time], input[type=url], select, textarea {
  width: 100%; padding: 7px 9px; border: 1px solid #cfcfca; border-radius: 6px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 14px; }
.days { display: flex; gap: 4px; }
.days label { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 32px; border: 1px solid #cfcfca; border-radius: 6px; cursor: pointer; user-select: none; }
.days input { display: none; }
.days label.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.err { color: var(--bad); font-size: 13px; margin: 8px 0; }
.btn { border: 1px solid #cfcfca; background: #fff; padding: 7px 14px; border-radius: 6px; cursor: pointer; }
.btn:hover { background: var(--bg); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn:disabled { opacity: 0.5; cursor: default; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.filters label.f { margin: 0; min-width: 160px; }
.kw { display: flex; align-items: center; gap: 8px; padding: 5px 0; }
.kw.off span { color: var(--muted); text-decoration: line-through; }

/* drawer */
.scrim { position: fixed; inset: 0; background: rgba(20, 22, 26, 0.32); z-index: 20; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw); background: var(--panel); z-index: 21; overflow-y: auto; box-shadow: -8px 0 30px rgba(0,0,0,0.12); }
.drawer .dh { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.drawer .db { padding: 18px 20px 40px; }
.section-t { font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin: 18px 0 10px; font-weight: 650; }
.confirm { background: #fffbea; border: 1px solid #f0d77a; border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; }
.confirm ul { margin: 6px 0 12px; padding-left: 18px; }
pre.log { background: #15171a; color: #e7e7e3; padding: 12px; border-radius: 6px; font-size: 11.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shots figure { margin: 0; }
.shots img { width: 100%; border: 1px solid var(--line); border-radius: 6px; display: block; }
.shots figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
dl.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; }

/* login */
.login { max-width: 380px; margin: 12vh auto; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 28px; }
.login h1 { font-size: 18px; margin: 0 0 4px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #1d1f23; color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 40; font-size: 13px; }

@media (max-width: 760px) {
  header.top { gap: 10px; padding: 0 12px; }
  .who .email { display: none; }
  main { padding: 14px 12px 60px; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .tl { grid-template-columns: 70px repeat(24, 1fr); }
  .hide-sm { display: none; }
}
