@font-face { font-family: Vazirmatn; src: url(/fonts/vazirmatn.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
:root {
  --bg: #f3f5f4; --surface: #fff; --ink: #14201f; --muted: #66767a; --line: #e2e8e6;
  --brand: #0f3d3e; --brand-2: #17595a; --accent: #e8b04a; --danger: #c2410c;
  --st-submitted: #2563eb; --st-under_review: #b45309; --st-referred: #7c3aed; --st-closed: #4b5563;
  --radius: 14px; --shadow: 0 1px 2px rgba(15,61,62,.06), 0 8px 24px rgba(15,61,62,.07);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0c1415; --surface: #142022; --ink: #e8efee; --muted: #8fa3a6; --line: #223436; --brand: #1c6b6c; --brand-2: #2a8a8b; --shadow: none; }
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Vazirmatn, Tahoma, sans-serif; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.7; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 80% -10%, #1c6b6c55, transparent), linear-gradient(160deg, #0f3d3e, #0a2627); }
.login-card { width: min(420px, 100%); background: var(--surface); border-radius: 22px; padding: 34px 28px; box-shadow: 0 30px 60px rgba(0,0,0,.35); }
.login-card img { width: 64px; height: 64px; display: block; margin: 0 auto 14px; }
.login-card h1 { text-align: center; font-size: 22px; margin: 0 0 4px; }
.login-card p.sub { text-align: center; color: var(--muted); margin: 0 0 24px; }
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px #17595a26; }
input.ltr { direction: ltr; text-align: center; letter-spacing: 2px; }
.btn { border: 0; border-radius: 10px; padding: 11px 18px; background: var(--brand); color: #fff; cursor: pointer; font-weight: 600; transition: transform .1s, opacity .15s; }
.btn:hover { opacity: .92; } .btn:active { transform: scale(.98); } .btn:disabled { opacity: .5; cursor: wait; }
.btn.block { width: 100%; } .btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); } .btn.small { padding: 6px 12px; font-size: 13px; }
.err { color: var(--danger); font-size: 13px; min-height: 20px; margin: 6px 0; }
.link { background: none; border: 0; color: var(--brand-2); cursor: pointer; padding: 0; }

/* shell */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: var(--brand); color: #fff; padding: 22px 16px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 18px; margin-bottom: 22px; }
.brand img { width: 38px; height: 38px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: #ffffffcc; text-decoration: none; cursor: pointer; }
.nav a.active, .nav a:hover { background: #ffffff1f; color: #fff; }
.me { margin-top: auto; background: #ffffff14; border-radius: 12px; padding: 12px; font-size: 13px; }
.me b { display: block; font-size: 14px; } .me small { color: #ffffffa8; }
.main { padding: 26px clamp(16px, 3vw, 36px); min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.head h2 { margin: 0; font-size: 22px; }
.menu-btn { display: none; }

/* cards */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--surface); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); border-inline-start: 4px solid var(--c, var(--brand)); cursor: pointer; }
.stat.on { outline: 2px solid var(--c); }
.stat small { color: var(--muted); } .stat b { display: block; font-size: 26px; line-height: 1.2; }
.panel { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.toolbar { display: flex; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar input { flex: 1 1 220px; } .toolbar select { width: auto; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 14px; text-align: start; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: color-mix(in srgb, var(--bg) 60%, var(--surface)); }
tbody tr { cursor: pointer; } tbody tr:hover { background: color-mix(in srgb, var(--bg) 70%, var(--surface)); }
td.wrap { white-space: normal; min-width: 200px; max-width: 360px; }
tr.fresh { animation: flash 2.5s ease-out; }
@keyframes flash { from { background: #e8b04a55; } to { background: transparent; } }
.badge { display: inline-block; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--c); background: color-mix(in srgb, var(--c) 14%, transparent); }
.empty { padding: 48px 16px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; color: var(--muted); font-size: 13px; }

/* drawer */
.overlay { position: fixed; inset: 0; background: #0008; z-index: 20; display: flex; justify-content: flex-start; }
.drawer { width: min(640px, 100%); background: var(--surface); height: 100%; overflow-y: auto; padding: 22px; animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(-30px); opacity: 0; } }
.drawer h3 { margin: 0 0 4px; font-size: 20px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 14px; margin: 16px 0; }
.kv dt { color: var(--muted); font-size: 13px; } .kv dd { margin: 0; word-break: break-word; }
.section-title { font-weight: 700; margin: 20px 0 8px; }
.people { display: grid; gap: 8px; }
.person { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; }
.person small { color: var(--muted); display: block; }
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.media figure { margin: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg); }
.media img, .media video { width: 100%; height: 130px; object-fit: cover; display: block; cursor: zoom-in; }
.media audio { width: 100%; margin: 12px 0; } .media figcaption { font-size: 12px; padding: 6px 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media .doc { display: block; padding: 28px 10px; text-align: center; text-decoration: none; color: var(--brand-2); font-size: 13px; cursor: pointer; background: none; border: 0; width: 100%; }
.timeline { border-inline-start: 2px solid var(--line); margin: 0; padding: 0 14px 0 0; list-style: none; }
.timeline li { position: relative; padding: 0 0 14px; margin-inline-start: 6px; }
.timeline li::before { content: ''; position: absolute; inset-inline-start: -13px; top: 8px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.timeline small { color: var(--muted); }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .row .full { grid-column: 1 / -1; }
.lightbox { position: fixed; inset: 0; background: #000d; z-index: 40; display: grid; place-items: center; cursor: zoom-out; }
.lightbox img { max-width: 94vw; max-height: 92vh; border-radius: 10px; }
#toasts { position: fixed; bottom: 18px; inset-inline-start: 18px; display: grid; gap: 8px; z-index: 50; }
.toast { background: var(--brand); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px #0005; cursor: pointer; animation: slide .2s; }
.toast.error { background: var(--danger); }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 260px; z-index: 30; transform: translateX(100%); transition: transform .2s; }
  .side.open { transform: none; }
  .menu-btn { display: inline-block; }
  .kv { grid-template-columns: 90px 1fr; } .row { grid-template-columns: 1fr; }
}

/* region picker & breakdown */
.region-picker { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 100%; }
.region-picker select { width: auto; min-width: 160px; }
.region-picker:empty { display: none; }
.breakdown { padding: 14px; margin-bottom: 18px; }
.breakdown:empty { display: none; }
.bd-head { display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; margin-bottom: 10px; }
.bd-head small { color: var(--muted); }
.bd-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; max-height: 260px; overflow: auto; }
.bd-item { position: relative; display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); cursor: pointer; overflow: hidden; text-align: start; }
.bd-item i { position: absolute; inset-block: 0; inset-inline-start: 0; background: color-mix(in srgb, var(--brand-2) 16%, transparent); pointer-events: none; }
.bd-item span, .bd-item b { position: relative; }
.bd-item.zero { color: var(--muted); }
