/* =====================================================================
   سیستم طراحی سامانه بیمه تکمیلی درمان پرسنل — نسخه ۲ (بازطراحی کامل)
   جهت‌گیری: Soft UI مدرن — سایبار روشن، کارت‌های نرم، رنگ فیروزه‌ای آرام
   + سبز سلامت، سایه‌های رنگی ملایم، تایپوگرافی گرد و دوستانه (Vazirmatn)
   ===================================================================== */

:root, [data-theme="light"] {
    /* --- برند --- */
    --primary: #0891B2;
    --primary-dark: #0E7490;
    --primary-light: #22D3EE;
    --primary-bg: #E5F7FA;
    --accent: #059669;
    --accent-dark: #047857;
    --accent-light: #10B981;
    --accent-bg: #DCFBEE;

    /* --- خنثی / سطوح --- */
    --ink: #0F2C33;
    --ink-2: #234450;
    --muted: #5B7480;
    --muted-light: #9BB1B8;
    --bg: #F4FAFB;
    --surface: #FFFFFF;
    --surface-2: #EEF7F8;
    --line: #DCEEF1;

    /* --- معنایی --- */
    --amber: #D97706;
    --amber-bg: #FEF3E0;
    --danger: #DC2626;
    --danger-bg: #FDEAEA;
    --success: #059669;
    --success-bg: #DCFBEE;

    /* --- تنوع بصری آیکون/برچسب --- */
    --accent-blue: #2563EB;
    --accent-blue-bg: rgba(37,99,235,0.10);
    --accent-purple: #7C3AED;
    --accent-purple-bg: rgba(124,58,237,0.10);
    --accent-yellow: #CA8A04;
    --accent-yellow-bg: rgba(202,138,4,0.12);
    --accent-red: #DC2626;
    --accent-red-bg: rgba(220,38,38,0.10);
    --accent-teal-bg: rgba(8,145,178,0.10);

    --sidebar-bg: #FFFFFF;
    --sidebar-text: #5B7480;
    --sidebar-border: #E7F2F4;
    --topbar-bg: rgba(244,250,251,0.82);

    --radius-xl: 22px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-sm: 11px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 3px rgba(15,44,51,0.06);
    --shadow-card: 0 6px 24px rgba(8,90,110,0.08);
    --shadow-pop: 0 20px 48px rgba(8,90,110,0.20);
    --shadow-inset: inset 0 0 0 1px rgba(8,145,178,0.10);

    --sidebar-w: 272px;

    --bs-font-sans-serif: 'Vazirmatn', Tahoma, sans-serif;
    --bs-body-font-family: var(--bs-font-sans-serif);
    --bs-primary: var(--primary);
    --bs-primary-rgb: 8, 145, 178;
    --bs-link-color: var(--primary);
    --bs-link-hover-color: var(--primary-dark);
    --bs-border-radius: var(--radius-sm);
    color-scheme: light;
}

[data-theme="dark"] {
    --primary: #22D3EE;
    --primary-dark: #67E8F9;
    --primary-light: #A5F3FC;
    --primary-bg: rgba(34,211,238,0.12);
    --accent: #34D399;
    --accent-dark: #6EE7B7;
    --accent-light: #6EE7B7;
    --accent-bg: rgba(52,211,153,0.14);

    --ink: #E7F3F5;
    --ink-2: #C7DEE2;
    --muted: #8FAFB8;
    --muted-light: #5B7480;
    --bg: #0A1C21;
    --surface: #102A31;
    --surface-2: #14343C;
    --line: #1E3C43;

    --amber: #F0A94E;
    --amber-bg: rgba(240,169,78,0.14);
    --danger: #F27C6E;
    --danger-bg: rgba(242,124,110,0.14);
    --success: #34D399;
    --success-bg: rgba(52,211,153,0.14);

    --accent-blue: #7DA2FF;
    --accent-blue-bg: rgba(125,162,255,0.16);
    --accent-purple: #B69CFB;
    --accent-purple-bg: rgba(182,156,251,0.16);
    --accent-yellow: #E3BA52;
    --accent-yellow-bg: rgba(227,186,82,0.16);
    --accent-red: #F27C6E;
    --accent-red-bg: rgba(242,124,110,0.16);
    --accent-teal-bg: rgba(34,211,238,0.14);

    --sidebar-bg: #0D2229;
    --sidebar-text: #8FAFB8;
    --sidebar-border: #1E3C43;
    --topbar-bg: rgba(10,28,33,0.82);

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.28);
    --shadow-card: 0 6px 24px rgba(0,0,0,0.32);
    --shadow-pop: 0 20px 48px rgba(0,0,0,0.45);
    --shadow-inset: inset 0 0 0 1px rgba(34,211,238,0.14);
    color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]):not([data-theme="dark"]) {
        --primary: #22D3EE;
        --primary-dark: #67E8F9;
        --primary-light: #A5F3FC;
        --primary-bg: rgba(34,211,238,0.12);
        --accent: #34D399;
        --accent-dark: #6EE7B7;
        --accent-light: #6EE7B7;
        --accent-bg: rgba(52,211,153,0.14);
        --ink: #E7F3F5;
        --ink-2: #C7DEE2;
        --muted: #8FAFB8;
        --muted-light: #5B7480;
        --bg: #0A1C21;
        --surface: #102A31;
        --surface-2: #14343C;
        --line: #1E3C43;
        --amber: #F0A94E;
        --amber-bg: rgba(240,169,78,0.14);
        --danger: #F27C6E;
        --danger-bg: rgba(242,124,110,0.14);
        --success: #34D399;
        --success-bg: rgba(52,211,153,0.14);
        --accent-blue: #7DA2FF;
        --accent-blue-bg: rgba(125,162,255,0.16);
        --accent-purple: #B69CFB;
        --accent-purple-bg: rgba(182,156,251,0.16);
        --accent-yellow: #E3BA52;
        --accent-yellow-bg: rgba(227,186,82,0.16);
        --accent-red: #F27C6E;
        --accent-red-bg: rgba(242,124,110,0.16);
        --accent-teal-bg: rgba(34,211,238,0.14);
        --sidebar-bg: #0D2229;
        --sidebar-text: #8FAFB8;
        --sidebar-border: #1E3C43;
        --topbar-bg: rgba(10,28,33,0.82);
        --shadow-sm: 0 1px 3px rgba(0,0,0,0.28);
        --shadow-card: 0 6px 24px rgba(0,0,0,0.32);
        --shadow-pop: 0 20px 48px rgba(0,0,0,0.45);
        --shadow-inset: inset 0 0 0 1px rgba(34,211,238,0.14);
        color-scheme: dark;
    }
}

* { box-sizing: border-box; }
html { font-size: 100%; overflow-x: hidden; scroll-behavior: smooth; }
html, body { max-width: 100%; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

body {
    overflow-x: hidden;
    background-color: var(--bg);
    background-image: radial-gradient(circle at 100% 0%, var(--primary-bg) 0%, transparent 45%);
    background-attachment: fixed;
    color: var(--ink);
    margin: 0;
    transition: background-color 0.2s ease, color 0.2s ease;
}
.card, .form-control, .form-select, .table { transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease; }

body, .btn, .form-control, .form-select, .table, .card, .badge, .modal, .accordion {
    font-family: 'Vazirmatn', Tahoma, sans-serif !important;
}
h1, h2, h3, h4, h5, h6, .fw-heading {
    font-family: 'Vazirmatn', Tahoma, sans-serif !important;
    font-weight: 700 !important;
    color: var(--ink);
    letter-spacing: -0.01em;
}

a { color: var(--primary); }
a:hover { color: var(--primary-dark); }
a, button, .btn, .sidebar-link, .stat-card, [role="button"] { cursor: pointer; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

svg.icon { width: 19px; height: 19px; flex-shrink: 0; }

/* ---------- کلید تغییر پوسته (روشن/تیره/خودکار) ---------- */
.theme-switch {
    display: flex;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    padding: 3px;
    gap: 2px;
    margin-top: 12px;
}
.theme-switch button {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--muted);
    border-radius: var(--radius-pill);
    padding: 6px 4px;
    font-size: 0.72rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}
.theme-switch button.active { background: var(--primary); color: #fff; }
.theme-switch button svg { width: 15px; height: 15px; }

/* =====================================================================
   پوسته اصلی برنامه: نوار کناری روشن + محتوا
   ===================================================================== */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.app-sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: var(--sidebar-bg);
    border-inline-start: 1px solid var(--sidebar-border);
    color: var(--ink);
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 40;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, background-color 0.2s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 24px 22px 18px;
    font-weight: 700;
    font-size: 1.02rem;
    color: var(--ink);
}
.sidebar-brand img { width: 34px; height: 34px; }

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
    border-radius: var(--radius-md);
    color: var(--muted);
    text-decoration: none;
    font-size: 0.93rem;
    font-weight: 500;
    min-height: 44px;
    transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.sidebar-link svg { opacity: 0.75; }
.sidebar-link:hover { background: var(--surface-2); color: var(--ink); }
.sidebar-link.active {
    background: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-card);
}
.sidebar-link.active svg { opacity: 1; }

.sidebar-user {
    padding: 16px 20px 20px;
    border-top: 1px solid var(--line);
}
.sidebar-user-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sidebar-avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff; font-weight: 700; font-size: 0.95rem;
    display: flex; align-items: center; justify-content: center;
}
.sidebar-user-name { color: var(--ink); font-weight: 600; font-size: 0.92rem; }
.sidebar-user-role { color: var(--muted); font-size: 0.78rem; }
.sidebar-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ink-2);
    text-decoration: none;
    font-size: 0.85rem;
    background: var(--surface-2);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    width: fit-content;
    min-height: 40px;
}
.sidebar-logout:hover { background: var(--danger-bg); color: var(--danger); }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10,28,33,0.45);
    backdrop-filter: blur(2px);
    z-index: 35;
}
.sidebar-backdrop.show { display: block; }

.app-main {
    flex: 1;
    margin-right: var(--sidebar-w);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    width: calc(100% - var(--sidebar-w));
}

.app-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 32px;
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.app-topbar-title { font-weight: 700; color: var(--ink); font-size: 1.08rem; }
.sidebar-toggle {
    display: none;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 8px;
    color: var(--ink);
    min-width: 40px;
    min-height: 40px;
    align-items: center;
    justify-content: center;
}

.app-content, .app-content-plain {
    max-width: 1240px;
    width: 100%;
    margin: 0 auto;
    padding: 30px 32px 64px;
    animation: page-in 0.35s ease both;
}
.app-content-plain { min-height: 100vh; }

@keyframes page-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(100%); box-shadow: var(--shadow-pop); }
    .app-sidebar.open { transform: translateX(0); }
    .app-main { margin-right: 0; width: 100%; }
    .sidebar-toggle { display: inline-flex; }
    .app-content, .app-content-plain { padding: 20px 16px 44px; }
    .app-topbar { padding: 14px 18px; }
}

/* =====================================================================
   سرصفحه‌ی محتوایی صفحات (عنوان + توضیح + دکمه عملیات)
   ===================================================================== */
.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 22px;
}
.page-header h4, .page-header h5 { margin-bottom: 4px; }
.page-header p { color: var(--muted); margin: 0; }

/* ---------- بنر خوش‌آمدگویی با تصویرسازی ---------- */
.welcome-banner {
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 130%);
    border-radius: var(--radius-xl);
    padding: 28px 32px;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    box-shadow: var(--shadow-card);
    margin-bottom: 26px;
    position: relative;
    overflow: hidden;
}
.welcome-banner::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 15% 120%, rgba(255,255,255,0.18), transparent 55%);
}
.welcome-banner .welcome-text { position: relative; z-index: 1; }
.welcome-banner h4 { color: #fff; margin-bottom: 4px; }
.welcome-banner p { color: rgba(255,255,255,0.88); margin: 0; }
.welcome-banner .welcome-illustration { width: 132px; height: 132px; flex-shrink: 0; position: relative; z-index: 1; }
@media (max-width: 767.98px) { .welcome-banner .welcome-illustration { display: none; } }

/* =====================================================================
   اجزای عمومی
   ===================================================================== */
.btn {
    border-radius: var(--radius-sm);
    font-weight: 600;
    padding: 0.6rem 1.2rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, filter 0.15s ease;
}
.btn-sm { min-height: 36px; padding: 0.4rem 0.85rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); box-shadow: 0 4px 14px rgba(8,145,178,0.28); }
.btn-primary:hover, .btn-primary:focus { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-danger, .btn-outline-danger:hover { background: var(--danger); border-color: var(--danger); }
.btn-warning { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); }

.card {
    border: none;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}

.badge { font-weight: 600; padding: 0.42em 0.8em; border-radius: var(--radius-pill); }
.bg-success { background: var(--success) !important; }
.bg-danger { background: var(--danger) !important; }
.bg-warning { background: var(--amber) !important; color: #fff !important; }
.bg-primary { background: var(--primary) !important; }

.table { background: var(--surface); border-radius: var(--radius-md); overflow: hidden; }
.table thead.table-light th, .table > :not(caption) > * > th {
    background-color: var(--surface-2) !important;
    color: var(--ink);
    font-weight: 700;
    border-bottom-width: 1px;
    border-color: var(--line);
}
.table > :not(caption) > * > td { border-color: var(--line); color: var(--ink-2); }
.table-hover > tbody > tr:hover > * { background-color: var(--primary-bg); }

.form-control, .form-select {
    border-radius: var(--radius-sm);
    border-color: var(--line);
    background-color: var(--surface);
    color: var(--ink);
    padding: 0.6rem 0.9rem;
    min-height: 44px;
}
.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 0.2rem var(--primary-bg);
}
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--danger); }
.form-label { font-weight: 600; color: var(--ink); font-size: 0.92rem; }
.form-text { color: var(--muted); }

.brand-hero { width: 96px; height: 96px; margin: 0 auto 1rem; display: block; }

/* ---------- کارت‌های آماری داشبورد ---------- */
.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: 20px 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}
a:has(> .stat-card):hover .stat-card, a:hover > .stat-card { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.stat-card .stat-icon {
    width: 46px; height: 46px; border-radius: var(--radius-md);
    background: var(--primary-bg); color: var(--primary);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.stat-card .stat-value { font-weight: 800; font-size: 1.4rem; color: var(--ink); line-height: 1.2; }
.stat-card .stat-label { color: var(--muted); font-size: 0.82rem; }

/* ---------- نوار پیشرفت مانده/مصرف ---------- */
.balance-item { padding: 15px 17px; border-radius: var(--radius-md); background: var(--surface); border: 1px solid var(--line); }
.balance-item .balance-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; }
.balance-item .balance-figures { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--muted); margin-bottom: 6px; }
.balance-track { width: 100%; height: 8px; background: var(--surface-2); border-radius: var(--radius-pill); overflow: hidden; }
.balance-fill { height: 100%; border-radius: var(--radius-pill); background: linear-gradient(90deg, var(--accent-light), var(--accent)); transition: width 0.5s ease; }
.balance-item.low .balance-fill { background: linear-gradient(90deg, #F0A94E, var(--amber)); }
.balance-item.blocked { background: var(--surface-2); color: var(--muted); }

.balance-card { border-right: 4px solid var(--primary); border-radius: var(--radius-md); }
.balance-card.low { border-right-color: var(--amber); }
.balance-card.ok { border-right-color: var(--success); }

/* ---------- فهرست زمانی درخواست‌ها ---------- */
.claim-item { display: flex; align-items: flex-start; gap: 14px; padding: 15px 6px; border-bottom: 1px solid var(--line); border-radius: var(--radius-sm); transition: background 0.15s ease; }
.claim-item:hover { background: var(--surface-2); }
.claim-item:last-child { border-bottom: none; }
.claim-item .claim-icon { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--primary); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.claim-item .claim-main { flex: 1; min-width: 0; }
.claim-item .claim-title { font-weight: 700; font-size: 0.93rem; }
.claim-item .claim-meta { color: var(--muted); font-size: 0.8rem; }
.claim-item .claim-amount { font-weight: 700; white-space: nowrap; }

/* ---------- وضعیت خالی ---------- */
.empty-state { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty-state svg, .empty-state img { width: 140px; height: 140px; margin-bottom: 14px; }

.info-item { margin-bottom: 4px; }
.info-label { font-size: 0.85rem; color: var(--muted); }
.info-label::after { content: ": "; }
.info-value { font-weight: 600; }

.doc-thumb { display: block; width: 90px !important; max-width: 90px !important; height: 60px !important; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); margin-top: 4px; }

.equal-height-cards { display: flex; }
.equal-height-cards > .card { height: 100%; }

.sticky-table-wrap { max-height: 600px; overflow-x: auto; overflow-y: auto; position: relative; width: 100%; -webkit-overflow-scrolling: touch; border-radius: var(--radius-md); }
.sticky-table-wrap table { border-collapse: separate; border-spacing: 0; width: max-content; min-width: 100%; }
.sticky-table-wrap thead th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); }
.sticky-table-wrap tbody th, .sticky-table-wrap tbody td.sticky-col { position: sticky; right: 0; z-index: 2; background: var(--surface); }
.sticky-table-wrap thead th:first-child { z-index: 5; right: 0; }

/* ---------- کارت تعهدنامه/ورود (auth) ---------- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: var(--radius-xl); box-shadow: var(--shadow-pop); padding: 36px 32px; text-align: center; }
.auth-illustration { width: 168px; height: 168px; margin: 0 auto 8px; }

footer.app-footer { text-align: center; color: var(--muted); font-size: 0.85rem; margin-top: 2rem; }

@media print {
    .no-print { display: none !important; }
    .app-main { margin-right: 0 !important; width: 100% !important; }
    body { background: #fff; }
    .app-content { max-width: 100%; padding: 0; animation: none; }
}

/* =====================================================================
   انتخاب‌گر قالب ظاهری (پروفایل من)
   ===================================================================== */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.tpl-option {
    position: relative; display: flex; flex-direction: column; gap: 10px;
    padding: 16px; border: 2px solid var(--line); border-radius: var(--radius-lg);
    cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.tpl-option:hover { border-color: var(--primary-light); }
.tpl-option.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.tpl-option input[type="radio"] { position: absolute; top: 14px; left: 14px; width: 18px; height: 18px; accent-color: var(--primary); margin: 0; }
.tpl-name { font-weight: 700; font-size: 0.92rem; }
.tpl-desc { color: var(--muted); font-size: 0.78rem; line-height: 1.7; }

.tpl-preview { display: block; height: 78px; border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--line); overflow: hidden; position: relative; }
.tpl-preview-bar { position: absolute; background: var(--primary); }
.tpl-preview-body { position: absolute; display: flex; gap: 5px; }
.tpl-preview-body span { display: block; background: var(--surface); border: 1px solid var(--line); }

.tpl-preview-modern .tpl-preview-bar { inset-inline-end: 0; top: 0; bottom: 0; width: 24%; }
.tpl-preview-modern .tpl-preview-body { inset-inline-start: 8px; top: 10px; right: 32%; bottom: 10px; left: 8px; }
.tpl-preview-modern .tpl-preview-body span { flex: 1; border-radius: 8px; }

.tpl-preview-classic .tpl-preview-bar { top: 0; right: 0; left: 0; height: 22%; }
.tpl-preview-classic .tpl-preview-body { top: 30%; right: 8px; left: 8px; bottom: 8px; }
.tpl-preview-classic .tpl-preview-body span { flex: 1; border-radius: 2px; }

.tpl-preview-minimal .tpl-preview-bar { inset-inline-end: 0; top: 0; bottom: 0; width: 18%; background: var(--surface-2); }
.tpl-preview-minimal .tpl-preview-body { inset-inline-start: 8px; top: 10px; right: 26%; bottom: 10px; left: 8px; }
.tpl-preview-minimal .tpl-preview-body span { flex: 1; border-radius: 2px; border-color: var(--muted-light); }

/* =====================================================================
   قالب کلاسیک اداری — نوار ابزار بالای صفحه به‌جای نوار کناری،
   گوشه‌های تیز، چیدمان فشرده و رسمی (فقط توکن‌های شکل/ساختار تغییر می‌کنند؛
   پالت رنگی و حالت روشن/تیره مستقل باقی می‌مانند)
   ===================================================================== */
:root[data-template="classic"] {
    --radius-xl: 8px;
    --radius-lg: 8px;
    --radius-md: 6px;
    --radius-sm: 5px;
    --shadow-card: 0 1px 3px rgba(15,44,51,0.10);
    --shadow-pop: 0 6px 20px rgba(15,44,51,0.16);
}
[data-theme="dark"][data-template="classic"] {
    --shadow-card: 0 1px 3px rgba(0,0,0,0.30);
}
[data-template="classic"] h1, [data-template="classic"] h2, [data-template="classic"] h3,
[data-template="classic"] h4, [data-template="classic"] h5, [data-template="classic"] h6,
[data-template="classic"] .fw-heading { letter-spacing: 0; }
[data-template="classic"] .card, [data-template="classic"] .stat-card,
[data-template="classic"] .panel, [data-template="classic"] .welcome-banner { border: 1px solid var(--line); }
[data-template="classic"] .welcome-banner { border-radius: var(--radius-md); }

@media (min-width: 992px) {
    [data-template="classic"] .app-sidebar {
        position: fixed; top: 0; right: 0; left: 0; width: auto; height: 66px;
        flex-direction: row; align-items: center; border-inline-start: none;
        border-bottom: 1px solid var(--sidebar-border); transform: none;
    }
    [data-template="classic"] .sidebar-brand { border-bottom: none; padding: 0 22px; flex-shrink: 0; }
    [data-template="classic"] .sidebar-nav { flex-direction: row; flex: 1; overflow-x: auto; overflow-y: hidden; padding: 0 6px; }
    [data-template="classic"] .sidebar-link { white-space: nowrap; }
    [data-template="classic"] .sidebar-user { border-top: none; padding: 0 20px; flex-shrink: 0; display: flex; align-items: center; gap: 14px; }
    [data-template="classic"] .sidebar-user-top { margin-bottom: 0; }
    [data-template="classic"] .sidebar-user-role { display: none; }
    [data-template="classic"] .sidebar-logout span { display: none; }
    [data-template="classic"] .theme-switch { margin-top: 0; width: 96px; }
    [data-template="classic"] .app-main { margin-right: 0; width: 100%; margin-top: 66px; }
    [data-template="classic"] .app-topbar { display: none; }
    [data-template="classic"] .sidebar-toggle { display: none; }
}

/* =====================================================================
   قالب مینیمال — بدون سایه/گرادیان، خطوط باریک به‌جای کادر رنگی،
   فضای بیشتر و رنگ کم‌رنگ‌تر
   ===================================================================== */
:root[data-template="minimal"] {
    --shadow-card: none;
    --shadow-pop: 0 4px 16px rgba(15,44,51,0.12);
}
[data-template="minimal"] .app-sidebar { box-shadow: none; }
[data-template="minimal"] .card, [data-template="minimal"] .stat-card, [data-template="minimal"] .panel {
    box-shadow: none; border: 1px solid var(--line);
}
[data-template="minimal"] .sidebar-link.active {
    background: transparent; color: var(--primary); box-shadow: none;
    border-radius: 0; border-inline-end: 3px solid var(--primary);
}
[data-template="minimal"] .stat-icon { background: transparent; color: var(--ink-2); border: 1px solid var(--line); }
[data-template="minimal"] .claim-icon { background: transparent; border: 1px solid var(--line); }
[data-template="minimal"] .welcome-banner {
    background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: none;
}
[data-template="minimal"] .welcome-banner::after { display: none; }
[data-template="minimal"] .welcome-banner h4, [data-template="minimal"] .welcome-banner p { color: var(--ink); }
[data-template="minimal"] .welcome-banner p { color: var(--muted); }
[data-template="minimal"] .welcome-illustration { filter: grayscale(1) opacity(0.55); }
[data-template="minimal"] .btn-primary { box-shadow: none; }
[data-template="minimal"] .app-content, [data-template="minimal"] .app-content-plain { max-width: 1180px; }

/* =====================================================================
   رنگ اصلی قابل انتخاب کاربر (پروفایل من / تنظیمات مدیر)
   فقط رنگ برند/تعاملی (--primary...) تغییر می‌کند؛ رنگ‌های معنایی
   (موفقیت/هشدار/خطا) همیشه سبز/کهربایی/قرمز ثابت باقی می‌مانند
   تا وضعیت درخواست‌ها همیشه قابل تشخیص باشد. حالت پیش‌فرض «teal» است
   و نیازی به بازنویسی ندارد چون همان مقادیر پایه است.
   ===================================================================== */
:root[data-color="green"]  { --primary:#16A34A; --primary-dark:#15803D; --primary-light:#4ADE80; --primary-bg:#DCFCE7; }
:root[data-color="blue"]   { --primary:#2563EB; --primary-dark:#1D4ED8; --primary-light:#60A5FA; --primary-bg:#DBEAFE; }
:root[data-color="red"]    { --primary:#E11D48; --primary-dark:#BE123C; --primary-light:#FB7185; --primary-bg:#FFE4E6; }
:root[data-color="orange"] { --primary:#EA580C; --primary-dark:#C2410C; --primary-light:#FB923C; --primary-bg:#FFEDD5; }
:root[data-color="purple"] { --primary:#7C3AED; --primary-dark:#6D28D9; --primary-light:#A78BFA; --primary-bg:#EDE9FE; }

:root[data-theme="dark"][data-color="green"]  { --primary:#4ADE80; --primary-dark:#86EFAC; --primary-light:#BBF7D0; --primary-bg:rgba(74,222,128,.16); }
:root[data-theme="dark"][data-color="blue"]   { --primary:#60A5FA; --primary-dark:#93C5FD; --primary-light:#BFDBFE; --primary-bg:rgba(96,165,250,.16); }
:root[data-theme="dark"][data-color="red"]    { --primary:#FB7185; --primary-dark:#FDA4AF; --primary-light:#FECDD3; --primary-bg:rgba(251,113,133,.16); }
:root[data-theme="dark"][data-color="orange"] { --primary:#FB923C; --primary-dark:#FDBA74; --primary-light:#FED7AA; --primary-bg:rgba(251,146,60,.16); }
:root[data-theme="dark"][data-color="purple"] { --primary:#A78BFA; --primary-dark:#C4B5FD; --primary-light:#DDD6FE; --primary-bg:rgba(167,139,250,.16); }

@media (prefers-color-scheme: dark) {
    :root[data-color="green"]:not([data-theme="light"]):not([data-theme="dark"])  { --primary:#4ADE80; --primary-dark:#86EFAC; --primary-light:#BBF7D0; --primary-bg:rgba(74,222,128,.16); }
    :root[data-color="blue"]:not([data-theme="light"]):not([data-theme="dark"])   { --primary:#60A5FA; --primary-dark:#93C5FD; --primary-light:#BFDBFE; --primary-bg:rgba(96,165,250,.16); }
    :root[data-color="red"]:not([data-theme="light"]):not([data-theme="dark"])    { --primary:#FB7185; --primary-dark:#FDA4AF; --primary-light:#FECDD3; --primary-bg:rgba(251,113,133,.16); }
    :root[data-color="orange"]:not([data-theme="light"]):not([data-theme="dark"]) { --primary:#FB923C; --primary-dark:#FDBA74; --primary-light:#FED7AA; --primary-bg:rgba(251,146,60,.16); }
    :root[data-color="purple"]:not([data-theme="light"]):not([data-theme="dark"]) { --primary:#A78BFA; --primary-dark:#C4B5FD; --primary-light:#DDD6FE; --primary-bg:rgba(167,139,250,.16); }
}

.color-grid { display: flex; flex-wrap: wrap; gap: 12px; }
.color-option {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 7px;
    width: 76px; cursor: pointer;
}
.color-option input[type="radio"] { position: absolute; opacity: 0; width: 1px; height: 1px; }
.color-swatch {
    width: 44px; height: 44px; border-radius: 50%; border: 3px solid transparent;
    box-shadow: inset 0 0 0 1px rgba(15,44,51,0.08);
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.color-option:hover .color-swatch { transform: scale(1.06); }
.color-option.selected .color-swatch { border-color: var(--ink); }
.color-option:focus-within .color-swatch { outline: 2px solid var(--primary); outline-offset: 2px; }
.color-name { font-size: 0.74rem; color: var(--muted); font-weight: 600; }
.color-option.selected .color-name { color: var(--ink); }
