/* Ayeh Gold admin panel. Layout: fixed black sidebar (brand colours: black + logo yellow) on the right, content column on the left. */
@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; }
@font-face { font-family: Vazirmatn; src: url(fonts/Vazirmatn-ExtraBold.woff2) format("woff2"); font-weight: 800; font-display: swap; }

:root {
  --bg: #f3f5f4; --card: #ffffff; --ink: #18232f; --muted: #66717d; --line: #e3e8e6;
  --green: #0b5e4c; --green-2: #0a8f70; --green-bg: #e3f4ee;
  --gold: #9a6a00; --gold-bg: #fff4cf;
  --brand: #ffc83d; --brand-ink: #141414;
  --red: #c03049; --red-bg: #fde8ec;
  --amber: #a86400; --amber-bg: #fff0d6;
  --side: #0f0f0f; --side-ink: #d8d3c4;
  --f: Vazirmatn, Tahoma, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 14.5px/1.8 var(--f); direction: rtl; display: flex; min-height: 100vh; }
a { color: #8a5d00; text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* sidebar */
.side { width: 230px; flex: none; background: var(--side); color: var(--side-ink); padding: 20px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 0 8px 18px; border-bottom: 1px solid rgba(255,255,255,.08); margin-bottom: 12px; }
.brand b { display: block; color: #fff; font-size: 16px; line-height: 1.4; }
.brand small { color: #9c9686; font-size: 12px; }
.logo { width: 40px; height: 40px; flex: none; display: block; }
.side nav { display: grid; gap: 2px; }
.side nav a { color: var(--side-ink); padding: 8px 12px; border-radius: 8px; font-weight: 500; white-space: nowrap; }
.side nav a:hover { background: rgba(255,255,255,.06); text-decoration: none; }
.side nav a.on { background: rgba(255,200,61,.13); color: var(--brand); }

/* main column */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; }
.top h1 { font-size: 18px; margin: 0; font-weight: 800; }
.who { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13.5px; }
.who form { margin: 0; }
.role { background: var(--gold-bg); color: var(--gold); padding: 0 10px; border-radius: 999px; font-weight: 500; }
.content { padding: 24px 28px 60px; display: grid; gap: 20px; align-content: start; }

/* building blocks */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; min-width: 0; }
.card h2 { font-size: 15.5px; margin: 0 0 12px; font-weight: 800; }
.card h2 small { color: var(--muted); font-weight: 400; margin-right: 6px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 18px; }
.stat span { color: var(--muted); font-size: 13px; display: block; }
.stat b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.5; }
.stat small { color: var(--muted); display: block; font-size: 12.5px; }
.stat.gold b { color: #b07a00; }
.stat.green b { color: var(--green-2); }

.tbl { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
th { color: var(--muted); font-weight: 500; font-size: 12.5px; background: #fafbfa; }
td.num, th.num { font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; min-width: 220px; }
tr:hover td { background: #fbfcfb; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.muted { color: var(--muted); }

.badge { display: inline-block; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; line-height: 1.9; }
.badge.ok { background: var(--green-bg); color: var(--green); }
.badge.warn { background: var(--amber-bg); color: var(--amber); }
.badge.bad { background: var(--red-bg); color: var(--red); }
.badge.gold { background: var(--gold-bg); color: #86600a; }
.badge.mute { background: #eef1f0; color: var(--muted); }

.flash { padding: 10px 16px; border-radius: 10px; font-weight: 500; }
.flash.ok { background: var(--green-bg); color: var(--green); }
.flash.error { background: var(--red-bg); color: var(--red); }

/* forms */
form.stack { display: grid; gap: 12px; max-width: 560px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > label { flex: 1 1 160px; }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); font-weight: 500; }
input, select, textarea { font: inherit; color: var(--ink); background: #fff; border: 1px solid #cfd8d4; border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: #d9a520; outline: none; box-shadow: 0 0 0 3px rgba(255,200,61,.25); }
button, .btn { font: inherit; font-weight: 700; border: 0; border-radius: 8px; padding: 8px 16px; cursor: pointer; background: var(--brand-ink); color: var(--brand); display: inline-block; }
button:hover, .btn:hover { background: #000; text-decoration: none; }
button.ghost, .btn.ghost { background: transparent; color: var(--brand-ink); border: 1px solid #d9d2bd; }
button.ghost:hover, .btn.ghost:hover { background: var(--gold-bg); }
button.danger { background: var(--red); }
button.gold { background: var(--brand); color: var(--brand-ink); }
button.gold:hover { background: #f2b812; }
button.link { background: none; color: var(--muted); padding: 0; font-weight: 500; }
button.link:hover { color: var(--red); background: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.filters label { flex: 0 1 200px; }
.pager { display: flex; gap: 14px; align-items: center; justify-content: center; padding-top: 12px; color: var(--muted); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }

.thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--gold-bg); display: block; }
.preview { max-width: 220px; border-radius: 10px; border: 1px solid var(--line); }

/* bar chart */
.chart { display: flex; align-items: end; gap: 6px; height: 150px; padding-top: 8px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: end; gap: 4px; height: 100%; min-width: 0; }
.chart .bar i { display: block; width: 100%; max-width: 30px; background: #e8b21f; border-radius: 5px 5px 2px 2px; min-height: 2px; }
.chart .bar b { font-size: 11.5px; font-weight: 500; color: var(--ink); }
.chart .bar span { font-size: 10.5px; color: var(--muted); }

/* login */
body.bare { display: grid; place-items: center; background: radial-gradient(circle at 70% 20%, #2a2412, #0b0b0b 65%); }
.auth { width: min(400px, calc(100vw - 32px)); display: grid; gap: 14px; }
.auth .card { padding: 28px; }
.auth h1 { font-size: 20px; margin: 0 0 4px; }
.auth p { margin: 0 0 14px; color: var(--muted); }
.auth-brand { display: grid; justify-items: center; gap: 2px; color: #fff; text-align: center; }
.auth-brand img { width: 96px; height: 96px; margin-bottom: 6px; }
.auth-brand b { font-size: 20px; font-weight: 800; }
.auth-brand small { color: #b9b2a0; font-size: 13px; }
.qr { display: grid; place-items: center; background: #fff; padding: 8px; }
.qr svg { width: 200px; height: 200px; }
.secret { font-family: ui-monospace, Menlo, monospace; direction: ltr; text-align: center; background: var(--bg); border-radius: 8px; padding: 6px; letter-spacing: .08em; font-size: 13px; word-break: break-all; }

@media (max-width: 860px) {
  body { flex-direction: column; }
  .side { width: auto; height: auto; position: static; padding: 12px; }
  .side nav { grid-auto-flow: column; overflow-x: auto; scrollbar-width: thin; scrollbar-color: #3a3a3a transparent; padding-bottom: 4px; }
  .brand { display: none; }
  .top, .content { padding-left: 16px; padding-right: 16px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
