/* ==========================================================================
   سارمو | پنل حسابداری شرکا — سیستم طراحی (RTL، روشن/تیره)
   الهام: داشبوردهای مالی مدرن (Stripe, Mercury, Linear) — آرام، دقیق، عدد‌محور
   ========================================================================== */

/* IRANYekanX — همه وزن‌ها. YekanX = ارقام فارسی (پیش‌فرض رابط)، YekanX Latin = ارقام لاتین (کدها و فیلدهای ltr) */
@font-face { font-family: "YekanX"; src: url("../fonts/IRANYekanXFaNum-Thin.woff2") format("woff2"), url("../fonts/IRANYekanXFaNum-Thin.woff") format("woff"); font-weight: 100; font-display: swap; }
@font-face { font-family: "YekanX"; src: url("../fonts/IRANYekanXFaNum-UltraLight.woff2") format("woff2"), url("../fonts/IRANYekanXFaNum-UltraLight.woff") format("woff"); font-weight: 200; font-display: swap; }
@font-face { font-family: "YekanX"; src: url("../fonts/IRANYekanXFaNum-Light.woff2") format("woff2"), url("../fonts/IRANYekanXFaNum-Light.woff") format("woff"); font-weight: 300; font-display: swap; }
@font-face { font-family: "YekanX"; src: url("../fonts/IRANYekanXFaNum-Regular.woff2") format("woff2"), url("../fonts/IRANYekanXFaNum-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "YekanX"; src: url("../fonts/IRANYekanXFaNum-Medium.woff2") format("woff2"), url("../fonts/IRANYekanXFaNum-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "YekanX"; src: url("../fonts/IRANYekanXFaNum-DemiBold.woff2") format("woff2"), url("../fonts/IRANYekanXFaNum-DemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "YekanX"; src: url("../fonts/IRANYekanXFaNum-Bold.woff2") format("woff2"), url("../fonts/IRANYekanXFaNum-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "YekanX"; src: url("../fonts/IRANYekanXFaNum-ExtraBold.woff2") format("woff2"), url("../fonts/IRANYekanXFaNum-ExtraBold.woff") format("woff"); font-weight: 800; font-display: swap; }
@font-face { font-family: "YekanX"; src: url("../fonts/IRANYekanXFaNum-Black.woff2") format("woff2"), url("../fonts/IRANYekanXFaNum-Black.woff") format("woff"); font-weight: 900; font-display: swap; }
@font-face { font-family: "YekanX"; src: url("../fonts/IRANYekanXFaNum-Heavy.woff2") format("woff2"), url("../fonts/IRANYekanXFaNum-Heavy.woff") format("woff"); font-weight: 950; font-display: swap; }
@font-face { font-family: "YekanX"; src: url("../fonts/IRANYekanXFaNum-ExtraBlack.woff2") format("woff2"), url("../fonts/IRANYekanXFaNum-ExtraBlack.woff") format("woff"); font-weight: 1000; font-display: swap; }
@font-face { font-family: "YekanX Latin"; src: url("../fonts/IRANYekanX-Thin.woff2") format("woff2"), url("../fonts/IRANYekanX-Thin.woff") format("woff"); font-weight: 100; font-display: swap; }
@font-face { font-family: "YekanX Latin"; src: url("../fonts/IRANYekanX-UltraLight.woff2") format("woff2"), url("../fonts/IRANYekanX-UltraLight.woff") format("woff"); font-weight: 200; font-display: swap; }
@font-face { font-family: "YekanX Latin"; src: url("../fonts/IRANYekanX-Light.woff2") format("woff2"), url("../fonts/IRANYekanX-Light.woff") format("woff"); font-weight: 300; font-display: swap; }
@font-face { font-family: "YekanX Latin"; src: url("../fonts/IRANYekanX-Regular.woff2") format("woff2"), url("../fonts/IRANYekanX-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "YekanX Latin"; src: url("../fonts/IRANYekanX-Medium.woff2") format("woff2"), url("../fonts/IRANYekanX-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "YekanX Latin"; src: url("../fonts/IRANYekanX-DemiBold.woff2") format("woff2"), url("../fonts/IRANYekanX-DemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "YekanX Latin"; src: url("../fonts/IRANYekanX-Bold.woff2") format("woff2"), url("../fonts/IRANYekanX-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }
@font-face { font-family: "YekanX Latin"; src: url("../fonts/IRANYekanX-ExtraBold.woff2") format("woff2"), url("../fonts/IRANYekanX-ExtraBold.woff") format("woff"); font-weight: 800; font-display: swap; }
@font-face { font-family: "YekanX Latin"; src: url("../fonts/IRANYekanX-Black.woff2") format("woff2"), url("../fonts/IRANYekanX-Black.woff") format("woff"); font-weight: 900; font-display: swap; }
@font-face { font-family: "YekanX Latin"; src: url("../fonts/IRANYekanX-Heavy.woff2") format("woff2"), url("../fonts/IRANYekanX-Heavy.woff") format("woff"); font-weight: 950; font-display: swap; }
@font-face { font-family: "YekanX Latin"; src: url("../fonts/IRANYekanX-ExtraBlack.woff2") format("woff2"), url("../fonts/IRANYekanX-ExtraBlack.woff") format("woff"); font-weight: 1000; font-display: swap; }

:root {
  --bg: #f4f5f9;
  --bg-grad: radial-gradient(1200px 500px at 85% -10%, #e9ebff 0%, rgba(233,235,255,0) 60%);
  --surface: #ffffff;
  --surface-2: #f8f9fc;
  --surface-3: #f1f3f8;
  --border: #e5e8f0;
  --border-strong: #d3d8e4;
  --text: #0e1525;
  --text-2: #4a5468;
  --muted: #8790a3;
  --brand: #4f46e5;
  --brand-strong: #4338ca;
  --brand-soft: #eef0ff;
  --brand-softer: #f5f6ff;
  --brand-ink: #3730a3;
  --success: #0f9f6e; --success-soft: #e8f8f1; --success-ink: #05704c;
  --danger: #dc2f45; --danger-soft: #fdeef0; --danger-ink: #a51a2e;
  --warning: #c77a06; --warning-soft: #fff6e5; --warning-ink: #8a5300;
  --info: #0b84c6; --info-soft: #e8f5fc; --info-ink: #075f8f;
  --accent: var(--brand); --accent-soft: var(--brand-soft);
  --radius-lg: 18px; --radius: 14px; --radius-md: 11px; --radius-sm: 8px;
  --shadow-xs: 0 1px 1px rgba(14,21,37,.03);
  --shadow-sm: 0 1px 2px rgba(14,21,37,.04), 0 2px 6px rgba(14,21,37,.04);
  --shadow-md: 0 4px 10px rgba(14,21,37,.05), 0 12px 32px rgba(14,21,37,.07);
  --shadow-lg: 0 24px 64px rgba(14,21,37,.18);
  --ring: 0 0 0 3px rgba(79,70,229,.18);
  --sidebar-w: 268px;
  --topbar-h: 64px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0e1a;
  --bg-grad: radial-gradient(1000px 480px at 85% -10%, rgba(79,70,229,.16) 0%, rgba(10,14,26,0) 60%);
  --surface: #111729; --surface-2: #0e1424; --surface-3: #18203a;
  --border: #1f2842; --border-strong: #2b3656;
  --text: #e8ebf4; --text-2: #a9b2c7; --muted: #6f7a95;
  --brand: #8b8cf8; --brand-strong: #a5a6fb; --brand-soft: rgba(139,140,248,.14); --brand-softer: rgba(139,140,248,.07); --brand-ink: #c7c8ff;
  --success: #34d399; --success-soft: rgba(52,211,153,.12); --success-ink: #6ee7b7;
  --danger: #f87185; --danger-soft: rgba(248,113,133,.12); --danger-ink: #fda4b2;
  --warning: #fbbf24; --warning-soft: rgba(251,191,36,.12); --warning-ink: #fcd34d;
  --info: #38bdf8; --info-soft: rgba(56,189,248,.12); --info-ink: #7dd3fc;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3); --shadow-md: 0 8px 28px rgba(0,0,0,.35); --shadow-lg: 0 24px 64px rgba(0,0,0,.55);
  --ring: 0 0 0 3px rgba(139,140,248,.28);
  color-scheme: dark;
}

/* رنگ هر پرونده */
[data-accent="indigo"]  { --accent: #4f46e5; --accent-soft: #eef0ff; }
[data-accent="emerald"] { --accent: #059669; --accent-soft: #e7f8f1; }
[data-accent="amber"]   { --accent: #d97706; --accent-soft: #fff4e2; }
[data-accent="rose"]    { --accent: #e11d48; --accent-soft: #ffedf1; }
[data-accent="sky"]     { --accent: #0284c7; --accent-soft: #e6f4fc; }
[data-accent="violet"]  { --accent: #7c3aed; --accent-soft: #f3edff; }
[data-accent="teal"]    { --accent: #0d9488; --accent-soft: #e5f6f4; }
[data-accent="slate"]   { --accent: #475569; --accent-soft: #eef1f5; }
:root[data-theme="dark"] [data-accent] { --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent); }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: "YekanX", Tahoma, sans-serif; font-size: 14px; line-height: 1.75;
  color: var(--text); background: var(--bg); background-image: var(--bg-grad); background-repeat: no-repeat;
  font-feature-settings: "ss01", "tnum"; -webkit-font-smoothing: antialiased; min-height: 100vh;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-strong); }
h1, h2, h3, h4 { margin: 0; line-height: 1.4; font-weight: 700; letter-spacing: -.2px; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.icon { width: 18px; height: 18px; flex-shrink: 0; }
.ltr { direction: ltr; unicode-bidi: plaintext; font-family: "YekanX Latin", "YekanX", Tahoma, sans-serif; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 12.5px; }
.xsmall { font-size: 11.5px; }
.strong { font-weight: 700; }
.pos { color: var(--success); }
.neg { color: var(--danger); }
.hidden, [hidden] { display: none !important; }
.truncate { display: block; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.d-block { display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
::selection { background: var(--brand-soft); color: var(--brand-ink); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }

/* ---------------- اسکلت صفحه ---------------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px;
  background: var(--surface); border-inline-start: 0; border-inline-end: 1px solid var(--border); padding: 18px 14px;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 16px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px;
  background: linear-gradient(135deg, #6366f1 0%, #4f46e5 45%, #7c3aed 100%); box-shadow: 0 6px 16px rgba(79,70,229,.35);
}
.brand-name { font-weight: 800; font-size: 15px; line-height: 1.3; }
.brand-sub { font-size: 11.5px; color: var(--muted); }
.nav-title { font-size: 11px; font-weight: 700; color: var(--muted); padding: 14px 10px 6px; letter-spacing: .2px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--text-2); font-weight: 500;
  transition: background .15s, color .15s;
}
.nav-link:hover { background: var(--surface-3); color: var(--text); }
.nav-link.active { background: var(--brand-soft); color: var(--brand-ink); font-weight: 600; }
.nav-link .icon { width: 18px; height: 18px; opacity: .9; }
.nav-link .count { margin-inline-start: auto; font-size: 11px; color: var(--muted); background: var(--surface-3); padding: 0 7px; border-radius: 99px; }
.nav-dot { width: 9px; height: 9px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); margin: 0 4px; flex-shrink: 0; }
.nav-link .type-tag { margin-inline-start: auto; font-size: 10.5px; color: var(--muted); }
.nav-link.inactive { opacity: .55; }
.sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); display: grid; gap: 8px; }
.user-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.user-card:hover { background: var(--surface-3); }
.avatar {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--accent-soft); color: var(--accent); flex-shrink: 0;
}
.avatar.lg { width: 52px; height: 52px; border-radius: 15px; font-size: 20px; }
.avatar.xl { width: 60px; height: 60px; border-radius: 18px; font-size: 24px; }
.user-meta { min-width: 0; line-height: 1.45; }
.user-meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 11.5px; color: var(--muted); }
.sidebar-actions { display: flex; gap: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid transparent;
}
.topbar.scrolled { border-bottom-color: var(--border); }
.crumbs { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; min-width: 0; }
.crumbs a { color: var(--text-2); }
.crumbs .icon { width: 14px; height: 14px; flex-shrink: 0; }
.crumbs b { color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
/* سه‌خط: دسکتاپ منوی کناری را جمع/باز می‌کند (کلاس nav-collapsed روی html، ذخیره در مرورگر)، موبایل کشویی */
.menu-toggle { flex-shrink: 0; }
@media (min-width: 981px) {
  :root.nav-collapsed .app { grid-template-columns: minmax(0, 1fr); }
  :root.nav-collapsed .sidebar { display: none; }
}
.page { padding: 8px 28px 48px; width: 100%; max-width: 1440px; margin: 0 auto; }
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 14px 0 22px; flex-wrap: wrap; }
.page-title { font-size: 23px; font-weight: 800; }
.page-sub { color: var(--text-2); margin-top: 4px; max-width: 720px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.footer { color: var(--muted); font-size: 12px; text-align: center; padding: 18px 0 26px; }
.backdrop { position: fixed; inset: 0; background: rgba(8,12,24,.45); z-index: 40; opacity: 0; pointer-events: none; transition: opacity .2s; }
.backdrop.show { opacity: 1; pointer-events: auto; }

/* ---------------- پرونده: هدر و تب‌ها ---------------- */
/* بدون overflow:hidden تا منوی «بیشتر» بریده نشود؛ هاله رنگی به‌جای ::after لایه پس‌زمینه است */
.ws-header {
  position: relative; z-index: 5; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 22px 24px; margin: 12px 0 0; border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  background:
    radial-gradient(circle 170px at right 60px top 40px, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    linear-gradient(120deg, var(--accent-soft), var(--surface) 70%);
  border: 1px solid var(--border); border-bottom: 0;
}
.ws-title { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ws-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; color: var(--text-2); font-size: 12.5px; }
.ws-actions { margin-inline-start: auto; display: flex; gap: 8px; position: relative; z-index: 1; }
.ws-tabs {
  display: flex; gap: 2px; padding: 0 14px; overflow-x: auto; scrollbar-width: none;
  background: var(--surface); border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius-lg) var(--radius-lg); margin-bottom: 22px;
}
.ws-tabs::-webkit-scrollbar { display: none; }
.ws-tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 13px 14px; color: var(--text-2); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.ws-tab:hover { color: var(--text); }
.ws-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
.ws-tab .icon { width: 17px; height: 17px; }

/* ---------------- کارت‌ها ---------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); min-width: 0; }
.card-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-header h2, .card-header h3 { font-size: 15px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.card-header .icon { color: var(--muted); }
.card-header .tools { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }
.card-footer { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card + .card, .stack > * + * { margin-top: 18px; }
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(320px, 1fr); align-items: start; }
.sticky-col { position: sticky; top: calc(var(--topbar-h) + 12px); }

/* ---------------- KPI ---------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-xs); overflow: hidden; min-width: 0;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.kpi-label { color: var(--text-2); font-size: 12.5px; font-weight: 500; }
.kpi-icon { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.kpi-icon .icon { width: 17px; height: 17px; }
.kpi-icon.brand { background: var(--brand-soft); color: var(--brand); }
.kpi-icon.success { background: var(--success-soft); color: var(--success); }
.kpi-icon.danger { background: var(--danger-soft); color: var(--danger); }
.kpi-icon.warning { background: var(--warning-soft); color: var(--warning); }
.kpi-icon.info { background: var(--info-soft); color: var(--info); }
/* مبلغ هرگز بریده نمی‌شود: اندازه روان و در صورت نیاز شکستن خط */
.kpi-value { font-size: clamp(17px, 1.55vw, 22px); font-weight: 800; margin-top: 8px; letter-spacing: -.3px; overflow-wrap: anywhere; line-height: 1.5; }
.kpi-value small { font-size: 12px; font-weight: 500; color: var(--muted); margin-inline-start: 4px; }
.kpi-foot { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.hero {
  grid-column: span 2; color: #fff; border: 0;
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 55%, #7c3aed 100%); box-shadow: 0 14px 34px rgba(79,70,229,.28);
}
.kpi.hero.negative { background: linear-gradient(135deg, #7f1d1d 0%, #dc2f45 60%, #f97316 110%); box-shadow: 0 14px 34px rgba(220,47,69,.25); }
.kpi.hero.zero { background: linear-gradient(135deg, #1e293b, #475569); }
.kpi.hero .kpi-label, .kpi.hero .kpi-foot, .kpi.hero .kpi-value small { color: rgba(255,255,255,.82); }
.kpi.hero .kpi-icon { background: rgba(255,255,255,.16); color: #fff; }
.kpi.hero .kpi-value { font-size: clamp(21px, 2.2vw, 30px); }
.kpi.hero .kpi-foot { white-space: normal; }
.kpi.hero::after {
  content: ""; position: absolute; inset-inline-start: -40px; bottom: -70px; width: 200px; height: 200px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%);
}
.kpi .skeleton { height: 26px; margin-top: 10px; width: 70%; }

/* ---------------- صورت‌حساب (+/−) ---------------- */
.statement { display: grid; }
.st-row {
  display: flex; align-items: center; gap: 10px; padding: 11px 4px; border-bottom: 1px dashed var(--border);
  cursor: pointer; border-radius: 8px; transition: background .12s;
}
.st-row:hover { background: var(--surface-2); }
.st-row.active { background: var(--brand-softer); }
.st-sign {
  width: 24px; height: 24px; border-radius: 8px; display: grid; place-items: center; font-weight: 800; font-size: 15px; flex-shrink: 0;
}
.st-sign.plus { background: var(--success-soft); color: var(--success); }
.st-sign.minus { background: var(--danger-soft); color: var(--danger); }
.st-label { color: var(--text-2); flex: 1; min-width: 0; }
.st-value { font-weight: 700; }
.st-row.has-error .st-value::after { content: " ⚠"; color: var(--warning); }
.st-total {
  display: flex; align-items: center; gap: 10px; margin-top: 12px; padding: 14px 16px; border-radius: 14px;
  background: var(--surface-3); font-weight: 800;
}
.st-total .st-label { color: var(--text); font-weight: 700; }
.st-total.positive { background: var(--success-soft); color: var(--success-ink); }
.st-total.negative { background: var(--danger-soft); color: var(--danger-ink); }
.st-total .st-value { font-size: 18px; }
.st-note { display: block; font-size: 11.5px; font-weight: 500; opacity: .85; }

/* ---------------- دکمه‌ها ---------------- */
.btn {
  --b-bg: var(--surface); --b-fg: var(--text); --b-bd: var(--border-strong);
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: var(--radius-md); border: 1px solid var(--b-bd); background: var(--b-bg); color: var(--b-fg);
  font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .05s, opacity .15s; box-shadow: var(--shadow-xs);
}
.btn:hover { background: var(--surface-3); color: var(--b-fg); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { --b-bg: var(--brand); --b-fg: #fff; --b-bd: var(--brand); box-shadow: 0 1px 2px rgba(79,70,229,.3), inset 0 1px 0 rgba(255,255,255,.15); }
.btn-primary:hover { background: var(--brand-strong); border-color: var(--brand-strong); color: #fff; }
.btn-accent { --b-bg: var(--accent); --b-fg: #fff; --b-bd: var(--accent); }
.btn-accent:hover { background: color-mix(in srgb, var(--accent) 88%, #000); color: #fff; }
.btn-danger { --b-bg: var(--danger); --b-fg: #fff; --b-bd: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); color: #fff; }
.btn-danger-soft { --b-bg: var(--danger-soft); --b-fg: var(--danger-ink); --b-bd: transparent; box-shadow: none; }
.btn-danger-soft:hover { background: color-mix(in srgb, var(--danger) 18%, transparent); color: var(--danger-ink); }
.btn-ghost { --b-bg: transparent; --b-bd: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-soft { --b-bg: var(--brand-soft); --b-fg: var(--brand-ink); --b-bd: transparent; box-shadow: none; }
.btn-soft:hover { background: color-mix(in srgb, var(--brand) 18%, transparent); color: var(--brand-ink); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 13px; }
.btn-icon { width: 38px; padding: 0; }
.btn-sm.btn-icon { width: 32px; }
.btn-block { width: 100%; }
.btn.loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.loading::after {
  content: ""; position: absolute; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor;
  border-color: var(--b-fg) transparent var(--b-fg) transparent; animation: spin .7s linear infinite;
}
.btn-group { display: inline-flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- بج و چیپ ---------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.badge .icon { width: 13px; height: 13px; }
.badge-brand { background: var(--brand-soft); color: var(--brand-ink); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-success { background: var(--success-soft); color: var(--success-ink); }
.badge-danger { background: var(--danger-soft); color: var(--danger-ink); }
.badge-warning { background: var(--warning-soft); color: var(--warning-ink); }
.badge-info { background: var(--info-soft); color: var(--info-ink); }
.badge-outline { background: transparent; border: 1px solid var(--border-strong); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; display: inline-block; }
.dot.pulse { animation: pulse 1.4s ease-in-out infinite; }

/* ---------------- فرم ---------------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field + .field { margin-top: 16px; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.field-row + .field-row, .field-row + .field, .field + .field-row { margin-top: 16px; }
.label { font-weight: 600; font-size: 13px; color: var(--text); display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--danger); }
.help { font-size: 12px; color: var(--muted); line-height: 1.7; }
.error-text { font-size: 12px; color: var(--danger); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-md); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font: inherit; font-size: 13.5px; transition: border-color .15s, box-shadow .15s;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.8; }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in srgb, var(--brand) 35%, var(--border-strong)); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.input.is-invalid, .select.is-invalid { border-color: var(--danger); }
.input[readonly] { background: var(--surface-2); }
.select {
  appearance: none; padding-inline-end: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238790a3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-size: 16px; background-position: left 11px center;
}
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-inline-start: 38px; }
.input-group > .icon { position: absolute; inset-inline-start: 12px; color: var(--muted); pointer-events: none; }
.input-group .addon { position: absolute; inset-inline-end: 6px; }
.input-sm { height: 34px; font-size: 13px; }
.checkbox { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.checkbox input { width: 17px; height: 17px; accent-color: var(--brand); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  position: relative; width: 40px; height: 23px; border-radius: 99px; background: var(--border-strong); transition: background .2s; flex-shrink: 0;
}
.switch .track::after {
  content: ""; position: absolute; top: 3px; right: 3px; width: 17px; height: 17px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s;
}
.switch input:checked + .track { background: var(--brand); }
.switch input:checked + .track::after { transform: translateX(-17px); }
.switch input:focus-visible + .track { box-shadow: var(--ring); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border); }
.segmented button, .segmented label {
  border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px;
  border-radius: 8px; cursor: pointer; white-space: nowrap;
}
.segmented .active, .segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.segmented input { display: none; }
.segmented label span { display: block; padding: 0; }
.radio-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.radio-card { position: relative; display: flex; gap: 12px; padding: 16px; border-radius: var(--radius); border: 1.5px solid var(--border); cursor: pointer; background: var(--surface); transition: border-color .15s, box-shadow .15s; }
.radio-card input { position: absolute; opacity: 0; }
.radio-card:hover { border-color: var(--border-strong); }
.radio-card:has(input:checked) { border-color: var(--brand); box-shadow: var(--ring); background: var(--brand-softer); }
.radio-card .rc-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.radio-card b { display: block; }
.color-picks { display: flex; gap: 8px; flex-wrap: wrap; }
.color-pick { position: relative; }
.color-pick input { position: absolute; opacity: 0; }
.color-pick span { display: block; width: 30px; height: 30px; border-radius: 10px; background: var(--accent); cursor: pointer; box-shadow: inset 0 0 0 2px rgba(255,255,255,.4); transition: transform .15s; }
.color-pick input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent); transform: scale(1.06); }

/* ---------------- جدول ---------------- */
.table-wrap { overflow: auto; max-width: 100%; }
.table-wrap.scroll { max-height: 560px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th {
  position: sticky; top: 0; z-index: 1; background: var(--surface-2); color: var(--text-2); font-weight: 600; font-size: 12px;
  text-align: start; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: end; }
.table tfoot td { background: var(--surface-2); font-weight: 700; border-top: 1px solid var(--border); border-bottom: 0; position: sticky; bottom: 0; }
.table .cell-title { max-width: 420px; }
.table .cell-title .t { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table .cell-title .s { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.table tr.sub-row td { background: var(--surface-2); padding: 0; }
.table tr.expandable { cursor: pointer; }
.table .row-actions { display: flex; gap: 4px; justify-content: flex-end; }
.doc-no { font-family: "YekanX"; font-weight: 600; color: var(--brand-ink); background: var(--brand-softer); padding: 1px 8px; border-radius: 6px; font-size: 12px; }
.mini-bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; min-width: 80px; display: flex; }
.mini-bar span { display: block; height: 100%; }
.mini-bar .s1 { background: var(--accent); }
/* آمار موجودی امانی (صفحه پرونده) */
.stock-bar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--surface-3); }
.stock-bar span { display: block; height: 100%; }
.s-settled { background: var(--accent); }
.s-unsettled { background: color-mix(in srgb, var(--warning) 75%, transparent); }
.s-remaining { background: color-mix(in srgb, var(--success) 60%, transparent); }
.stock-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.stock-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); background: var(--surface); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius-lg) var(--radius-lg); overflow: hidden; }
.stat { background: var(--surface); box-shadow: inset 0 -1px 0 var(--border), inset -1px 0 0 var(--border); padding: 12px 16px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.stat-label { font-size: 12px; color: var(--text-2); }
.stat-qty { font-size: 18px; font-weight: 800; }
.stat-qty small { font-size: 11px; font-weight: 500; color: var(--muted); }
.stat-amount { font-size: 12.5px; color: var(--text-2); }
.stat-foot { font-size: 11.5px; color: var(--muted); }
.stat.hero { background: var(--accent-soft); }
.stat.hero .stat-qty { color: var(--accent); font-size: 22px; }
.stat.ok .stat-qty { color: var(--success); }
.stat.warn .stat-qty { color: var(--warning); }
.stat.bad .stat-qty { color: var(--danger); }
.mini-bar .s2 { background: color-mix(in srgb, var(--warning) 70%, transparent); }

/* ---------------- تب‌های داخلی ---------------- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: var(--surface-3); border-radius: 12px; border: 1px solid var(--border); }
.tab {
  border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 9px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tab .badge { height: 19px; padding: 0 6px; font-size: 10.5px; }
.tab-total { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.tab-total strong { font-size: 18px; }

/* ---------------- هشدار ---------------- */
.alert { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-md); font-size: 13px; border: 1px solid transparent; line-height: 1.8; }
.alert .icon { margin-top: 3px; }
.alert-info { background: var(--info-soft); color: var(--info-ink); }
.alert-success { background: var(--success-soft); color: var(--success-ink); }
.alert-warning { background: var(--warning-soft); color: var(--warning-ink); }
.alert-danger { background: var(--danger-soft); color: var(--danger-ink); }
.alert ul { margin: 4px 0 0; padding-inline-start: 18px; }
.alert + .alert, .alert + .card, .card + .alert { margin-top: 12px; }
.callout { padding: 14px 16px; border-radius: var(--radius); background: var(--surface-2); border: 1px dashed var(--border-strong); color: var(--text-2); font-size: 13px; }
.callout ol, .callout ul { margin: 6px 0 0; padding-inline-start: 18px; }
.callout li + li { margin-top: 4px; }

/* ---------------- حالت خالی و اسکلت ---------------- */
.empty { text-align: center; padding: 42px 20px; color: var(--muted); }
.empty .empty-icon { width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); }
.empty .empty-icon .icon { width: 26px; height: 26px; }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }
.skeleton { display: block; border-radius: 8px; background: linear-gradient(90deg, var(--surface-3) 25%, var(--surface-2) 50%, var(--surface-3) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; height: 14px; }
.skeleton-lines { display: grid; gap: 12px; padding: 20px; }

/* ---------------- اجرای مرحله‌ای ---------------- */
.runner-status { display: flex; align-items: center; gap: 12px; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 99px; font-weight: 600; font-size: 12.5px; background: var(--surface-3); color: var(--text-2); }
.status-pill.loading { background: var(--brand-soft); color: var(--brand-ink); }
.status-pill.success { background: var(--success-soft); color: var(--success-ink); }
.status-pill.error { background: var(--danger-soft); color: var(--danger-ink); }
.status-pill.waiting { background: var(--warning-soft); color: var(--warning-ink); }
.runner-summary { margin-top: 10px; color: var(--text-2); min-height: 22px; }
.progress { position: relative; height: 10px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress-bar { position: absolute; inset-block: 0; inset-inline-start: 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #a78bfa)); transition: width .35s ease; }
.progress.indeterminate .progress-bar { width: 35% !important; animation: indeterminate 1.2s ease-in-out infinite; }
.progress-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; font-size: 12.5px; color: var(--text-2); }
.step-now { display: flex; align-items: center; gap: 10px; padding: 12px 14px; margin-top: 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--brand-soft); border-top-color: var(--brand); animation: spin .8s linear infinite; flex-shrink: 0; }
.console {
  margin-top: 14px; height: 300px; overflow-y: auto; border-radius: 12px; padding: 10px 0; font-size: 12.5px; line-height: 1.9;
  background: #0d1220; color: #c9d1e4; border: 1px solid #1c2440; direction: rtl;
}
:root[data-theme="dark"] .console { background: #070a13; }
.console .line { padding: 1px 14px; display: flex; gap: 10px; }
.console .line:hover { background: rgba(255,255,255,.03); }
.console .time { color: #59637e; font-size: 11px; flex-shrink: 0; padding-top: 2px; direction: ltr; }
.console .ok { color: #6ee7b7; }
.console .warn { color: #fcd34d; }
.console .err { color: #fda4af; }
.console .muted-line { color: #6b7690; }
.console-head { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; font-size: 12.5px; color: var(--muted); }

/* ---------------- مودال، توست، منو ---------------- */
.modal-root { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px; background: rgba(8,12,24,.5); backdrop-filter: blur(2px); opacity: 0; transition: opacity .18s; }
.modal-root.show { opacity: 1; }
.modal { width: min(520px, 100%); background: var(--surface); border-radius: 20px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); transform: translateY(8px) scale(.98); transition: transform .18s; overflow: hidden; }
.modal-root.show .modal { transform: none; }
.modal-head { display: flex; gap: 14px; padding: 22px 22px 6px; }
.modal-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); flex-shrink: 0; }
.modal-icon.danger { background: var(--danger-soft); color: var(--danger); }
.modal-icon.warning { background: var(--warning-soft); color: var(--warning); }
.modal-title { font-size: 16px; font-weight: 800; }
.modal-body { padding: 6px 22px 18px; color: var(--text-2); white-space: pre-line; }
.modal-body .confirm-word { margin-top: 12px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-start; padding: 14px 22px; background: var(--surface-2); border-top: 1px solid var(--border); }
.toasts { position: fixed; z-index: 90; bottom: 20px; left: 20px; display: grid; gap: 10px; width: min(380px, calc(100vw - 40px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-md); animation: toast-in .25s ease;
}
.toast .icon { margin-top: 3px; }
.toast.success .icon { color: var(--success); }
.toast.error .icon { color: var(--danger); }
.toast.warning .icon { color: var(--warning); }
.toast.hide { animation: toast-out .2s ease forwards; }
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; z-index: 50; top: calc(100% + 6px); inset-inline-end: 0; min-width: 200px; padding: 6px; border-radius: 14px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); display: none;
}
.dropdown.open .dropdown-menu { display: block; animation: pop .14s ease; }
.dropdown-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 10px; border-radius: 9px; border: 0; background: none; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; text-align: start; }
.dropdown-item:hover { background: var(--surface-3); color: var(--text); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-sep { height: 1px; background: var(--border); margin: 5px 0; }

/* ---------------- تقویم شمسی ---------------- */
.jdp { position: relative; }
.jdp-panel {
  position: absolute; z-index: 60; top: calc(100% + 6px); inset-inline-start: 0; width: 292px; padding: 12px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-md); display: none;
}
.jdp.open .jdp-panel { display: block; animation: pop .14s ease; }
.jdp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.jdp-head b { font-size: 14px; }
.jdp-title { display: flex; gap: 4px; }
.jdp-select { font: inherit; font-size: 13.5px; font-weight: 700; color: var(--text); background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 3px 6px; cursor: pointer; }
.jdp-select:hover { border-color: var(--border-strong); }
.jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; text-align: center; }
.jdp-grid .wd { font-size: 11px; color: var(--muted); padding: 4px 0; }
.jdp-day { border: 0; background: none; font: inherit; font-size: 13px; height: 34px; border-radius: 9px; cursor: pointer; color: var(--text); }
.jdp-day:hover:not(:disabled) { background: var(--surface-3); }
.jdp-day.today { box-shadow: inset 0 0 0 1.5px var(--brand); }
.jdp-day.selected { background: var(--brand); color: #fff; }
.jdp-day:disabled { color: var(--border-strong); cursor: not-allowed; }
.jdp-foot { display: flex; gap: 6px; margin-top: 8px; }

/* ---------------- تنظیمات ---------------- */
.settings-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--topbar-h) + 12px); display: grid; gap: 2px; }
.settings-nav a { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-weight: 500; }
.settings-nav a:hover { background: var(--surface); color: var(--text); }
.settings-nav a.active { background: var(--surface); color: var(--brand-ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.settings-group { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.settings-group .card-header p { width: 100%; color: var(--muted); font-size: 12.5px; margin-top: -4px; }
.setting-row { display: grid; grid-template-columns: minmax(150px, 300px) minmax(220px, 1fr); gap: 20px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row.wide { grid-template-columns: minmax(0, 1fr); gap: 10px; }
.setting-row.wide .select { max-width: 100%; }
.setting-row .label { margin-top: 8px; }
.setting-row .help { margin-top: 3px; }
.savebar {
  position: sticky; bottom: 14px; z-index: 20; margin-top: 18px; display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: 16px; background: color-mix(in srgb, var(--surface) 90%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--border); box-shadow: var(--shadow-md);
}
.savebar .dirty-note { color: var(--warning-ink); font-size: 12.5px; display: none; }
.savebar.dirty .dirty-note { display: inline-flex; align-items: center; gap: 6px; }
.rules-table td { padding: 6px 8px; }
.rules-table .input { height: 36px; }
.rules-table th { padding: 8px; }

/* ---------------- داشبورد ---------------- */
.profile-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.profile-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); color: var(--text); transition: box-shadow .2s, transform .2s, border-color .2s; position: relative; overflow: hidden; }
.profile-card::before { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: var(--accent); opacity: .8; }
.profile-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); color: var(--text); border-color: var(--border-strong); }
.pc-head { display: flex; align-items: center; gap: 12px; }
.pc-head b { font-size: 15.5px; display: block; }
.pc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.pc-stat { background: var(--surface-2); border-radius: 11px; padding: 8px 10px; min-width: 0; }
.pc-stat span { display: block; font-size: 11px; color: var(--muted); }
.pc-stat b { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.pc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); }
.timeline { display: grid; }
.tl-item { display: flex; gap: 12px; padding: 10px 20px; }
.tl-item + .tl-item { border-top: 1px solid var(--border); }
.tl-icon { width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); flex-shrink: 0; }
.tl-icon .icon { width: 15px; height: 15px; }
.tl-icon.success { background: var(--success-soft); color: var(--success); }
.tl-icon.danger { background: var(--danger-soft); color: var(--danger); }
.tl-icon.brand { background: var(--brand-soft); color: var(--brand); }
.tl-body { min-width: 0; flex: 1; }
.tl-body p { font-size: 13px; color: var(--text); overflow-wrap: anywhere; }
.tl-body span { font-size: 11.5px; color: var(--muted); }
.welcome { display: flex; align-items: center; gap: 18px; padding: 22px 24px; margin-bottom: 18px; border-radius: var(--radius-lg); color: #fff; background: linear-gradient(120deg, #1e1b4b, #4338ca 55%, #7c3aed); box-shadow: 0 16px 36px rgba(67,56,202,.25); position: relative; overflow: hidden; }
.welcome h1 { font-size: 21px; font-weight: 800; }
.welcome p { opacity: .85; margin-top: 4px; }
.welcome .stats { margin-inline-start: auto; display: flex; gap: 22px; position: relative; z-index: 1; }
.welcome .stats div { text-align: center; }
.welcome .stats b { display: block; font-size: 22px; }
.welcome .stats span { font-size: 12px; opacity: .8; }
.welcome::after { content: ""; position: absolute; inset-inline-start: -80px; top: -120px; width: 320px; height: 320px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.14), transparent 70%); }

/* ---------------- نمودار ---------------- */
.chart { width: 100%; height: 240px; }
.chart text { fill: var(--muted); font-size: 11px; font-family: "YekanX"; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .bar-a { fill: var(--accent); }
.chart .bar-b { fill: color-mix(in srgb, var(--accent) 30%, transparent); }
.chart .bar:hover { opacity: .8; }
.chart-legend { display: flex; gap: 14px; font-size: 12px; color: var(--text-2); }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; vertical-align: -1px; }

/* ---------------- ورود و نصب ---------------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); }
.auth-side {
  position: relative; overflow: hidden; color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(150deg, #1e1b4b 0%, #312e81 40%, #4f46e5 75%, #7c3aed 110%);
}
.auth-side::before, .auth-side::after { content: ""; position: absolute; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%); }
.auth-side::before { width: 520px; height: 520px; top: -160px; left: -160px; }
.auth-side::after { width: 380px; height: 380px; bottom: -140px; right: -80px; }
.auth-side h2 { font-size: 30px; font-weight: 800; line-height: 1.5; position: relative; z-index: 1; }
.auth-side p { opacity: .85; max-width: 440px; margin-top: 12px; position: relative; z-index: 1; }
.auth-feats { display: grid; gap: 12px; position: relative; z-index: 1; }
.auth-feat { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: 14px; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); backdrop-filter: blur(6px); max-width: 420px; }
.auth-feat .icon { width: 20px; height: 20px; }
.auth-main { display: grid; place-items: center; padding: 32px 20px; }
.auth-card { width: min(420px, 100%); }
.auth-card h1 { font-size: 24px; font-weight: 800; margin: 18px 0 6px; }
.auth-card .page-sub { margin-bottom: 26px; }
.install-wrap { max-width: 860px; margin: 0 auto; padding: 36px 20px 60px; }
.install-step { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.install-step .n { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); font-size: 13px; }
.req-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.req { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: var(--surface-2); font-size: 12.5px; }
.req .icon { width: 16px; height: 16px; }
.req.ok .icon { color: var(--success); }
.req.bad .icon { color: var(--danger); }
.req.opt .icon { color: var(--warning); }

/* ---------------- صفحه‌بندی ---------------- */
.pagination { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; padding: 14px; }
.pagination a, .pagination span { min-width: 34px; height: 34px; padding: 0 10px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: 13px; }
.pagination .active { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .disabled { opacity: .45; }

/* ---------------- انیمیشن‌ها ---------------- */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px); } }
@keyframes indeterminate { from { transform: translateX(120%); } to { transform: translateX(-320%); } }
@keyframes fade-up { from { opacity: 0; transform: translateY(6px); } }
.fade-up { animation: fade-up .3s ease both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------------- واکنش‌گرا ---------------- */
@media (max-width: 1180px) {
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .sticky-col { position: static; }
  .kpi.hero { grid-column: auto; }
}
@media (max-width: 980px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; width: min(300px, 86vw); transform: translateX(110%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .topbar { padding: 0 16px; }
  .page { padding: 4px 16px 40px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .settings-layout { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { position: static; display: flex; overflow-x: auto; gap: 4px; }
  .settings-nav a { white-space: nowrap; }
  .setting-row { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-side { display: none; }
  .welcome { flex-wrap: wrap; }
  .welcome .stats { margin-inline-start: 0; width: 100%; justify-content: space-around; }
}
@media (max-width: 560px) {
  .ws-header { padding: 18px 16px; }
  .ws-actions { width: 100%; }
  .page-title { font-size: 20px; }
  .kpi.hero .kpi-value { font-size: 24px; }
  .pc-stats { grid-template-columns: repeat(2, 1fr); }
  .card-header, .card-body { padding-inline: 16px; }
}
@media print {
  .sidebar, .topbar, .ws-tabs, .ws-actions, .page-actions, .no-print { display: none !important; }
  .app { grid-template-columns: 1fr; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
