@font-face {
  font-family: 'Vazirmatn';
  src: url('https://cdn.jsdelivr.net/npm/vazirmatn@33.0.3/fonts/webfonts/Vazirmatn[wght].woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
:root {
  --bg: #f5f1e8; --panel: #fff; --panel2: #fbfaf6; --ink: #141413; --muted: #6f6b5f;
  --line: rgba(20,20,19,.14); --line2: rgba(20,20,19,.3);
  --red: #b3281d; --up: #1f8a52; --fill: #141413; --on-fill: #f5f1e8;
  --shadow: 0 10px 30px rgba(0,0,0,.08);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a; --panel: #101010; --panel2: #141414; --ink: #e9e4d6; --muted: #8b877b;
    --line: rgba(233,228,214,.14); --line2: rgba(233,228,214,.3);
    --red: #d13b2f; --up: #3bc47a; --fill: #e9e4d6; --on-fill: #141413;
    --shadow: 0 18px 50px rgba(0,0,0,.55);
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--ink); background: var(--bg);
  font: 15px/1.7 'Vazirmatn', Tahoma, system-ui, sans-serif;
}
h1, h2 { margin: 0 0 .25rem; font-weight: 700; }
h1 { font-size: 2rem; letter-spacing: .02em; }
h2 { font-size: 1.05rem; }
p { margin: .25rem 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.lead { margin-bottom: 1rem; }
.error { color: var(--red); min-height: 1.4em; margin: 0; }

.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; background: var(--bg); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; white-space: nowrap; }
#tabs { display: flex; gap: .25rem; overflow-x: auto; flex: 1; scrollbar-width: none; }
#tabs button {
  font: inherit; color: var(--muted); background: none; border: 0; padding: .4rem .8rem;
  border-radius: 8px; cursor: pointer; white-space: nowrap;
}
#tabs button.on { color: var(--on-fill); background: var(--fill); }
#tabs button:focus-visible, .btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
.switch input:focus-visible + i { outline: 2px solid var(--ink); outline-offset: 2px; }

.wrap { max-width: 860px; margin: 0 auto; padding: 1.25rem 1rem 4rem; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  padding: 1.1rem 1.2rem; margin-bottom: 1rem;
}
.card > label, form > label { display: block; margin: .8rem 0; font-size: .9rem; color: var(--muted); }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem; padding: .55rem .7rem; font: inherit; color: var(--ink);
  background: var(--panel2); border: 1px solid var(--line2); border-radius: 9px;
}
textarea { resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } .top { flex-wrap: wrap; } }

.btn {
  font: inherit; cursor: pointer; padding: .5rem 1.1rem; border-radius: 9px;
  color: var(--ink); background: transparent; border: 1px solid var(--line2);
}
.btn.primary { color: var(--on-fill); background: var(--fill); border-color: var(--fill); }
.btn.ghost { border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--red); border-color: var(--red); }
.btn.small { padding: .2rem .7rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: progress; }

.row { display: flex; gap: 1rem; align-items: center; }
.between { justify-content: space-between; align-items: flex-start; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; text-align: center; }
.stat span { display: block; font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat label { color: var(--muted); font-size: .82rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.chip { border: 1px solid var(--line2); border-radius: 99px; padding: .15rem .8rem; font-size: .85rem; direction: ltr; }

.switch { position: relative; flex: none; width: 52px; height: 30px; cursor: pointer; margin: 0 !important; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line2); transition: background .2s; pointer-events: none; }
.switch i::after {
  content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--panel); transition: transform .2s;
}
.switch input:checked + i { background: var(--up); }
.switch input:checked + i::after { transform: translateX(-22px); }

.feature { display: grid; gap: .6rem; }
.feature .head { display: flex; justify-content: space-between; gap: 1rem; align-items: center; }
.feature code { direction: ltr; display: inline-block; color: var(--muted); font-size: .8rem; }
.feature.off { border-color: var(--red); }
.state { font-size: .8rem; padding: .05rem .6rem; border-radius: 99px; border: 1px solid currentColor; }
.state.on { color: var(--up); } .state.offc { color: var(--red); }

.msg { border-top: 1px solid var(--line); padding: .8rem 0; display: grid; gap: .25rem; }
.msg:first-child { border-top: 0; }
.msg .meta { font-size: .8rem; color: var(--muted); display: flex; gap: .8rem; flex-wrap: wrap; align-items: center; }
.msg.gone { opacity: .5; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { text-align: start; padding: .45rem .5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }
td.id { direction: ltr; font-family: ui-monospace, monospace; cursor: copy; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.login-card { width: min(360px, 100%); box-shadow: var(--shadow); }
.login-card h1 { text-align: center; }
.login-card .muted { text-align: center; }
.login-card .btn { width: 100%; }

.banner { background: var(--red); color: #fff; text-align: center; padding: .5rem 1rem; font-weight: 600; }
.toast {
  position: fixed; bottom: 1.2rem; inset-inline: 0; margin: auto; width: fit-content; max-width: 90vw;
  background: var(--fill); color: var(--on-fill); padding: .55rem 1.2rem; border-radius: 99px; box-shadow: var(--shadow);
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

.field { margin: .8rem 0; }
.lbl { display: block; font-size: .9rem; color: var(--muted); margin-bottom: .3rem; }
.grow { flex: 1; }
.check { display: flex !important; flex-wrap: wrap; align-items: center; gap: .5rem; padding-top: 1.4rem; }
.check input { width: auto; margin: 0; }
.check small { flex-basis: 100%; }
.preview { max-width: 100%; max-height: 220px; border-radius: 10px; border: 1px solid var(--line); margin-top: .5rem; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); }
.msg .line { display: flex; gap: .8rem; align-items: flex-start; }
.msg .line > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rollout { display: flex; align-items: center; gap: .6rem; font-size: .85rem; color: var(--muted); }
.rollout input[type=range] { margin: 0; flex: 1; }
.rollout output { min-width: 3.2em; text-align: end; font-variant-numeric: tabular-nums; color: var(--ink); }
details.crash { border-top: 1px solid var(--line); padding: .6rem 0; }
details.crash summary { cursor: pointer; display: flex; gap: .8rem; flex-wrap: wrap; align-items: baseline; }
details.crash pre { direction: ltr; text-align: left; overflow-x: auto; background: var(--panel2); padding: .8rem; border-radius: 8px; font-size: .78rem; max-height: 320px; }
td.blocked { color: var(--red); font-weight: 600; }
td input.note { min-width: 8em; margin: 0; padding: .2rem .4rem; font-size: .8rem; }

.badge { display: inline-grid; place-items: center; min-width: 1.5em; height: 1.5em; padding: 0 .4em; margin-inline-start: .35em; border-radius: 99px; background: var(--red); color: #fff; font-size: .72rem; font-weight: 800; vertical-align: .1em; }
.stat-link { font: inherit; color: inherit; cursor: pointer; }
.stat-link:hover { border-color: var(--line2); }
.pill { display: inline-block; padding: .1rem .65rem; border-radius: 99px; font-size: .78rem; border: 1px solid currentColor; }
.pill--bug { color: var(--red); }
.pill--feature { color: var(--up); }
.pill--status.fb-status--new { color: var(--on-fill); background: var(--fill); border-color: var(--fill); }
.pill--status.fb-status--read { color: var(--muted); }
.pill--status.fb-status--resolved { color: var(--up); }
.fb { border-top: 1px solid var(--line); padding: .9rem 0; display: grid; gap: .5rem; }
.fb:first-child { border-top: 0; padding-top: .2rem; }
.fb--new { }
.fb__top { display: flex; gap: .5rem; align-items: center; }
.fb__msg { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.fb__note { margin: 0; color: var(--muted); font-size: .85rem; }
.fb__image { display: block; }
.fb__image img { max-width: 240px; max-height: 240px; border-radius: 10px; border: 1px solid var(--line); }
.fb__actions { margin-top: .2rem; }
