@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-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --ink: #17242a;
  --muted: #64737a;
  --line: #dde4e2;
  --brand: #0f6e66;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1ef;
  --accent: #d9822b;
  --danger: #b4312c;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 36, 42, .06), 0 6px 24px rgba(16, 36, 42, .06);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: "Vazirmatn", Tahoma, sans-serif; background: var(--bg); color: var(--ink); line-height: 1.75; font-size: 15.5px; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.55rem; margin: 0 0 .3rem; line-height: 1.5; }
h2 { font-size: 1.15rem; margin: 0 0 .8rem; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 28px; padding-bottom: 40px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.ltr { direction: ltr; text-align: left; unicode-bidi: isolate; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--brand); display: grid; place-items: center; }
.brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.brand-text b { font-size: 1.15rem; }
.brand-text small { color: var(--muted); font-size: .78rem; }
.nav { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nav a, .nav .link { padding: 6px 12px; border-radius: 9px; color: var(--ink); font: inherit; }
.nav a:hover, .nav .link:hover { background: var(--brand-soft); text-decoration: none; }
.inline { display: inline; margin: 0; }
.link { background: none; border: 0; cursor: pointer; }

.footer { background: #12302d; color: #d7e7e4; font-size: .9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 8px 24px; flex-wrap: wrap; padding-top: 16px; padding-bottom: 16px; }
.footer .muted { color: #9cbcb7; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 18px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; }
.btn:hover { text-decoration: none; border-color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: #0c5b54; }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; }
.btn-danger { color: var(--danger); border-color: #ebc7c5; }

.hero { margin: 4px 0 22px; max-width: 760px; }
.hero h1 { font-size: 1.8rem; }
.lead { color: var(--muted); margin: 0; font-size: 1.02rem; }

.upload-card { padding: 22px; }
.drop { display: block; position: relative; border: 2px dashed #b9cbc7; border-radius: 12px; background: #fafcfb; cursor: pointer; min-height: 230px; transition: border-color .15s, background .15s; }
.drop:hover, .drop.is-over { border-color: var(--brand); background: var(--brand-soft); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 226px; padding: 20px; text-align: center; color: var(--brand); }
.drop-empty strong { color: var(--ink); }
.drop-preview { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px; }
.drop-preview img { max-width: 100%; max-height: 360px; border-radius: 8px; box-shadow: var(--shadow); }
.file-name { color: var(--muted); font-size: .9rem; direction: ltr; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 700; font-size: .92rem; }
.field input, .field select { font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); min-width: 0; }
.field input:focus, .field select:focus { outline: 2px solid var(--brand-soft); border-color: var(--brand); }
.actions { display: flex; align-items: center; gap: 16px; margin-top: 18px; flex-wrap: wrap; }
.progress { flex: 1; min-width: 160px; height: 8px; background: var(--brand-soft); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.message { margin: 14px 0 0; padding: 10px 14px; border-radius: 9px; background: #fbeaea; color: var(--danger); }
.message.is-error { margin: 0 0 12px; }

.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.step { display: flex; gap: 10px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; color: var(--muted); font-size: .92rem; }
.step b { flex: none; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }

.result-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.result-head p { margin: 0; }
.badge { display: inline-block; padding: 3px 12px; border-radius: 99px; font-size: .85rem; font-weight: 700; white-space: nowrap; }
.badge-queued { background: #eef0f2; color: #4d5a61; }
.badge-running { background: #fdf0e1; color: #a35b12; }
.badge-done { background: var(--brand-soft); color: var(--brand); }
.badge-failed { background: #fbeaea; color: var(--danger); }
.waiting { display: flex; gap: 18px; align-items: center; }
.waiting p { margin: 0; }
.spinner { flex: none; width: 38px; height: 38px; border: 4px solid var(--brand-soft); border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-card { color: var(--danger); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.stats.small { grid-template-columns: repeat(4, 1fr); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; color: var(--ink); }
.stat:hover { text-decoration: none; }
.stat b { font-size: 1.6rem; color: var(--brand); line-height: 1.3; }
.stat span { color: var(--muted); font-size: .9rem; }
.figure { margin: 0 0 18px; padding: 12px; }
.figure img { display: block; width: 100%; height: auto; border-radius: 8px; background: #eef2f1; }
.figure figcaption { margin-top: 8px; font-size: .9rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .93rem; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: right; vertical-align: middle; }
th { color: var(--muted); font-weight: 700; font-size: .85rem; white-space: nowrap; }
td.ltr { text-align: left; }
tbody tr:hover { background: #f8fbfa; }
.num { display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 6px; border-radius: 6px; font-weight: 700; font-size: .85rem; direction: ltr; }
.num-0 { background: #e6194b; color: #fff; } .num-1 { background: #3cb44b; color: #fff; } .num-2 { background: #0082c8; color: #fff; }
.num-3 { background: #f58230; color: #000; } .num-4 { background: #911eb4; color: #fff; } .num-5 { background: #46c8dc; color: #000; }
.num-6 { background: #f032e6; color: #fff; } .num-7 { background: #aac814; color: #000; } .num-8 { background: #fabebe; color: #000; }
.num-9 { background: #008080; color: #fff; } .num-10 { background: #9a6324; color: #fff; } .num-11 { background: #800000; color: #fff; }
.num-12 { background: #6ebe8c; color: #000; } .num-13 { background: #808000; color: #fff; } .num-14 { background: #ffd700; color: #000; }
.num-15 { background: #000080; color: #fff; } .num-16 { background: #ff6347; color: #000; } .num-17 { background: #6a5acd; color: #fff; }
.num-18 { background: #2e8b57; color: #fff; } .num-19 { background: #d2691e; color: #fff; }

.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: end; }
.filters .wide { grid-column: span 2; }
.filter-actions { display: flex; gap: 8px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 14px; }
.meta dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 20px; margin: 0; }
.meta dt { color: var(--muted); font-size: .85rem; }
.meta dd { margin: 0; overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.error-text { background: #fbeaea; color: var(--danger); padding: 10px; border-radius: 8px; white-space: pre-wrap; font-size: .85rem; overflow-x: auto; }
details summary { cursor: pointer; font-weight: 700; }
details[open] summary { margin-bottom: 10px; }
.login { max-width: 400px; margin: 30px auto; display: flex; flex-direction: column; gap: 14px; }

@media (max-width: 760px) {
  .fields, .steps, .stats { grid-template-columns: 1fr; }
  .stats.small { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 1.45rem; }
  .nav { width: 100%; }
}
