/* =====================================================================
   سامانه سال‌مد — Design System مرکزی (تم روشن سازمانی)
   فونت Self-hosted (Vazirmatn، WOFF2)؛ بدون CDN و بدون فریم‌ورک.
   ===================================================================== */

@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Regular.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Medium.woff2") format("woff2");
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: "Vazirmatn";
    src: url("../fonts/Vazirmatn-Bold.woff2") format("woff2");
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    /* رنگ‌های پایه */
    --bg: #eef3f9;
    --surface: #ffffff;
    --surface-2: #f5f8fd;
    --border: #e7edf6;
    --border-strong: #d4deec;

    /* متن */
    --text: #16243d;
    --text-muted: #586882;
    --text-soft: #8a98ad;

    /* برند و لهجه */
    --brand: #16345f;
    --brand-700: #102845;
    --accent: #2f6fed;
    --accent-700: #2059cf;
    --accent-soft: #e9f1ff;

    /* وضعیت‌ها */
    --success: #149a5c;  --success-soft: #e5f6ee;
    --warning: #e0881a;  --warning-soft: #fdf2e1;
    --danger:  #e23b35;  --danger-soft:  #fdecec;
    --info:    #2f6fed;  --info-soft:    #e9f1ff;

    /* شکل */
    --radius-sm: 9px;
    --radius: 14px;
    --radius-lg: 18px;
    --shadow-sm: 0 1px 2px rgba(22, 52, 95, .06);
    --shadow: 0 8px 24px rgba(22, 52, 95, .08);

    /* اندازه‌ها */
    --control-h: 46px;
    --sidebar-w: 252px;
    --header-h: 64px;

    --fs-xs: .79rem;
    --fs-sm: .88rem;
    --fs-base: .97rem;
    --fs-lg: 1.15rem;
    --fs-xl: 1.45rem;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; overflow-x: hidden; max-width: 100%; }

img, svg { max-width: 100%; }
input, select, textarea, button { max-width: 100%; }

body {
    font-family: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: var(--fs-base);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-700); }
code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85em; direction: ltr; unicode-bidi: embed; }
h1, h2, h3 { margin: 0; font-weight: 700; }

/* ================= چیدمان کلی ================= */
.layout {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}

.main { display: flex; flex-direction: column; min-width: 0; }
.content { padding: 1.25rem 1.5rem 1.5rem; display: flex; flex-direction: column; gap: 1rem; width: 100%; max-width: 100%; }

/* ================= Sidebar ================= */
/* ================= منوی روشن سازمانی (Sidebar + Nav آکاردئونی) ================= */
.sidebar {
    background: var(--surface);
    color: var(--text);
    border-inline-end: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar__brand {
    display: flex;
    align-items: center;
    gap: .65rem;
    padding: 0 1.05rem;
    min-height: var(--header-h);
    border-bottom: 1px solid var(--border);
    color: var(--text);
    flex: 0 0 auto;
}
.sidebar__logo {
    width: 34px; height: 34px; border-radius: 9px;
    background: var(--accent); display: grid; place-items: center; color: #fff;
    font-weight: 700; font-size: 1.05rem; flex: 0 0 auto;
}
.sidebar__titles { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.sidebar__title { font-weight: 700; font-size: .98rem; color: var(--text); white-space: nowrap; }
.sidebar__subtitle { font-size: var(--fs-xs); color: var(--text-muted); }

/* ناحیهٔ اسکرولِ مستقل منو */
.sidebar__scroll { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: .5rem .55rem 1rem; }
.sidebar__scroll::-webkit-scrollbar { width: 7px; }
.sidebar__scroll::-webkit-scrollbar-thumb { background: rgba(22, 52, 95, .16); border-radius: 8px; }

/* ابرگروه (سرفصل بصری) */
.nav__section { margin-top: .35rem; }
.nav__section + .nav__section { margin-top: .55rem; padding-top: .55rem; border-top: 1px solid var(--border); }
.nav__section-label {
    font-size: var(--fs-xs); font-weight: 700; letter-spacing: .01em;
    color: var(--text-soft); padding: .25rem .65rem .35rem;
}

/* سر گروه آکاردئون / لینک تک‌سطحی */
.nav__group { border-radius: 10px; }
.nav__head {
    width: 100%; display: flex; align-items: center; gap: .6rem;
    padding: .6rem .65rem; border: 0; background: none; cursor: pointer;
    color: var(--text); font-family: inherit; font-size: var(--fs-sm); font-weight: 500;
    text-align: start; border-radius: 10px;
    transition: background .15s, color .15s;
}
a.nav__head { text-decoration: none; }
.nav__head:hover { background: var(--surface-2); color: var(--text); }
.nav__icon { width: 19px; height: 19px; flex: 0 0 auto; opacity: .8; color: var(--text-muted); }
.nav__text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav__chev { width: 16px; height: 16px; flex: 0 0 auto; opacity: .55; transition: transform .22s ease; }
.nav__group.is-open > .nav__head { color: var(--accent-700); background: var(--accent-soft); }
.nav__group.is-open > .nav__head .nav__icon { color: var(--accent-700); opacity: 1; }
.nav__group.is-open > .nav__head .nav__chev { transform: rotate(180deg); opacity: .8; }

/* باکس زیرمجموعه‌ها — کمی متمایز، با انیمیشن نرم */
.nav__panel { overflow: hidden; max-height: 0; transition: max-height .28s ease; }
.nav__group.is-open > .nav__panel { max-height: 1600px; }
.nav__panel-inner {
    margin: .15rem .25rem .35rem;
    padding: .25rem .25rem .3rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex; flex-direction: column;
}

.nav__sublink {
    display: flex; align-items: center; gap: .5rem;
    padding: .48rem .7rem; border-radius: 8px;
    color: var(--text-muted); font-size: var(--fs-sm); text-decoration: none;
    border-inline-start: 2px solid transparent;
    transition: background .15s, color .15s;
}
.nav__sublink:hover { background: rgba(22, 52, 95, .05); color: var(--text); }
.nav__sublink.is-active {
    background: var(--accent-soft);
    color: var(--accent-700); font-weight: 600;
    border-inline-start-color: var(--accent);
}

/* وضعیت «در حال توسعه» — بدون لینک، کم‌رنگ، با نشان */
.nav__head.is-soon, .nav__sublink.is-soon, .nav__foot-link.is-soon {
    cursor: default; color: var(--text-soft);
}
.nav__head.is-soon:hover, .nav__sublink.is-soon:hover { background: none; }
.nav__soon {
    margin-inline-start: auto; flex: 0 0 auto;
    font-size: .66rem; font-weight: 600; color: var(--text-soft);
    background: rgba(22, 52, 95, .06); border-radius: 6px;
    padding: .08rem .4rem; white-space: nowrap;
}

/* Badge شمارنده */
.nav__badge {
    flex: 0 0 auto; min-width: 18px; height: 18px; padding: 0 5px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: .68rem; font-weight: 700; line-height: 1;
    color: #fff; background: var(--danger); border-radius: 9px;
}

/* بخش ثابت پایین */
.sidebar__foot { flex: 0 0 auto; border-top: 1px solid var(--border); padding: .4rem .55rem .55rem; }
.nav__section--foot { margin-top: 0; }
.nav__logout-form { margin: 0; }
.nav__foot-link {
    width: 100%; display: flex; align-items: center; gap: .55rem;
    padding: .55rem .65rem; border: 0; background: none; cursor: pointer;
    color: var(--text); font-family: inherit; font-size: var(--fs-sm);
    text-align: start; border-radius: 9px; transition: background .15s, color .15s;
}
.nav__foot-link .nav__icon { color: var(--text-muted); }
.nav__foot-link:hover { background: var(--surface-2); color: var(--text); }
.nav__foot-link--logout:hover { background: var(--danger-soft); color: var(--danger); }
.nav__foot-link--logout:hover .nav__icon { color: var(--danger); }
.sidebar__version { padding: .45rem .65rem .15rem; font-size: var(--fs-xs); color: var(--text-soft); }

/* ================= Header ================= */
.header {
    height: var(--header-h);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: 0 1.5rem; position: sticky; top: 0; z-index: 20;
}
.header__titles { min-width: 0; }
.header__title { font-size: var(--fs-lg); font-weight: 700; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header__user { min-width: 0; }
.header__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 130px; }
.breadcrumb { display: flex; gap: .35rem; align-items: center; color: var(--text-soft); font-size: var(--fs-xs); }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb .sep { color: var(--border-strong); }
.header__user { display: flex; align-items: center; gap: .8rem; }
.header__id { text-align: left; line-height: 1.3; }
.header__name { font-weight: 600; font-size: var(--fs-sm); }
.header__role { font-size: var(--fs-xs); color: var(--text-soft); }
.avatar {
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent);
    display: grid; place-items: center; font-weight: 700; flex: 0 0 auto;
}
.hamburger { display: none; background: none; border: none; cursor: pointer; padding: .4rem; color: var(--text); }
.hamburger svg { width: 24px; height: 24px; }
.header__start { display: flex; align-items: center; gap: .4rem; }

/* دکمه بازگشت — خارج از Header، ابتدای محتوا */
.page-back { display: flex; align-items: center; }

/* ================= Card ================= */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    min-width: 0;
    overflow: hidden;
}
.card__head {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 1rem; padding: 1.1rem 1.25rem; border-bottom: 1px solid var(--border);
}
.card__head .titlebox { min-width: 0; }
.card__title { font-size: var(--fs-lg); }
.card__desc { color: var(--text-muted); font-size: var(--fs-sm); margin-top: .2rem; }
.card__body { padding: 1.25rem; }
.card--narrow { width: 100%; max-width: 560px; margin-inline: auto; }

/* ================= دکمه‌ها ================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    height: var(--control-h); padding: 0 1.1rem;
    border: 1px solid transparent; border-radius: 9px;
    font: inherit; font-weight: 600; font-size: var(--fs-sm);
    cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s;
}
.btn svg { width: 17px; height: 17px; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-700); color: #fff; }
.btn--secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); }
.btn--secondary:hover { background: var(--surface-2); }
.btn--danger { background: var(--danger-soft); color: var(--danger); border-color: #f3c9c9; }
.btn--danger:hover { background: #fbdcdc; }
.btn--back { background: var(--accent-soft); color: var(--accent-700); border-color: #c7dbfb; font-weight: 500; }
.btn--back:hover { background: #d6e6fd; color: var(--accent-700); }
.btn--ghost { background: transparent; color: var(--text-muted); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }
.btn--sm { height: 34px; padding: 0 .7rem; font-size: var(--fs-xs); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ================= فرم ================= */
.form-section { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 1rem; overflow: hidden; }
.form-section__head { background: var(--surface-2); padding: .8rem 1.1rem; border-bottom: 1px solid var(--border); }
.form-section__title { font-size: var(--fs-base); font-weight: 700; }
.form-section__desc { font-size: var(--fs-xs); color: var(--text-soft); }
.form-section__body { padding: 1.1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.field { display: flex; flex-direction: column; gap: .35rem; }
.field--full { grid-column: 1 / -1; }
.field > label, .field__label { font-size: var(--fs-sm); font-weight: 600; color: var(--text); }
.field input, .field select, .field textarea {
    height: var(--control-h);
    padding: 0 .8rem;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: 9px;
    color: var(--text); font: inherit; font-size: var(--fs-sm);
    width: 100%; transition: border-color .15s, box-shadow .15s;
}
.field textarea { height: auto; padding: .6rem .8rem; min-height: 90px; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input:disabled, .field select:disabled { background: var(--surface-2); color: var(--text-soft); }
.field__help { font-size: var(--fs-xs); color: var(--text-soft); }
.field__error { font-size: var(--fs-xs); color: var(--danger); }
.checks { display: flex; flex-direction: column; gap: .5rem; }
.check { display: flex; align-items: center; gap: .55rem; font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.switch-row { display: flex; align-items: center; gap: .75rem; padding: .4rem 0; cursor: pointer; user-select: none; }
.switch { position: relative; display: inline-flex; width: 44px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch__thumb { position: absolute; inset: 0; background: var(--border); border-radius: 24px; transition: background .2s; }
.switch__thumb::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; top: 3px; right: 3px; transition: right .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + .switch__thumb { background: var(--accent); }
.switch input:checked + .switch__thumb::after { right: calc(100% - 21px); }
.form-section--accent { border-right: 3px solid var(--accent); }
.mt-1 { margin-top: .85rem; }
.form-actions { display: flex; gap: .7rem; margin-top: 1.1rem; }

/* ================= جدول ================= */
.table-wrap { overflow-x: auto; max-width: 100%; }
.toolbar > * { max-width: 100%; }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th, .table td { text-align: right; padding: .8rem .9rem; }
.table thead th {
    background: var(--surface-2); color: var(--text-muted); font-weight: 600;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
.table tbody td { border-bottom: 1px solid var(--border); }
.table tbody tr:hover { background: var(--surface-2); }
.table .cell-actions { display: flex; gap: .4rem; align-items: center; justify-content: flex-start; }
.table .cell-actions form { margin: 0; }
.table .muted { color: var(--text-soft); }

/* ================= Badge ================= */
.badge {
    display: inline-flex; align-items: center; gap: .3rem;
    padding: .2rem .55rem; border-radius: 999px;
    font-size: var(--fs-xs); font-weight: 600; line-height: 1.6;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.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); }
.badge--info    { background: var(--info-soft);    color: var(--info); }
.badge--muted   { background: #eef1f5; color: var(--text-muted); }
.badge--plain::before { display: none; }

/* ================= Alert ================= */
.alert { display: flex; gap: .6rem; padding: .8rem 1rem; border-radius: var(--radius-sm); font-size: var(--fs-sm); border: 1px solid; margin-bottom: 1rem; }
.alert--ok      { background: var(--success-soft); border-color: #b9e3c6; color: #14622f; }
.alert--error   { background: var(--danger-soft);  border-color: #f3c9c9; color: #9b1c1c; }
.alert--info    { background: var(--info-soft);     border-color: #c7dbfb; color: #1e40af; }

/* ================= Toolbar / فیلتر ================= */
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1rem; }
.toolbar .field { flex-direction: row; align-items: center; gap: .4rem; }
.toolbar input, .toolbar select {
    height: 40px; padding: 0 .7rem;
    border: 1px solid var(--border-strong); border-radius: 9px;
    background: var(--surface); color: var(--text); font: inherit; font-size: var(--fs-sm);
}
.toolbar .grow { flex: 1 1 220px; min-width: 0; }
.toolbar select { min-width: 130px; }
/* کادر جستجو با آیکن داخلی */
.search-wrap {
    position: relative; display: flex; align-items: center;
}
.search-wrap input[type="search"] {
    width: 100%; padding-right: 2.3rem; padding-left: 2.1rem;
}
.search-icon {
    position: absolute; right: .7rem; top: 50%; transform: translateY(-50%);
    color: var(--text-soft); pointer-events: none;
}
.search-clear {
    position: absolute; left: .5rem; top: 50%; transform: translateY(-50%);
    display: grid; place-items: center; width: 22px; height: 22px;
    border-radius: 50%; background: var(--border); color: var(--text-muted);
    text-decoration: none;
}
.search-clear:hover { background: var(--border-strong); }

/* ================= کارت‌های آماری ================= */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: .9rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: .9rem; color: var(--text); }
.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); color: var(--text); }
.stat-card__icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; flex: 0 0 auto; }
.stat-card__icon svg { width: 22px; height: 22px; }
.stat-card__value { display: block; font-size: 1.6rem; font-weight: 700; line-height: 1; }
.stat-card__label { display: block; color: var(--text-muted); font-size: var(--fs-sm); margin-top: .25rem; }
.i-blue   { background: var(--accent-soft); color: var(--accent); }
.i-green  { background: var(--success-soft); color: var(--success); }
.i-red    { background: var(--danger-soft); color: var(--danger); }
.i-amber  { background: var(--warning-soft); color: var(--warning); }
.i-navy   { background: #e7ecf3; color: var(--brand); }
.i-teal   { background: #d8f1ec; color: #0d9488; }
.i-purple { background: #ece7fb; color: #7c3aed; }

/* عنوان بخش‌های داشبورد */
.section-title { font-size: var(--fs-base); font-weight: 700; color: var(--text); margin: .4rem 0 .1rem; }
.section-title span { color: var(--text-soft); font-weight: 400; font-size: var(--fs-xs); margin-inline-start: .4rem; }

/* کاشی‌های بخش‌ها */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: .7rem; }
.tile {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: .85rem 1rem; color: var(--text); text-decoration: none; box-shadow: var(--shadow-sm);
}
.tile:hover { border-color: var(--border-strong); color: var(--text); }

/* رنگ‌های آیکونی اضافی */
.i-pink   { background: #fce7f0; color: #db2777; }
.i-indigo { background: #e7e9fb; color: #4f46e5; }

/* کاشی‌های رنگیِ بخش‌ها با آیکون */
.sec-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .85rem; }
.sec-tile {
    display: flex; align-items: center; gap: .8rem;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: .9rem; box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none;
    transition: transform .12s, box-shadow .12s, border-color .12s;
}
.sec-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--border-strong); color: var(--text); }
.sec-tile__icon { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: 0 0 auto; }
.sec-tile__icon svg { width: 23px; height: 23px; }
.sec-tile__body { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.sec-tile__name { font-weight: 600; font-size: var(--fs-sm); line-height: 1.4; }

/* فهرست هشدارها */
.alert-list { display: flex; flex-direction: column; }
.alert-row { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.alert-row:last-child { border-bottom: none; }
.alert-row__main { display: flex; align-items: center; gap: .6rem; font-size: var(--fs-sm); }
.alert-row__dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }

/* لیست فعالیت اخیر */
.feed { display: flex; flex-direction: column; }
.feed__item { display: flex; gap: .7rem; padding: .7rem 0; border-bottom: 1px solid var(--border); font-size: var(--fs-sm); }
.feed__item:last-child { border-bottom: none; }
.feed__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); margin-top: .55rem; flex: 0 0 auto; }
.feed__main { min-width: 0; }
.feed__meta { color: var(--text-soft); font-size: var(--fs-xs); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }

/* ================= Empty State ================= */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--text-soft); }
.empty svg { width: 46px; height: 46px; opacity: .5; margin-bottom: .6rem; }
.empty__title { font-weight: 600; color: var(--text-muted); }

/* ================= Pagination ================= */
.pager { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: 1.1rem; }
.pager a {
    min-width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--border-strong); border-radius: 9px; color: var(--text); font-size: var(--fs-sm);
}
.pager a:hover { background: var(--surface-2); }
.pager a.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ================= Tabs ================= */
.tabs { display: flex; gap: .3rem; border-bottom: 1px solid var(--border); margin-bottom: 1.1rem; }
.tabs a { padding: .6rem .9rem; font-size: var(--fs-sm); color: var(--text-muted); border-bottom: 2px solid transparent; }
.tabs a.is-active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

/* ================= Modal ================= */
.modal { position: fixed; inset: 0; background: rgba(16, 24, 40, .45); display: none; align-items: center; justify-content: center; z-index: 50; padding: 1rem; }
.modal.is-open { display: flex; }
.modal__dialog { background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow); width: 100%; max-width: 420px; overflow: hidden; }
.modal__body { padding: 1.4rem; text-align: center; }
.modal__icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto .8rem; background: var(--danger-soft); color: var(--danger); }
.modal__title { font-size: var(--fs-lg); margin-bottom: .4rem; }
.modal__text { color: var(--text-muted); font-size: var(--fs-sm); }
.modal__foot { display: flex; gap: .6rem; padding: 1rem 1.4rem; background: var(--surface-2); border-top: 1px solid var(--border); }
.modal__foot .btn { flex: 1; }

/* ================= صفحه ورود / حالت بدون پنل ================= */
.auth-shell { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.auth-card { width: 100%; max-width: 400px; }
.auth-brand { text-align: center; margin-bottom: 1.3rem; }
.auth-brand .logo { width: 52px; height: 52px; border-radius: 14px; background: var(--brand); color: #fff; display: grid; place-items: center; margin: 0 auto .7rem; font-weight: 700; font-size: 1.3rem; }
.auth-brand h1 { font-size: var(--fs-lg); color: var(--brand); }
.auth-brand p { color: var(--text-soft); font-size: var(--fs-sm); margin: .2rem 0 0; }

/* اعداد LTR کنترل‌شده در متن فارسی در صورت نیاز */
.ltr { direction: ltr; unicode-bidi: embed; display: inline-block; }
.text-muted { color: var(--text-muted); }
.mt-1 { margin-top: 1rem; }

/* ================= دسکتاپ (≥881px) ================= */
@media (min-width: 881px) {
    /* header__start فقط همبرگر دارد — روی دسکتاپ مخفی چون hamburger هم hidden است */
    .header__start { display: none; }
    /* عنوان و breadcrumb از طرف راست (RTL flex-start) */
    .header { justify-content: space-between; }
}

/* ================= واکنش‌گرا / موبایل ================= */
.modal-backdrop-mobile { display: none; }

@media (max-width: 880px) {
    .layout { grid-template-columns: 1fr; }
    .hamburger { display: inline-flex; }
    .sidebar {
        position: fixed; inset: 0 0 0 auto; right: 0;
        width: min(84%, 360px); z-index: 60;
        transform: translateX(100%); transition: transform .25s ease;
        box-shadow: -8px 0 24px rgba(16,24,40,.18);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .scrim { display: block; }
    /* قفل اسکرول پس‌زمینه هنگام بازبودن منو؛ خود منو اسکرول مستقل دارد. */
    body.nav-open { overflow: hidden; }
    .scrim { display: none; position: fixed; inset: 0; background: rgba(16,24,40,.4); z-index: 55; }
    .form-grid { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .stat-grid { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
    .stat-card { padding: .8rem; gap: .6rem; }
    .stat-card__value { font-size: 1.35rem; }
    .content { padding: .75rem 1rem 1rem; gap: .75rem; max-width: 100%; }
    .page-back { margin-bottom: -.1rem; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .toolbar input, .toolbar select, .toolbar .grow { width: 100%; flex: 0 0 auto; }
    .header__id { display: none; }
    /* جلوگیری از زوم خودکار iOS هنگام فوکوس روی فیلدها */
    input, select, textarea { font-size: 16px; }
    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; }
    .card__head { flex-direction: column; align-items: stretch; gap: .6rem; }
    .card__head .btn { width: 100%; }
    .header { padding: 0 1rem; }

    /* جدول‌ها در موبایل به کارت تبدیل می‌شوند */
    .table.responsive thead { display: none; }
    .table.responsive tbody tr {
        display: block; background: var(--surface); border: 1px solid var(--border);
        border-radius: var(--radius); margin-bottom: .8rem; padding: .4rem .9rem;
    }
    .table.responsive tbody td {
        display: flex; justify-content: space-between; gap: 1rem; align-items: center;
        border-bottom: 1px dashed var(--border); padding: .55rem 0;
    }
    .table.responsive tbody tr td:last-child { border-bottom: none; }
    .table.responsive tbody td::before {
        content: attr(data-label); color: var(--text-soft); font-size: var(--fs-xs); font-weight: 600;
    }
    .table.responsive .cell-actions { justify-content: flex-end; }
    .table.responsive .cell-actions::before { content: ""; }
}

@media (max-width: 420px) {
    .stat-card { padding: .9rem; }
    .header__id { display: none; }
}

/* ================= داشبورد منابع انسانی — کارت‌های رنگی ================= */
.hrd-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: .85rem;
}
.hrd-card {
    display: flex; align-items: center; gap: .75rem;
    border-radius: var(--radius); padding: .9rem 1rem;
    text-decoration: none; border: 1px solid transparent;
    transition: transform .12s, box-shadow .12s;
    box-shadow: 0 2px 8px rgba(22,52,95,.10);
    min-height: 82px;
    /* المان تزئینی دایره‌ای */
    position: relative; overflow: hidden; isolation: isolate;
}
/* دایره بزرگ — گوشه چپ-پایین */
.hrd-card::before {
    content: ""; position: absolute; pointer-events: none; z-index: 0;
    border-radius: 50%;
    width: 160px; height: 160px;
    left: -80px; bottom: -60px;
    background: rgba(255,255,255,.13);
}
/* دایره کوچک‌تر — روی دایره بزرگ */
.hrd-card::after {
    content: ""; position: absolute; pointer-events: none; z-index: 0;
    border-radius: 50%;
    width: 90px; height: 90px;
    left: -38px; bottom: -28px;
    background: rgba(255,255,255,.10);
}
.hrd-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(22,52,95,.16); }
.hrd-card__icon {
    width: 42px; height: 42px; border-radius: 10px; flex: 0 0 auto;
    display: grid; place-items: center;
    background: rgba(255,255,255,.25);
    position: relative; z-index: 1;
}
.hrd-card__icon svg { width: 20px; height: 20px; }
.hrd-card__body { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; position: relative; z-index: 1; }
.hrd-card__value { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.hrd-card__label { font-size: .75rem; font-weight: 500; opacity: .82; line-height: 1.3; }

/* رنگ‌ها */
.hrd-c1  { background: #1e3d7a; color: #fff;    border-color: #163066; }
.hrd-c2  { background: #2d7a5a; color: #fff;    border-color: #236048; }
.hrd-c3  { background: #b5e8c8; color: #145228; border-color: #8fd4a8; }
.hrd-c4  { background: #e87060; color: #fff;    border-color: #d45848; }
.hrd-c5  { background: #e8d88c; color: #4a3800; border-color: #d4c060; }
.hrd-c6  { background: #d5c8f0; color: #3a1a80; border-color: #b8a8e0; }
.hrd-c7  { background: #f5c4c4; color: #8a1a1a; border-color: #e8a4a4; }
.hrd-c8  { background: #f8c8a8; color: #7a3a0a; border-color: #f0ac84; }
.hrd-c9  { background: #4a8ed4; color: #fff;    border-color: #3070b8; }
.hrd-c10 { background: #f5d8a8; color: #7a4008; border-color: #e8c080; }

/* نمودار */
.hrd-chart-legend {
    display: flex; gap: 1.2rem; align-items: center;
    font-size: var(--fs-xs); color: var(--text-muted);
    margin-bottom: .8rem; flex-wrap: wrap;
}
.hrd-legend-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-left: .3rem; }

/* ── Breakpoints — sidebar=252px، content = viewport - 252px ──
   1400px+  → 5 ستون  (content≥1148px)
   1100–1399px → 4 ستون (content≈848–1147px)
   881–1099px  → 3 ستون (content≈629–847px)
   ≤880px   → موبایل (sidebar پنهان)
*/
@media (max-width: 1399px) {
    .hrd-grid { grid-template-columns: repeat(4, 1fr); gap: .75rem; }
    .hrd-card__value { font-size: 1.5rem; }
}
@media (max-width: 1099px) {
    .hrd-grid { grid-template-columns: repeat(3, 1fr); gap: .65rem; }
    .hrd-card { padding: .8rem .85rem; min-height: 78px; }
    .hrd-card__value { font-size: 1.4rem; }
}
/* موبایل — sidebar پنهان، content تمام عرض */
@media (max-width: 880px) {
    .hrd-grid { grid-template-columns: repeat(2, 1fr); gap: .55rem; }
    .hrd-card { padding: .75rem .8rem; gap: .6rem; min-height: 70px; }
    .hrd-card::before { width: 110px; height: 110px; left: -55px; bottom: -42px; }
    .hrd-card::after  { width: 65px;  height: 65px;  left: -28px; bottom: -20px; }
    .hrd-card__value { font-size: 1.35rem; }
    .hrd-card__icon { width: 36px; height: 36px; }
    .hrd-card__icon svg { width: 18px; height: 18px; }
}
@media (max-width: 380px) {
    .hrd-grid { grid-template-columns: 1fr; }
}

/* ================= بخش‌های کاری — محتوای کارت (Grid/Card از hrd reuse می‌شود) ================= */

/* نام بخش داخل hrd-card__body */
.sc-card__name {
    font-weight: 700; font-size: var(--fs-sm); line-height: 1.3;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
}
/* badge اداری / عملیاتی */
.sc-card__badge {
    display: inline-block; padding: .1rem .45rem; align-self: flex-start;
    border-radius: 999px; font-size: .65rem; font-weight: 600;
}
.sc-card__badge--ops   { background: rgba(255,255,255,.30); color: inherit; }
.sc-card__badge--admin { background: rgba(255,255,255,.22); color: inherit; }

/* ۱۹ رنگ اختصاصی بخش‌ها — روی hrd-card اعمال می‌شوند */
.sc-c1  { background: #1e3d7a; color: #fff; border-color: #163066; }
.sc-c2  { background: #2d7a5a; color: #fff; border-color: #236048; }
.sc-c3  { background: #d5c8f0; color: #3a1a80; border-color: #b8a8e0; }
.sc-c4  { background: #4a8ed4; color: #fff; border-color: #3070b8; }
.sc-c5  { background: #f5c4c4; color: #8a1a1a; border-color: #e8a4a4; }
.sc-c6  { background: #e8d88c; color: #4a3800; border-color: #d4c060; }
.sc-c7  { background: #b5e8c8; color: #145228; border-color: #8fd4a8; }
.sc-c8  { background: #f8c8a8; color: #7a3a0a; border-color: #f0ac84; }
.sc-c9  { background: #c8d8f5; color: #1a3060; border-color: #a8c0e8; }
.sc-c10 { background: #e87060; color: #fff; border-color: #d45848; }
.sc-c11 { background: #b8a8e0; color: #2a0868; border-color: #9888c8; }
.sc-c12 { background: #a8d8c8; color: #0d4030; border-color: #80c0a8; }
.sc-c13 { background: #f5d8a8; color: #7a4008; border-color: #e8c080; }
.sc-c14 { background: #a8d898; color: #1a4810; border-color: #80c070; }
.sc-c15 { background: #2a5298; color: #fff; border-color: #1e3c78; }
.sc-c16 { background: #5b9bd5; color: #fff; border-color: #4080b8; }
.sc-c17 { background: #80c0b8; color: #003830; border-color: #60a898; }
.sc-c18 { background: #e8a060; color: #4a1800; border-color: #d07840; }
.sc-c19 { background: #48a870; color: #fff; border-color: #308050; }

/* ── Header موبایل: راست=همبرگر | وسط=عنوان | چپ=کاربر ── */
@media (max-width: 880px) {
    .header {
        position: relative; height: 54px;
        padding: 0 .65rem; overflow: visible;
    }
    .header__start {
        position: absolute; right: .65rem; top: 50%; transform: translateY(-50%);
        z-index: 2;
    }
    .header__titles {
        position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
        text-align: center; pointer-events: none; padding: 0 90px;
    }
    .header__title {
        font-size: var(--fs-sm); white-space: nowrap;
        overflow: hidden; text-overflow: ellipsis;
    }
    .header .breadcrumb { display: none; }
    .header__user {
        position: absolute; left: .65rem; top: 50%; transform: translateY(-50%);
        gap: .35rem; z-index: 2;
    }
    .header__user .header__id { display: none; }
    .header__user .btn--ghost .btn-label { display: none; }
    .header__user .btn--ghost { padding: 0 .4rem; height: 32px; min-width: 32px; }
    .avatar { width: 32px; height: 32px; font-size: .8rem; }
}

/* ── Toggle switch ── */
.toggle { display: inline-flex; align-items: center; cursor: pointer; gap: .4rem; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track {
    position: relative; width: 44px; height: 24px; border-radius: 12px;
    background: var(--border); transition: background .2s;
    flex-shrink: 0;
}
.toggle__track::after {
    content: ''; position: absolute; top: 3px; right: 3px;
    width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25);
    transition: transform .2s;
}
.toggle input:checked ~ .toggle__track { background: var(--primary); }
.toggle input:checked ~ .toggle__track::after { transform: translateX(-20px); }
.toggle input:focus-visible ~ .toggle__track { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ── Helper ── */
.mt-1 { margin-top: .75rem; }
.grow { flex: 1 1 0; }

/* ══════════════════════════════════════════════════════════
   تقویم شمسی — jalali-picker
   ══════════════════════════════════════════════════════════ */

/* فیلد خطا */
.field__err { display: block; color: var(--danger); font-size: .78rem; margin-top: .25rem; }
.field--err input,
.field--err .field__inp,
.field--err select,
.field--err textarea { border-color: var(--danger) !important; box-shadow: 0 0 0 2px var(--danger-soft) !important; }
.field__label.req::after { content: ' *'; color: var(--danger); }

/* تقویم */
.jpicker {
    position: absolute;
    z-index: 10000;
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    width: 280px;
    padding: .5rem;
    display: none;
    direction: rtl;
    font-size: .85rem;
}
.jpicker__nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .35rem;
    direction: rtl; /* راست‌چین: «ماه قبل» (›) سمت راست، «ماه بعد» (‹) سمت چپ */
}
.jpicker__btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: .25rem .5rem;
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    font-size: .9rem;
    transition: background .15s;
}
.jpicker__btn:hover { background: var(--accent-soft); }
.jpicker__lbl { flex: 1; text-align: center; font-weight: 600; color: var(--brand); font-size: .875rem; }
.jpicker__prev,.jpicker__next { font-size: 1.3rem; line-height: 1; color: var(--text-muted); }
.jpicker__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    color: var(--text-soft);
    font-size: .75rem;
    margin-bottom: .2rem;
    padding-bottom: .2rem;
    border-bottom: 1px solid var(--border);
}
.jpicker__grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}
.jpicker__grid--months,
.jpicker__grid--years {
    grid-template-columns: repeat(3, 1fr);
    gap: 4px;
}
.jpicker__cell--month,
.jpicker__cell--year { padding: .55rem 0; font-size: .85rem; }
.jpicker__cell {
    background: none;
    border: none;
    padding: .3rem 0;
    border-radius: 6px;
    cursor: pointer;
    text-align: center;
    font-family: inherit;
    font-size: .825rem;
    color: var(--text);
    transition: background .12s, color .12s;
}
.jpicker__cell:hover { background: var(--accent-soft); color: var(--accent); }
.jpicker__cell--empty { cursor: default; }
.jpicker__cell--disabled { color: var(--text-soft); opacity: .35; cursor: not-allowed; pointer-events: none; }
.jpicker__cell--today { color: var(--accent); font-weight: 600; }
.jpicker__cell--sel { background: var(--accent) !important; color: #fff !important; font-weight: 700; }
.jpicker__foot {
    display: flex;
    gap: .5rem;
    margin-top: .4rem;
    padding-top: .4rem;
    border-top: 1px solid var(--border);
}
.jpicker__today { flex: 1; font-size: .78rem; }
.jpicker__clear { flex: 1; font-size: .78rem; color: var(--danger); }
.jpicker__clear:hover { background: var(--danger-soft); }

/* فیلد تاریخ — نشانگر تقویم */
[data-jpicker] { cursor: pointer; 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='%238a98ad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2' ry='2'%3E%3C/rect%3E%3Cline x1='16' y1='2' x2='16' y2='6'%3E%3C/line%3E%3Cline x1='8' y1='2' x2='8' y2='6'%3E%3C/line%3E%3Cline x1='3' y1='10' x2='21' y2='10'%3E%3C/line%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left .75rem center; padding-left: 2.2rem; }
