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

:root {
  --paper: #f5f1e8;
  --paper-2: #fbf8f1;
  --card: #fffdf9;
  --ink: #14213d;
  --ink-2: #2b3a5c;
  --muted: #5f6677;
  --line: #e3dccd;
  --line-2: #d4cab5;
  --accent: #c2711b;
  --accent-soft: #f6e6d0;
  --ok: #1f7a4d;
  --ok-soft: #dff1e6;
  --warn: #9a6200;
  --warn-soft: #fbefd5;
  --bad: #b3261e;
  --bad-soft: #fbe3e1;
  --info: #23589c;
  --info-soft: #e1ebf8;
  --radius: 14px;
  --shadow: 0 1px 0 rgba(20, 33, 61, .04), 0 8px 24px -12px rgba(20, 33, 61, .18);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0f1524;
    --paper-2: #182033;
    --card: #141c2e;
    --ink: #eef1f7;
    --ink-2: #c9d1e3;
    --muted: #98a1b5;
    --line: #26304a;
    --line-2: #34405e;
    --accent: #e0913d;
    --accent-soft: #3a2a17;
    --ok: #5cc98e; --ok-soft: #173326;
    --warn: #e8b04f; --warn-soft: #3a2d12;
    --bad: #f08a83; --bad-soft: #3d1c1a;
    --info: #86b2ec; --info-soft: #1a2b44;
    --shadow: 0 8px 24px -12px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.7 "Vazirmatn", system-ui, -apple-system, "Segoe UI", Tahoma, sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
[lang="en"] body, body:lang(en) { line-height: 1.6; }
a { color: var(--ink); }
img, svg { display: block; }
.wrap { width: 100%; max-width: 1080px; margin-inline: auto; padding-inline: 16px; }
main.wrap { flex: 1; padding-block: 8px 48px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; }
.muted { color: var(--muted); }
.center { text-align: center; }
.pad { padding: 32px 16px; }
.nowrap { white-space: nowrap; }
.small-text { font-size: .875rem; }
.inline { display: inline; margin: 0; }

/* ---------- header ---------- */
.topbar { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); min-width: 0; }
.logo-mark { width: 38px; height: 38px; flex: none; color: var(--ink); }
.brand span { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.brand strong { font-size: 1.1rem; font-weight: 800; }
.brand small { color: var(--muted); font-size: .78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { display: flex; align-items: center; gap: 4px; flex: none; }
.nav a, .nav .link { text-decoration: none; padding: 6px 12px; border-radius: 999px; font-size: .92rem; color: var(--ink-2); font-weight: 500; }
.nav a:hover, .nav .link:hover { background: var(--paper-2); color: var(--ink); }
.nav .lang { border: 1px solid var(--line-2); margin-inline-start: 6px; }
button.link { background: none; border: 0; font: inherit; cursor: pointer; }

/* ---------- hero ---------- */
.hero { padding: 44px 0 28px; max-width: 680px; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.35; margin: 0 0 10px; font-weight: 800; letter-spacing: -.01em; }
.hero p { margin: 0; color: var(--muted); font-size: 1.05rem; }
.hero.small { padding-top: 36px; }
.hero.center { margin-inline: auto; text-align: center; }
.hero.center h1 { font-size: 3.5rem; }
.hero h1::after { content: ""; display: block; width: 56px; height: 4px; border-radius: 4px; background: var(--accent); margin-top: 14px; }
.hero.center h1::after { margin-inline: auto; }

/* ---------- layout ---------- */
.grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.side { display: grid; gap: 16px; }
.narrow { max-width: 640px; display: grid; gap: 16px; }
.narrow.tiny { max-width: 400px; margin: 48px auto 0; }
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .side { order: -1; }
  .side .steps { display: none; }
}

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card.flush { padding: 0; overflow: hidden; }
.h2 { font-size: 1.3rem; margin: 0 0 14px; }
.h3 { font-size: 1.05rem; margin: 22px 0 10px; }
.form .h3:first-of-type, .card > .h3:first-child { margin-top: 0; }

/* ---------- form ---------- */
.form { display: grid; gap: 16px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 560px) { .row2 { grid-template-columns: 1fr; } .card { padding: 18px; } }
.field { display: grid; gap: 6px; }
.field > span { font-weight: 600; font-size: .92rem; }
.field em { font-style: normal; font-weight: 400; color: var(--muted); font-size: .85em; }
input, select, textarea {
  font: inherit; color: var(--ink); width: 100%;
  background: var(--paper-2); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 10px 12px; min-height: 46px; transition: border-color .15s, box-shadow .15s, background .15s;
}
textarea { resize: vertical; min-height: 90px; }
input::placeholder, textarea::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink-2); background: var(--card); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink-2) 18%, transparent); }
[aria-invalid="true"] { border-color: var(--bad); }
.err { color: var(--bad); font-size: .85rem; margin: 0; }
.form-alert { background: var(--bad-soft); color: var(--bad); border-radius: 10px; padding: 10px 14px; font-weight: 500; }
.form-alert.ok { background: var(--ok-soft); color: var(--ok); margin-bottom: 16px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; color: var(--ink-2); cursor: pointer; }
.check input { width: 20px; height: 20px; min-height: 0; margin-top: 4px; flex: none; accent-color: var(--ink); }

.drop {
  position: relative; display: grid; justify-items: center; text-align: center; gap: 4px;
  border: 2px dashed var(--line-2); border-radius: 12px; padding: 26px 16px; cursor: pointer;
  background: repeating-linear-gradient(-45deg, transparent 0 10px, color-mix(in srgb, var(--line) 30%, transparent) 10px 11px), var(--paper-2);
  transition: border-color .15s, background-color .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background-color: var(--accent-soft); }
.drop[data-invalid="true"] { border-color: var(--bad); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.drop svg { width: 34px; height: 34px; color: var(--accent); }
.drop strong { font-weight: 600; }
.drop small { color: var(--muted); font-size: .82rem; }
.drop:focus-within { border-color: var(--ink-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ink-2) 18%, transparent); }

.file-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.file-list:empty { display: none; }
.file-list li { display: flex; align-items: center; gap: 10px; background: var(--paper-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: .9rem; }
.file-list .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .bad { color: var(--bad); }
.file-list button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 1.2rem; line-height: 1; padding: 2px 6px; border-radius: 6px; }
.file-list button:hover { color: var(--bad); background: var(--bad-soft); }

.progress { height: 8px; border-radius: 8px; background: var(--line); overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer;
  border-radius: 10px; padding: 12px 22px; min-height: 48px; border: 1px solid transparent;
  transition: transform .05s, background .15s, opacity .15s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); color: var(--paper-2); }
.btn.primary:hover { background: var(--ink-2); }
.btn.primary[disabled] { opacity: .6; cursor: progress; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn.ghost:hover { background: var(--paper-2); }
.btn.small { padding: 6px 12px; min-height: 36px; font-size: .88rem; font-weight: 600; }
.form > .btn.primary { justify-self: start; min-width: 180px; }
@media (max-width: 560px) { .form > .btn.primary { justify-self: stretch; } }

/* ---------- side cards ---------- */
.steps h2 { font-size: 1rem; margin: 0 0 12px; }
.steps ol { margin: 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 12px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; font-size: .93rem; color: var(--ink-2); }
.steps li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 800; font-size: .85rem; }
.secure { display: flex; gap: 12px; align-items: flex-start; background: var(--paper-2); box-shadow: none; }
.secure svg { width: 28px; height: 28px; flex: none; color: var(--ok); }
.secure p { margin: 0; font-size: .88rem; color: var(--muted); }
.track-link { display: flex; justify-content: space-between; align-items: center; text-decoration: none; box-shadow: none; }
.track-link:hover { border-color: var(--ink-2); }

/* ---------- done ---------- */
.done { max-width: 600px; margin: 48px auto 0; text-align: center; padding: 36px 24px; }
.done h1 { margin: 12px 0 6px; font-size: 1.5rem; }
.done p { color: var(--muted); margin: 0 auto 22px; max-width: 460px; }
.done-icon { width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: grid; place-items: center; margin: 0 auto; }
.done-icon svg { width: 34px; height: 34px; }
.ticket {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px;
  border: 2px dashed var(--accent); border-radius: 12px; background: var(--accent-soft);
  padding: 18px 16px; margin: 0 auto 22px; max-width: 360px;
}
.ticket span { font-size: .85rem; color: var(--muted); }
.ticket code { font-size: 1.7rem; font-weight: 800; color: var(--ink); letter-spacing: .06em; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
.actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- tracking result ---------- */
.result-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.result-head h2, .result-head h1 { margin: 0; font-size: 1.1rem; }
.badge { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: .82rem; font-weight: 700; white-space: nowrap; }
.st-received { background: var(--info-soft); color: var(--info); }
.st-reviewing { background: var(--warn-soft); color: var(--warn); }
.st-needs_info { background: var(--accent-soft); color: var(--accent); }
.st-approved { background: var(--ok-soft); color: var(--ok); }
.st-rejected { background: var(--bad-soft); color: var(--bad); }
.timeline { list-style: none; display: flex; padding: 0; margin: 4px 0 18px; }
.timeline li { flex: 1; position: relative; text-align: center; font-size: .82rem; color: var(--muted); padding-top: 26px; }
.timeline li::before { content: ""; position: absolute; top: 4px; left: 50%; transform: translateX(-50%); width: 14px; height: 14px; border-radius: 50%; background: var(--line-2); z-index: 1; }
.timeline li::after { content: ""; position: absolute; top: 10px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--line-2); }
.timeline li:last-child::after { display: none; }
.timeline li.on { color: var(--ink); font-weight: 600; }
.timeline li.on::before { background: var(--ok); }
.timeline li.on:has(+ li.on)::after { background: var(--ok); }
dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
dl div { background: var(--paper-2); border-radius: 10px; padding: 10px 12px; }
dt { font-size: .78rem; color: var(--muted); }
dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.note { margin-top: 16px; border-inline-start: 3px solid var(--accent); background: var(--paper-2); padding: 10px 14px; border-radius: 0 10px 10px 0; }
[dir="rtl"] .note { border-radius: 10px 0 0 10px; }
.note p { margin: 4px 0 0; white-space: pre-wrap; }

/* ---------- admin ---------- */
.admin-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; align-items: center; margin: 28px 0 16px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab { text-decoration: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); font-size: .88rem; color: var(--ink-2); }
.tab b { font-weight: 700; color: var(--muted); margin-inline-start: 4px; }
.tab.on { background: var(--ink); color: var(--paper-2); border-color: var(--ink); }
.tab.on b { color: var(--paper-2); opacity: .75; }
.search { display: flex; gap: 8px; flex: 1; max-width: 380px; min-width: 240px; }
.search input { min-height: 38px; padding: 6px 12px; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: start; font-weight: 600; font-size: .8rem; color: var(--muted); background: var(--paper-2); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--paper-2); }
.table a { font-weight: 700; text-decoration: none; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 12px; }
.back { text-decoration: none; color: var(--muted); display: inline-block; margin-top: 24px; }
.kv { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.dl-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.dl-list li { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 8px 12px; }
[dir="rtl"] .dl-list li { padding: 8px 12px 8px 8px; }
.dl-list .fname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.danger { box-shadow: none; background: transparent; border-style: dashed; padding: 14px; }
.danger-btn { width: 100%; background: transparent; color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 40%, transparent); }
.danger-btn:hover { background: var(--bad-soft); }

/* ---------- footer ---------- */
.footer { border-top: 1px solid var(--line); padding: 20px 0; color: var(--muted); font-size: .85rem; }
.footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer a { color: var(--muted); }

@media (max-width: 560px) {
  .brand small { display: none; }
  .nav a, .nav .link { padding: 6px 8px; }
  .hero { padding-top: 28px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
.brand strong { white-space: nowrap; }
.table .mono { white-space: nowrap; }
