/* ==========================================================================
   حساب‌آرا — سامانه جامع حسابداری
   استایل اصلی (RTL) — بخش ۱: پایه، پوسته و اجزای عمومی
   ========================================================================== */

/* ---------- فونت شبنم (Farsi Digits) ---------- */
@font-face {
    font-family: "Shabnam";
    src: url("../fonts/Shabnam-Medium-FD.woff2") format("woff2"),
         url("../fonts/Shabnam-Medium-FD.woff") format("woff");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

/* ---------- متغیرها و پوسته‌ها ---------- */
:root {
    --font: "Shabnam", "Vazirmatn", "Segoe UI", Tahoma, sans-serif;
    --bg: #f2f6f5;
    --bg-accent: #e8f1ef;
    --surface: #ffffff;
    --surface-soft: #f8fbfa;
    --surface-muted: #f1f5f4;
    --text: #0f2430;
    --text-soft: #334b57;
    --muted: #6b8189;
    --border: #e2eae8;
    --border-strong: #cfdbd8;
    --accent: #0f766e;
    --accent-strong: #0b5b55;
    --accent-2: #14b8a6;
    --accent-soft: #e7f6f3;
    --accent-line: #a7ded6;
    --ring: rgba(15, 118, 110, 0.18);
    --navy: #0a2231;
    --navy-2: #0d2d3f;
    --navy-3: #123a4f;
    --gold: #f0c15c;
    --success: #14855f;
    --success-soft: #e5f7ef;
    --danger: #c2414b;
    --danger-soft: #fdecee;
    --warning: #b67815;
    --warning-soft: #fdf4e3;
    --info: #2563a8;
    --info-soft: #eaf2fc;
    --violet: #7c3aed;
    --violet-soft: #f1eafe;
    --rose: #c2416f;
    --rose-soft: #fdebf2;
    --amber: #b67815;
    --amber-soft: #fdf4e3;
    --shadow-sm: 0 1px 2px rgba(13, 43, 54, 0.05), 0 4px 14px rgba(13, 43, 54, 0.04);
    --shadow-md: 0 2px 6px rgba(13, 43, 54, 0.05), 0 18px 42px rgba(13, 43, 54, 0.07);
    --shadow-lg: 0 30px 70px rgba(7, 32, 43, 0.16);
    --radius: 18px;
    --radius-sm: 12px;
    --radius-xs: 9px;
    --sidebar-w: 274px;
    --topbar-h: 74px;
    --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

html[data-theme="navy"] {
    --accent: #1d4ed8;
    --accent-strong: #1e3a8a;
    --accent-2: #3b82f6;
    --accent-soft: #eaf0fe;
    --accent-line: #b9cdf6;
    --ring: rgba(29, 78, 216, 0.18);
    --bg: #f2f5fa;
    --bg-accent: #e6ecf6;
}
html[data-theme="emerald"] {
    --accent: #047857;
    --accent-strong: #065f46;
    --accent-2: #10b981;
    --accent-soft: #e6f8f1;
    --accent-line: #a7e4ce;
    --ring: rgba(4, 120, 87, 0.18);
    --bg: #f2f7f4;
}
html[data-theme="violet"] {
    --accent: #6d28d9;
    --accent-strong: #5b21b6;
    --accent-2: #8b5cf6;
    --accent-soft: #f3eefe;
    --accent-line: #d2c1f6;
    --ring: rgba(109, 40, 217, 0.18);
    --bg: #f5f3fa;
    --bg-accent: #ece7f7;
}

/* ---------- بازنشانی ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.75;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 700; line-height: 1.45; color: var(--text); }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; transition: color 0.16s var(--ease); }
a:hover { color: var(--accent-strong); }
img, svg { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
bdi { unicode-bidi: isolate; }
::selection { background: var(--accent-line); color: var(--navy); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 7px; }
.btn:focus-visible, .icon-btn:focus-visible, .tabs a:focus-visible,
.tabs button:focus-visible, .type-chip:focus-visible, .nav-item:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
button::-moz-focus-inner { border: 0; }
input, select, textarea, button { -webkit-tap-highlight-color: transparent; }
.num, .amount, .money, .kpi-value, .stat-value, .report-table td.num { font-variant-numeric: tabular-nums; }

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: #c3d3cf transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: #c3d3cf; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------- ابزارهای عمومی ---------- */
.muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.mono { font-feature-settings: "tnum"; letter-spacing: 0.4px; }
strong { font-weight: 700; }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
    position: fixed; inset-inline-start: 50%; top: -60px; transform: translateX(50%);
    z-index: 200; background: var(--navy); color: #fff; padding: 8px 18px;
    border-radius: 0 0 12px 12px; transition: top 0.2s;
}
.skip-link:focus { top: 0; color: #fff; }
[hidden] { display: none !important; }

/* ---------- آیکون‌ها ---------- */
.icon, svg.icon, .nav-icon svg, .btn svg, .kpi-icon svg, .icon-btn svg,
.card-link svg, .alert-icon svg, .filter-field > svg, .stat-tile-icon svg {
    width: 18px; height: 18px; flex: 0 0 auto; display: inline-block;
    vertical-align: -3px; stroke-width: 1.8;
}
.btn svg { width: 17px; height: 17px; }
.kpi-icon svg, .stat-tile-icon svg { width: 22px; height: 22px; }
.nav-icon svg { width: 19px; height: 19px; }

/* ---------- دکمه‌ها ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 42px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent;
    appearance: none; -webkit-appearance: none;
    background: var(--surface); color: var(--text-soft); font-weight: 500; font-size: 13.5px;
    text-decoration: none; white-space: nowrap; user-select: none;
    transition: background 0.16s var(--ease), border-color 0.16s, color 0.16s, box-shadow 0.16s, transform 0.1s;
}
.btn:active { transform: translateY(1px); }
/* A flat accent fill avoids any dark hairline from gradient/border clipping
   at fractional browser zoom or device pixel ratios. */
.btn-primary {
    background: var(--accent);
    background-image: none;
    color: #fff; border: 0;
    box-shadow: none;
}
.btn-primary:hover { color: #fff; filter: brightness(1.04); box-shadow: none; }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-soft); box-shadow: var(--shadow-sm); }
.btn-ghost:hover { border-color: var(--accent-line); color: var(--accent-strong); background: var(--surface-soft); }
.btn-soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-strong); }
.btn-soft:hover { background: var(--accent-line); color: var(--accent-strong); }
.btn-danger-soft { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.btn-danger-soft:hover { background: #f9d9dd; color: #9f2f39; }
.btn-light { background: rgba(255, 255, 255, 0.14); border-color: rgba(255, 255, 255, 0.22); color: #fff; }
.btn-light:hover { background: rgba(255, 255, 255, 0.22); color: #fff; }
.btn-glass {
    background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.2);
    color: #fff; backdrop-filter: blur(8px);
}
.btn-glass:hover { background: rgba(255, 255, 255, 0.18); color: #fff; }
.btn-block { width: 100%; }
.btn-lg { height: 50px; padding: 0 26px; font-size: 15px; border-radius: 14px; }
.btn-sm { height: 34px; padding: 0 12px; font-size: 12.5px; border-radius: 9px; gap: 6px; }
.btn-sm svg { width: 15px; height: 15px; }
.btn-xs { height: 28px; padding: 0 9px; font-size: 11.5px; border-radius: 8px; gap: 5px; }
.btn-xs svg { width: 14px; height: 14px; }
.btn[disabled], .btn.is-disabled { opacity: 0.55; pointer-events: none; }
.btn-group { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.stacked-actions { display: flex; flex-direction: column; gap: 8px; }
.stack-form { display: flex; flex-direction: column; gap: 16px; }
.inline-form { display: inline-flex; margin: 0; }
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-soft); position: relative;
    transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent-line); }
.icon-btn-sm { width: 32px; height: 32px; border-radius: 9px; }
.icon-btn-sm svg { width: 15px; height: 15px; }

/* ---------- نشان‌ها و تراشه‌ها ---------- */
.chip {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px;
    border-radius: 999px; font-size: 11.5px; font-weight: 500; line-height: 1.7;
    background: var(--surface-muted); color: var(--text-soft); white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-primary { background: var(--accent-soft); color: var(--accent-strong); }
.chip-success { background: var(--success-soft); color: var(--success); }
.chip-warning { background: var(--warning-soft); color: var(--warning); }
.chip-danger { background: var(--danger-soft); color: var(--danger); }
.chip-info { background: var(--info-soft); color: var(--info); }
.chip-violet { background: var(--violet-soft); color: var(--violet); }
.chip-neutral { background: var(--surface-muted); color: var(--muted); }
.chip-xs { font-size: 10.5px; padding: 1px 8px; }
.code-chip {
    display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px;
    border-radius: 7px; background: var(--surface-muted); border: 1px solid var(--border);
    font-size: 11.5px; color: var(--text-soft); font-variant-numeric: tabular-nums;
}
.badge { display: inline-flex; align-items: center; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.status-dot {
    width: 8px; height: 8px; border-radius: 50%; background: #34d399;
    box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.2); display: inline-block; flex: 0 0 auto;
}
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--muted); }
.dot-primary { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dot-muted { background: var(--muted); }
.req { color: var(--danger); }

/* ---------- کارت‌ها ---------- */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
    padding: 22px; position: relative;
}
.card + .card { margin-top: 18px; }
.card-head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 16px; margin-bottom: 18px; flex-wrap: wrap;
}
.card-head h3 { font-size: 16px; letter-spacing: -0.2px; }
.card-head p { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-head .chip { margin-top: 4px; }
.card-link {
    display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px;
    color: var(--accent); font-weight: 500; white-space: nowrap;
}
.card-link svg { width: 15px; height: 15px; }
.card-link:hover { gap: 7px; }
.card > .table-wrap:last-child, .card > .list-table:last-child { margin-bottom: -6px; }

/* ---------- فرم‌ها ---------- */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .field-label {
    font-size: 12.5px; font-weight: 500; color: var(--text-soft);
    display: flex; align-items: center; gap: 5px;
}
.field > label .req { font-size: 13px; }
.field input:where(:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"])),
.field select, .field textarea,
.input, .select, .textarea {
    width: 100%; height: 44px; padding: 0 13px; border-radius: 10px;
    border: 1px solid var(--border-strong); background: var(--surface);
    color: var(--text); font-size: 13.5px; line-height: 1.6;
    transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
    appearance: none; box-shadow: 0 1px 2px rgba(13, 43, 54, 0.03);
}
.field input:where(:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]):not([type="range"]):not([type="color"]):not([type="submit"]):not([type="button"]):not([type="reset"])):hover,
.field select:hover, .field textarea:hover,
.input:hover, .select:hover, .textarea:hover { border-color: #b8cbc7; }
.field textarea, .textarea { height: auto; min-height: 96px; padding: 11px 13px; resize: vertical; line-height: 1.85; }
.field select, .select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b8189' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left 12px center; padding-left: 36px; cursor: pointer;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus, .select:focus, .textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); background: #fff;
}
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: #9bafb4; opacity: 1; }
.field input:disabled, .field select:disabled, .field textarea:disabled,
.input:disabled, .select:disabled {
    background: var(--surface-muted); color: var(--muted); cursor: not-allowed; box-shadow: none;
}
.field input[readonly], .field textarea[readonly] { background: var(--surface-soft); }
.field input[type="file"] {
    width: 100%; padding: 9px 12px; border: 1px dashed var(--border-strong);
    border-radius: 10px; background: var(--surface-soft); font-size: 12px; cursor: pointer;
}
.field input[type="file"]::file-selector-button {
    font-family: var(--font); font-size: 11.5px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text-soft); border-radius: 8px;
    padding: 5px 11px; margin-inline-end: 10px; cursor: pointer;
}
.field input[type="file"]::file-selector-button:hover { border-color: var(--accent-line); color: var(--accent-strong); }
.field-help, .form-hint { font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.field-full { grid-column: 1 / -1; }
.field-span-2 { grid-column: span 2; }
.input-suffix { position: relative; display: flex; align-items: center; }
.input-suffix input { padding-left: 48px; }
.input-suffix > span {
    position: absolute; left: 12px; font-size: 11.5px; color: var(--muted);
    pointer-events: none; background: var(--surface-soft); border-radius: 6px; padding: 0 5px;
}
.input-icon { position: relative; }
.input-icon > svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; pointer-events: none; }
.input-icon input { padding-right: 38px; text-align: right; }
.password-field { position: relative; }
.password-field input, .input-icon:has(.password-toggle) input { padding-left: 44px; }
.password-toggle {
    position: absolute; left: 6px; top: 50%; transform: translateY(-50%);
    width: 32px; height: 32px; border: 0; background: transparent; color: var(--muted);
    display: inline-flex; align-items: center; justify-content: center; border-radius: 8px;
}
.password-toggle:hover { background: var(--surface-muted); color: var(--text); }
.form-grid { display: grid; gap: 16px 14px; }
.form-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.checkbox-row { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--text-soft); cursor: pointer; }
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--accent); margin-top: 4px; flex: 0 0 auto; }
.checkbox-row-card {
    border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px;
    background: var(--surface-soft); transition: border-color 0.16s, background 0.16s;
}
.checkbox-row-card:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch input + .switch-track, .switch > span:first-of-type {
    width: 42px; height: 24px; background: #cfdcd9; border-radius: 999px; position: relative;
    transition: background 0.18s; flex: 0 0 auto;
}
.switch > span:first-of-type::after {
    content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px;
    background: #fff; border-radius: 50%; transition: transform 0.18s; box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-track, .switch input:checked ~ span:first-of-type { background: var(--accent); }
.switch input:checked + .switch-track::after, .switch input:checked ~ span:first-of-type::after { transform: translateX(-18px); }
.switch input:focus-visible + .switch-track, .switch input:focus-visible ~ span:first-of-type { box-shadow: 0 0 0 4px var(--ring); }
.switch-field {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; background: var(--surface-soft);
}
.switch-field small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 1px; }
.switch-field-sm { padding: 8px 11px; border-radius: 10px; }
.segmented {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px;
    background: var(--surface-muted); padding: 6px; border-radius: 14px;
}
.segment {
    position: relative; display: flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 58px; border-radius: 10px; font-size: 13px; color: var(--text-soft);
    cursor: pointer; transition: background 0.16s, color 0.16s, box-shadow 0.16s;
    text-align: center; padding: 8px 12px;
}
.segment input { position: absolute; opacity: 0; pointer-events: none; }
.segment > span {
    display: grid; grid-template-columns: auto auto; align-items: center; justify-content: center;
    column-gap: 7px; row-gap: 2px; line-height: 1.45; min-width: 0;
}
.segment > span > svg { width: 17px; height: 17px; }
.segment > span > strong { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.segment > span > strong svg { width: 16px; height: 16px; }
.segment > span > small { grid-column: 1 / -1; font-size: 10.5px; line-height: 1.5; color: var(--muted); font-weight: 400; }
.segment:has(input:checked) { background: var(--surface); color: var(--accent-strong); font-weight: 500; box-shadow: var(--shadow-sm); }
.segment:has(input:checked) > span > small { color: var(--text-soft); }
.segmented-sm .segment { min-height: 46px; padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.segmented-sm .segment > span > strong { font-size: 12px; }
.segmented-sm .segment > span > small { font-size: 10px; }
.radio-pills { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- پوسته اصلی ---------- */
.app-shell { min-height: 100vh; }
body.app-body { background: radial-gradient(1200px 500px at 85% -100px, rgba(20, 184, 166, 0.07), transparent 70%), var(--bg); }
.main-area { margin-inline-start: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.main-content { flex: 1; padding: 26px 30px 10px; max-width: 1620px; width: 100%; margin: 0 auto; }
.main-content > * + * { margin-top: 18px; }
.main-content > .page-head + * { margin-top: 0; }

/* ---------- نوار کناری ---------- */
.sidebar {
    position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w);
    background:
        radial-gradient(520px 260px at 100% 0%, rgba(20, 184, 166, 0.16), transparent 65%),
        radial-gradient(420px 300px at 0% 100%, rgba(59, 130, 246, 0.1), transparent 70%),
        linear-gradient(180deg, var(--navy-2), var(--navy) 60%);
    color: #c7d8de; z-index: 60; display: flex; flex-direction: column;
    border-inline-end: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 20px 0 60px -30px rgba(3, 20, 30, 0.6);
}
.sidebar::before {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
    background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
    background-size: 22px 22px;
    mask-image: linear-gradient(180deg, #000, transparent 65%);
}
.sidebar-brand {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 20px 20px 18px; border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    position: relative;
}
.brand-link { display: flex; align-items: center; gap: 11px; color: #fff; min-width: 0; }
.brand-link:hover { color: #fff; }
.brand-mark {
    width: 44px; height: 44px; border-radius: 13px; flex: 0 0 auto;
    display: inline-flex; align-items: center; justify-content: center;
    background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 24px -12px rgba(34, 211, 238, 0.6);
}
.brand-mark svg { width: 40px; height: 40px; }
.brand-mark-lg { width: 56px; height: 56px; border-radius: 16px; }
.brand-mark-lg svg { width: 50px; height: 50px; }
.brand-logo { width: 44px; height: 44px; border-radius: 12px; object-fit: contain; background: #fff; padding: 3px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.5; min-width: 0; }
.brand-text strong { font-size: 16px; color: #fff; letter-spacing: -0.2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-text small { font-size: 10.5px; color: #7fa0ac; letter-spacing: 0.2px; }
.sidebar-close { display: none; background: rgba(255, 255, 255, 0.06); border-color: rgba(255, 255, 255, 0.12); color: #dbe7ea; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 12px 8px; position: relative; scrollbar-color: rgba(255,255,255,0.18) transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); background-clip: content-box; }
.nav-group { margin-bottom: 14px; }
.nav-label {
    font-size: 10px; font-weight: 500; color: #6c8b97; letter-spacing: 0.6px;
    padding: 6px 12px 5px; text-transform: uppercase;
}
.nav-item {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin-bottom: 2px;
    border-radius: 10px; color: #b9cdd4; font-size: 13px; position: relative;
    transition: background 0.16s, color 0.16s, padding 0.16s; border: 1px solid transparent;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.055); color: #fff; }
.nav-item.is-active {
    background: linear-gradient(90deg, rgba(20, 184, 166, 0.2), rgba(20, 184, 166, 0.06));
    color: #eafffb; border-color: rgba(45, 212, 191, 0.18);
}
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 24px; opacity: 0.9; }
.nav-item.is-active .nav-icon { color: #2dd4bf; opacity: 1; }
.nav-text { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-indicator {
    width: 4px; height: 18px; border-radius: 4px; background: linear-gradient(180deg, #2dd4bf, #34d399);
    box-shadow: 0 0 12px rgba(45, 212, 191, 0.65); flex: 0 0 auto;
}
.sidebar-footer {
    padding: 12px 16px 16px; border-top: 1px solid rgba(255, 255, 255, 0.07); position: relative;
}
.sidebar-version { display: flex; align-items: center; gap: 8px; font-size: 10.5px; color: #7897a2; padding: 0 4px 10px; }
.sidebar-logout {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
    height: 38px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.04); color: #a9c0c8; font-size: 12px;
    transition: background 0.16s, color 0.16s;
}
.sidebar-logout:hover { background: rgba(244, 63, 94, 0.14); color: #fda4af; border-color: rgba(244, 63, 94, 0.25); }
.sidebar-logout svg { width: 16px; height: 16px; }
.sidebar-overlay {
    position: fixed; inset: 0; background: rgba(5, 22, 30, 0.55); z-index: 55;
    backdrop-filter: blur(2px); animation: fadeIn 0.2s var(--ease);
}

/* ---------- نوار بالا ---------- */
.topbar {
    height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
    gap: 20px; padding: 0 30px; background: rgba(255, 255, 255, 0.82);
    backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--border);
    position: sticky; top: 0; z-index: 40;
}
.topbar-start { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1; }
.topbar-end { display: flex; align-items: center; gap: 12px; }
.menu-toggle { display: none; }
.topbar-date {
    font-size: 12px; color: var(--muted); white-space: nowrap;
    padding-inline-end: 6px; border-inline-end: 1px solid var(--border); padding-left: 14px;
}
.global-search {
    display: flex; align-items: center; gap: 9px; height: 42px; width: min(450px, 100%);
    background: var(--surface-soft); border: 1px solid var(--border); border-radius: 12px;
    padding: 0 13px; color: var(--muted); transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.global-search:focus-within { border-color: var(--accent-line); background: #fff; box-shadow: 0 0 0 4px var(--ring); }
.global-search svg { width: 17px; height: 17px; flex: 0 0 auto; }
.global-search input { border: 0; background: transparent; outline: 0; flex: 1; font-size: 12.5px; min-width: 0; color: var(--text); }
.global-search kbd {
    font-family: var(--font); font-size: 10px; color: var(--muted); background: #fff;
    border: 1px solid var(--border); border-radius: 6px; padding: 1px 5px; direction: ltr;
}
.notification-btn .notif-badge {
    position: absolute; top: -4px; inset-inline-end: -4px; min-width: 18px; height: 18px;
    border-radius: 999px; background: var(--danger); color: #fff; font-size: 10px;
    display: inline-flex; align-items: center; justify-content: center; padding: 0 4px;
    border: 2px solid #fff; line-height: 1;
}
.user-menu {
    display: flex; align-items: center; gap: 9px; border: 1px solid var(--border);
    background: var(--surface); border-radius: 12px; padding: 4px 8px 4px 10px;
    color: var(--text); transition: border-color 0.16s, background 0.16s;
}
.user-menu:hover { border-color: var(--accent-line); background: var(--surface-soft); }
.user-menu > svg { width: 15px; height: 15px; color: var(--muted); }
.avatar {
    display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px;
    border-radius: 10px; background: linear-gradient(135deg, var(--accent-2), var(--accent));
    color: #fff; font-size: 12px; font-weight: 700; flex: 0 0 auto; letter-spacing: 0.3px;
}
.avatar-sm { width: 28px; height: 28px; border-radius: 8px; font-size: 10.5px; }
.avatar-lg { width: 42px; height: 42px; border-radius: 12px; font-size: 14px; }
.avatar-xl { width: 76px; height: 76px; border-radius: 20px; font-size: 24px; }
.user-meta { display: flex; flex-direction: column; line-height: 1.45; text-align: start; }
.user-meta strong { font-size: 12.5px; font-weight: 500; }
.user-meta small { font-size: 10.5px; color: var(--muted); }

/* ---------- منوهای بازشو ---------- */
.dropdown { position: relative; }
.dropdown-menu {
    position: absolute; top: calc(100% + 10px); inset-inline-end: 0; min-width: 260px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: var(--shadow-md); padding: 8px; z-index: 80;
    animation: dropdownIn 0.18s var(--ease); transform-origin: top left;
}
html[dir="rtl"] .dropdown-menu { transform-origin: top right; }
.dropdown-head { font-size: 11.5px; font-weight: 500; color: var(--muted); padding: 7px 10px 9px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown-item {
    display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px;
    border: 0; background: transparent; border-radius: 9px; font-size: 12.5px;
    color: var(--text-soft); text-align: start; transition: background 0.14s, color 0.14s;
}
.dropdown-item:hover { background: var(--accent-soft); color: var(--accent-strong); }
.dropdown-item.is-danger { color: var(--danger); }
.dropdown-item.is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.dropdown-item svg { width: 17px; height: 17px; }
.dropdown-user {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px 12px;
    border-bottom: 1px solid var(--border); margin-bottom: 6px;
}
.dropdown-user strong { display: block; font-size: 13px; }
.dropdown-user small { color: var(--muted); font-size: 11px; }
.dropdown-empty { padding: 22px 12px; text-align: center; color: var(--muted); font-size: 12px; }
.dropdown-empty svg { width: 30px; height: 30px; color: var(--success); margin-bottom: 6px; }
.notifications-menu { min-width: 300px; }
.notification-item {
    display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 10px;
    color: var(--text); transition: background 0.14s;
}
.notification-item:hover { background: var(--surface-soft); color: var(--text); }
.notification-item strong { display: block; font-size: 12px; font-weight: 500; }
.notification-item small { color: var(--muted); font-size: 11px; }
.notification-icon {
    width: 34px; height: 34px; border-radius: 9px; display: inline-flex;
    align-items: center; justify-content: center; flex: 0 0 auto;
}
.notification-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.notification-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.notification-icon svg { width: 17px; height: 17px; }

/* ---------- سرصفحه صفحه ---------- */
.page-head {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
    margin-bottom: 22px; flex-wrap: wrap;
}
.page-head-text { min-width: 0; }
.breadcrumb { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--muted); margin-bottom: 5px; }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb span:last-child { color: var(--text-soft); }
.page-head h1 { font-size: 23px; letter-spacing: -0.5px; line-height: 1.4; }
.page-head-text > p { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.page-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }

/* ---------- هشدارها و فلش ---------- */
.flash-stack { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.alert {
    display: flex; align-items: flex-start; gap: 11px; padding: 12px 15px;
    border-radius: 13px; border: 1px solid var(--border); background: var(--surface);
    font-size: 13px; box-shadow: var(--shadow-sm); margin-bottom: 16px;
    animation: slideDown 0.3s var(--ease);
}
.flash-stack .alert { margin-bottom: 0; }
.alert-icon { flex: 0 0 auto; display: inline-flex; margin-top: 1px; }
.alert-icon svg { width: 19px; height: 19px; }
.alert-text { flex: 1; line-height: 1.75; }
.alert-close {
    flex: 0 0 auto; border: 0; background: transparent; color: currentColor; opacity: 0.55;
    width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center;
}
.alert-close:hover { opacity: 1; background: rgba(0, 0, 0, 0.06); }
.alert-close svg { width: 15px; height: 15px; }
.alert-success { background: var(--success-soft); border-color: #bfe8d6; color: #0d6647; }
.alert-error, .alert-danger { background: var(--danger-soft); border-color: #f3c9ce; color: #9f2f39; }
.alert-warning { background: var(--warning-soft); border-color: #f0dcb4; color: #8c5c10; }
.alert-info { background: var(--info-soft); border-color: #c9dcf4; color: #1f4f85; }
.document-link-alert { align-items: flex-start; margin-bottom: 0; }
.document-link-alert .alert-text strong { display: block; font-size: 13px; margin-bottom: 1px; }
.document-link-alert .alert-text span { display: block; font-size: 12.5px; line-height: 1.8; opacity: 0.92; }
.document-link-alert .alert-text a { color: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.document-link-alert .alert-text a:hover { opacity: 0.78; }
.alert-list { margin: 6px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 3px; }
.alert-list li { position: relative; padding-inline-start: 14px; font-size: 12.5px; }
.alert-list li::before { content: ""; position: absolute; inset-inline-start: 2px; top: 10px; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.alert-list-mini { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.note-box {
    display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px;
    background: var(--surface-soft); border: 1px dashed var(--border-strong); color: var(--text-soft);
    font-size: 12px; line-height: 1.8;
}
.note-icon { color: var(--accent); flex: 0 0 auto; margin-top: 2px; }
.note-icon svg { width: 17px; height: 17px; }

/* ---------- اعلان شناور ---------- */
.toast-stack {
    position: fixed; bottom: 22px; inset-inline-start: 22px; z-index: 120;
    display: flex; flex-direction: column; gap: 9px; max-width: min(360px, calc(100vw - 44px));
}
.toast {
    display: flex; align-items: center; gap: 10px; padding: 12px 15px; border-radius: 12px;
    background: var(--navy); color: #e8f3f3; font-size: 12.5px; box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s var(--ease); border: 1px solid rgba(255, 255, 255, 0.08);
}
.toast.is-success { background: #0f5c46; }
.toast.is-error { background: #8f2b35; }
.toast svg { width: 17px; height: 17px; flex: 0 0 auto; }
.toast.is-leaving { animation: toastOut 0.25s var(--ease) forwards; }

/* ---------- پاورقی ---------- */
.app-footer {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 26px 2px 18px; margin-top: 18px; color: var(--muted); font-size: 11.5px;
    border-top: 1px solid rgba(207, 219, 216, 0.6); flex-wrap: wrap;
}
.footer-links { display: flex; gap: 16px; }
.footer-links a { color: var(--muted); }
.footer-links a:hover { color: var(--accent); }

/* ---------- انیمیشن‌ها ---------- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dropdownIn { from { opacity: 0; transform: translateY(-6px) scale(0.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* ==========================================================================
   بخش ۲: میزکار، جدول‌ها، فیلترها و صفحات مدیریتی
   ========================================================================== */

/* ---------- میزکار ---------- */
.dashboard { display: flex; flex-direction: column; gap: 18px; }
.hero-card {
    position: relative; overflow: hidden; border-radius: 22px; padding: 28px 30px;
    background:
        radial-gradient(600px 300px at 0% -30%, rgba(34, 211, 238, 0.22), transparent 60%),
        radial-gradient(500px 320px at 100% 110%, rgba(52, 211, 153, 0.18), transparent 60%),
        linear-gradient(135deg, #0b2b3c 0%, #0a2130 55%, #08202c 100%);
    color: #e9f4f5; box-shadow: var(--shadow-md); border: 1px solid rgba(255, 255, 255, 0.06);
    display: flex; align-items: center; justify-content: space-between; gap: 28px; flex-wrap: wrap;
}
.hero-card::before {
    content: ""; position: absolute; inset: 0; opacity: 0.35; pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 20px 20px;
    mask-image: linear-gradient(120deg, transparent 30%, #000);
}
.hero-card > * { position: relative; z-index: 1; }
.hero-content { max-width: 620px; }
.hero-eyebrow {
    display: inline-flex; align-items: center; gap: 7px; font-size: 11px; color: #7fe4d7;
    background: rgba(45, 212, 191, 0.1); border: 1px solid rgba(45, 212, 191, 0.2);
    border-radius: 999px; padding: 3px 11px; margin-bottom: 12px;
}
.hero-eyebrow .dot { background: #2dd4bf; box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.18); }
.hero-card h2 { font-size: 25px; color: #fff; letter-spacing: -0.4px; margin-bottom: 8px; }
.hero-card h2 span { color: #5eead4; }
.hero-card p { color: #a7c2cc; font-size: 13px; max-width: 540px; line-height: 1.9; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.hero-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 280px; }
.hero-stat {
    background: rgba(255, 255, 255, 0.055); border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px; padding: 12px 14px; backdrop-filter: blur(6px);
}
.hero-stat span { display: block; font-size: 10.5px; color: #93b3bd; margin-bottom: 2px; }
.hero-stat strong { font-size: 17px; color: #fff; font-variant-numeric: tabular-nums; }
.hero-stat small { display: block; font-size: 10.5px; color: #6d919d; margin-top: 2px; }
.hero-decor {
    position: absolute; inset-inline-start: -60px; bottom: -80px; width: 240px; height: 240px;
    border-radius: 50%; border: 40px solid rgba(45, 212, 191, 0.05); pointer-events: none;
}

/* KPI */
.kpi-grid { display: grid; gap: 14px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpi-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 17px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
    transition: transform 0.16s var(--ease), box-shadow 0.16s, border-color 0.16s;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.kpi-card::after {
    content: ""; position: absolute; inset-inline-start: 0; top: 0; width: 100%; height: 3px;
    background: linear-gradient(90deg, var(--accent-2), transparent 70%); opacity: 0; transition: opacity 0.2s;
}
.kpi-card:hover::after { opacity: 1; }
.kpi-top { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.kpi-icon {
    width: 36px; height: 36px; border-radius: 10px; display: inline-flex;
    align-items: center; justify-content: center; flex: 0 0 auto;
    background: var(--accent-soft); color: var(--accent-strong);
}
.kpi-label { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.kpi-value { display: block; font-size: 21px; font-weight: 700; letter-spacing: -0.4px; line-height: 1.5; }
.kpi-value small { font-size: 11px; font-weight: 400; color: var(--muted); margin-inline-start: 3px; }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 10.5px; color: var(--muted); margin-top: 7px; }
.kpi-foot a { font-weight: 500; color: var(--accent); }
.kpi-card-sm { padding: 14px 15px; }
.kpi-card-sm .kpi-top { margin-bottom: 8px; }
.kpi-card-sm .kpi-icon { width: 30px; height: 30px; border-radius: 9px; }
.kpi-card-sm .kpi-icon svg { width: 17px; height: 17px; }
.kpi-card-sm .kpi-label { font-size: 10.5px; }
.kpi-card-sm .kpi-value { font-size: 16px; }
.tone-teal { background: var(--accent-soft); color: var(--accent-strong); }
.tone-green { background: var(--success-soft); color: var(--success); }
.tone-rose { background: var(--rose-soft); color: var(--rose); }
.tone-amber { background: var(--warning-soft); color: var(--warning); }
.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-blue { background: var(--info-soft); color: var(--info); }
.tone-red { background: var(--danger-soft); color: var(--danger); }

/* شبکه‌های میزکار */
.dashboard-grid { display: grid; gap: 18px; }
.dashboard-grid-main { grid-template-columns: minmax(0, 1.9fr) minmax(0, 1fr); align-items: start; }
.dashboard-grid-two { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.dashboard-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.chart-card { padding: 20px 22px; }
.chart-card .card-head { margin-bottom: 10px; }
.chart-holder { position: relative; height: 300px; width: 100%; }
.chart-holder canvas { width: 100% !important; height: 100% !important; }
.chart-summary { display: flex; gap: 18px; flex-wrap: wrap; }
.chart-summary span { font-size: 11px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.legend-inline { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.legend-inline .dot { width: 7px; height: 7px; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }

/* لیست رتبه‌بندی */
.rank-list { display: flex; flex-direction: column; }
.rank-row {
    display: flex; align-items: center; gap: 11px; padding: 11px 2px;
    border-bottom: 1px dashed var(--border); text-decoration: none; color: var(--text);
}
.rank-row:last-child { border-bottom: 0; }
.rank-row:hover { color: var(--accent-strong); }
.rank-number {
    width: 26px; height: 26px; border-radius: 8px; background: var(--surface-muted);
    display: inline-flex; align-items: center; justify-content: center; font-size: 11px;
    color: var(--muted); flex: 0 0 auto; font-weight: 500;
}
.rank-row:first-child .rank-number { background: var(--accent-soft); color: var(--accent-strong); }
.rank-text { flex: 1; min-width: 0; }
.rank-text strong { display: block; font-size: 12.5px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-text small { display: block; color: var(--muted); font-size: 10.5px; }
.rank-amount { font-size: 12px; color: var(--text-soft); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* خزانه کوچک */
.treasury-mini { display: flex; flex-direction: column; gap: 4px; }
.treasury-mini-row {
    display: flex; align-items: center; gap: 10px; padding: 9px 4px; border-radius: 10px;
    transition: background 0.14s; color: var(--text);
}
.treasury-mini-row:hover { background: var(--surface-soft); }
.treasury-mini-icon {
    width: 34px; height: 34px; border-radius: 10px; display: inline-flex;
    align-items: center; justify-content: center; flex: 0 0 auto;
}
.treasury-mini-icon svg { width: 17px; height: 17px; }
.treasury-mini-icon.is-bank { background: var(--info-soft); color: var(--info); }
.treasury-mini-icon.is-cash { background: var(--success-soft); color: var(--success); }
.treasury-mini-info { flex: 1; min-width: 0; }
.treasury-mini-info strong { display: block; font-size: 12.5px; font-weight: 500; }
.treasury-mini-info small { display: block; color: var(--muted); font-size: 10.5px; }
.treasury-mini-amount { font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* اقدام‌های سریع */
.quick-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.quick-action {
    display: flex; align-items: center; gap: 9px; padding: 11px 12px; border-radius: 11px;
    border: 1px solid var(--border); background: var(--surface-soft); color: var(--text-soft);
    font-size: 12px; transition: background 0.14s, border-color 0.14s, color 0.14s;
}
.quick-action:hover { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.quick-action svg { width: 17px; height: 17px; flex: 0 0 auto; }
.quick-search-card { background: linear-gradient(135deg, var(--accent-soft), #fff); border-color: var(--accent-line); }
.quick-search-grid { display: grid; gap: 8px; margin-top: 12px; }

/* نوار آماری */
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat-tile {
    display: flex; align-items: center; justify-content: center; gap: 11px; padding: 14px 16px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    transition: border-color 0.16s, background 0.16s, box-shadow 0.16s;
}
.stat-tile:hover { border-color: var(--accent-line); background: var(--surface-soft); }
.stat-tile-icon { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.stat-tile > span:not(.stat-tile-icon) { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; min-width: 0; font-size: 10.5px; color: var(--muted); }
.stat-tile strong { display: block; font-size: 17px; line-height: 1.4; color: var(--text); font-variant-numeric: tabular-nums; }
.stat-tile small { display: block; font-size: 10.5px; line-height: 1.5; color: var(--muted); }

/* ---------- جدول‌ها ---------- */
.table-wrap { width: 100%; overflow-x: auto; border-radius: 12px; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.data-table thead th {
    background: var(--surface-soft); color: var(--muted); font-weight: 500; font-size: 11px;
    text-align: start; padding: 10px 12px; white-space: nowrap;
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1;
}
.data-table thead th:first-child { border-radius: 0 10px 10px 0; }
.data-table thead th:last-child { border-radius: 10px 0 0 10px; }
.data-table tbody td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover { background: var(--surface-soft); }
.data-table tfoot td { padding: 11px 12px; border-top: 1px solid var(--border-strong); font-weight: 500; background: var(--surface-soft); }
.data-table .num, .data-table th.num { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table td.actions-col, .data-table th.actions-col { width: 1%; white-space: nowrap; text-align: center; }
.data-table .col-index { width: 42px; text-align: center; color: var(--muted); font-size: 11px; }
.table-link { font-weight: 500; color: var(--text); }
.table-link:hover { color: var(--accent); }
.table-main { display: block; font-weight: 500; color: var(--text); line-height: 1.6; }
.table-sub { display: block; color: var(--muted); font-size: 10.5px; line-height: 1.6; }
.entity-cell { display: flex; align-items: center; gap: 9px; min-width: 0; }
.entity-cell .avatar { width: 32px; height: 32px; border-radius: 9px; font-size: 11px; }
.entity-cell > div { min-width: 0; }
.row-actions { display: inline-flex; align-items: center; gap: 4px; }
.row-actions a, .row-actions button {
    width: 30px; height: 30px; border-radius: 8px; border: 0; background: transparent;
    color: var(--muted); display: inline-flex; align-items: center; justify-content: center;
    transition: background 0.14s, color 0.14s;
}
.row-actions a:hover, .row-actions button:hover { background: var(--accent-soft); color: var(--accent-strong); }
.row-actions .is-danger:hover { background: var(--danger-soft); color: var(--danger); }
.row-actions .is-convert { color: var(--violet); }
.row-actions .is-convert:hover { background: var(--violet-soft); color: var(--violet); }
.row-actions svg { width: 15px; height: 15px; }
.row-index { color: var(--muted); font-size: 11px; }
.actions-col form { display: inline-flex; }
.select-sm {
    height: 30px; border-radius: 8px; border: 1px solid var(--border-strong);
    background: var(--surface); font-size: 11.5px; padding: 0 8px; max-width: 120px;
}

/* لیست کارتی */
.list-table { display: flex; flex-direction: column; }
.list-table-row {
    display: flex; align-items: center; gap: 11px; padding: 11px 4px;
    border-bottom: 1px solid var(--border); color: var(--text);
}
.list-table-row:last-child { border-bottom: 0; }
.list-table-row:hover { color: var(--accent-strong); }
.list-icon {
    width: 34px; height: 34px; border-radius: 9px; background: var(--surface-muted);
    color: var(--text-soft); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.list-icon svg { width: 16px; height: 16px; }
.list-text { flex: 1; min-width: 0; }
.list-text strong { display: block; font-size: 12.5px; font-weight: 500; }
.list-text small { display: block; color: var(--muted); font-size: 10.5px; }
.list-amount, .list-table-amount { font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list-table-text { flex: 1; min-width: 0; }
.list-table-text strong { display: block; font-size: 12.5px; font-weight: 500; }
.list-table-text small { display: block; color: var(--muted); font-size: 10.5px; }
.category-row .list-table-text strong { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.category-row .chip { font-size: 9px; padding: 1px 6px; }

/* ---------- فیلترها و صفحه‌بندی ---------- */
.filter-bar {
    display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap;
    margin-bottom: 16px; padding-bottom: 15px; border-bottom: 1px solid var(--border);
}
.filter-field { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.filter-field > label { font-size: 10.5px; color: var(--muted); padding-inline-start: 3px; }
.filter-field select, .filter-field input {
    height: 39px; border-radius: 10px; border: 1px solid var(--border-strong);
    background: var(--surface); padding: 0 11px; font-size: 12.5px; min-width: 0;
}
.filter-field select {
    padding-left: 30px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b8189' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left 10px center; appearance: none;
}
.filter-field input:focus, .filter-field select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.filter-search {
    position: relative; flex: 1; min-width: 220px; max-width: 360px; flex-direction: row; align-items: center;
}
.filter-search svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; z-index: 1; }
.filter-search input { width: 100%; padding-right: 36px; }
.filter-date { flex-direction: column; }
.filter-actions { display: flex; gap: 7px; align-items: center; }
.filter-actions .btn { height: 39px; }
.pagination {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); flex-wrap: wrap;
}
.pagination-info { font-size: 11.5px; color: var(--muted); }
.pagination-links { display: flex; gap: 4px; flex-wrap: wrap; }
.pagination-links a, .pagination-links span {
    min-width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border);
    background: var(--surface); display: inline-flex; align-items: center; justify-content: center;
    font-size: 11.5px; color: var(--text-soft); padding: 0 8px;
}
.pagination-links a:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--accent-strong); }
.pagination-links .is-active { background: var(--accent); border-color: var(--accent); color: #fff; }
.pagination-links .is-disabled { opacity: 0.45; pointer-events: none; }

/* ---------- حالت خالی ---------- */
.empty-state { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty-icon {
    width: 64px; height: 64px; border-radius: 18px; background: var(--accent-soft);
    color: var(--accent); display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 13px;
}
.empty-icon svg { width: 30px; height: 30px; }
.empty-state h4 { font-size: 14px; color: var(--text-soft); margin-bottom: 4px; }
.empty-state p { font-size: 12px; max-width: 340px; margin: 0 auto 14px; }
.empty-inline { padding: 18px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- تب‌ها ---------- */
.tabs-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    flex-wrap: wrap; margin-bottom: 18px;
}
.tabs { display: flex; gap: 4px; flex-wrap: wrap; background: var(--surface-muted); padding: 4px; border-radius: 12px; }
.tabs a, .tabs button {
    display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px;
    border-radius: 9px; border: 0; background: transparent; color: var(--text-soft);
    font-size: 12px; font-weight: 500; transition: background 0.14s, color 0.14s, box-shadow 0.14s;
}
.tabs a:hover, .tabs button:hover { color: var(--accent-strong); }
.tabs a.is-active, .tabs button.is-active, .tabs .is-active {
    background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow-sm);
}
.tab-count { font-size: 10px; background: var(--surface-muted); border-radius: 999px; padding: 0 6px; color: var(--muted); }
.tabs-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tabs-row + .card { margin-top: 0; }

/* ---------- شبکه ویرایش ---------- */
.crud-grid { display: grid; grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.6fr); gap: 18px; align-items: start; }
.form-page { width: 100%; }
.form-layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.form-layout-narrow { grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr); }
.form-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.form-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.form-side, .detail-side {
    position: sticky; top: calc(var(--topbar-h) + 18px); align-self: start;
    max-height: calc(100vh - var(--topbar-h) - 36px);
    max-height: calc(100dvh - var(--topbar-h) - 36px);
    overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.form-side > *, .detail-side > * { flex: 0 0 auto; }
.form-card { padding: 20px 22px; }
.form-actions {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 18px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 14px; box-shadow: var(--shadow-sm); flex-wrap: wrap; margin-top: 18px;
}
.form-actions .btn-group { margin-inline-start: auto; }
.sticky-card { position: static; }
.help-list { display: flex; flex-direction: column; gap: 7px; font-size: 11.5px; color: var(--muted); }
.help-list li { display: flex; gap: 7px; align-items: flex-start; }
.help-list li::before { content: "•"; color: var(--accent); font-weight: 700; }
.info-block { display: flex; flex-direction: column; gap: 3px; }
.info-block span { font-size: 10.5px; color: var(--muted); }
.info-block strong { font-size: 13px; font-weight: 500; }
.info-list { display: flex; flex-direction: column; gap: 0; }
.info-list > div { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--border); font-size: 12.5px; }
.info-list > div:last-child { border-bottom: 0; }
.info-list dt, .info-list span:first-child { color: var(--muted); font-size: 11.5px; }
.info-list dd, .info-list strong { margin: 0; font-weight: 500; text-align: end; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.summary-list { display: flex; flex-direction: column; gap: 2px; }
.summary-list > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; font-size: 12.5px; border-bottom: 1px dashed var(--border); }
.summary-list > div:last-child { border-bottom: 0; }
.summary-list span { color: var(--muted); }
.summary-list strong { font-variant-numeric: tabular-nums; }
.summary-list .is-grand { border-top: 1px solid var(--border-strong); border-bottom: 0; margin-top: 4px; padding-top: 11px; font-size: 14px; }
.summary-progress { height: 6px; border-radius: 99px; background: var(--surface-muted); overflow: hidden; margin: 6px 0; }
.summary-progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.progress { height: 7px; border-radius: 99px; background: var(--surface-muted); overflow: hidden; }
.progress > span, .progress-bar { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: inherit; }
.strong { font-weight: 700; }
.is-positive { color: var(--success); }
.is-negative { color: var(--danger); }
.is-muted { color: var(--muted); }
.text-muted { color: var(--muted); }

/* ---------- جزئیات و پروفایل ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.detail-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.detail-side { display: flex; flex-direction: column; gap: 18px; min-width: 0; position: sticky; top: calc(var(--topbar-h) + 18px); }
.profile-hero {
    position: relative; overflow: hidden; border-radius: var(--radius); border: 1px solid var(--border);
    background:
        radial-gradient(420px 200px at 100% -30%, rgba(20, 184, 166, 0.1), transparent 65%),
        var(--surface);
    box-shadow: var(--shadow-sm); padding: 22px 24px 20px; margin-bottom: 18px;
    display: flex; flex-direction: column; gap: 18px;
}
.profile-identity { display: flex; align-items: center; gap: 16px; min-width: 0; }
.profile-identity > .avatar { box-shadow: 0 0 0 4px var(--accent-soft); }
.profile-identity > div { min-width: 0; }
.profile-identity h2 { font-size: 20px; line-height: 1.4; letter-spacing: -0.3px; }
.profile-cover {
    height: 110px;
    background:
        radial-gradient(400px 200px at 90% -40%, rgba(52, 211, 153, 0.35), transparent 70%),
        linear-gradient(120deg, #0b2e3d, #0f4a50);
    position: relative;
}
.profile-cover::after {
    content: ""; position: absolute; inset: 0; opacity: 0.4;
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 18px 18px;
}
.profile-card { padding: 0 24px 22px; }
.profile-avatar { margin-top: -40px; position: relative; display: inline-flex; border: 4px solid var(--surface); border-radius: 20px; background: var(--surface); }
.profile-meta { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.profile-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.profile-company { font-size: 12px; color: var(--text-soft); margin-top: 3px; }
.profile-contact-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); margin-top: 9px; }
.profile-contact-row span { display: inline-flex; align-items: center; gap: 5px; }
.profile-contact-row svg { width: 14px; height: 14px; }
.profile-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 0; }
.profile-metric {
    padding: 12px 14px; border-radius: 12px; background: var(--surface-soft);
    border: 1px solid var(--border);
}
.profile-metric span { display: block; font-size: 10.5px; color: var(--muted); }
.profile-metric strong { display: block; margin-top: 2px; font-size: 16px; line-height: 1.5; font-variant-numeric: tabular-nums; }
.profile-metric small { display: block; margin-top: 1px; font-size: 10.5px; line-height: 1.5; color: var(--muted); }
.profile-layout { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, 1fr); gap: 18px; align-items: start; }
.profile-main { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.profile-card-body { padding: 20px 22px; }
.profile-security-note { font-size: 11px; color: var(--muted); }
.detail-grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.party-box { border: 1px solid var(--border); border-radius: 13px; padding: 13px 15px; background: var(--surface-soft); }
.party-label { font-size: 10.5px; color: var(--muted); margin-bottom: 3px; }
.party-box strong { display: block; font-size: 13px; margin-bottom: 2px; }
.party-box p { font-size: 11.5px; color: var(--text-soft); line-height: 1.8; }
.address-box { font-size: 12px; color: var(--text-soft); line-height: 1.9; padding: 11px 13px; border-radius: 11px; background: var(--surface-soft); border: 1px solid var(--border); }
.contact-preview { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--border); }
.contact-preview-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--accent-soft); color: var(--accent-strong); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.contact-preview-icon svg { width: 17px; height: 17px; }
.contact-preview-body { min-width: 0; flex: 1; }
.contact-preview-body strong { display: block; font-size: 12.5px; font-weight: 500; }
.contact-preview-phone { font-size: 10.5px; color: var(--muted); direction: ltr; text-align: start; }
.danger-zone { border: 1px solid #f3c9ce; border-radius: 14px; padding: 16px; background: #fffafa; }
.danger-zone h3 { color: var(--danger); font-size: 14px; margin-bottom: 3px; }
.danger-zone p { font-size: 11.5px; color: var(--muted); margin-bottom: 10px; }

/* ---------- تنظیمات ---------- */
.settings-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 20px; align-items: start; }
.settings-nav {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 8px; box-shadow: var(--shadow-sm); position: sticky; top: calc(var(--topbar-h) + 18px);
    display: flex; flex-direction: column; gap: 3px;
}
.settings-nav a {
    display: flex; align-items: center; gap: 10px; padding: 10px 11px; border-radius: 10px;
    color: var(--text-soft); font-size: 12.5px; transition: background 0.14s, color 0.14s;
}
.settings-nav a:hover { background: var(--surface-soft); color: var(--accent-strong); }
.settings-nav a.is-active { background: var(--accent-soft); color: var(--accent-strong); font-weight: 500; }
.settings-nav-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--surface-muted); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.settings-nav a.is-active .settings-nav-icon { background: #fff; color: var(--accent); }
.settings-nav-icon svg { width: 16px; height: 16px; }
.settings-nav-text { flex: 1; min-width: 0; }
.settings-nav-text strong { display: block; font-size: 12px; font-weight: 500; }
.settings-nav-text small { display: block; font-size: 10px; color: var(--muted); }
.settings-nav-note { padding: 12px 10px 6px; margin-top: 4px; border-top: 1px solid var(--border); font-size: 10.5px; color: var(--muted); line-height: 1.9; }
.settings-content { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.settings-subhead {
    grid-column: 1 / -1; font-size: 11px; font-weight: 500; color: var(--accent-strong);
    border-top: 1px dashed var(--border); padding-top: 12px; margin-top: 4px;
}
.settings-subhead:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 11px; }
.theme-preview { position: relative; display: block; cursor: pointer; }
.theme-preview input { position: absolute; opacity: 0; }
.theme-preview-inner, .theme-preview > span:last-child {
    display: block; border: 2px solid var(--border); border-radius: 12px; overflow: hidden;
    transition: border-color 0.16s, box-shadow 0.16s;
}
.theme-preview:has(input:checked) .theme-preview-inner,
.theme-preview:has(input:checked) > span:last-child { border-color: var(--accent); box-shadow: 0 0 0 4px var(--ring); }
.theme-swatch { height: 58px; display: flex; }
.theme-swatch i { flex: 1; display: block; }
.theme-preview strong { display: block; padding: 7px 10px; font-size: 11.5px; font-weight: 500; background: var(--surface); }
.company-logo-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.company-logo-preview {
    width: 70px; height: 70px; border-radius: 14px; border: 1px dashed var(--border-strong);
    background: var(--surface-soft); display: inline-flex; align-items: center; justify-content: center;
    color: var(--muted); overflow: hidden; flex: 0 0 auto;
}
.company-logo-preview img { width: 100%; height: 100%; object-fit: contain; }
.company-logo-fields { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 7px; }
.invoice-note-fields { display: flex; flex-direction: column; gap: 13px; }
.role-guide { display: flex; flex-direction: column; gap: 8px; font-size: 11.5px; color: var(--muted); }
.role-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.role-card {
    position: relative; border: 1px solid var(--border); border-radius: 12px; padding: 12px;
    cursor: pointer; background: var(--surface-soft); transition: border-color 0.16s, background 0.16s;
    display: flex; flex-direction: column; gap: 6px;
}
.role-card input { position: absolute; opacity: 0; }
.role-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.role-icon { width: 30px; height: 30px; border-radius: 8px; background: var(--surface); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; }
.role-icon svg { width: 16px; height: 16px; }
.role-card strong { font-size: 12px; }
.role-card small { font-size: 10.5px; color: var(--muted); line-height: 1.7; }
.role-option-icon { color: var(--accent); }

/* ---------- جستجو، فعالیت و پشتیبان ---------- */
.search-hero {
    border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow-sm);
    background:
        radial-gradient(500px 240px at 100% -30%, rgba(45, 212, 191, 0.12), transparent 70%),
        var(--surface);
    padding: 24px; margin-bottom: 20px;
}
.search-hero-body { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.search-hero-icon { width: 48px; height: 48px; border-radius: 13px; background: var(--accent-soft); color: var(--accent-strong); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.search-hero-icon svg { width: 24px; height: 24px; }
.search-hero h2 { font-size: 18px; margin-bottom: 2px; }
.search-hero p { font-size: 12px; color: var(--muted); }
.search-hero-form { display: flex; gap: 8px; max-width: 640px; }
.search-hero-form .input-icon { flex: 1; }
.search-hero-form input { height: 46px; border-radius: 12px; }
.search-results { display: flex; flex-direction: column; gap: 18px; }
.search-group { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.search-group-title { display: flex; align-items: center; gap: 9px; padding: 13px 18px; background: var(--surface-soft); border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 500; }
.search-group-icon { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-strong); display: inline-flex; align-items: center; justify-content: center; }
.search-group-icon svg { width: 15px; height: 15px; }
.search-result-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 18px; border-bottom: 1px solid var(--border); color: var(--text); }
.search-result-row:last-child { border-bottom: 0; }
.search-result-row:hover { background: var(--surface-soft); color: var(--accent-strong); }
.search-result-row strong { display: block; font-size: 12.5px; font-weight: 500; }
.search-result-row small { display: block; color: var(--muted); font-size: 10.5px; }
.search-result-row .chip { flex: 0 0 auto; }
.audit-timeline { display: flex; flex-direction: column; }
.audit-item { display: flex; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--border); }
.audit-item:last-child { border-bottom: 0; }
.backup-hero {
    display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
    border-radius: var(--radius); padding: 24px;
    background:
        radial-gradient(400px 200px at 0% -20%, rgba(45, 212, 191, 0.14), transparent 70%),
        var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm); margin-bottom: 18px;
}
.backup-hero-icon { width: 58px; height: 58px; border-radius: 16px; background: var(--accent-soft); color: var(--accent-strong); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.backup-hero-icon svg { width: 28px; height: 28px; }
.backup-hero-text { flex: 1; min-width: 220px; }
.backup-hero-eyebrow { font-size: 10.5px; color: var(--accent); font-weight: 500; letter-spacing: 0.4px; }
.backup-hero h2 { font-size: 18px; margin: 1px 0 4px; }
.backup-hero p { font-size: 12px; color: var(--muted); line-height: 1.9; }

/* ---------- درخت حساب‌ها ---------- */
.accounts-table td { vertical-align: top; }
.tree-branch { display: inline-flex; align-items: center; gap: 6px; }
.account-name { display: flex; align-items: center; gap: 7px; }
.account-name svg { width: 15px; height: 15px; color: var(--muted); }
.account-name.is-group { font-weight: 500; }
.account-type-color { display: inline-flex; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.is-group-row { background: var(--surface-soft); font-weight: 500; }
.is-readonly { color: var(--muted); }

/* ==========================================================================
   بخش ۳: فرم‌های عملیاتی، فاکتور، خزانه و اسناد
   ========================================================================== */

/* ---------- سوییچ نوع فاکتور ---------- */
.type-switcher { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.type-chip {
    display: inline-flex; align-items: center; gap: 7px; padding: 8px 15px;
    border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
    color: var(--text-soft); font-size: 12.5px; box-shadow: var(--shadow-sm);
    transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.type-chip svg { width: 16px; height: 16px; }
.type-chip:hover { border-color: var(--accent-line); color: var(--accent-strong); }
.type-chip.is-active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 8px 18px -10px rgba(15, 118, 110, 0.8); }

/* ---------- فرم فاکتور ---------- */
.invoice-form .form-main { gap: 18px; }
.invoice-form .items-card { padding-bottom: 18px; }
.items-table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.items-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 880px; }
.items-table thead th {
    background: var(--surface-soft); font-size: 11.5px; font-weight: 500; color: var(--muted);
    padding: 10px 8px; text-align: start; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.items-table tbody td { padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.items-table tbody tr:last-child td { border-bottom: 0; }
.items-table tbody tr:hover { background: #fbfdfd; }
.items-table .row-index { width: 32px; text-align: center; color: var(--muted); font-size: 12px; }
.items-table input, .items-table select {
    width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 8px;
    background: var(--surface); padding: 0 8px; font-size: 13px; min-width: 60px;
    transition: border-color 0.14s, box-shadow 0.14s;
}
.items-table select {
    min-width: 170px; font-size: 12.5px; appearance: none; padding-left: 24px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%236b8189' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left 7px center;
}
.items-table input:focus, .items-table select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.items-table .item-description { min-width: 130px; }
.items-table .item-qty { max-width: 78px; text-align: center; }
.items-table .item-price, .items-table .item-discount, .items-table .item-tax { max-width: 104px; text-align: left; direction: ltr; }
.items-table .item-line-total { font-size: 13px; font-weight: 500; white-space: nowrap; text-align: left; padding-inline-start: 8px; font-variant-numeric: tabular-nums; }
.items-table .icon-btn.is-danger { color: var(--danger); border-color: transparent; background: transparent; width: 30px; height: 30px; }
.items-table .icon-btn.is-danger:hover { background: var(--danger-soft); }
.items-table .col-action { width: 34px; }

/* در نمایشگرهای متوسط، هر ردیف اقلام به یک کارت برچسب‌دار تبدیل می‌شود تا هیچ ستونی پنهان نماند. */
@media screen and (max-width: 1740px) {
    .invoice-form .items-table-wrap {
        overflow: visible; border: 0; border-radius: 0; background: transparent;
    }
    .invoice-form .items-table {
        display: block; width: 100%; min-width: 0; border-collapse: initial;
    }
    .invoice-form .items-table thead { display: none; }
    .invoice-form .items-table tbody { display: grid; gap: 10px; }
    .invoice-form .items-table tr.item-row {
        display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 9px 10px;
        padding: 13px; border: 1px solid var(--border); border-radius: 12px;
        background: var(--surface-soft); transition: background 0.16s, border-color 0.16s;
    }
    .invoice-form .items-table tr.item-row:hover { background: #fff; border-color: var(--border-strong); }
    .invoice-form .items-table tbody td { display: block; padding: 0; border: 0; min-width: 0; }
    .invoice-form .items-table td::before {
        content: attr(data-label); display: block; margin-bottom: 4px;
        font-size: 10px; color: var(--muted); font-weight: 500; line-height: 1.4;
    }
    .invoice-form .items-table td.row-index { display: none; }
    .invoice-form .items-table td.col-product { grid-column: 1 / 11; grid-row: 1; }
    .invoice-form .items-table td.col-action {
        grid-column: 11 / 13; grid-row: 1; align-self: start;
        display: flex; justify-content: flex-end;
    }
    .invoice-form .items-table td.col-desc { grid-column: 1 / 7; grid-row: 2; }
    .invoice-form .items-table td.col-qty { grid-column: 7 / 9; grid-row: 2; }
    .invoice-form .items-table td.col-price { grid-column: 9 / 13; grid-row: 2; }
    .invoice-form .items-table td.col-discount { grid-column: 1 / 5; grid-row: 3; }
    .invoice-form .items-table td.col-tax { grid-column: 5 / 9; grid-row: 3; }
    .invoice-form .items-table td.col-total { grid-column: 9 / 13; grid-row: 3; align-self: end; padding-bottom: 9px; }
    .invoice-form .items-table input, .invoice-form .items-table select {
        max-width: none; width: 100%; height: 40px; font-size: 12.5px;
    }
    .invoice-form .items-table .item-qty,
    .invoice-form .items-table .item-price,
    .invoice-form .items-table .item-discount,
    .invoice-form .items-table .item-tax { max-width: none; }
    .invoice-form .items-table .item-description { min-width: 0; }
    .invoice-form .items-table .item-line-total {
        text-align: start; padding: 0; font-size: 13px; color: var(--text);
    }
    .invoice-form .items-table .col-action .icon-btn { width: 34px; height: 34px; }
}

@media screen and (max-width: 760px) {
    .invoice-form .items-table td.col-product { grid-column: 1 / 10; }
    .invoice-form .items-table td.col-action { grid-column: 10 / 13; }
    .invoice-form .items-table td.col-desc { grid-column: 1 / 13; grid-row: 2; }
    .invoice-form .items-table td.col-qty { grid-column: 1 / 4; grid-row: 3; }
    .invoice-form .items-table td.col-price { grid-column: 4 / 10; grid-row: 3; }
    .invoice-form .items-table td.col-discount { grid-column: 1 / 5; grid-row: 4; }
    .invoice-form .items-table td.col-tax { grid-column: 5 / 9; grid-row: 4; }
    .invoice-form .items-table td.col-total { grid-column: 9 / 13; grid-row: 4; }
}
.items-hint {
    display: flex; gap: 8px; align-items: flex-start; margin-top: 10px;
    font-size: 10.5px; color: var(--muted); line-height: 1.8;
}
.items-hint svg { width: 14px; height: 14px; color: var(--accent); flex: 0 0 auto; margin-top: 3px; }
.items-footer { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.85fr); gap: 22px; margin-top: 18px; align-items: start; }
.invoice-note-fields { display: flex; flex-direction: column; gap: 12px; }
.invoice-note-fields textarea { min-height: 78px; font-size: 12px; }
.totals-panel {
    background: var(--surface-soft); border: 1px solid var(--border); border-radius: 14px;
    padding: 14px 16px; display: flex; flex-direction: column; gap: 2px;
}
.totals-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 7px 0; font-size: 12.5px; border-bottom: 1px dashed var(--border);
}
.totals-row:last-of-type { border-bottom: 0; }
.totals-row span { color: var(--muted); }
.totals-row strong { font-variant-numeric: tabular-nums; }
.totals-row input {
    width: 130px; height: 34px; border: 1px solid var(--border-strong); border-radius: 8px;
    text-align: left; padding: 0 9px; font-size: 12px; direction: ltr; background: #fff;
}
.totals-row input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.totals-grand {
    margin-top: 6px; padding-top: 11px; border-top: 2px solid var(--accent-line); border-bottom: 0;
    font-size: 13px;
}
.totals-grand strong { font-size: 17px; color: var(--accent-strong); }
.totals-grand small { font-size: 10px; color: var(--muted); font-weight: 400; }
.totals-words {
    margin-top: 8px; padding: 8px 10px; border-radius: 9px; background: #fff;
    border: 1px dashed var(--border-strong); font-size: 10.5px; color: var(--text-soft);
    line-height: 1.9;
}
.invoice-totals { display: flex; flex-direction: column; gap: 0; }
.invoice-totals .totals-row { font-size: 12px; }
.invoice-notes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.summary-list .is-total, .summary-list .is-grand {
    margin-top: 5px; padding-top: 10px; border-top: 1px solid var(--border-strong);
    border-bottom: 0; font-size: 14px;
}
.summary-list .is-total strong, .summary-list .is-grand strong { color: var(--accent-strong); font-size: 16px; }
.form-actions.is-stacked { flex-direction: column; align-items: stretch; margin-top: 14px; padding: 0; border: 0; box-shadow: none; background: transparent; }
.form-actions.is-stacked .btn { width: 100%; }
.compact { padding: 10px 12px; font-size: 11.5px; border-radius: 10px; margin: 12px 0 0; }
.alert.compact { padding: 12px 15px; border-radius: 11px; }
.alert.compact .alert-text { line-height: 1.85; }
.alert.compact + .form-grid { margin-top: 16px; }
.compact .alert-icon svg { width: 16px; height: 16px; }
.empty-state.compact { padding: 24px 16px; }
.empty-state.compact .empty-icon { width: 46px; height: 46px; border-radius: 13px; margin-bottom: 8px; }
.empty-state.compact .empty-icon svg { width: 22px; height: 22px; }

/* پیش‌نمایش فاکتور در فرم */
.invoice-preview-card {
    border: 1px solid var(--border); border-radius: 12px; padding: 15px;
    background: var(--surface-soft); font-size: 12.5px;
}
.invoice-preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; border-bottom: 1px solid var(--border); padding-bottom: 9px; margin-bottom: 9px; }
.invoice-preview-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.invoice-logo { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.invoice-preview-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; color: var(--muted); font-size: 11.5px; }
.invoice-preview-meta strong { font-size: 12px; }
.invoice-preview-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; padding-bottom: 9px; border-bottom: 1px dashed var(--border); }
.invoice-preview-parties span { display: block; color: var(--muted); font-size: 11px; }
.invoice-preview-parties strong { font-size: 12.5px; }
.invoice-notes { font-size: 12px; color: var(--muted); }
.invoice-preview-card .table-wrap {
    border: 1px solid var(--border); border-radius: 12px; background: var(--surface);
}
.invoice-preview-card .items-summary { font-size: 13px; }
.invoice-preview-card .items-summary thead th { font-size: 11.5px; padding: 11px 12px; }
.invoice-preview-card .items-summary tbody td { padding: 9px 12px; }
.invoice-preview-card .totals-row { font-size: 13px; padding: 8px 0; }
.invoice-preview-card .totals-grand { font-size: 14px; }
.invoice-preview-card .totals-grand strong { font-size: 18px; }
.invoice-preview-card .items-summary thead th:first-child,
.invoice-preview-card .items-summary thead th:last-child { border-radius: 0; }

/* ---------- تخصیص پرداخت ---------- */
.allocation-table td { font-size: 12px; }
.allocation-table .alloc-input { width: 118px; height: 33px; text-align: left; direction: ltr; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: 8px; font-size: 12px; }
.allocation-table .alloc-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.allocation-summary {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px;
    padding: 11px 14px; border-radius: 11px; background: var(--accent-soft);
    border: 1px solid var(--accent-line); font-size: 12px;
}
.allocation-summary strong { font-size: 14px; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.allocation-summary .muted { margin-inline-start: auto; font-size: 11px; }
.amount-input { font-weight: 700; font-size: 16px; letter-spacing: 0.2px; direction: ltr; text-align: left; }
.amount-input:focus { border-color: var(--accent); }

/* ---------- دفتر روزنامه ---------- */
.journal-form-table, .journal-table { width: 100%; border-collapse: separate; border-spacing: 0; min-width: 760px; }
.journal-form-table th, .journal-table th {
    background: var(--surface-soft); font-size: 10.5px; font-weight: 500; color: var(--muted);
    padding: 9px 10px; text-align: start; border-bottom: 1px solid var(--border);
}
.journal-form-table td, .journal-table td { padding: 8px 8px; border-bottom: 1px solid var(--border); font-size: 12px; vertical-align: middle; }
.journal-form-table input, .journal-form-table select {
    width: 100%; height: 38px; border: 1px solid var(--border); border-radius: 8px;
    background: #fff; padding: 0 9px; font-size: 12px;
}
.journal-form-table select {
    padding-left: 26px; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%236b8189' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: left 8px center;
}
.journal-form-table input:focus, .journal-form-table select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--ring); }
.journal-form-table .num-input { text-align: left; direction: ltr; }
.journal-form-table .row-index { width: 34px; text-align: center; color: var(--muted); }
.journal-totals {
    display: flex; align-items: center; justify-content: flex-end; gap: 24px; flex-wrap: wrap;
    padding: 12px 16px; margin-top: 12px; background: var(--surface-soft);
    border: 1px solid var(--border); border-radius: 11px; font-size: 12px;
}
.journal-totals span { color: var(--muted); }
.journal-totals strong { font-variant-numeric: tabular-nums; margin-inline-start: 5px; }
.journal-totals .is-diff { color: var(--danger); font-weight: 700; }
.journal-totals .is-diff.is-ok, .journal-totals .is-ok { color: var(--success); }
.journal-totals .is-diff.is-bad, .journal-totals .is-bad { color: var(--danger); }
.voucher-sheet .journal-table th { font-size: 11px; }
.voucher-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding-bottom: 12px; border-bottom: 2px solid var(--navy); margin-bottom: 14px; }
.voucher-title { font-size: 18px; }
.voucher-kicker { font-size: 10.5px; color: var(--muted); letter-spacing: 0.5px; }
.voucher-icon { width: 42px; height: 42px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-strong); display: inline-flex; align-items: center; justify-content: center; }
.voucher-big-amount { font-size: 20px; font-weight: 700; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.voucher-amount { font-variant-numeric: tabular-nums; white-space: nowrap; }
.voucher-words { margin-top: 12px; padding: 9px 13px; border-radius: 10px; background: var(--surface-soft); border: 1px dashed var(--border-strong); font-size: 11.5px; line-height: 1.9; }
.voucher-words-small { font-size: 10.5px; color: var(--muted); }

/* ---------- خزانه ---------- */
.treasury-hero {
    display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px;
    border-radius: var(--radius); padding: 24px 26px;
    background:
        radial-gradient(500px 250px at 0% -20%, rgba(45, 212, 191, 0.24), transparent 65%),
        linear-gradient(130deg, #0b2c3b, #0a2231);
    color: #e7f4f4; box-shadow: var(--shadow-md); margin-bottom: 18px;
    position: relative; overflow: hidden; align-items: center;
}
.treasury-hero::after {
    content: ""; position: absolute; inset-inline-end: -80px; top: -80px; width: 240px; height: 240px;
    border-radius: 50%; border: 46px solid rgba(45, 212, 191, 0.07);
}
.treasury-hero > * { position: relative; z-index: 1; }
.treasury-hero h2 { color: #fff; font-size: 20px; margin-bottom: 3px; }
.treasury-hero p { color: #93b4be; font-size: 12px; }
.treasury-total { display: flex; flex-direction: column; gap: 2px; margin-top: 12px; }
.treasury-total-label { font-size: 10.5px; color: #7fa0ac; }
.treasury-total-card {
    min-width: 210px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px; padding: 16px 18px; backdrop-filter: blur(6px);
}
.treasury-total-card strong { font-size: 23px; color: #fff; display: block; font-variant-numeric: tabular-nums; }
.treasury-total-card small { display: block; color: #8fb0ba; font-size: 10.5px; margin-top: 2px; }
.treasury-breakdown { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.treasury-breakdown > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 11.5px; color: #a9c5cd; padding-bottom: 7px; border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.treasury-breakdown > div:last-child { border-bottom: 0; padding-bottom: 0; }
.treasury-breakdown strong { color: #fff; font-variant-numeric: tabular-nums; }

/* ---------- صورت حساب ---------- */
.statement-sheet { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow-sm); }
.statement-items { width: 100%; border-collapse: collapse; font-size: 11.5px; }
.statement-items th { background: var(--surface-soft); padding: 9px 10px; font-size: 10.5px; font-weight: 500; color: var(--muted); text-align: start; border-bottom: 1px solid var(--border); }
.statement-items td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.statement-items tbody tr:hover { background: var(--surface-soft); }
.statement-items .num { text-align: left; font-variant-numeric: tabular-nums; white-space: nowrap; }
.statement-items tfoot td { font-weight: 700; background: var(--surface-soft); border-top: 1px solid var(--border-strong); }

/* ---------- ورودی‌های عددی و ردیف‌های ساده ---------- */
.num-input { direction: ltr; text-align: left; font-variant-numeric: tabular-nums; }
.simple-items { display: flex; flex-direction: column; gap: 8px; }
.simple-items .item-row { display: grid; grid-template-columns: 1fr 110px 130px 36px; gap: 7px; align-items: center; }
.simple-items .item-row input, .simple-items .item-row select { height: 38px; border: 1px solid var(--border); border-radius: 8px; padding: 0 9px; font-size: 12px; width: 100%; }
.inline-details { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; font-size: 11.5px; color: var(--muted); }
.inline-details strong { color: var(--text-soft); font-weight: 500; }
.inline-popover { position: relative; display: inline-flex; }
.note-icon { color: var(--accent); }
.currency-select { max-width: 130px; }
.sheet-parties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin: 16px 0; }
.sheet-party { border: 1px solid var(--border); border-radius: 11px; padding: 11px 13px; background: var(--surface-soft); }
.sheet-party-label { font-size: 9.5px; letter-spacing: 0.3px; color: var(--muted); margin-bottom: 2px; }
.sheet-party strong { display: block; font-size: 12.5px; }
.sheet-party p { font-size: 10.5px; color: var(--text-soft); line-height: 1.8; }

/* ==========================================================================
   بخش ۴: گزارش‌ها و برگه‌های تحلیلی
   ========================================================================== */

/* فیلتر تاریخ گزارش */
.report-filter { align-items: flex-end; }
.filter-bar .filter-date { position: relative; }
.filter-bar .filter-date > svg {
    position: absolute; inset-inline-start: 12px; bottom: 12px; width: 15px; height: 15px;
    color: var(--muted); pointer-events: none; z-index: 1;
}
.filter-bar .filter-date > input { padding-inline-start: 36px; direction: ltr; text-align: right; }
.report-period-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 15px; }
.report-period-field { position: relative; display: flex; align-items: center; }
.report-period-field svg { position: absolute; inset-inline-start: 11px; width: 15px; height: 15px; color: #90b0b8; pointer-events: none; }
.report-period-field input {
    height: 38px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08); color: #fff; padding: 0 34px 0 12px;
    font-size: 12px; width: 150px; direction: ltr; text-align: right;
}
.report-period-field input::placeholder { color: #7e9da7; }
.report-period-field input:focus { outline: none; border-color: #2dd4bf; box-shadow: 0 0 0 3px rgba(45, 212, 191, 0.18); }

/* سربرگ گزارش */
.report-sheet {
    background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
    padding: 28px 30px 22px; box-shadow: var(--shadow-sm); position: relative;
}
.report-head {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 24px;
    padding-bottom: 18px; margin-bottom: 20px; border-bottom: 2px solid var(--navy);
    flex-wrap: wrap;
}
.report-brand { display: flex; align-items: flex-start; gap: 11px; max-width: 48%; }
.report-logo { width: 42px; height: 42px; border-radius: 11px; object-fit: contain; border: 1px solid var(--border); background: #fff; padding: 3px; }
.report-logo-mark {
    width: 42px; height: 42px; border-radius: 11px; background: linear-gradient(135deg, var(--navy-2), var(--navy));
    color: #2dd4bf; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.report-logo-mark svg { width: 22px; height: 22px; }
.report-brand-text { display: flex; flex-direction: column; line-height: 1.65; }
.report-brand-text strong { font-size: 13.5px; }
.report-brand-text span { font-size: 10.5px; color: var(--muted); }
.report-brand-text small { font-size: 9.5px; color: var(--muted); }
.report-heading { text-align: end; }
.report-kicker { font-size: 9.5px; letter-spacing: 1px; color: var(--accent); font-weight: 500; }
.report-heading h2 { font-size: 20px; margin: 1px 0 2px; letter-spacing: -0.3px; }
.report-heading p { font-size: 11px; color: var(--text-soft); }
.report-heading small { font-size: 9.5px; color: var(--muted); }

/* هیرو گزارش‌ها */
.report-hero {
    position: relative; overflow: hidden; border-radius: var(--radius); padding: 25px 28px;
    background:
        radial-gradient(560px 300px at 0% -40%, rgba(45, 212, 191, 0.2), transparent 60%),
        radial-gradient(420px 280px at 100% 120%, rgba(52, 211, 153, 0.13), transparent 60%),
        linear-gradient(130deg, #0b2c3d, #0a2231 70%);
    color: #dcecf0; box-shadow: var(--shadow-md); margin-bottom: 18px;
    display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; flex-wrap: wrap;
}
.report-hero::before {
    content: ""; position: absolute; inset: 0; opacity: 0.3; pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px);
    background-size: 22px 22px; mask-image: linear-gradient(90deg, transparent, #000 70%);
}
.report-hero > * { position: relative; z-index: 1; }
.report-hero-main { max-width: 640px; }
.report-hero-eyebrow { display: inline-block; font-size: 10.5px; color: #5eead4; letter-spacing: 0.5px; margin-bottom: 5px; }
.report-hero h2 { color: #fff; font-size: 22px; letter-spacing: -0.4px; margin-bottom: 5px; }
.report-hero p { color: #92b3bd; font-size: 12px; line-height: 1.9; }
.report-hero-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.report-hero-stats > div {
    min-width: 140px; padding: 11px 14px; border-radius: 12px;
    background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(6px);
}
.report-hero-stats span { display: block; font-size: 10px; color: #8fb0ba; margin-bottom: 1px; }
.report-hero-stats strong { font-size: 15px; color: #fff; font-variant-numeric: tabular-nums; }
.report-hero-stats .is-positive { color: #5eead4; }
.report-hero-stats .is-negative { color: #fda4af; }

/* کاشی گزارش‌ها */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 11px; }
.report-tile {
    display: flex; align-items: flex-start; gap: 11px; padding: 14px; border-radius: 13px;
    border: 1px solid var(--border); background: var(--surface); color: var(--text);
    position: relative; transition: border-color 0.16s, box-shadow 0.16s, transform 0.16s, background 0.16s;
}
.report-tile:hover {
    border-color: var(--accent-line); box-shadow: var(--shadow-md); transform: translateY(-2px);
    background: linear-gradient(180deg, #fff, var(--surface-soft)); color: var(--text);
}
.report-tile-icon { width: 40px; height: 40px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.report-tile-icon svg { width: 20px; height: 20px; }
.report-tile-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.report-tile-body strong { font-size: 12.5px; font-weight: 500; }
.report-tile-body small { font-size: 10.5px; color: var(--muted); line-height: 1.7; }
.report-tile-meta {
    display: flex; align-items: center; gap: 2px; font-size: 9.5px; color: var(--accent);
    margin-top: 6px; white-space: nowrap;
}
.report-tile > .report-tile-icon + .report-tile-body + .report-tile-meta { align-self: flex-end; }
.report-tile-meta svg { width: 12px; height: 12px; }

/* ستون‌ها و بخش‌های گزارش */
.report-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; margin-top: 4px; }
.report-stack { display: flex; flex-direction: column; gap: 16px; }
.report-section {
    border: 1px solid var(--border); border-radius: 14px; padding: 15px 16px;
    background: var(--surface); break-inside: avoid;
}
.report-section-head {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding-bottom: 10px; margin-bottom: 8px; border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.report-section-head h3 { display: flex; align-items: center; gap: 6px; font-size: 13.5px; }
.report-section-head h3 svg { width: 17px; height: 17px; color: var(--accent); }
.report-section-head > span { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.report-table { font-size: 11.5px; }
.report-table thead th { padding: 8px 9px; font-size: 10px; }
.report-table tbody td { padding: 8px 9px; }
.report-table tfoot td { padding: 9px; font-size: 11.5px; background: var(--surface-soft); }
.report-table tfoot tr.is-total td { color: var(--text); font-weight: 700; border-top: 1px solid var(--border-strong); }
.report-table .code-chip { font-size: 10px; }
.report-summary-strip {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px;
    margin-bottom: 18px;
}
.report-summary-strip > div {
    padding: 12px 14px; border-radius: 12px; background: var(--surface-soft);
    border: 1px solid var(--border);
}
.report-summary-strip span { display: block; font-size: 10px; color: var(--muted); margin-bottom: 2px; }
.report-summary-strip strong { font-size: 15px; font-variant-numeric: tabular-nums; }
.report-summary-strip .is-success { background: var(--success-soft); border-color: #bfe8d6; }
.report-summary-strip .is-success strong { color: var(--success); }
.report-summary-strip .is-warning { background: var(--warning-soft); border-color: #f0dcb4; }
.report-summary-strip .is-warning strong { color: var(--warning); }
.report-net-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 13px 17px; border-radius: 12px; margin-top: 16px;
    background: linear-gradient(90deg, var(--accent-soft), #f8fdfc);
    border: 1px solid var(--accent-line); font-size: 13px;
}
.report-net-row strong { font-size: 17px; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.report-totals-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-top: 14px; }
.report-totals-grid > div { padding: 13px 15px; border-radius: 12px; background: var(--surface-soft); border: 1px solid var(--border); }
.report-totals-grid span { display: block; font-size: 10.5px; color: var(--muted); }
.report-totals-grid strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.report-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--border);
    color: var(--muted); font-size: 9.5px; flex-wrap: wrap;
}
.report-mini-list { display: flex; flex-direction: column; }
.report-mini-row { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px dashed var(--border); font-size: 12px; }
.report-mini-row:last-child { border-bottom: 0; }
.report-mini-row .list-icon { width: 30px; height: 30px; border-radius: 8px; }
.report-mini-row .list-icon.is-success { background: var(--success-soft); color: var(--success); }
.report-mini-row .list-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.report-mini-row .list-icon svg { width: 15px; height: 15px; }

/* سود و زیان */
.income-highlight {
    display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
    border-radius: 14px; padding: 18px 20px; margin-bottom: 18px;
    background: linear-gradient(115deg, #0c3544, #0a2635); color: #e7f5f5;
    position: relative; overflow: hidden;
}
.income-highlight::after {
    content: ""; position: absolute; inset-inline-start: -40px; bottom: -70px; width: 200px; height: 200px;
    border-radius: 50%; border: 38px solid rgba(45, 212, 191, 0.08);
}
.income-highlight > * { position: relative; z-index: 1; }
.income-highlight.is-loss { background: linear-gradient(115deg, #4a1c24, #2c1219); }
.income-highlight > div:first-child > span { display: block; font-size: 10.5px; color: #8fb2bc; margin-bottom: 2px; }
.income-highlight strong { display: block; font-size: 26px; color: #fff; font-variant-numeric: tabular-nums; letter-spacing: -0.3px; line-height: 1.5; }
.income-highlight.is-profit strong { color: #5eead4; }
.income-highlight.is-loss strong { color: #fda4af; }
.income-highlight small { display: block; font-size: 9.5px; color: #8fb2bc; margin-top: 2px; }
.income-highlight-stats { display: flex; gap: 10px; flex-wrap: wrap; }
.income-highlight-stats > div {
    min-width: 130px; padding: 9px 13px; border-radius: 10px;
    background: rgba(255, 255, 255, 0.07); border: 1px solid rgba(255, 255, 255, 0.1);
}
.income-highlight-stats span { display: block; font-size: 9.5px; color: #8fb2bc; }
.income-highlight-stats strong { font-size: 13.5px; }

/* تراز مقایسه‌ای */
.balance-compare { display: flex; flex-direction: column; gap: 12px; }
.balance-compare-col { display: flex; flex-direction: column; gap: 3px; }
.balance-compare-col span { font-size: 10.5px; color: var(--muted); }
.balance-compare-col strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.balance-compare-col.is-liability strong { color: var(--danger); }
.balance-bar { height: 8px; border-radius: 99px; background: var(--surface-muted); overflow: hidden; margin-top: 3px; }
.balance-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-2), var(--accent)); }
.balance-compare-col.is-liability .balance-bar i { background: linear-gradient(90deg, #f59e0b, #d97706); }
.balance-compare .is-equity .balance-bar i { background: linear-gradient(90deg, #a78bfa, #7c3aed); }

/* معادله ترازنامه */
.equation-banner {
    display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap;
    margin-top: 18px; padding: 14px 18px; border-radius: 13px;
    background: var(--surface-soft); border: 1px solid var(--border);
}
.equation-banner > div { text-align: center; }
.equation-banner > div span { display: block; font-size: 9.5px; color: var(--muted); }
.equation-banner > div strong { font-size: 14px; font-variant-numeric: tabular-nums; }
.equation-equals { font-size: 20px; color: var(--accent); font-weight: 700; }
.equation-sign { font-size: 16px; color: var(--muted); }
.equation-banner.is-success { background: var(--success-soft); border-color: #bfe8d6; }
.equation-banner.is-warning { background: var(--warning-soft); border-color: #f0dcb4; }

/* ردیف‌های رنگی گزارش */
.is-highlight { background: var(--accent-soft) !important; }
.is-profit { color: var(--success); }
.is-loss { color: var(--danger); }
.is-liability { color: var(--danger); }
.is-equity { color: var(--violet); }
.is-total td, tr.is-total td { font-weight: 700; background: var(--surface-soft); border-top: 1px solid var(--border-strong); }
.report-sheet .is-info { background: var(--info-soft); }
.report-sheet .is-warning { background: var(--warning-soft); }
.report-sheet .is-success { background: var(--success-soft); }

/* گزارش انبار / طرف حساب / خزانه */
.report-sheet .table-wrap { border: 1px solid var(--border); }
.report-sheet .data-table thead th { background: var(--surface-soft); }
.report-sheet .data-table tbody td { font-size: 11.5px; }
.report-sheet .data-table tbody tr:hover { background: #fbfdfd; }
.report-sheet .data-table tfoot td { background: var(--surface-soft); }
.report-sheet > .filter-bar { margin-bottom: 18px; }
.report-sheet .kpi-grid { margin-bottom: 16px; }

/* کارت گردش حساب */
.account-ledger-table td { font-size: 11.5px; }
.account-ledger-table .is-opening { background: var(--surface-soft); color: var(--muted); }
.ledger-balance { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ==========================================================================
   بخش ۵: چاپ، فاکتور رسمی، ورود و نصب‌کننده
   ========================================================================== */

/* ---------- چاپ و برگه رسمی ---------- */
.print-body { background: #e8edec; margin: 0; padding: 0; }
.print-toolbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
    justify-content: space-between; gap: 16px; padding: 11px 22px; flex-wrap: wrap;
    background: rgba(255, 255, 255, 0.94); border-bottom: 1px solid var(--border);
    backdrop-filter: blur(10px);
}
.print-toolbar-start, .print-toolbar-end { display: flex; align-items: center; gap: 11px; flex-wrap: wrap; }
.print-toolbar-title { font-size: 13px; font-weight: 500; }
.print-hint { font-size: 10.5px; color: var(--muted); }
.paper-switch {
    display: inline-flex; align-items: center; gap: 3px; padding: 3px;
    border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft);
}
.paper-switch-label { font-size: 10px; color: var(--muted); padding: 0 4px; }
.paper-switch-btn {
    min-width: 34px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
    border-radius: 6px; font-size: 11px; font-weight: 500; color: var(--text-soft);
    text-decoration: none; transition: background 0.15s, color 0.15s;
}
.paper-switch-btn:hover { background: var(--surface-muted); color: var(--accent-strong); }
.paper-switch-btn.is-active { background: var(--accent); color: #fff; }
.print-stage { padding: 26px 18px 50px; display: flex; flex-direction: column; align-items: center; gap: 22px; }
.print-body .no-print { display: none !important; }
.pdf-render-stage {
    position: fixed; top: 0; left: 0; width: 210mm;
    background: #fff; z-index: 2147483646; opacity: 0; pointer-events: none;
}
.pdf-render-stage.is-a5 { width: 148mm; }
.pdf-render-stage .invoice-sheet {
    width: 210mm; min-height: 296mm; margin: 0;
    box-shadow: none; border-radius: 0;
}
.pdf-render-stage.is-a5 .invoice-sheet {
    width: 148mm; min-height: 209mm;
}
/* html2pdf centers its temporary render container. The foreignObject renderer
   crops from the container's left edge, so pin it to 0 to avoid a left crop. */
.html2pdf__container {
    left: 0 !important; right: auto !important; margin: 0 !important;
}
.btn.is-busy { pointer-events: none; opacity: 0.75; }
.invoice-sheet {
    width: 210mm; min-height: 296mm; background: #fff; padding: 12mm 12mm 10mm;
    box-shadow: 0 18px 50px rgba(22, 43, 51, 0.16); border-radius: 3px;
    color: #16242c; font-size: calc(12px * var(--invoice-scale, 1)); line-height: 1.8; position: relative;
    display: flex; flex-direction: column;
    --invoice-scale: 1;
}
.invoice-sheet, .invoice-sheet * { font-family: var(--font); }
.invoice-sheet::before {
    content: ""; position: absolute; top: 0; inset-inline: 0; height: 5px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2), var(--gold));
    border-radius: 3px 3px 0 0;
}
.sheet-header {
    display: flex; align-items: flex-start; justify-content: space-between; gap: 18px;
    padding-bottom: 14px; border-bottom: 2px solid #122c3a; margin-bottom: 14px;
}
.sheet-header-note {
    border: 1px dashed #c6d8d4; background: #f7fbfa; border-radius: 8px;
    padding: 7px 10px; margin: -3px 0 13px; font-size: calc(9.5px * var(--invoice-scale, 1)); color: #465c65; line-height: 1.9;
}
.sheet-company { display: flex; align-items: flex-start; gap: 11px; max-width: 56%; }
.sheet-logo { width: 50px; height: 50px; object-fit: contain; border: 1px solid #e1e9e7; border-radius: 9px; padding: 3px; background: #fff; flex: 0 0 auto; }
.sheet-logo-mark {
    width: 50px; height: 50px; border-radius: 11px; flex: 0 0 auto;
    background: linear-gradient(135deg, #0e4453, #0a2735); color: #2dd4bf;
    display: inline-flex; align-items: center; justify-content: center;
}
.sheet-logo-mark svg { width: 26px; height: 26px; }
.sheet-company-info { display: flex; flex-direction: column; line-height: 1.8; }
.sheet-company-info h1 { font-size: calc(17px * var(--invoice-scale, 1)); margin-bottom: 1px; }
.sheet-company-info p { font-size: calc(10px * var(--invoice-scale, 1)); color: #4f646d; display: flex; flex-wrap: wrap; gap: 0 10px; }
.sheet-company-info .sheet-legal { font-size: calc(10px * var(--invoice-scale, 1)); color: #5d747d; }
.sheet-company-info .sheet-sub { margin-top: 1px; color: #6b8189; font-size: calc(9.5px * var(--invoice-scale, 1)); }
.sheet-company-info bdi { font-variant-numeric: tabular-nums; }
.sheet-title-block { text-align: end; min-width: 240px; }
.sheet-kicker { font-size: calc(9px * var(--invoice-scale, 1)); letter-spacing: 1.2px; color: var(--accent); font-weight: 500; }
.sheet-title-block h2 { font-size: calc(20px * var(--invoice-scale, 1)); margin: 0 0 7px; }
.sheet-meta-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 14px; }
.sheet-meta-grid > div { display: flex; align-items: baseline; gap: 5px; font-size: calc(9.5px * var(--invoice-scale, 1)); }
.sheet-meta-grid span { color: #6b8189; }
.sheet-meta-grid strong { font-size: calc(10.5px * var(--invoice-scale, 1)); font-weight: 500; white-space: nowrap; }
.sheet-parties { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 13px; }
.sheet-party { border: 1px solid #dfe8e6; border-radius: 8px; padding: 10px 12px; background: #fafcfc; }
.sheet-party.is-soft { background: var(--accent-soft); border-color: var(--accent-line); }
.sheet-party-label { display: block; font-size: calc(9px * var(--invoice-scale, 1)); color: #6b8189; letter-spacing: 0.3px; margin-bottom: 2px; }
.sheet-party strong { display: block; font-size: calc(11.5px * var(--invoice-scale, 1)); margin-bottom: 2px; }
.sheet-party p { font-size: calc(9.5px * var(--invoice-scale, 1)); color: #465c65; line-height: 1.85; display: flex; flex-wrap: wrap; gap: 0 9px; }
.sheet-party p strong { display: inline; font-size: calc(10px * var(--invoice-scale, 1)); }
.sheet-party.is-soft p strong { white-space: nowrap; flex-shrink: 0; }
.sheet-items {
    width: 100%; border-collapse: separate; border-spacing: 0;
    margin-bottom: 13px; background: #0d2b3a;
}
.sheet-items thead { background: #0d2b3a; }
.sheet-items tbody { background: #fff; }
.sheet-items thead th {
    background: #0d2b3a; color: #e8f3f4; font-size: calc(9.5px * var(--invoice-scale, 1)); font-weight: 500;
    padding: 8px 6px; text-align: center; white-space: nowrap;
}
.sheet-items thead th.col-product { text-align: start; }
.sheet-items thead th { border-radius: 0; }
.sheet-items tbody td { padding: 8px 6px; border-bottom: 1px solid #e6edeb; font-size: calc(10px * var(--invoice-scale, 1)); text-align: center; vertical-align: middle; }
.sheet-items tbody td.col-product { text-align: start; }
.sheet-items tbody td.col-product strong { display: block; font-size: calc(10.5px * var(--invoice-scale, 1)); font-weight: 500; }
.sheet-items tbody td.col-product small { display: block; color: #6b8189; font-size: calc(8.8px * var(--invoice-scale, 1)); }
.sheet-items tbody tr:nth-child(even) { background: #f8fbfa; }
.sheet-items .col-qty, .sheet-items .col-unit, .sheet-items .col-price,
.sheet-items .col-discount, .sheet-items .col-tax, .sheet-items .col-total { white-space: nowrap; }
.sheet-items .col-price, .sheet-items .col-total { font-variant-numeric: tabular-nums; }
.sheet-items .col-total { font-weight: 700; }
.sheet-items-wrap {
    border: 1px solid #dfe8e6; border-radius: 9px; overflow: hidden;
    margin-bottom: 13px; background: #fff;
}
.sheet-items-wrap .sheet-items { margin-bottom: 0; }
.sheet-items-wrap .sheet-items thead th.col-product,
.sheet-items-wrap .sheet-items thead th.col-total { border-radius: 0; }
.sheet-items-wrap .sheet-items tbody tr:last-child td { border-bottom: 0; }
.sheet-bottom { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr); gap: 14px; margin-bottom: 14px; align-items: start; }
.sheet-notes { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sheet-words {
    border: 1px dashed #c6d8d4; background: #f7fbfa; border-radius: 8px;
    padding: 9px 11px; font-size: calc(9.5px * var(--invoice-scale, 1)); line-height: 1.9;
}
.sheet-words span { color: #6b8189; margin-inline-end: 4px; }
.sheet-words strong { font-size: calc(10.5px * var(--invoice-scale, 1)); }
.sheet-note, .sheet-bank { font-size: calc(9.5px * var(--invoice-scale, 1)); color: #465c65; line-height: 1.9; }
.sheet-note > span, .sheet-bank > span { display: block; font-weight: 500; color: #122c3a; font-size: calc(9px * var(--invoice-scale, 1)); }
.sheet-note p, .sheet-bank p { margin: 0; }
.sheet-bank p { display: flex; flex-wrap: wrap; gap: 0 8px; align-items: baseline; }
.sheet-bank p strong { font-size: calc(9.5px * var(--invoice-scale, 1)); }
.sheet-totals { align-self: end; border: 1px solid #dfe8e6; border-radius: 9px; overflow: hidden; background: #fff; }
.sheet-total-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 7px 12px; font-size: calc(10.5px * var(--invoice-scale, 1)); border-bottom: 1px solid #eef3f2;
}
.sheet-total-row:last-child { border-bottom: 0; }
.sheet-total-row span { color: #5d747d; white-space: nowrap; flex: 0 0 auto; }
.sheet-total-row strong { font-variant-numeric: tabular-nums; font-weight: 500; white-space: nowrap; flex: 0 0 auto; font-size: calc(10.5px * var(--invoice-scale, 1)); }
.sheet-total-row.is-grand { background: #0d2b3a; color: #fff; padding: 10px 12px; }
.sheet-total-row.is-grand span { color: #b7d2d8; font-size: calc(10.5px * var(--invoice-scale, 1)); }
.sheet-total-row.is-grand strong { color: #fff; font-size: calc(14px * var(--invoice-scale, 1)); font-weight: 700; }
.sheet-total-row.is-grand small { font-size: calc(8.5px * var(--invoice-scale, 1)); color: #8fb0ba; font-weight: 400; }
.sheet-footer { margin-top: auto; padding-top: 11px; border-top: 1px solid #e2eae8; }
.sheet-signatures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px; margin-bottom: 14px; }
.sheet-signatures > div { border-top: 1px dashed #b9cbc7; padding-top: 6px; text-align: center; min-height: 50px; display: flex; align-items: flex-end; justify-content: center; }
.sheet-signatures span { font-size: calc(9px * var(--invoice-scale, 1)); color: #6b8189; }
.sheet-footnote { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: #7b9097; font-size: calc(8.5px * var(--invoice-scale, 1)); }
.sheet-footnote p { margin: 0; }

/* ---------- اندازه A5 ---------- */
.invoice-sheet.sheet-a5 {
    width: 148mm; min-height: 209mm; padding: 7mm 7mm 6mm;
    font-size: calc(9.5px * var(--invoice-scale, 1)); line-height: 1.65;
}
.invoice-sheet.sheet-a5::before { height: 4px; }
.invoice-sheet.sheet-a5 .sheet-header { padding-bottom: 8px; margin-bottom: 8px; gap: 10px; }
.invoice-sheet.sheet-a5 .sheet-header-note { padding: 5px 8px; margin: -2px 0 8px; font-size: calc(8px * var(--invoice-scale, 1)); border-radius: 6px; }
.invoice-sheet.sheet-a5 .sheet-company { gap: 7px; max-width: 56%; }
.invoice-sheet.sheet-a5 .sheet-logo,
.invoice-sheet.sheet-a5 .sheet-logo-mark { width: 36px; height: 36px; border-radius: 8px; }
.invoice-sheet.sheet-a5 .sheet-logo-mark svg { width: 20px; height: 20px; }
.invoice-sheet.sheet-a5 .sheet-company-info { line-height: 1.65; }
.invoice-sheet.sheet-a5 .sheet-company-info h1 { font-size: calc(13.5px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-company-info p { font-size: calc(8.2px * var(--invoice-scale, 1)); gap: 0 7px; }
.invoice-sheet.sheet-a5 .sheet-company-info .sheet-legal { font-size: calc(8.4px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-company-info .sheet-sub { font-size: calc(7.8px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-title-block { min-width: 165px; }
.invoice-sheet.sheet-a5 .sheet-kicker { font-size: calc(7.5px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-title-block h2 { font-size: calc(16px * var(--invoice-scale, 1)); margin-bottom: 4px; }
.invoice-sheet.sheet-a5 .sheet-meta-grid { gap: 2px 8px; }
.invoice-sheet.sheet-a5 .sheet-meta-grid > div { font-size: calc(8px * var(--invoice-scale, 1)); gap: 3px; }
.invoice-sheet.sheet-a5 .sheet-meta-grid strong { font-size: calc(8.5px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-parties { gap: 7px; margin-bottom: 8px; }
.invoice-sheet.sheet-a5 .sheet-party { padding: 6px 8px; border-radius: 6px; }
.invoice-sheet.sheet-a5 .sheet-party-label { font-size: calc(7.5px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-party strong { font-size: calc(9.5px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-party p { font-size: calc(8.2px * var(--invoice-scale, 1)); line-height: 1.7; gap: 0 7px; }
.invoice-sheet.sheet-a5 .sheet-party p strong { font-size: calc(8.5px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-items { margin-bottom: 8px; table-layout: fixed; }
.invoice-sheet.sheet-a5 .sheet-items .col-index { width: 5%; }
.invoice-sheet.sheet-a5 .sheet-items .col-product { width: 32%; }
.invoice-sheet.sheet-a5 .sheet-items .col-qty { width: 6%; }
.invoice-sheet.sheet-a5 .sheet-items .col-unit { width: 7%; }
.invoice-sheet.sheet-a5 .sheet-items .col-price { width: 13%; }
.invoice-sheet.sheet-a5 .sheet-items .col-discount { width: 11%; }
.invoice-sheet.sheet-a5 .sheet-items .col-tax { width: 11%; }
.invoice-sheet.sheet-a5 .sheet-items .col-total { width: 15%; }
.invoice-sheet.sheet-a5 .sheet-items thead th { font-size: calc(8px * var(--invoice-scale, 1)); padding: 5px 3px; }
.invoice-sheet.sheet-a5 .sheet-items tbody td { font-size: calc(8.3px * var(--invoice-scale, 1)); padding: 5px 3px; }
.invoice-sheet.sheet-a5 .sheet-items tbody td.col-product strong { font-size: calc(8.6px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-items tbody td.col-product small { font-size: calc(7.4px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-items-wrap { border-radius: 6px; margin-bottom: 8px; }
.invoice-sheet.sheet-a5 .sheet-bottom { grid-template-columns: minmax(0, 1fr) minmax(190px, 0.95fr); gap: 8px; margin-bottom: 8px; }
.invoice-sheet.sheet-a5 .sheet-words { padding: 6px 8px; font-size: calc(8.2px * var(--invoice-scale, 1)); border-radius: 6px; }
.invoice-sheet.sheet-a5 .sheet-words strong { font-size: calc(8.8px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-note,
.invoice-sheet.sheet-a5 .sheet-bank { font-size: calc(8px * var(--invoice-scale, 1)); line-height: 1.7; }
.invoice-sheet.sheet-a5 .sheet-note > span,
.invoice-sheet.sheet-a5 .sheet-bank > span { font-size: calc(7.6px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-bank p strong { font-size: calc(8px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-totals { border-radius: 6px; }
.invoice-sheet.sheet-a5 .sheet-total-row { padding: 5px 8px; font-size: calc(8.8px * var(--invoice-scale, 1)); gap: 8px; }
.invoice-sheet.sheet-a5 .sheet-total-row strong { font-size: calc(8.8px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-total-row.is-grand { padding: 7px 8px; }
.invoice-sheet.sheet-a5 .sheet-total-row.is-grand span { font-size: calc(8.6px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-total-row.is-grand strong { font-size: calc(11.5px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-total-row.is-grand small { font-size: calc(7px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-footer { padding-top: 6px; }
.invoice-sheet.sheet-a5 .sheet-signatures { gap: 24px; margin-bottom: 8px; }
.invoice-sheet.sheet-a5 .sheet-signatures > div { min-height: 30px; padding-top: 4px; }
.invoice-sheet.sheet-a5 .sheet-signatures span { font-size: calc(7.5px * var(--invoice-scale, 1)); }
.invoice-sheet.sheet-a5 .sheet-footnote { font-size: calc(7.2px * var(--invoice-scale, 1)); }

.voucher-sheet .sheet-header { align-items: center; }
.voucher-sheet .sheet-items tbody td { padding: 8px 6px; font-size: 11px; }
.sheet-statement-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 11px; }
.sheet-statement-summary > div { padding: 8px 10px; border-radius: 7px; background: #f7fbfa; border: 1px solid #e3ecea; }
.sheet-statement-summary span { display: block; font-size: 9px; color: #6b8189; }
.sheet-statement-summary strong { font-size: 11px; font-variant-numeric: tabular-nums; }
.statement-sheet .sheet-company-info h1 { font-size: 16px; }

/* ---------- ورود ---------- */
.auth-body {
    min-height: 100vh; background: var(--bg); margin: 0;
    background-image: radial-gradient(900px 500px at 90% -10%, rgba(20, 184, 166, 0.08), transparent 65%);
}
.auth-shell {
    display: grid; grid-template-columns: minmax(0, 1.08fr) minmax(430px, 0.92fr);
    min-height: 100vh;
}
.auth-visual {
    position: relative; overflow: hidden; color: #e6f2f4; display: flex;
    background:
        radial-gradient(800px 500px at 20% 0%, rgba(20, 184, 166, 0.22), transparent 62%),
        radial-gradient(600px 420px at 100% 100%, rgba(59, 130, 246, 0.14), transparent 60%),
        linear-gradient(145deg, #0b2b3d, #081d29 75%);
}
.auth-visual-pattern {
    position: absolute; inset: 0; opacity: 0.5; pointer-events: none;
    background-image: radial-gradient(rgba(255, 255, 255, 0.075) 1px, transparent 1px);
    background-size: 24px 24px;
    mask-image: radial-gradient(700px 600px at 30% 20%, #000, transparent 75%);
}
.auth-visual::after {
    content: ""; position: absolute; inset-inline-start: -120px; bottom: -160px;
    width: 420px; height: 420px; border-radius: 50%; border: 70px solid rgba(45, 212, 191, 0.055);
    pointer-events: none;
}
.auth-visual-content {
    position: relative; z-index: 1; display: flex; flex-direction: column;
    padding: 38px 52px 32px; width: 100%; max-width: 660px; margin: 0 auto;
}
.auth-brand { display: inline-flex; align-items: center; gap: 11px; color: #fff; align-self: flex-start; }
.auth-brand:hover { color: #fff; }
.auth-brand-logo { width: 52px; height: 52px; border-radius: 14px; object-fit: contain; background: #fff; padding: 4px; }
.auth-brand > span { display: flex; flex-direction: column; line-height: 1.5; }
.auth-brand strong { font-size: 17px; }
.auth-brand small { font-size: 10.5px; color: #86a5b0; }
.auth-hero { margin: auto 0; padding: 40px 0 26px; max-width: 500px; }
.auth-eyebrow { font-size: 11px; color: #5eead4; letter-spacing: 0.4px; margin-bottom: 10px; }
.auth-hero h2 { font-size: 32px; line-height: 1.55; color: #fff; letter-spacing: -0.6px; margin-bottom: 12px; }
.auth-hero h2 span { color: #5eead4; }
.auth-hero-text { color: #9dbac3; font-size: 12.5px; line-height: 2; max-width: 440px; }
.auth-features { display: flex; flex-direction: column; gap: 8px; margin-top: 22px; }
.auth-feature {
    display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 11px;
    background: rgba(255, 255, 255, 0.045); border: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(4px); max-width: 380px;
}
.auth-feature > span {
    width: 34px; height: 34px; border-radius: 9px; background: rgba(45, 212, 191, 0.12);
    color: #5eead4; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.auth-feature > span svg { width: 17px; height: 17px; }
.auth-feature strong { display: block; font-size: 12px; color: #e8f4f5; }
.auth-feature small { display: block; font-size: 10px; color: #7e9da7; }
.auth-testimonial { border-top: 1px solid rgba(255, 255, 255, 0.09); padding-top: 16px; display: flex; align-items: flex-start; gap: 10px; }
.quote-mark { font-size: 34px; line-height: 1; color: #2dd4bf; opacity: 0.6; margin-top: -6px; }
.auth-testimonial p { font-size: 12px; color: #bcd2d8; }
.auth-testimonial small { font-size: 10px; color: #6f919c; display: block; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 30px; background: var(--surface); }
.auth-panel-inner { width: 100%; max-width: 380px; }
.auth-panel-head { text-align: center; margin-bottom: 22px; }
.auth-panel-icon {
    width: 52px; height: 52px; border-radius: 15px; background: var(--accent-soft);
    color: var(--accent-strong); display: inline-flex; align-items: center; justify-content: center;
    margin-bottom: 12px; border: 1px solid var(--accent-line);
}
.auth-panel-icon svg { width: 24px; height: 24px; }
.auth-panel-head h1 { font-size: 20px; letter-spacing: -0.3px; }
.auth-panel-head p { font-size: 12px; color: var(--muted); margin-top: 2px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form .btn-lg { margin-top: 4px; }
.auth-note {
    display: flex; align-items: flex-start; gap: 8px; margin-top: 18px; padding: 11px 13px;
    border-radius: 11px; background: var(--surface-soft); border: 1px dashed var(--border-strong);
    font-size: 10.5px; color: var(--muted); line-height: 1.8;
}
.auth-note svg { width: 15px; height: 15px; color: var(--accent); flex: 0 0 auto; margin-top: 2px; }
.auth-copyright {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 26px; padding-top: 14px; border-top: 1px solid var(--border);
    font-size: 10px; color: var(--muted);
}
.auth-form .password-toggle svg { width: 17px; height: 17px; }

/* ---------- نصب‌کننده ---------- */
.installer-body { background: #eef3f2; margin: 0; min-height: 100vh; }
.installer-shell { display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: 100vh; }
.installer-aside {
    position: relative; overflow: hidden; padding: 34px 28px;
    background:
        radial-gradient(500px 400px at 100% 0%, rgba(20, 184, 166, 0.2), transparent 65%),
        linear-gradient(160deg, #0b2b3d, #081d29);
    color: #dcecef; display: flex; flex-direction: column; gap: 26px;
}
.installer-aside::after {
    content: ""; position: absolute; inset-inline-start: -100px; bottom: -120px;
    width: 320px; height: 320px; border-radius: 50%; border: 54px solid rgba(45, 212, 191, 0.055);
}
.installer-brand { display: flex; align-items: center; gap: 11px; color: #fff; position: relative; z-index: 1; }
.installer-brand strong { display: block; font-size: 16px; }
.installer-brand small { display: block; font-size: 10px; color: #7e9da7; }
.installer-eyebrow { font-size: 10px; color: #5eead4; letter-spacing: 0.8px; margin-bottom: 4px; }
.installer-aside p { font-size: 11.5px; color: #93b3bd; line-height: 1.95; }
.installer-steps { display: flex; flex-direction: column; gap: 3px; position: relative; z-index: 1; }
.installer-steps li { display: flex; align-items: center; gap: 9px; padding: 8px 0; font-size: 11.5px; color: #7e9da7; }
.installer-steps li.is-active { color: #eafffb; }
.installer-steps li.is-done { color: #5eead4; }
.step-bullet {
    width: 24px; height: 24px; border-radius: 8px; background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12); display: inline-flex; align-items: center;
    justify-content: center; font-size: 10px; flex: 0 0 auto;
}
.installer-steps li.is-active .step-bullet { background: #14b8a6; border-color: #14b8a6; color: #062a2a; font-weight: 700; }
.installer-steps li.is-done .step-bullet { background: rgba(45, 212, 191, 0.16); color: #5eead4; border-color: rgba(45, 212, 191, 0.3); }
.step-text { line-height: 1.6; }
.installer-aside-note {
    margin-top: auto; padding: 13px; border-radius: 11px; font-size: 10.5px;
    background: rgba(255, 255, 255, 0.05); border: 1px solid rgba(255, 255, 255, 0.09);
    color: #9dbac3; position: relative; z-index: 1;
}
.installer-main { padding: 34px 38px 20px; width: 100%; max-width: 1060px; margin: 0 auto; }
.installer-topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.installer-topbar h1 { font-size: 21px; letter-spacing: -0.3px; }
.installer-topbar p { font-size: 11.5px; color: var(--muted); }
.installer-card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 24px 26px; box-shadow: var(--shadow-sm); margin-bottom: 18px;
}
.installer-lead { font-size: 12.5px; color: var(--muted); line-height: 1.95; margin-bottom: 16px; max-width: 700px; }
.installer-section-title { font-size: 14px; margin: 20px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.installer-section-title:first-of-type { margin-top: 4px; }
.installer-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.installer-errors { margin-bottom: 14px; }
.installer-success, .installer-locked { text-align: center; padding: 44px 30px; }
.installer-success-icon, .installer-locked-icon {
    width: 68px; height: 68px; border-radius: 20px; margin: 0 auto 14px;
    background: var(--success-soft); color: var(--success); display: flex;
    align-items: center; justify-content: center; font-size: 30px; border: 1px solid #bfe8d6;
}
.installer-locked-icon { background: var(--warning-soft); color: var(--warning); border-color: #f0dcb4; }
.installer-success h2, .installer-locked h2 { font-size: 21px; margin-bottom: 4px; }
.installer-success .installer-actions, .installer-locked .installer-actions { justify-content: center; }
.installer-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 9px; margin: 18px 0; }
.installer-stats > div { padding: 12px; border-radius: 11px; background: var(--surface-soft); border: 1px solid var(--border); }
.installer-stats span { display: block; font-size: 10px; color: var(--muted); }
.installer-stats strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.installer-next { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; text-align: start; margin-top: 18px; }
.installer-credential { padding: 14px 16px; border-radius: 12px; background: var(--accent-soft); border: 1px solid var(--accent-line); font-size: 11.5px; }
.installer-credential strong { display: block; margin-bottom: 4px; font-size: 12.5px; }
.installer-credential code { background: #fff; border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-family: var(--font); direction: ltr; display: inline-block; }
.installer-checklist { display: flex; flex-direction: column; gap: 6px; font-size: 11px; color: var(--muted); text-align: start; }
.installer-checklist li { display: flex; gap: 7px; align-items: flex-start; }
.installer-checklist li::before { content: "✓"; color: var(--success); font-weight: 700; }
.installer-footer { text-align: center; font-size: 10px; color: var(--muted); padding: 6px 0 24px; }
.installer-aside-note strong { color: #cfe6e9; display: block; margin-bottom: 2px; }
.installer-body .form-grid { gap: 14px; }
.installer-body .field > label { font-size: 12px; }
.installer-body .filter-bar { border-bottom: 0; padding-bottom: 0; }
.requirement-label { display: flex; flex-direction: column; gap: 1px; }
.requirement-label strong { font-size: 12px; font-weight: 500; }
.requirement-label small { font-size: 10px; color: var(--muted); }
.requirements-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.requirement-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12px; }
.requirement-row:last-child { border-bottom: 0; }
.requirement-row:nth-child(even) { background: var(--surface-soft); }
.requirement-value { font-size: 10.5px; color: var(--muted); direction: ltr; }
.requirement-status { font-size: 10px; padding: 2px 8px; border-radius: 999px; background: var(--surface-muted); color: var(--muted); white-space: nowrap; }
.requirement-status.is-ok { background: var(--success-soft); color: var(--success); }
.requirement-status.is-bad { background: var(--danger-soft); color: var(--danger); }
.db-panel { background: var(--surface-soft); border: 1px solid var(--border); border-radius: 13px; padding: 15px; margin: 14px 0; }
.db-driver-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.db-driver-card {
    position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: 11px; background: var(--surface);
    cursor: pointer; transition: border-color 0.16s, background 0.16s;
}
.db-driver-card input { position: absolute; opacity: 0; }
.db-driver-card:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--ring); }
.db-driver-icon { width: 34px; height: 34px; border-radius: 9px; background: var(--surface-muted); color: var(--accent); display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.db-driver-icon svg { width: 17px; height: 17px; }
.db-driver-card strong { display: block; font-size: 12px; }
.db-driver-card small { display: block; font-size: 10px; color: var(--muted); }
.review-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.review-card { border: 1px solid var(--border); border-radius: 12px; background: var(--surface-soft); padding: 13px 15px; }
.review-card-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500; padding-bottom: 6px; margin-bottom: 6px; border-bottom: 1px dashed var(--border); }
.review-card-head svg { width: 15px; height: 15px; color: var(--accent); }
.review-card .info-list > div { padding: 5px 0; font-size: 11.5px; }
.review-features { display: flex; flex-direction: column; gap: 5px; margin-top: 8px; }
.review-features span { display: flex; gap: 6px; align-items: flex-start; font-size: 11px; color: var(--muted); }
.review-features svg { width: 14px; height: 14px; color: var(--success); flex: 0 0 auto; margin-top: 3px; }
.installer-footnote { font-size: 10px; color: var(--muted); line-height: 1.9; margin-top: 10px; }

/* ---------- واکنش‌گرایی ---------- */
@media (max-width: 1280px) {
    .kpi-grid-5 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .report-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
    .hero-card { padding: 24px; }
    .hero-stats { min-width: 250px; }
}
@media (max-width: 1120px) {
    :root { --sidebar-w: 258px; }
    .main-content { padding: 22px 22px 8px; }
    .topbar { padding: 0 22px; }
    .dashboard-grid-main { grid-template-columns: minmax(0, 1fr); }
    .form-layout, .detail-grid { grid-template-columns: minmax(0, 1fr); }
    .form-side, .detail-side { position: static; max-height: none; overflow: visible; }
    .sticky-card, .detail-side, .settings-nav { position: static; }
    .settings-layout { grid-template-columns: 230px minmax(0, 1fr); }
    .crud-grid { grid-template-columns: minmax(0, 1fr); }
    .profile-layout { grid-template-columns: minmax(0, 1fr); }
    .report-columns { grid-template-columns: minmax(0, 1fr); }
    .kpi-grid, .kpi-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .dashboard-grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .auth-visual-content { padding: 32px 36px 26px; }
    .auth-hero h2 { font-size: 27px; }
    .installer-shell { grid-template-columns: 280px minmax(0, 1fr); }
    .installer-main { padding: 28px 26px 18px; }
}
@media (max-width: 1040px) {
    .settings-layout { grid-template-columns: minmax(0, 1fr); }
    .settings-nav { flex-direction: column; }
    .settings-nav > nav { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px; }
    .settings-nav a { min-width: 0; }
    .settings-nav-note { display: none; }
}
@media (max-width: 940px) {
    .sidebar {
        transform: translateX(100%); transition: transform 0.28s var(--ease);
        width: 286px; box-shadow: -30px 0 60px rgba(4, 20, 28, 0.35);
    }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-close { display: inline-flex; }
    .main-area { margin-inline-start: 0; }
    .menu-toggle { display: inline-flex; }
    .topbar-date { display: none; }
    .topbar { gap: 12px; }
    .global-search { width: 100%; }
    .global-search kbd { display: none; }
    .user-meta { display: none; }
    .user-menu { padding: 4px; gap: 4px; }
    .user-menu > svg { display: none; }
    .dashboard-grid-two, .dashboard-grid-three { grid-template-columns: minmax(0, 1fr); }
    .kpi-grid-3, .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .profile-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .profile-metric:last-child:nth-child(odd) { grid-column: 1 / -1; }
    .settings-layout { grid-template-columns: minmax(0, 1fr); }
    .auth-shell { grid-template-columns: minmax(0, 1fr); }
    .auth-visual { display: none; }
    .auth-panel { min-height: 100vh; padding: 26px; }
    .installer-shell { grid-template-columns: minmax(0, 1fr); }
    .installer-aside { padding: 22px 24px; gap: 14px; }
    .installer-steps { flex-direction: row; overflow-x: auto; }
    .installer-steps li { white-space: nowrap; padding: 4px 0; }
    .installer-aside-note { display: none; }
}
@media (max-width: 760px) {
    .main-content { padding: 18px 14px 6px; }
    .topbar { padding: 0 14px; height: 66px; }
    :root { --topbar-h: 66px; }
    .page-head { align-items: flex-start; }
    .page-head h1 { font-size: 20px; }
    .page-actions { width: 100%; }
    .page-actions .btn-group { width: 100%; }
    .page-actions .btn { flex: 1; }
    .kpi-grid, .kpi-grid-2, .kpi-grid-3, .kpi-grid-4, .kpi-grid-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kpi-value { font-size: 17px; }
    .hero-card { padding: 20px; }
    .hero-card h2 { font-size: 20px; }
    .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 100%; }
    .form-grid-2, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
    .field-span-2 { grid-column: auto; }
    .items-footer, .invoice-notes { grid-template-columns: minmax(0, 1fr); }
    .form-actions .btn-group { margin-inline-start: 0; width: 100%; }
    .form-actions .btn-group .btn { flex: 1; }
    .card { padding: 17px; border-radius: 15px; }
    .card-head { margin-bottom: 14px; }
    .report-hero { padding: 20px; }
    .report-hero h2 { font-size: 18px; }
    .report-hero-stats { width: 100%; }
    .report-hero-stats > div { flex: 1; min-width: 120px; }
    .report-sheet { padding: 20px 16px 16px; }
    .report-head { gap: 14px; }
    .report-brand, .report-heading { max-width: 100%; }
    .report-heading { text-align: start; }
    .report-section { padding: 12px; }
    .income-highlight { padding: 16px; }
    .income-highlight strong { font-size: 21px; }
    .report-summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-totals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .equation-banner { gap: 12px; }
    .tabs-row { align-items: flex-start; flex-direction: column; }
    .profile-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid-2, .info-grid, .sheet-parties, .sheet-statement-summary { grid-template-columns: minmax(0, 1fr); }
    .treasury-hero { grid-template-columns: minmax(0, 1fr); padding: 20px; }
    .treasury-total-card { min-width: 0; }
    .quick-actions { grid-template-columns: minmax(0, 1fr); }
    .role-options { grid-template-columns: minmax(0, 1fr); }
    .review-grid { grid-template-columns: minmax(0, 1fr); }
    .installer-main { padding: 20px 14px 10px; }
    .installer-card { padding: 18px; border-radius: 15px; }
    .installer-next { grid-template-columns: minmax(0, 1fr); }
    .installer-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .db-driver-grid { grid-template-columns: minmax(0, 1fr); }
    .installer-topbar h1 { font-size: 18px; }
    .print-stage { padding: 14px 8px 30px; }
    .print-toolbar { padding: 9px 12px; }
    .print-hint { display: none; }
    .toast-stack { inset-inline: 14px; bottom: 14px; max-width: none; }
    .filter-bar { gap: 8px; }
    .filter-field { flex: 1; min-width: 120px; }
    .filter-search { max-width: none; flex-basis: 100%; }
    .pagination { justify-content: center; }
    .app-footer { flex-direction: column; align-items: flex-start; gap: 6px; }
}
@media (max-width: 560px) {
    .stat-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
}
@media (max-width: 480px) {
    .kpi-grid, .kpi-grid-2, .kpi-grid-3, .kpi-grid-4, .kpi-grid-5 { grid-template-columns: minmax(0, 1fr); }
    .hero-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-summary-strip, .report-totals-grid { grid-template-columns: minmax(0, 1fr); }
    .profile-metrics { grid-template-columns: minmax(0, 1fr); }
    .installer-stats { grid-template-columns: minmax(0, 1fr); }
    .auth-panel { padding: 20px 16px; }
    .step-text { display: none; }
    .installer-steps li { padding: 2px; }
}

/* ---------- قواعد چاپ ---------- */
@media print {
    @page { size: A4 portrait; margin: 0; }
    html, body { background: #fff !important; }
    html, body, .invoice-sheet, .invoice-sheet *, .invoice-sheet::before {
        -webkit-print-color-adjust: exact !important;
        color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    .no-print, .print-toolbar, .app-footer, .sidebar, .topbar, .page-head, .filter-bar,
    .tabs-row, .toast-stack, .skip-link, .page-actions { display: none !important; }
    .print-body, .print-stage { background: #fff !important; padding: 0 !important; margin: 0 !important; display: block !important; }
    .invoice-sheet {
        width: 210mm !important; min-height: 296mm; box-shadow: none !important;
        border-radius: 0 !important; margin: 0; padding: 12mm 12mm 10mm;
        page-break-after: always;
    }
    .invoice-sheet.sheet-a5 {
        width: 148mm !important; min-height: 209mm !important; padding: 7mm 7mm 6mm !important;
    }
    .invoice-sheet:last-child { page-break-after: auto; }
    .sheet-items thead { display: table-header-group; }
    .sheet-items tr, .sheet-bottom, .sheet-footer, .sheet-words, .sheet-totals { break-inside: avoid; }
    .report-sheet { box-shadow: none !important; border: 0 !important; padding: 10mm 10mm 8mm !important; border-radius: 0 !important; }
    .report-sheet + .report-sheet { page-break-before: always; }
    .report-section, .report-tile, .income-highlight, .equation-banner, .report-summary-strip { break-inside: avoid; }
    .report-table thead { display: table-header-group; }
    .main-area { margin: 0 !important; }
    .main-content { padding: 0 !important; max-width: none !important; }
    .card { box-shadow: none !important; }
    a[href]::after { content: none !important; }
    .voucher-sheet, .statement-sheet { box-shadow: none !important; }
}

/* ==========================================================================
   افزودنی‌ها: تاریخ‌گزین، پنجره تأیید و اصلاح سوییچ
   ========================================================================== */

/* سوییچ واقعی */
.switch {
    position: relative; display: inline-block; width: 42px; height: 24px;
    background: #cfdcd9; border-radius: 999px; flex: 0 0 auto;
    transition: background 0.18s var(--ease); cursor: pointer; vertical-align: middle;
}
.switch::after {
    content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px;
    border-radius: 50%; background: #fff; transition: transform 0.18s var(--ease);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}
.switch-field > input:checked + .switch,
.switch-field > input:checked ~ .switch,
.switch input:checked + .switch-track { background: var(--accent); }
.switch-field > input:checked + .switch::after,
.switch-field > input:checked ~ .switch::after,
.switch input:checked + .switch-track::after { transform: translateX(-18px); }
.switch-field > input:focus-visible + .switch,
.switch-field > input:focus-visible ~ .switch { box-shadow: 0 0 0 4px var(--ring); }
.switch-field > input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-field { cursor: pointer; }
.switch-field > span:last-child { font-size: 12.5px; color: var(--text-soft); }
.switch-field:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }

/* تاریخ‌گزین شمسی */
.jp-pop {
    position: fixed; z-index: 160; width: 288px; background: var(--surface);
    border: 1px solid var(--border); border-radius: 15px; box-shadow: var(--shadow-lg);
    padding: 10px; direction: rtl; animation: dropdownIn 0.16s var(--ease);
    font-family: var(--font);
}
.jp-head { display: flex; align-items: center; gap: 2px; padding-bottom: 7px; margin-bottom: 5px; border-bottom: 1px solid var(--border); }
.jp-title { flex: 1; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--text); }
.jp-nav {
    width: 26px; height: 26px; border: 0; background: transparent; border-radius: 7px;
    color: var(--muted); font-size: 16px; line-height: 1; display: inline-flex;
    align-items: center; justify-content: center; padding: 0;
}
.jp-nav:hover { background: var(--surface-muted); color: var(--accent-strong); }
.jp-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; margin-bottom: 3px; }
.jp-week span { text-align: center; font-size: 10px; color: var(--muted); padding: 3px 0; font-weight: 500; }
.jp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jp-day {
    height: 32px; border: 0; background: transparent; border-radius: 8px;
    font-size: 11.5px; color: var(--text-soft); display: inline-flex;
    align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
    transition: background 0.12s, color 0.12s;
}
.jp-day:hover { background: var(--accent-soft); color: var(--accent-strong); }
.jp-day.is-empty { pointer-events: none; }
.jp-day.is-today { box-shadow: inset 0 0 0 1px var(--accent-line); color: var(--accent-strong); font-weight: 700; }
.jp-day.is-selected { background: var(--accent); color: #fff; font-weight: 700; box-shadow: 0 6px 14px -7px rgba(15, 118, 110, 0.8); }
.jp-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--border); }
.jp-today, .jp-close {
    height: 29px; padding: 0 11px; border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface-soft); color: var(--text-soft); font-size: 11px;
}
.jp-today { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent-strong); }
.jp-today:hover, .jp-close:hover { filter: brightness(0.97); }

/* پنجره تأیید */
.confirm-backdrop {
    position: fixed; inset: 0; z-index: 180; background: rgba(6, 24, 33, 0.55);
    backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center;
    padding: 18px; animation: fadeIn 0.18s var(--ease);
}
.confirm-dialog {
    width: 100%; max-width: 390px; background: var(--surface); border-radius: 18px;
    box-shadow: var(--shadow-lg); padding: 22px; text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.6); animation: dropdownIn 0.2s var(--ease);
}
.confirm-icon {
    width: 52px; height: 52px; border-radius: 15px; background: var(--warning-soft);
    color: var(--warning); display: inline-flex; align-items: center; justify-content: center;
    font-size: 26px; font-weight: 700; margin-bottom: 11px; border: 1px solid #f0dcb4;
}
.confirm-body h3 { font-size: 16px; margin-bottom: 5px; }
.confirm-body p { font-size: 12.5px; color: var(--muted); line-height: 1.9; }
.confirm-actions { display: flex; justify-content: center; gap: 8px; margin-top: 18px; }
.confirm-actions .btn { min-width: 100px; }

/* اصلاحات جزئی */
.quick-action > span:first-child {
    width: 31px; height: 31px; border-radius: 9px; display: inline-flex;
    align-items: center; justify-content: center; flex: 0 0 auto;
}
.quick-action > span:first-child svg { width: 16px; height: 16px; }
.quick-action > strong { font-size: 12px; font-weight: 500; flex: 1; }
.quick-action > small { display: none; }
.sheet-items tbody tr.is-opening { background: var(--surface-soft); color: var(--muted); }
.sheet-items tbody tr.is-grand { background: #eef6f4; font-weight: 700; }
.sheet-items tbody td.is-empty { text-align: center; color: var(--muted); padding: 14px; }
.sheet-items tbody tr.is-grand td { border-top: 1.5px solid #c6d8d4; }
.stat-tile .is-success { color: var(--success); }
.audit-item:last-child { border-bottom: 0; }
.list-icon.is-success { background: var(--success-soft); color: var(--success); }
.list-icon.is-warning { background: var(--warning-soft); color: var(--warning); }
.print-stage { overflow-x: auto; }
.theme-preview input:focus-visible + .theme-preview-inner { box-shadow: 0 0 0 4px var(--ring); }
.is-hidden { display: none !important; }