/* کفترچی — سبک مشترک صفحه‌ها (معرفی، ورود، پنل کاربر، پنل مدیریت) */
@font-face {
  font-family: "Vazirmatn";
  src: url("/fonts/Vazirmatn-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
/* روشن پیش‌فرض است؛ تیره یا با تنظیم سیستم، یا با دکمه‌ی تغییر پوسته (data-theme روی html). */
:root {
  color-scheme: light;
  --bg: #f6f3ec;
  --surface: #ffffff;
  --surface-2: #f0ece3;
  --ink: #1d2733;
  --muted: #5f6b78;
  --line: #e2ddd2;
  --accent: #2f6f5e;
  --accent-ink: #ffffff;
  --accent-soft: #e2efe9;
  --warn: #9a6212;
  --warn-soft: #fbf0dc;
  --danger: #a33a3a;
  --danger-soft: #f8e3e3;
  --ok: #2f7a45;
  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 4px 16px rgb(0 0 0 / 4%);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11161c;
    --surface: #1a2129;
    --surface-2: #222a33;
    --ink: #e6ebf0;
    --muted: #9aa6b2;
    --line: #2c3540;
    --accent: #69c2a4;
    --accent-ink: #0d1a15;
    --accent-soft: #1d3029;
    --warn: #e6b765;
    --warn-soft: #33291a;
    --danger: #ef8f8f;
    --danger-soft: #3a2222;
    --ok: #79cf94;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11161c;
  --surface: #1a2129;
  --surface-2: #222a33;
  --ink: #e6ebf0;
  --muted: #9aa6b2;
  --line: #2c3540;
  --accent: #69c2a4;
  --accent-ink: #0d1a15;
  --accent-soft: #1d3029;
  --warn: #e6b765;
  --warn-soft: #33291a;
  --danger: #ef8f8f;
  --danger-soft: #3a2222;
  --ok: #79cf94;
  --shadow: none;
}
.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand img { width: 32px; height: 32px; }
.theme-toggle { inline-size: 38px; block-size: 38px; padding: 0; border-radius: 10px; font-size: 1.05rem; }
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: Vazirmatn, "Segoe UI", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.8;
  font-size: 15px;
}
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.4; margin: 0 0 8px; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 24px 16px 64px; }

/* سرصفحه */
.topbar {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .inner { max-width: 1080px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 12px; }
.brand { font-weight: 800; font-size: 1.1rem; text-decoration: none; color: var(--ink); white-space: nowrap; }
.topbar .btn, .topbar .badge { white-space: nowrap; }
.spacer { flex: 1; }
@media (max-width: 560px) {
  .topbar .inner { gap: 6px; padding-inline: 12px; }
  .topbar .btn { padding: 6px 10px; }
  #who { display: none; }
}

/* زبانه‌ها */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin: 16px 0; padding-bottom: 2px; }
.tab {
  border: 0; background: transparent; color: var(--muted); padding: 8px 14px; border-radius: 999px;
  font: inherit; cursor: pointer; white-space: nowrap;
}
.tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); font-weight: 700; }
[role="tabpanel"][hidden] { display: none; }

/* کارت و شبکه */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.stat { font-size: 1.6rem; font-weight: 800; }

/* فرم */
label { display: block; font-size: 0.9rem; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
input[type="checkbox"] { width: auto; }
.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 0.95rem; margin: 6px 0; white-space: nowrap; }
.row > .check { margin-inline-end: 12px; }
.field + .field { margin-top: 12px; }
.ltr { direction: ltr; unicode-bidi: isolate; text-align: left; }

/* دکمه */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 10px; padding: 8px 16px;
  font: inherit; font-weight: 700; cursor: pointer; text-decoration: none;
  background: var(--accent); color: var(--accent-ink);
}
.btn.secondary { background: var(--surface-2); color: var(--ink); border-color: var(--line); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.link { background: none; color: var(--accent); padding: 4px 6px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }

/* نشان و نوار */
.badge { display: inline-block; padding: 1px 10px; border-radius: 999px; font-size: 0.8rem; background: var(--surface-2); color: var(--muted); }
.badge.ok { background: var(--accent-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 6px; }
.meter > span { display: block; height: 100%; background: var(--accent); }
.notice { border-radius: 12px; padding: 12px 14px; background: var(--warn-soft); color: var(--warn); }
.code { font-family: Consolas, monospace; direction: ltr; unicode-bidi: isolate; background: var(--surface-2); padding: 2px 8px; border-radius: 6px; user-select: all; }

/* فهرست و جدول */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.list > li:last-child { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; }

/* پیام کوتاه */
#toast {
  position: fixed; inset-inline: 16px; bottom: 16px; margin: 0 auto; max-width: 420px; z-index: 20;
  background: var(--ink); color: var(--bg); padding: 10px 14px; border-radius: 12px;
  opacity: 0; transform: translateY(8px); transition: 0.2s; pointer-events: none;
}
#toast.show { opacity: 1; transform: none; }
#toast.error { background: var(--danger); color: #fff; }

dialog { border: 0; border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--ink); width: min(560px, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / 45%); }
dialog .card { border: 0; box-shadow: none; }
.empty { color: var(--muted); padding: 12px 0; }
