/* Vazirmatn 33.0.3 (SIL OFL 1.1, see /fonts/OFL.txt), served from this site. */
@font-face {
    font-family: "Vazirmatn";
    src: url("/fonts/Vazirmatn.woff2") format("woff2");
    font-weight: 100 900;
    font-display: swap;
}

:root {
    --bg: #f3f5fa; --card: #ffffff; --soft: #f7f9fc; --ink: #111827; --muted: #64748b; --line: #e3e8f0;
    --accent: #4f46e5; --accent-strong: #4338ca; --accent-soft: #eef0ff;
    --ok: #047857; --ok-soft: #e7f8f1; --warn: #92560a; --warn-soft: #fdf4e3; --bad: #b91c1c; --bad-soft: #fdecec;
    --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 24px -12px rgba(15, 23, 42, .12);
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1020; --card: #131a2c; --soft: #0f1526; --ink: #e5e9f5; --muted: #93a0bd; --line: #25304a;
        --accent: #6d66f5; --accent-strong: #8781ff; --accent-soft: #1f2250;
        --ok: #4ade9f; --ok-soft: #0f2e27; --warn: #f2bd5c; --warn-soft: #30260f; --bad: #ff8f8f; --bad-soft: #35161c;
        --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 10px 30px -14px rgba(0, 0, 0, .7);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 14.5px/1.9 "Vazirmatn", "Segoe UI", Tahoma, system-ui, sans-serif; }
a { color: var(--accent-strong); }
button, input, select, textarea { font-family: inherit; }
svg { flex: none; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* Header */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); }
.topbar .inner { max-width: 1160px; margin: 0 auto; padding: 0 20px; min-height: 64px; display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 15px; }
.logo { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #6366f1, #7c3aed); color: #fff; }
.nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 9px; color: var(--muted); text-decoration: none; }
.nav a:hover { background: var(--soft); color: var(--ink); }
.nav a.active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; }
.topbar form { margin: 0; }

main { max-width: 980px; margin: 0 auto; padding: 28px 20px 80px; }
main.wide { max-width: 1200px; }

.page-head { margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 22px; line-height: 1.6; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card .hint { margin: 0 0 14px; }
.muted, .hint { color: var(--muted); font-size: 13px; }

/* Forms */
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; margin-bottom: 5px; font-weight: 600; font-size: 13px; }
.field > span small { font-weight: normal; color: var(--muted); }
input[type=text], input[type=password], select, textarea {
    width: 100%; padding: 10px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--soft); color: var(--ink); font: inherit;
}
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; flex: none; }
.ltr { direction: ltr; text-align: left; unicode-bidi: isolate; font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; overflow-wrap: anywhere; }
span.ltr, bdi.ltr { display: inline-block; }
input.ltr::placeholder { direction: rtl; text-align: right; font-family: "Vazirmatn", "Segoe UI", Tahoma, sans-serif; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 18px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 18px; border: 1px solid transparent; border-radius: 10px; background: var(--accent); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); font-weight: normal; }
.btn.ghost:hover { background: var(--soft); filter: none; }
.btn.danger { color: var(--bad); }
.btn.small { padding: 4px 11px; font-size: 12.5px; border-radius: 8px; gap: 5px; }
.btn.small .icon { width: 15px; height: 15px; }
.btn.large { padding: 12px 28px; font-size: 15.5px; }
.btn.block { width: 100%; }
.spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.alert { display: flex; gap: 10px; align-items: flex-start; border-radius: 12px; padding: 11px 15px; margin-bottom: 16px; font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.alert .icon { margin-top: 4px; }
.alert.bad { background: var(--bad-soft); color: var(--bad); }
.alert.ok { background: var(--ok-soft); color: var(--ok); }
.alert.warn { background: var(--warn-soft); color: var(--warn); }

.badge { display: inline-block; padding: 0 9px; border-radius: 99px; font: 11.5px/1.9 "Vazirmatn", "Segoe UI", Tahoma, sans-serif; background: var(--warn-soft); color: var(--warn); direction: rtl; white-space: nowrap; }
.badge.new { background: var(--accent-soft); color: var(--accent-strong); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }

/* Steps */
.steps { display: flex; gap: 10px; list-style: none; padding: 0; margin: 0 0 22px; counter-reset: step; }
.steps li { flex: 1; display: flex; align-items: center; gap: 9px; padding-bottom: 10px; border-bottom: 3px solid var(--line); color: var(--muted); counter-increment: step; }
.steps li::before { content: counter(step, persian); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--line); font-size: 12px; }
.steps li.done { border-color: var(--accent); color: var(--ink); }
.steps li.current { border-color: var(--accent); color: var(--ink); font-weight: 700; }
.steps li.done::before, .steps li.current::before { background: var(--accent); color: #fff; }

/* Upload */
.dropzone { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 44px 20px; border: 2px dashed var(--line); border-radius: 14px; background: var(--soft); text-align: center; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.dropzone .round { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
.dropzone .round .icon { width: 26px; height: 26px; }
.dropzone strong { font-size: 15.5px; }
.upload-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }

/* File tree */
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.toolbar input[type=text] { flex: 1; min-width: 180px; padding: 7px 12px; }
.files { border: 1px solid var(--line); border-radius: 12px; max-height: 440px; overflow: auto; padding: 8px 12px; background: var(--soft); direction: ltr; text-align: left; }
.files label { display: flex; gap: 9px; align-items: center; padding: 3px 6px; border-radius: 7px; cursor: pointer; }
.files label:hover, .files summary:hover { background: var(--accent-soft); }
.files summary { cursor: pointer; padding: 3px 6px; border-radius: 7px; font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px; }
.files summary input { vertical-align: middle; margin-right: 4px; }
.files .children { margin-left: 11px; padding-left: 12px; border-left: 1px solid var(--line); }
.files .hidden { display: none; }
.more { margin-top: 10px; }
.more > summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.more .files { margin-top: 8px; max-height: 220px; }

/* Choice chips and switches */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: block; padding: 6px 16px; border: 1px solid var(--line); border-radius: 99px; background: var(--soft); user-select: none; }
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.switch:last-child { border-bottom: 0; }
.switch small { display: block; color: var(--muted); }
.switch input { appearance: none; position: relative; width: 40px; height: 22px; border-radius: 99px; background: var(--line); transition: background .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; right: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform .15s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(-18px); }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; cursor: pointer; }

details.card { padding: 0; }
details.card > summary { list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 18px 22px; cursor: pointer; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { margin: 0; }
details.card > summary .icon { transition: transform .15s; color: var(--muted); }
details.card[open] > summary .icon { transform: rotate(180deg); }
details.card > .body { padding: 0 22px 20px; }

.actionbar { position: sticky; bottom: 12px; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; box-shadow: 0 12px 32px -10px rgba(15, 23, 42, .35); }

/* Numbers */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 18px; box-shadow: var(--shadow); }
.stat span { display: block; color: var(--muted); font-size: 12.5px; }
.stat strong { font-size: 21px; }
.meter { height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--accent); }

.success { text-align: center; padding: 34px 22px; }
.success .round { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); }
.success .round .icon { width: 32px; height: 32px; }
.success h1 { margin: 12px 0 4px; font-size: 21px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; }
.row form { margin: 0; }

/* Lists and tables */
.table-card { padding: 0; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 13px 12px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
th { background: var(--soft); color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--soft); }
td.nowrap { white-space: nowrap; }
.product { font-weight: 600; }
.row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.row-actions form { margin: 0; }
.btn.icon-only { padding: 6px 8px; }
.empty-state { text-align: center; padding: 46px 20px; color: var(--muted); }
.recent { list-style: none; margin: 0; padding: 0; }
.recent li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.recent li:last-child { border-bottom: 0; }

/* History table: one short line per cell with at most one smaller line below it. */
table.history th, table.history td { padding: 10px 10px; white-space: nowrap; line-height: 1.7; }
table.history tbody tr { height: 66px; }
.cell .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.cell .sub .ltr { font-size: 12px; }
.clip { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }
dialog.card h2 { margin-bottom: 12px; }
.sub.clip .ltr { overflow-wrap: normal; }
.nowrap, bdi.ltr.nowrap { white-space: nowrap; overflow-wrap: normal; }
.badge.soft { background: var(--soft); color: var(--muted); border: 1px solid var(--line); cursor: help; font-size: 10.5px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent-strong); font: inherit; text-decoration: underline; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
dialog.card { width: min(520px, calc(100vw - 32px)); color: var(--ink); }
dialog::backdrop { background: rgba(10, 15, 30, .55); }
main.wide { max-width: 1320px; }

/* History table: one short line per cell with at most one smaller line below it. */
table.history th, table.history td { padding: 10px 10px; white-space: nowrap; line-height: 1.7; }
table.history tbody tr { height: 66px; }
.cell .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.cell .sub .ltr { font-size: 12px; }
.clip { max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub.clip .ltr { overflow-wrap: normal; }
.nowrap, bdi.ltr.nowrap { white-space: nowrap; overflow-wrap: normal; }
.badge.soft { background: var(--soft); color: var(--muted); border: 1px solid var(--line); cursor: help; font-size: 10.5px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent-strong); font: inherit; text-decoration: underline; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
dialog.card { width: min(520px, calc(100vw - 32px)); color: var(--ink); }
dialog::backdrop { background: rgba(10, 15, 30, .55); }
main.wide { max-width: 1320px; }

@media (max-width: 1200px) {
    table.history th, table.history td { white-space: normal; }
    table.history tbody tr { height: auto; }
    .clip { max-width: 60vw; }
    table.history th, table.history td { white-space: normal; }
    table.history tbody tr { height: auto; }
    .clip { max-width: 60vw; }
    .table-card { overflow: visible; background: none; border: 0; box-shadow: none; }
    table, tbody, tr, td { display: block; }
    thead { display: none; }
    tbody tr { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 14px; margin-bottom: 12px; box-shadow: var(--shadow); }
    tbody tr:hover { background: var(--card); }
    td { display: flex; justify-content: space-between; gap: 14px; padding: 8px 0; text-align: left; }
    td::before { content: attr(data-label); color: var(--muted); text-align: right; }
}

/* Signed-out pages */
body.guest { display: grid; place-items: center; padding: 20px; background: radial-gradient(900px 500px at 80% -10%, rgba(99, 102, 241, .20), transparent), radial-gradient(700px 500px at 0% 110%, rgba(124, 58, 237, .16), transparent), var(--bg); }
body.guest main { width: 100%; max-width: 380px; padding: 0; }
.auth { padding: 30px 28px; border-radius: 20px; }
.auth .logo { width: 54px; height: 54px; border-radius: 16px; margin: 0 auto 22px; }
.auth .logo .icon { width: 26px; height: 26px; }
.auth input { margin-bottom: 12px; padding: 12px 14px; }
.captcha { display: flex; gap: 10px; align-items: stretch; margin-bottom: 12px; }
.captcha img { flex: 1; min-width: 0; height: 56px; object-fit: contain; background: #eceff4; border: 1px solid var(--line); border-radius: 10px; }
.captcha .btn { width: 52px; padding: 0; }

@media (max-width: 640px) {
    .topbar .inner { gap: 10px; padding: 10px 14px; }
    .nav { order: 3; flex-basis: 100%; flex-wrap: nowrap; justify-content: space-between; }
    .nav a { padding: 5px 8px; gap: 5px; font-size: 12.5px; white-space: nowrap; }
    .nav .icon { width: 15px; height: 15px; }
    .actionbar { padding: 9px 12px; gap: 8px; bottom: 8px; }
    .actionbar #version-summary { display: none; }
    .actionbar .row { width: 100%; }
    .actionbar .btn { padding: 8px 14px; font-size: 13.5px; }
    .actionbar #submit { flex: 1; }
    .topbar form { margin-inline-start: auto; }
    main { padding: 18px 14px 70px; }
    .card { padding: 16px; }
    .steps li span { display: none; }
    .steps li.current span { display: inline; }
}
