/* Operator dashboard — hand-written, RTL-first. No framework, no build step.
   Everything is vendored: the font below is served from /static/fonts. */

@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-Medium.woff2') format('woff2');
  font-weight: 500; font-display: swap;
}
@font-face {
  font-family: 'Vazirmatn';
  src: url('/static/fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700; font-display: swap;
}

:root {
  --bg: #0f1216;
  --panel: #171b21;
  --panel-2: #1e242c;
  --line: #2a323d;
  --ink: #e6eaf0;
  --muted: #94a1b2;
  --accent: #4c9aff;
  --ok: #3fb950;
  --warn: #d29922;
  --crit: #f85149;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Vazirmatn', Tahoma, sans-serif;
  font-size: 14px;
  line-height: 1.7;
  direction: rtl;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- layout --------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }

.side {
  width: 220px; flex: 0 0 220px;
  background: var(--panel);
  border-inline-start: 1px solid var(--line);
  padding: 18px 0;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.side .brand {
  font-weight: 700; font-size: 15px; padding: 0 18px 16px;
  border-bottom: 1px solid var(--line); margin-bottom: 12px;
}
.side nav a {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 18px; color: var(--ink); border-inline-start: 3px solid transparent;
}
.side nav a:hover { background: var(--panel-2); text-decoration: none; }
.side nav a.on { border-inline-start-color: var(--accent); background: var(--panel-2); }
.side .who {
  margin-top: auto; padding: 14px 18px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
}

.main { flex: 1; padding: 22px 26px; min-width: 0; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 22px 0 10px; }
.sub { color: var(--muted); font-size: 12px; margin-bottom: 18px; }

/* --- tiles ---------------------------------------------------------- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tile {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 13px 15px;
}
.tile .k { color: var(--muted); font-size: 12px; }
.tile .v { font-size: 22px; font-weight: 700; margin-top: 2px; }
.tile .n { color: var(--muted); font-size: 11px; margin-top: 3px; }
.tile.crit { border-color: var(--crit); }
.tile.crit .v { color: var(--crit); }
.tile.warn { border-color: var(--warn); }
.tile.warn .v { color: var(--warn); }
.tile.ok .v { color: var(--ok); }

/* --- attention ------------------------------------------------------ */
.attention { margin-bottom: 18px; }
.att {
  display: flex; gap: 10px; align-items: center;
  border-radius: var(--radius); padding: 10px 14px; margin-bottom: 6px;
  border: 1px solid var(--line); background: var(--panel);
}
.att.crit { border-inline-start: 4px solid var(--crit); }
.att.warn { border-inline-start: 4px solid var(--warn); }
.att.calm { border-inline-start: 4px solid var(--ok); color: var(--muted); }

/* --- tables --------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
tr:hover td { background: var(--panel-2); }
.table-wrap {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); overflow-x: auto;
}
td.num, th.num { font-variant-numeric: tabular-nums; }

/* --- pills ---------------------------------------------------------- */
.pill {
  display: inline-block; padding: 1px 9px; border-radius: 999px;
  font-size: 11px; border: 1px solid var(--line); color: var(--muted);
  white-space: nowrap;
}
.pill.ok { color: var(--ok); border-color: var(--ok); }
.pill.warn { color: var(--warn); border-color: var(--warn); }
.pill.crit { color: var(--crit); border-color: var(--crit); }

/* --- bars ----------------------------------------------------------- */
.bar { background: var(--panel-2); border-radius: 999px; height: 6px; overflow: hidden; min-width: 60px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar > i.warn { background: var(--warn); }
.bar > i.crit { background: var(--crit); }

/* --- forms ---------------------------------------------------------- */
input, select, textarea, button {
  font-family: inherit; font-size: 13px;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 10px;
}
/* Inputs stay LTR+ASCII: Persian digits break int() and copy-paste. */
input[type=text], input[type=number], input[type=password], input.ascii {
  direction: ltr; text-align: left;
}
input.fa, textarea { direction: rtl; text-align: right; }
textarea { width: 100%; min-height: 90px; resize: vertical; }
button, .btn {
  cursor: pointer; background: var(--accent); border-color: var(--accent);
  color: #06121f; font-weight: 500;
}
button:hover { filter: brightness(1.1); }
button.ghost, .btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.danger, .btn.danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field label { color: var(--muted); font-size: 12px; }
.hint { color: var(--muted); font-size: 11px; }

.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
}
.card.danger { border-color: var(--crit); }
.card h3 { margin: 0 0 10px; font-size: 14px; }

.error {
  background: rgba(248,81,73,.1); border: 1px solid var(--crit);
  color: #ffb4ae; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px;
}
.notice {
  background: rgba(76,154,255,.08); border: 1px solid var(--accent);
  padding: 10px 14px; border-radius: var(--radius); margin-bottom: 14px;
}

/* --- tabs ----------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 14px 0 18px; flex-wrap: wrap; }
.tabs a {
  padding: 8px 14px; color: var(--muted); border-bottom: 2px solid transparent;
}
.tabs a.on { color: var(--ink); border-bottom-color: var(--accent); }

/* --- break-glass ---------------------------------------------------- */
.bg-banner {
  background: rgba(210,153,34,.12); border: 1px solid var(--warn);
  color: #f2cd6b; padding: 11px 15px; border-radius: var(--radius);
  margin-bottom: 14px; display: flex; justify-content: space-between;
  align-items: center; gap: 12px; flex-wrap: wrap;
}
/* The watermark is intentionally unmissable: a screenshot of a customer's
   ledger must carry the name of whoever took it. */
.watermark {
  position: fixed; inset: 0; pointer-events: none; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 700; color: rgba(230,234,240,.055);
  transform: rotate(-24deg); white-space: pre; text-align: center;
  line-height: 2.6;
}

/* --- pagination ----------------------------------------------------- */
.pager { display: flex; gap: 6px; align-items: center; margin-top: 14px; flex-wrap: wrap; }
.pager a, .pager span {
  padding: 5px 11px; border: 1px solid var(--line); border-radius: 7px;
  color: var(--ink);
}
.pager .on { background: var(--accent); color: #06121f; border-color: var(--accent); }

/* --- misc ----------------------------------------------------------- */
.mask { font-family: ui-monospace, monospace; letter-spacing: 1px; direction: ltr; display: inline-block; }
.muted { color: var(--muted); }
.right { margin-inline-start: auto; }
.stack > * + * { margin-top: 10px; }
details summary { cursor: pointer; color: var(--muted); }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator { opacity: 1; }
pre.trace {
  background: var(--bg); border: 1px solid var(--line); border-radius: 7px;
  padding: 10px; overflow-x: auto; direction: ltr; text-align: left;
  font-size: 11px; max-height: 220px;
}
.center-page { max-width: 380px; margin: 8vh auto; }
.spark { display: flex; gap: 2px; align-items: flex-end; height: 46px; }
.spark i { flex: 1; background: var(--accent); min-height: 2px; border-radius: 2px 2px 0 0; }

/* --- public signup (/join) -------------------------------------------
   Shares the panel's palette on purpose: one stylesheet, one look, and no
   second asset to keep in sync. The layout is wider and centred because this
   page is read on a phone by someone who has never seen us before. */
.join-page { max-width: 620px; margin: 0 auto; padding: 24px 16px 60px; }
.join-head { display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.join-logo { font-size: 15px; font-weight: 600; }
.join-foot { margin-top: 24px; color: var(--muted); font-size: 11px; text-align: center; }

.join-steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0;
  font-size: 11px; color: var(--muted); }
.join-steps li { padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; }
.join-steps li.on { color: var(--ink); border-color: var(--accent); }
.join-steps li.done { color: var(--ok); border-color: var(--ok); }

/* The honeypot must be invisible to people and present to parsers, so it is
   moved off-screen rather than display:none — some bots skip hidden fields. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.err { color: #ffb4ae; font-size: 11px; }

.plan-grid { display: grid; gap: 12px; margin-bottom: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.plan-card { display: block; cursor: pointer; }
.plan-card input { position: absolute; opacity: 0; }
.plan-body { background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; height: 100%; }
.plan-card input:checked + .plan-body { border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent) inset; }
.plan-name { font-size: 15px; font-weight: 600; }
.plan-tag { color: var(--muted); font-size: 11px; margin-top: 2px; }
.plan-price { font-size: 20px; margin-top: 10px; }
.plan-unit { font-size: 12px; color: var(--muted); }
.plan-per { font-size: 11px; color: var(--muted); }
.plan-trial { display: inline-block; margin-top: 6px; font-size: 11px;
  color: var(--ok); border: 1px solid var(--ok); border-radius: 999px; padding: 1px 8px; }
.plan-feats { margin: 10px 0 0; padding-inline-start: 18px; font-size: 12px;
  color: var(--muted); line-height: 1.9; }

/* The claim code is read off a screen and re-typed into a phone. LTR, wide
   tracking, and a monospace face so 8 and B cannot be confused. */
.claim-code { direction: ltr; font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 30px; letter-spacing: 5px; margin: 10px 0; color: var(--ink); }
.pay-card { direction: ltr; font-family: ui-monospace, "SFMono-Regular", monospace;
  font-size: 20px; letter-spacing: 3px; text-align: center; padding: 8px 0; }
.mono { font-family: ui-monospace, "SFMono-Regular", monospace; direction: ltr;
  display: inline-block; }
.join-howto { padding-inline-start: 20px; line-height: 2; }

/* A borderless key/value grid inside a card — for the signup queue, where the
   facts about one person are read together, not compared down a column. */
table.mini td, table.mini th { border-bottom: 0; padding: 3px 8px; }

/* The plan we want chosen. A badge with no visual weight is just a word. */
.plan-body.featured { border-color: var(--accent); }
.plan-badge { display: inline-block; margin-bottom: 6px; font-size: 11px;
  padding: 1px 9px; border-radius: 999px; background: var(--accent);
  color: #06121f; font-weight: 600; }
