@font-face { font-family: Vazirmatn; font-weight: 400; src: url(/fonts/Vazirmatn-Regular.ttf); }
@font-face { font-family: Vazirmatn; font-weight: 700; src: url(/fonts/Vazirmatn-Bold.ttf); }
@font-face { font-family: Vazirmatn; font-weight: 800; src: url(/fonts/Vazirmatn-ExtraBold.ttf); }

:root {
  --bg: #f4f7f6; --card: #fff; --text: #10201e; --muted: #5d6d6a; --line: #e1e8e6; --hover: #eef4f2;
  --teal: #0f766e; --teal2: #14b8a6; --danger: #dc2626; --warn: #d97706; --ok: #15803d;
  --chart: #0f766e; --chart2: #7c5cff;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e1615; --card: #16211f; --text: #e8f1ef; --muted: #a0b2ae; --line: #27332f; --hover: #1c2a27;
    --teal: #14b8a6; --danger: #f87171; --warn: #fbbf24; --ok: #4ade80; --chart: #2dd4bf; --chart2: #a78bfa; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 15px/1.8 Vazirmatn, Tahoma, sans-serif; }
h1, h2, h3 { margin: 0; line-height: 1.5; }
button, input, select, textarea { font: inherit; color: inherit; }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(135deg, #0f766e, #14b8a6 55%, #3ba9f5); }
.login form { width: min(400px, 100%); background: var(--card); border-radius: 24px; padding: 28px; display: grid; gap: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .25); }
.login img { width: 64px; height: 64px; border-radius: 18px; margin: auto; }
.login h1 { text-align: center; font-size: 21px; font-weight: 800; }

.shell { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }
aside { background: var(--card); border-inline-end: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; padding: 4px 10px 16px; }
.logo img { width: 34px; height: 34px; border-radius: 10px; }
aside a { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 12px; color: var(--muted); text-decoration: none; cursor: pointer; }
aside a:hover { background: var(--hover); }
aside a.on { background: var(--hover); color: var(--teal); font-weight: 700; }
aside .grp { font-size: 12px; color: var(--muted); padding: 14px 12px 4px; }
aside .sp { flex: 1; }
.badge { background: var(--danger); color: #fff; border-radius: 9px; font-size: 12px; padding: 0 7px; }
main { padding: 24px; min-width: 0; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.head h1 { font-size: 22px; font-weight: 800; }
.tools { display: flex; gap: 8px; flex-wrap: wrap; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.kpi span { color: var(--muted); font-size: 13px; display: block; }
.kpi b { font-size: 28px; font-weight: 800; }
.kpi small { color: var(--muted); }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; margin-bottom: 14px; }
.card h3 { font-size: 15px; font-weight: 700; margin-bottom: 10px; }
.empty { color: var(--muted); padding: 22px 0; text-align: center; }

.bar { display: grid; grid-template-columns: 140px 1fr 44px; gap: 10px; align-items: center; margin-bottom: 7px; font-size: 14px; }
.bar i { display: block; height: 10px; border-radius: 0 5px 5px 0; background: var(--chart); min-width: 2px; }
.bar em { font-style: normal; color: var(--muted); text-align: left; }
.meter { height: 8px; background: var(--hover); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--chart); }
.meter.hot i { background: var(--danger); }
svg.chart { width: 100%; height: 150px; display: block; }
svg .a { fill: var(--chart); opacity: .85; }
svg .a:hover { opacity: 1; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: 6px; background: var(--danger); }
.dot.ok { background: var(--ok); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.kv:last-child { border: 0; }
.kv span { color: var(--muted); }
.alert { border: 1px solid var(--warn); color: var(--warn); border-radius: 14px; padding: 10px 14px; margin-bottom: 14px; }

.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: start; color: var(--muted); font-weight: 400; font-size: 13px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tr:last-child td { border: 0; }
tbody tr:hover { background: var(--hover); }
td.acts { text-align: end; }
.tag { font-size: 12px; padding: 1px 9px; border-radius: 8px; background: var(--hover); color: var(--muted); }
.tag.ok { color: var(--ok); }
.tag.bad { color: var(--danger); }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; color: var(--muted); }

.btn { border: 1px solid var(--line); background: var(--card); padding: 6px 14px; border-radius: 11px; cursor: pointer; }
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.pri { background: var(--teal); border-color: var(--teal); color: #fff; font-weight: 700; }
@media (prefers-color-scheme: dark) { .btn.pri { color: #06211e; } }
.btn.pri:hover { filter: brightness(1.08); }
.btn.dan { color: var(--danger); }
input, select, textarea { width: 100%; padding: 9px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); }
input[type=checkbox] { width: auto; }
.search { width: 230px; }
label.f { display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
label.f.chk { display: flex; align-items: center; gap: 8px; }
.ltr { direction: ltr; text-align: left; }
.err { color: var(--danger); font-size: 14px; }

dialog { border: 0; border-radius: 22px; background: var(--card); color: var(--text); width: min(620px, calc(100vw - 24px)); padding: 22px; }
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog form { display: grid; gap: 11px; }
dialog h2 { font-size: 18px; font-weight: 800; }
.dlgacts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.story { white-space: pre-wrap; max-height: 50vh; overflow: auto; }

#toast { position: fixed; bottom: 20px; inset-inline-start: 20px; z-index: 50; background: #10201e; color: #fff; padding: 9px 16px; border-radius: 12px; opacity: 0; transition: opacity .2s; pointer-events: none; }
#toast.on { opacity: 1; }

@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  aside { position: static; height: auto; flex-direction: row; overflow-x: auto; padding: 8px; gap: 2px; border: 0; border-bottom: 1px solid var(--line); }
  aside a { white-space: nowrap; }
  aside .grp, aside .sp, .logo span { display: none; }
  .logo { padding: 0 4px; }
  main { padding: 14px; }
  .cols { grid-template-columns: 1fr; }
  .search { width: 100%; }
}
