@font-face {
  font-family: "Vazirmatn";
  src: url("/static/vazirmatn.woff2") format("woff2-variations"), url("/static/vazirmatn.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --bg: #eef2f0;
  --surface: #fbfcfb;
  --ink: #14231f;
  --muted: #5e6e68;
  --line: #cbd5d0;
  --signal: #1f7a5c;
  --signal-ink: #ffffff;
  --signal-soft: #dcefe6;
  --amber: #c98a12;
  --amber-soft: #f8ecd0;
  --danger: #b3412e;
  --danger-soft: #f6e0db;
  --bar: #14231f;
  --bar-ink: #eef2f0;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius-s: 6px;
  --radius-l: 14px;
  --gutter: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1714;
    --surface: #16211d;
    --ink: #e3ece8;
    --muted: #98aaa3;
    --line: #2b3a35;
    --signal: #4cc497;
    --signal-ink: #0b1a14;
    --signal-soft: #1b3a2f;
    --amber: #f0b73e;
    --amber-soft: #3a2f16;
    --danger: #ef7a66;
    --danger-soft: #3d201b;
    --bar: #1b2a25;
    --bar-ink: #e3ece8;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.75 "Vazirmatn", Tahoma, sans-serif;
}
a { color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.35; margin: 0; }
h1 { font-size: 1.5rem; font-weight: 800; }
h2 { font-size: 1.1rem; font-weight: 700; }
p { margin: 0; }

/* ---------- top bar ---------- */
.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--bar); color: var(--bar-ink);
}
.top-inner {
  max-width: 980px; margin: 0 auto; padding: 10px var(--gutter) 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
}
.brand { color: inherit; text-decoration: none; font-weight: 800; font-size: 1.05rem; }
.state { margin-inline-start: auto; font-size: .82rem; display: inline-flex; align-items: center; gap: 6px; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--signal); }
.state.paused::before { background: var(--amber); }
.tabs { flex-basis: 100%; display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  color: inherit; opacity: .7; text-decoration: none; padding: 8px 12px 10px; white-space: nowrap;
  border-bottom: 3px solid transparent; font-weight: 500;
}
.tabs a[aria-current="page"] { opacity: 1; border-color: var(--signal); font-weight: 700; }

main { max-width: 980px; margin: 0 auto; padding: 20px var(--gutter) 48px; display: grid; gap: 20px; }
.foot { max-width: 980px; margin: 0 auto; padding: 0 var(--gutter) 32px; display: flex; gap: 8px; }

/* ---------- surfaces ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 18px; }
.panel > h2 { margin-bottom: 12px; }
.hint { color: var(--muted); font-size: .88rem; }
.stack { display: grid; gap: 20px; align-content: start; }
.stack-s { display: grid; gap: 12px; }
.mt { margin-top: 12px; }
.grid-2 { display: grid; gap: 20px; }
@media (min-width: 860px) { .grid-2 { grid-template-columns: 1.15fr .85fr; align-items: start; } }

/* ---------- buttons & fields ---------- */
.btn {
  font: inherit; font-weight: 600; font-size: .92rem; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 7px 14px; border-radius: var(--radius-s); text-decoration: none; display: inline-flex;
  align-items: center; gap: 6px; min-height: 40px;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn.small { min-height: 34px; padding: 4px 10px; font-size: .85rem; }
.btn[disabled] { opacity: .45; cursor: default; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
label.field { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
label.field small { font-weight: 400; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=search], textarea {
  font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-s); padding: 8px 10px; width: 100%;
}
textarea { min-height: 120px; resize: vertical; }
textarea[rows] { min-height: 0; }
.ltr { direction: ltr; text-align: left; font-family: var(--mono); font-size: .8rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-block; padding: 4px 12px; border: 1px solid var(--line); border-radius: 999px;
  cursor: pointer; font-size: .88rem; user-select: none;
}
.chip input:checked + span { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
.chip input:focus-visible + span { outline: 2px solid var(--signal); outline-offset: 2px; }

/* ---------- flashes ---------- */
#flashes:empty { display: none; }
#flashes { display: grid; gap: 8px; }
.flash { padding: 10px 14px; border-radius: var(--radius-s); background: var(--signal-soft); white-space: pre-line; }
.flash.warn { background: var(--amber-soft); }
.flash.list { background: var(--amber-soft); direction: ltr; text-align: left; font-size: .8rem; word-break: break-all; }

/* ---------- next-slot board (dashboard hero) ---------- */
.board {
  background: var(--bar); color: var(--bar-ink); border-radius: var(--radius-l); padding: 20px;
  display: grid; gap: 14px;
}
.board-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.board-time { font-size: clamp(3rem, 14vw, 4.75rem); font-weight: 800; line-height: 1; letter-spacing: -.01em; }
.board-when { text-align: left; font-size: .95rem; opacity: .8; }
.board-when strong { display: block; font-size: 1.1rem; opacity: 1; color: var(--amber); }
.board pre {
  margin: 0; padding: 12px; border-radius: var(--radius-s); background: rgba(255,255,255,.07);
  direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-all; font: 400 .78rem/1.6 var(--mono);
  max-height: 220px; overflow: auto;
}
.board .btn { background: transparent; color: inherit; border-color: rgba(255,255,255,.3); }
.board .btn.primary { background: var(--signal); color: var(--signal-ink); border-color: var(--signal); }
.board-empty { font-size: 1.1rem; }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 600; }

/* ---------- timeline ---------- */
.tl { list-style: none; margin: 0; padding: 0; }
.tl-day { color: var(--muted); font-weight: 700; font-size: .85rem; padding: 14px 0 4px; }
.tl-day:first-child { padding-top: 0; }
.slot { display: grid; grid-template-columns: 58px 18px 1fr; column-gap: 6px; }
.slot-time { font-weight: 800; font-size: 1.05rem; padding-top: 9px; font-variant-numeric: tabular-nums; }
.slot-rail { position: relative; }
.slot-rail::before { content: ""; position: absolute; inset: 0 8px; width: 2px; background: var(--line); }
.slot-rail::after {
  content: ""; position: absolute; top: 17px; right: 4px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--signal);
}
.slot.locked .slot-rail::after { background: var(--amber); border-color: var(--amber); }
.slot details { padding: 6px 0 10px; border-bottom: 1px solid var(--line); min-width: 0; }
.slot:last-child details { border-bottom: 0; }
.slot summary { cursor: pointer; list-style: none; display: grid; gap: 2px; padding: 3px 0; }
.slot summary::-webkit-details-marker { display: none; }
.slot-tags { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-weight: 600; }
.slot-tags .none { color: var(--muted); font-weight: 400; }
.lock { font-size: .78rem; font-weight: 600; color: var(--amber); background: var(--amber-soft); padding: 0 8px; border-radius: 999px; }
.slot-hosts { direction: ltr; text-align: right; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }
.slot-body { display: grid; gap: 12px; padding: 10px 0 4px; }
.link-row { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.link-row .rep { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); }
.slot-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tl-empty { padding: 24px 0; text-align: center; color: var(--muted); }
.cap { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; color: var(--muted); }
.cap strong { color: var(--ink); }
.meter { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 6px; border: 0;
  background: var(--line); border-radius: 999px; overflow: hidden; margin-bottom: 16px; }
.meter::-webkit-progress-bar { background: var(--line); }
.meter::-webkit-progress-value { background: var(--signal); }
.meter::-moz-progress-bar { background: var(--signal); }

/* ---------- lists ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1 1 180px; min-width: 0; }
.post-text {
  margin: 6px 0 0; padding: 10px; background: var(--bg); border-radius: var(--radius-s); width: 100%;
  direction: ltr; text-align: left; white-space: pre-wrap; word-break: break-all; font: .76rem/1.6 var(--mono);
}
.pager { display: flex; gap: 8px; justify-content: center; align-items: center; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: var(--gutter); }
.login-card { width: min(380px, 100%); display: grid; gap: 18px; text-align: center; }
.login-card .mark { font-size: 2.6rem; font-weight: 800; letter-spacing: -.02em; }
.steps { display: flex; justify-content: center; gap: 6px; color: var(--muted); font-size: .85rem; }
.steps b { color: var(--ink); }
.err { color: var(--danger); background: var(--danger-soft); padding: 8px 12px; border-radius: var(--radius-s); }
.tg-wrap { min-height: 48px; display: flex; justify-content: center; }

.htmx-request { opacity: .6; transition: opacity .2s; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
fieldset.field { border: 0; padding: 0; margin: 0; }
fieldset.field legend { font-weight: 600; font-size: .9rem; margin-bottom: 6px; padding: 0; }
.grow { flex: 1 1 180px; min-width: 0; }

.queue-grid { display: grid; gap: 20px; grid-template-areas: "add" "tl" "batches"; }
.q-add { grid-area: add; } .q-tl { grid-area: tl; } .q-batches { grid-area: batches; }
@media (min-width: 860px) {
  .queue-grid { grid-template-columns: 1.15fr .85fr; grid-template-areas: "tl add" "tl batches"; align-items: start; }
}
