/* Shared by the landing page, the customer app and the admin app.
   Identity carried over from the MVP: slate and teal, Vazirmatn, and the double rule
   under the name (two ledger lines). Light and dark follow the system setting. */

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

:root {
  color-scheme: light dark;
  --bg: #f8fafc;
  --surface: #ffffff;
  --sunken: #f1f5f9;
  --line: #cbd5e1;
  --line-strong: #64748b;
  --text: #0f172a;
  --muted: #475569;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --on-accent: #ffffff;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --ok-bg: #f0fdfa;
  --radius: 10px;
  --radius-lg: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #020617;
    --surface: #0f172a;
    --sunken: #111c33;
    --line: #334155;
    --line-strong: #64748b;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --on-accent: #022c22;
    --danger: #fca5a5;
    --danger-bg: #2a1215;
    --ok-bg: #0b2a2a;
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 400 17px/1.75 Vazirmatn, Tahoma, sans-serif;
}
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.35; font-weight: 700; }
a { color: var(--accent); text-underline-offset: 4px; }
a:hover { color: var(--accent-strong); }
button, a, label, select, summary { cursor: pointer; }
button:disabled, input:disabled, select:disabled, textarea:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.skip {
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  transform: translateY(-200%);
  padding: 8px 14px;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--on-accent);
  z-index: 10;
}
.skip:focus { transform: none; color: var(--on-accent); }

/* The mark: the name over two ledger rules. */
.brand {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  color: var(--text);
  font-weight: 700;
  font-size: 26px;
  line-height: 1.2;
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.rules { display: flex; flex-direction: column; gap: 3px; width: 3.2rem; }
.rules span { display: block; height: 2px; background: currentColor; }

.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.neg { color: var(--danger); }
.ltr { direction: ltr; text-align: left; unicode-bidi: isolate; }

/* Buttons: one filled action per form, the rest outlined. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
}
.btn:hover { background: var(--sunken); border-color: var(--text); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled { border-style: dashed; color: var(--muted); background: var(--surface); transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 700; }
.btn.primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn.primary:disabled { background: transparent; border-style: dashed; border-color: var(--line-strong); color: var(--muted); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.small { min-height: 44px; padding: 0 12px; font-size: 15px; }
.linklike {
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.linklike:hover { color: var(--accent-strong); }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .label { font-weight: 500; font-size: 15px; }
.field .hint { color: var(--muted); font-size: 14px; line-height: 1.6; }
input[type="text"], input[type="password"], input[type="number"], input[type="tel"], select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font: 400 16px/1.6 Vazirmatn, Tahoma, sans-serif;
}
textarea { resize: vertical; min-height: 96px; }
textarea.code, input.code { font-family: Consolas, "Courier New", monospace; font-size: 14px; direction: ltr; text-align: left; }
input:hover, select:hover, textarea:hover { border-color: var(--text); }
input:disabled, select:disabled, textarea:disabled { border-style: dashed; color: var(--muted); }
input::placeholder, textarea::placeholder { color: var(--muted); }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }

.form { display: flex; flex-direction: column; gap: 16px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); gap: 16px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

.notice {
  padding: 10px 14px;
  border: 2px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--sunken);
}
.notice.error { border-color: var(--danger); background: var(--danger-bg); color: var(--danger); }
.notice.ok { border-color: var(--accent); background: var(--ok-bg); }

/* Tables scroll inside their own box, never the page. */
.table-wrap { width: 100%; overflow-x: auto; border: 2px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: start; vertical-align: top; border-bottom: 1px solid var(--line); }
th { font-weight: 700; font-size: 15px; white-space: nowrap; background: var(--sunken); }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: end; white-space: nowrap; }

.state { padding: 28px 16px; color: var(--muted); text-align: center; }
.state .btn { margin-top: 12px; }

/* The sign-in page of both apps. */
.gate { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.gate-box { width: min(100%, 400px); display: flex; flex-direction: column; gap: 24px; }
.gate-box h1 { font-size: 22px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
