/* ─────────── قلم فارسی ─────────── */
@font-face {
    font-family: 'Vazirmatn';
    src: url('/lib/vazirmatn/Vazirmatn-Regular.woff2') format('woff2');
    font-weight: 400;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/lib/vazirmatn/Vazirmatn-Medium.woff2') format('woff2');
    font-weight: 500;
    font-display: swap;
}

@font-face {
    font-family: 'Vazirmatn';
    src: url('/lib/vazirmatn/Vazirmatn-Bold.woff2') format('woff2');
    font-weight: 700;
    font-display: swap;
}

:root {
    --cb-primary: #0f5132;
    --cb-primary-soft: #198754;
    --cb-sidebar: #10312a;
    --cb-sidebar-hover: #1b4a3f;
    --cb-bg: #f4f6f8;
}

html, body {
    font-family: 'Vazirmatn', Tahoma, 'Segoe UI', sans-serif;
    background: var(--cb-bg);
    font-size: 14px;
}

/* اعداد در جدول‌ها با عرض یکنواخت خواناترند */
.num {
    font-variant-numeric: tabular-nums;
}

/* ─────────── چیدمان ─────────── */
.cb-shell {
    display: flex;
    min-height: 100vh;
}

.cb-sidebar {
    width: 265px;
    flex: 0 0 265px;
    background: var(--cb-sidebar);
    color: #d7e5e0;
    overflow-y: auto;
    max-height: 100vh;
    position: sticky;
    top: 0;
}

.cb-sidebar .brand {
    padding: 1rem 1rem .85rem;
    border-bottom: 1px solid rgba(255,255,255,.09);
}

.cb-sidebar .brand h1 {
    font-size: 1rem;
    font-weight: 700;
    margin: 0;
    color: #fff;
    line-height: 1.6;
}

/* نام معاونت/واحد در سربرگ: بزرگ‌تر از بقیهٔ نوار، ولی با اجازهٔ شکستن خط.
   نام‌هایی مثل «معاونت توسعه مدیریت و منابع انسانی» در ۲۶۵ پیکسل در یک خط
   جا نمی‌شوند؛ با nowrap بریده می‌شدند و کاربر نمی‌فهمید در کدام واحد است. */
.cb-sidebar .brand h1.unit-name {
    font-size: 1.12rem;
    line-height: 1.75;
    letter-spacing: -.01em;
    overflow-wrap: anywhere;
}

.cb-sidebar .brand small {
    color: #8fb3a8;
    font-size: .72rem;
}

.cb-sidebar .nav-group-title {
    font-size: .7rem;
    color: #6f9488;
    padding: .9rem 1rem .3rem;
}

.cb-sidebar a.nav-item {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem 1rem;
    color: #cfe0da;
    text-decoration: none;
    font-size: .84rem;
    border-right: 3px solid transparent;
    transition: background .12s, border-color .12s;
}

.cb-sidebar a.nav-item:hover {
    background: var(--cb-sidebar-hover);
    color: #fff;
}

.cb-sidebar a.nav-item.active {
    background: var(--cb-sidebar-hover);
    color: #fff;
    border-right-color: #58d3a0;
    font-weight: 500;
}

.cb-sidebar a.nav-item i {
    width: 1.1rem;
    text-align: center;
    opacity: .85;
}

.cb-main {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.cb-topbar {
    background: #fff;
    border-bottom: 1px solid #e3e7ea;
    padding: .6rem 1.15rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cb-content {
    padding: 1.15rem;
    flex: 1 1 auto;
}

/* ─────────── تاریخ و ساعت نوار بالا ─────────── */
.cb-clock {
    display: flex;
    align-items: center;
    gap: .35rem;
    font-size: .8rem;
    color: #5a6b74;
    background: #f4f7f8;
    border: 1px solid #e3e7ea;
    border-radius: .4rem;
    padding: .28rem .6rem;
    white-space: nowrap;
}

.cb-clock i { color: var(--cb-primary-soft); }
.cb-clock-sep { color: #c6ced3; }
#cb-time { font-variant-numeric: tabular-nums; min-width: 4.6em; display: inline-block; }

@media (max-width: 768px) {
    .cb-clock #cb-date, .cb-clock-sep { display: none; }
}

/* تقویم شمسی روی سایر عناصر صفحه بیفتد */
.datepicker-plot-area { z-index: 1060 !important; font-family: 'Vazirmatn', Tahoma, sans-serif; }

/* ─────────── کارت‌ها و جدول‌ها ─────────── */
.card {
    border: 1px solid #e3e7ea;
    border-radius: .55rem;
    box-shadow: 0 1px 2px rgba(16,49,42,.04);
}

.card-header {
    background: #fff;
    border-bottom: 1px solid #eef1f3;
    font-weight: 500;
    padding: .7rem 1rem;
}

.table {
    font-size: .84rem;
    margin-bottom: 0;
}

.table > thead > tr > th {
    background: #f7f9fa;
    font-weight: 500;
    color: #4a5a63;
    white-space: nowrap;
    border-bottom-width: 1px;
    font-size: .8rem;
}

.table > tbody > tr > td {
    vertical-align: middle;
}

.table-hover > tbody > tr:hover > td {
    background: #f2f8f5;
}

/* ─────────── کاشی‌های شاخص ─────────── */
.kpi {
    background: #fff;
    border: 1px solid #e3e7ea;
    border-radius: .55rem;
    padding: .85rem .95rem;
    height: 100%;
    display: block;
    text-decoration: none;
    color: inherit;
    transition: box-shadow .12s, transform .12s;
}

.kpi:hover {
    box-shadow: 0 4px 12px rgba(16,49,42,.1);
    transform: translateY(-1px);
    color: inherit;
}

.kpi .kpi-label {
    font-size: .76rem;
    color: #6b7b84;
    display: block;
    margin-bottom: .3rem;
}

.kpi .kpi-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.kpi .kpi-foot {
    font-size: .72rem;
    color: #8b979e;
}

.kpi.danger { border-right: 3px solid #dc3545; }
.kpi.warn   { border-right: 3px solid #ffc107; }
.kpi.ok     { border-right: 3px solid #198754; }
.kpi.info   { border-right: 3px solid #0dcaf0; }

/* ─────────── فرم ─────────── */
.form-label {
    font-size: .8rem;
    font-weight: 500;
    color: #45535b;
    margin-bottom: .25rem;
}

.form-control, .form-select {
    font-size: .85rem;
}

.required-star {
    color: #dc3545;
    margin-inline-start: .15rem;
}

.field-help {
    font-size: .72rem;
    color: #8b979e;
}

/* ─────────── نقشه شهرنما ۳۶۰ ─────────── */
#shahrnama-map {
    height: calc(100vh - 230px);
    min-height: 420px;
    border-radius: .55rem;
    z-index: 1;
}

.layer-toggle {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .3rem .1rem;
    font-size: .82rem;
}

.layer-dot {
    width: .7rem;
    height: .7rem;
    border-radius: 50%;
    display: inline-block;
}

/* ─────────── متفرقه ─────────── */
.badge { font-weight: 500; font-size: .72rem; }

.timeline {
    position: relative;
    padding-right: 1.1rem;
    border-right: 2px solid #e3e7ea;
}

.timeline-item {
    position: relative;
    padding-bottom: 1rem;
}

.timeline-item::before {
    content: '';
    position: absolute;
    right: -1.42rem;
    top: .35rem;
    width: .6rem;
    height: .6rem;
    border-radius: 50%;
    background: var(--cb-primary-soft);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #e3e7ea;
}

/* ═══════════════════════ صفحه ورود ═══════════════════════ */

.login-page {
    min-height: 100vh;
    margin: 0;
    background: linear-gradient(135deg, #0b241e 0%, #143b32 50%, #0f5132 100%);
}

/* بافت ملایم پس‌زمینه؛ به‌جای تصویر، تا چیزی از شبکه بار نشود */
.login-page::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        radial-gradient(circle at 18% 22%, rgba(88, 211, 160, .16), transparent 42%),
        radial-gradient(circle at 82% 78%, rgba(25, 135, 84, .20), transparent 46%);
    pointer-events: none;
}

.login-shell {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-box {
    width: 100%;
    max-width: 880px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: #fff;
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 18px 55px rgba(0, 0, 0, .34);
}

/* ───── ستون معرفی ───── */

.login-brand {
    background: linear-gradient(165deg, #10312a 0%, #16463b 100%);
    color: #dceee7;
    padding: 2.4rem 1.9rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.2rem;
    height: 3.2rem;
    border-radius: .85rem;
    background: rgba(255, 255, 255, .12);
    font-size: 1.6rem;
    color: #7fe3b6;
    margin-bottom: .9rem;
}

.login-brand-name {
    font-size: 1.3rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 .35rem;
}

.login-brand-sub {
    font-size: .82rem;
    line-height: 1.9;
    color: #a9cfc2;
    margin: 0;
}

.login-points {
    list-style: none;
    padding: 0;
    margin: 2rem 0;
    font-size: .82rem;
}

.login-points li {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .5rem 0;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.login-points li:first-child { border-top: none; }
.login-points i { color: #7fe3b6; font-size: .95rem; }

.login-brand-foot {
    font-size: .74rem;
    color: #8fb9ab;
    margin: 0;
}

/* ───── ستون فرم ───── */

.login-form-col { padding: 2.4rem 2rem; }

.login-heading {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0 0 .3rem;
    color: #15241f;
}

.login-heading-sub {
    font-size: .8rem;
    color: #6b7b76;
    margin: 0 0 1.5rem;
}

/* فیلد با آیکون چسبیده: به‌جای input-group بوت‌استرپ، تا جای دکمه چشم
   در سمت دیگر باز بماند و گوشه‌ها در RTL هم درست بنشیند. */
.login-field { position: relative; }

/* هشدار: اینجا عمداً از جهت فیزیکی (right/left) استفاده می‌شود، نه منطقی.
   فیلدهای نام کاربری و گذرواژه dir="ltr" دارند (محتوایشان لاتین است) ولی ظرفشان
   RTL است. در این حالت padding-inline-start روی خود input بر پایه ltr حساب
   می‌شود و دقیقاً در سمت مخالفِ آیکون می‌نشیند — نتیجه‌اش این بود که متن
   گذرواژه روی دکمه چشم می‌افتاد. */

.login-field-icon {
    position: absolute;
    top: 50%;
    right: .85rem;              /* آیکون همیشه سمت راست فیلد */
    transform: translateY(-50%);
    color: #94a7a1;
    pointer-events: none;
    line-height: 1;
}

.login-input {
    padding-right: 2.5rem;      /* جا برای آیکون سمت راست */
    padding-left: .75rem;
    height: 2.85rem;
    border-color: #d7dedc;
}

.login-input-pass { padding-left: 2.9rem; }   /* جا برای دکمه چشم سمت چپ */

.login-input:focus {
    border-color: var(--cb-primary-soft);
    box-shadow: 0 0 0 .2rem rgba(25, 135, 84, .18);
}

.login-input[aria-invalid="true"] { border-color: #dc3545; }

.login-eye {
    position: absolute;
    top: 50%;
    left: .35rem;               /* فیزیکی، به دلیلِ بالا */
    transform: translateY(-50%);
    width: 2.2rem;
    height: 2.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: .4rem;
    background: transparent;
    color: #6b7b76;
    cursor: pointer;
}

.login-eye:hover { background: #eef2f1; color: #15241f; }

/* حلقه تمرکز دیده‌شدنی — کاربر فقط-کیبورد باید بداند کجاست */
.login-eye:focus-visible,
.login-skip:focus {
    outline: 2px solid var(--cb-primary-soft);
    outline-offset: 2px;
}

.login-submit {
    height: 2.85rem;
    font-weight: 600;
    border-radius: .5rem;
}

.login-version {
    text-align: center;
    font-size: .72rem;
    color: #9aa8a4;
    margin: 1.4rem 0 0;
}

/* ───── پیوند پرش (فقط هنگام تمرکز دیده می‌شود) ───── */

.login-skip {
    position: absolute;
    inset-inline-start: 50%;
    top: -3rem;
    transform: translateX(50%);
    z-index: 10;
    background: #fff;
    color: var(--cb-primary);
    padding: .5rem 1rem;
    border-radius: 0 0 .4rem .4rem;
    font-size: .8rem;
    text-decoration: none;
    transition: top .15s ease-out;
}

.login-skip:focus { top: 0; }

/* ───── حساب‌های نمونه (فقط محیط توسعه) ───── */

.login-demo {
    border-top: 1px solid #e8edec;
    padding-top: 1rem;
    font-size: .78rem;
    color: #6b7b76;
}

.login-demo summary { cursor: pointer; }

.login-demo-body { margin-top: .6rem; line-height: 2; }

.login-demo-warn {
    background: #fff6e5;
    border: 1px solid #f3d9a4;
    color: #8a5a00;
    border-radius: .4rem;
    padding: .4rem .6rem;
    line-height: 1.8;
    margin-bottom: .6rem;
}

/* جدول حساب‌های نمونه — ۱۶ سطر، باید جمع‌وجور بماند */
.login-demo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .74rem;
    line-height: 1.6;
}

.login-demo-table th,
.login-demo-table td {
    padding: .22rem .4rem;
    border-bottom: 1px solid #eef2f1;
    text-align: start;
    white-space: nowrap;
}

.login-demo-table thead th {
    font-weight: 600;
    color: #15241f;
    border-bottom: 1px solid #d7dedc;
    background: #f7faf9;
}

.login-demo-table tbody th {
    font-weight: 500;
    color: #15241f;
}

.login-demo-table tbody tr:hover { background: #f4f8f7; }

.login-demo-fill {
    border: none;
    background: transparent;
    color: #6b7b76;
    border-radius: .3rem;
    padding: .1rem .3rem;
    cursor: pointer;
    line-height: 1;
}

.login-demo-fill:hover { background: #e4edea; color: var(--cb-primary); }

.login-demo-fill:focus-visible {
    outline: 2px solid var(--cb-primary-soft);
    outline-offset: 1px;
}

.login-demo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
    gap: .15rem .8rem;
    line-height: 1.9;
}

.login-demo code {
    background: #f1f5f4;
    padding: .05rem .3rem;
    border-radius: .25rem;
    color: #0f5132;
}

/* ───── موبایل: ستون معرفی فشرده می‌شود، حذف نمی‌شود ───── */

@media (max-width: 767.98px) {
    .login-box { grid-template-columns: 1fr; max-width: 420px; }
    .login-brand { padding: 1.6rem 1.5rem; }
    .login-points { display: none; }
    .login-brand-foot { display: none; }
    .login-form-col { padding: 1.7rem 1.5rem; }
}

@media (prefers-reduced-motion: reduce) {
    .login-skip { transition: none; }
}

@media (max-width: 992px) {
    .cb-sidebar { display: none; }
}

@media print {
    .cb-sidebar, .cb-topbar, .no-print { display: none !important; }
    .cb-content { padding: 0; }
    .card { border: none; box-shadow: none; }
}

/* پیوندی که نقش کاربر اجازه بازکردنش را ندارد؛ متن و رنگ دست‌نخورده می‌ماند
   و فقط رفتار کلیک برداشته می‌شود — RequireRolesTagHelper */
.cb-nolink {
    cursor: default;
    text-decoration: none;
}

/* ═══════════ گروه کشویی منو ═══════════
   با <details>/<summary> ساخته شده: بدون جاوااسکریپت کار می‌کند، با کیبورد
   ذاتاً قابل پیمایش است، و وضعیت باز/بسته را سرور تعیین می‌کند چون این پروژه
   عمداً هیچ ذخیره‌سازی سمت مرورگر ندارد. */

/* ─── جعبهٔ برجستهٔ هر گروه ───
   هیچ رنگ تازه‌ای اضافه نشده: برجستگی فقط از سایه و روشناییِ مشتق‌شده از همان
   دو رنگِ موجودِ نوار کناری ساخته می‌شود، تا پالت دست‌نخورده بماند. */
.cb-sidebar details.nav-group {
    margin: .4rem .55rem;
    border-radius: .55rem;
    background: linear-gradient(180deg,
                rgba(255,255,255,.045) 0%,
                rgba(255,255,255,.012) 45%,
                rgba(0,0,0,.10) 100%);
    border: 1px solid rgba(255,255,255,.07);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.085),
        inset 0 -1px 0 rgba(0,0,0,.28),
        0 1px 2px rgba(0,0,0,.35),
        0 4px 10px rgba(0,0,0,.22);
    overflow: hidden;
    transition: box-shadow .16s ease-out, transform .16s ease-out, border-color .16s ease-out;
}

.cb-sidebar details.nav-group:hover {
    border-color: rgba(255,255,255,.12);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.11),
        inset 0 -1px 0 rgba(0,0,0,.28),
        0 2px 4px rgba(0,0,0,.38),
        0 7px 16px rgba(0,0,0,.28);
}

/* گروهِ باز بالاتر می‌نشیند تا معلوم باشد کدام جعبه فعال است */
.cb-sidebar details.nav-group[open] {
    border-color: rgba(88,211,160,.22);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.12),
        inset 0 -1px 0 rgba(0,0,0,.3),
        0 3px 6px rgba(0,0,0,.42),
        0 10px 22px rgba(0,0,0,.3);
}

.cb-sidebar details.nav-group > summary.nav-group-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .4rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    padding: .6rem 1rem;
    border-radius: .5rem .5rem 0 0;
    background: linear-gradient(180deg,
                rgba(255,255,255,.055) 0%,
                rgba(255,255,255,.015) 60%,
                rgba(0,0,0,.08) 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
    transition: background .12s ease-out, color .12s ease-out, transform .08s ease-out;
}

/* فشردن سرِ جعبه، حسِ دکمهٔ فیزیکی می‌دهد */
.cb-sidebar details.nav-group > summary.nav-group-title:active {
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0,0,0,.35);
}

/* بدنهٔ جعبه کمی فرورفته است تا از سرِ برجسته جدا دیده شود */
.cb-sidebar details.nav-group[open] > summary.nav-group-title + * ,
.cb-sidebar details.nav-group[open] a.nav-item:first-of-type {
    margin-top: 0;
}

.cb-sidebar details.nav-group[open] > summary.nav-group-title {
    border-bottom: 1px solid rgba(0,0,0,.26);
    box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 1px 0 rgba(255,255,255,.04);
}

/* فلش پیش‌فرض مرورگر حذف می‌شود تا فلش خودمان در جای درستِ RTL بنشیند */
.cb-sidebar details.nav-group > summary.nav-group-title::-webkit-details-marker { display: none; }
.cb-sidebar details.nav-group > summary.nav-group-title::marker { content: ""; }

.cb-sidebar details.nav-group > summary.nav-group-title::after {
    content: "\F282";
    font-family: bootstrap-icons;
    font-size: .75rem;
    line-height: 1;
    opacity: .65;
    transition: transform .15s ease-out;
}

.cb-sidebar details.nav-group[open] > summary.nav-group-title { color: #cfe6dd; }
.cb-sidebar details.nav-group[open] > summary.nav-group-title::after { transform: rotate(180deg); }

.cb-sidebar details.nav-group > summary.nav-group-title:hover {
    background: var(--cb-sidebar-hover);
    color: #fff;
}

.cb-sidebar details.nav-group > summary.nav-group-title:focus-visible {
    outline: 2px solid #58d3a0;
    outline-offset: -2px;
}

/* گروهِ بسته‌ای که صفحه فعال داخلش است، نشانه رنگی می‌گیرد */
.cb-sidebar details.nav-group:not([open]):has(.nav-item.active) > summary.nav-group-title {
    color: #7fe3b6;
}

/* آیتم‌های داخل جعبه روی زمینهٔ فرورفته می‌نشینند */
.cb-sidebar details.nav-group[open] > a.nav-item {
    background: rgba(0,0,0,.14);
    border-right-width: 3px;
}

.cb-sidebar details.nav-group[open] > a.nav-item:last-child {
    border-radius: 0 0 .5rem .5rem;
}

.cb-sidebar .nav-item-loose { margin-top: .6rem; }

@media (prefers-reduced-motion: reduce) {
    .cb-sidebar details.nav-group,
    .cb-sidebar details.nav-group > summary.nav-group-title,
    .cb-sidebar details.nav-group > summary.nav-group-title::after { transition: none; }
    .cb-sidebar details.nav-group > summary.nav-group-title:active { transform: none; }
}
