/* php_app/frontend/css/style.css */

/* ---------------------------------------------------------------------------
 * فونت‌ها — محلی (قبلاً از fonts.googleapis.com می‌آمدند)
 *
 * روی هاست ایرانی، گوگل‌فونت کند یا غیرقابل‌اتکاست. اگر Material Icons نرسد،
 * همه‌ی آیکون‌های داشبورد به متنِ خام تبدیل می‌شوند — پس محلی بودنشان اجباری است.
 * فایل‌ها در frontend/fonts/ هستند و باید همراه این فایل آپلود شوند.
 * ------------------------------------------------------------------------ */

/* Vazirmatn — فونت متغیر، وزن ۱۰۰ تا ۹۰۰ در یک فایل */
@font-face {
    font-family: 'Vazirmatn';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/vazirmatn-arabic.woff2?v=1') format('woff2');
    unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E, U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
    font-family: 'Vazirmatn';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/vazirmatn-latin.woff2?v=1') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Vazirmatn';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/vazirmatn-latin-ext.woff2?v=1') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Material Icons — قبلاً در dashboard.php از گوگل لود می‌شد */
@font-face {
    font-family: 'Material Icons';
    font-style: normal;
    font-weight: 400;
    font-display: block; /* block نه swap: آیکون نیم‌نگاهی به متنِ لیگاتور نشان ندهد */
    src: url('../fonts/material-icons.woff2?v=1') format('woff2');
}
.material-icons {
    font-family: 'Material Icons';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
}

:root {
    --primary: #00C2D1;
    --secondary: #0D2B38;
    --tertiary: #FFB300;
    --alternate: #E6F9FA;
    --primary-text: #0D2B38;
    --secondary-text: #5A6E7A;
    --primary-bg: #E6F9FA;
    --secondary-bg: #F0F4F8;
    --success: #34C759;
    --warning: #FF9500;
    --error: #FF3B30;
    --font-family: 'Vazirmatn', sans-serif;
}

* {
    box-sizing: border-box;
}

/* =======================================================================
   دسترس‌پذیری (a11y) — پایه‌های سراسری
   ======================================================================= */

/* حلقه‌ی فوکوسِ واضح برای پیمایش با کیبورد.
   :focus-visible فقط هنگام کیبورد ظاهر می‌شود، پس کلیکِ ماوس شلوغ نمی‌شود. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

/* عناصرِ کلیک‌پذیری که دکمه‌ی واقعی نیستند (تایل‌ها، تب‌ها) با کیبورد هم کار کنند */
[role="button"] {
    cursor: pointer;
}

/* هدفِ لمسیِ حداقلِ ۴۴px (راهنمای WCAG 2.5.5) روی موبایل */
@media (max-width: 600px) {
    button,
    .menu-item,
    .action-btn,
    a.btn-primary,
    a.btn-secondary {
        min-height: 44px;
    }
}

/* لینکِ «پرش به محتوا» برای کاربرانِ کیبورد و صفحه‌خوان */
.skip-link {
    position: absolute;
    right: -9999px;
    top: 0;
    z-index: 3000;
    background: var(--primary);
    color: #fff;
    padding: 12px 20px;
    border-radius: 0 0 10px 10px;
    font-weight: 700;
    text-decoration: none;
}
.skip-link:focus {
    right: 12px;
}

/* =======================================================================
   پلاکِ خودروی ایرانی — هم ورودیِ خانه‌خانه، هم نمایشِ فقط‌خواندنی
   چیدمان از چپ به راست: [IR] [۲ رقم] [حرف] [۳ رقم] [ایران/۲ رقم]
   ظرف عمداً direction:ltr است چون صفحه RTL است و بدون آن ترتیب برعکس می‌شود.
   ======================================================================= */
.jg-plate {
    display: inline-flex;
    direction: ltr;
    align-items: stretch;
    background: #fff;
    border: 2px solid #14213d;
    border-radius: 7px;
    overflow: hidden;
    font-weight: 800;
    line-height: 1;
    vertical-align: middle;
    max-width: 100%;
}

/* نوارِ آبیِ سمت چپ (مثل پلاک واقعی) */
.jg-plate-ir {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1c3f94;
    color: #fff;
    padding: 0 5px;
    font-size: 0.62em;
    letter-spacing: .5px;
}

.jg-plate-seg {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 7px 9px;
    font-size: 1.05em;
    color: #14213d;
    font-variant-numeric: tabular-nums;
    border-left: 1px solid #dfe4ec;
}

.jg-plate-letter {
    background: #f4f6f9;
    min-width: 2.6em;
}

/* کادرِ سمت راست: «ایران» بالا، کد استان پایین */
.jg-plate-prov {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3px 8px;
    border-right: 0;
    border-left: 2px solid #14213d;
    background: #fff;
    color: #14213d;
    min-width: 3.1em;
}

.jg-plate-prov small {
    font-size: 0.5em;
    font-weight: 700;
    opacity: .85;
    margin-bottom: 1px;
}

/* --- حالتِ ورودی --- */
.jg-plate-input .jg-plate-seg,
.jg-plate-input .jg-plate-prov input {
    border: none;
    outline: none;
    background: transparent;
    font-family: inherit;
    font-weight: 800;
    text-align: center;
    color: #14213d;
    min-height: 44px;           /* هدفِ لمسیِ استاندارد */
}

.jg-plate-input input[data-part="two"]   { width: 3.1em; }
.jg-plate-input input[data-part="three"] { width: 4em; }
.jg-plate-input .jg-plate-prov input     { width: 2.6em; padding: 0; min-height: 26px; font-size: 1.05em; }
.jg-plate-input select.jg-plate-letter   { min-width: 4.4em; cursor: pointer; }

.jg-plate-input .jg-plate-seg:focus-within,
.jg-plate-input .jg-plate-seg:focus {
    background: var(--primary-bg, #E6F9FA);
}

/* بجِ عددیِ کنارِ آیتم‌های منو */
.menu-badge {
    background: var(--error);
    color: #fff;
    border-radius: 10px;
    padding: 2px 8px;
    font-size: 0.75em;
    font-weight: 700;
    float: left;
    line-height: 1.6;
}

/* احترام به تنظیمِ «کاهش حرکت» سیستم */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

body {
    font-family: var(--font-family);
    background-color: var(--secondary-bg);
    color: var(--primary-text);
    margin: 0;
    padding: 0;
    direction: rtl;
    /* Default for Persian apps */
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 600;
    margin: 0;
    padding: 0;
    background-color: var(--background);
}

/* Responsive Container */
.container {
    padding: 20px;
    max-width: 100%;
}

@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
}

.btn-primary {
    background-color: var(--primary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: background-color 0.2s;
}

.btn-primary:hover {
    background-color: #00A0AC;
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    cursor: pointer;
    font-family: var(--font-family);
    font-size: 1rem;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 20px;
    margin-bottom: 20px;
}

/* Form Styles */
.form-group {
    margin-bottom: 15px;
    text-align: right;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--secondary-text);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 1rem;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
}

/* Legacy input-group cleanup (optional, keeping for compatibility if utilized) */
.input-group {
    margin-bottom: 15px;
    text-align: right;
}

.input-group label {
    display: block;
    margin-bottom: 5px;
    color: var(--secondary-text);
}

.input-group input,
.input-group select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: var(--font-family);
    font-size: 1rem;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Layout Utilities */
/* The original .container rule is now superseded by the responsive one above, but keeping it for context if needed elsewhere. */
/* The instruction implies the responsive container should be the primary definition. */
/* Original .container definition:
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}
*/

/* Responsive Flex */
.flex {
    display: flex;
    gap: 10px;
}

@media (max-width: 600px) {
    .flex {
        flex-direction: column;
        align-items: stretch;
    }
}

/* Table Responsive */
.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    min-width: 600px;
    /* Ensure table doesn't squash too much */
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-col {
    display: flex;
    flex-direction: column;
}

/* Login Page Specific */
.login-page {
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, var(--secondary-bg) 0%, #dbe9f6 100%);
    padding: 20px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-card:before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
    background: var(--primary);
}

.login-header h2 {
    color: var(--secondary);
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.login-header p {
    color: var(--secondary-text);
    font-size: 0.9rem;
    margin-bottom: 30px;
}

.login-footer {
    margin-top: 25px;
    font-size: 0.85rem;
}

.login-footer a {
    color: var(--secondary-text);
    text-decoration: none;
    transition: color 0.2s;
}

.login-footer a:hover {
    color: var(--primary);
}

.error-msg {
    background-color: #ffebee;
    color: var(--error);
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    margin-top: 15px;
    display: none;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.stat-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 32px;
    margin-bottom: 16px;
    color: var(--primary);
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-text);
    margin-bottom: 8px;
}

.stat-label {
    color: var(--secondary-text);
    font-size: 14px;
}

/* Sidebar Premium Design */
.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--secondary) 0%, #081d26 100%);
    color: white;
    padding: 25px 20px;
    height: 100vh;
    position: fixed;
    right: 0;
    top: 0;
    overflow-y: auto;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.1);
    z-index: 1001;
}

.sidebar h2 {
    background: transparent;
    color: var(--primary);
    font-size: 1.8rem;
    margin-bottom: 5px;
    letter-spacing: 1px;
}

.sidebar nav {
    margin-top: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* اعلانات/پروفایل/خروج بخشی از همان فهرستِ پیوسته‌اند — نه بلوکِ جدا و چسبیده
   به پایین. نسخه‌ی قبلی sticky بود و روی موبایل آیتم‌های پایینی پشتش گم می‌شدند.
   حالا فقط یک خطِ جداکننده‌ی ظریف دارد و با بقیه‌ی منو اسکرول می‌خورد. */
.sidebar-bottom {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-item {
    display: flex;
    align-items: center;
    /* پدینگِ جمع‌تر تا منوی بلندِ مدیر عامل در ارتفاع‌های کوچک هم کامل جا شود */
    padding: 10px 16px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    border-radius: 12px;
    transition: all 0.2s;
    font-size: 0.95rem;
    font-weight: 400;
}

.menu-item:hover,
.menu-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: translateX(-5px);
}

.menu-item.active {
    background: linear-gradient(90deg, var(--primary) 0%, rgba(0, 194, 209, 0.5) 100%);
    box-shadow: 0 4px 15px rgba(0, 194, 209, 0.3);
    font-weight: 500;
}

.menu-item .material-icons {
    margin-left: 12px;
    font-size: 20px;
    opacity: 0.9;
}

/* «خروج» یک <button> واقعی است (نه لینکِ href="#") تا با کیبورد و صفحه‌خوان
   درست کار کند؛ این قانون ظاهرش را با بقیه‌ی آیتم‌های منو یکسان می‌کند. */
button.menu-item {
    width: 100%;
    background: none;
    border: none;
    font-family: inherit;
    text-align: right;
    cursor: pointer;
}

.menu-item-logout {
    color: #ffb4b4;
}

.menu-item-logout:hover {
    background: rgba(255, 59, 48, 0.18);
    color: #fff;
}

.main-content {
    margin-right: 280px;
    padding: 20px;
    transition: all 0.3s;
}

/* Install Banner */
.install-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: white;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 10000;
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
}

.install-banner.show {
    transform: translateY(0);
}

.install-banner-content {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* لوگوی شفافِ عریض — نه کادرِ مربعِ ۴۸ (که لوگو را له می‌کرد) */
.install-banner-content img {
    width: auto;
    height: 44px;
    max-width: 130px;
    object-fit: contain;
    border-radius: 0;
    flex-shrink: 0;
}

.install-banner-text h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--secondary);
}

.install-banner-text p {
    margin: 2px 0 0;
    font-size: 0.85rem;
    color: var(--secondary-text);
}

.install-banner-actions {
    display: flex;
    gap: 10px;
}

.btn-install {
    background: var(--success);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.btn-close-banner {
    background: var(--secondary-bg);
    color: var(--secondary-text);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
}

/* iOS specific layout */
.install-banner#iosBanner {
    flex-direction: column;
    text-align: center;
    gap: 10px;
}

.install-banner#iosBanner .install-banner-content {
    flex-direction: column;
    gap: 8px;
}

.install-banner#iosBanner .install-banner-text p {
    line-height: 1.5;
}


@media (max-width: 768px) {
    .sidebar {
        transform: translateX(100%);
        /* بالاتر از نوارِ ناوبریِ پایین (z-index: 1200) — وگرنه نوار روی
           آیتم‌های پایینیِ منو می‌افتاد و «خروج» دیده نمی‌شد. */
        z-index: 1300;
        /* فضای امن ته منو تا آخرین آیتم پشتِ نوارِ پایین/نوچ گم نشود */
        padding-bottom: calc(90px + env(safe-area-inset-bottom));
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .active-sidebar .sidebar {
        transform: translateX(0);
    }

    .main-content {
        margin-right: 0;
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    /* سه تایلِ آمار روی موبایل به ۲+۱ می‌شکنند و یک سلولِ خالی کنارِ کارتِ سوم
       می‌ماند. آن سلولِ خالی درست بالای کارت‌های میان‌بر می‌افتد و آن‌ها را جدا و
       پرت نشان می‌دهد. کارتِ تنها کلِ عرض را می‌گیرد تا حفره بسته شود.
       شرط :last-child باعث می‌شود فقط وقتی اعمال شود که دقیقاً سه کارت باشد. */
    .dashboard-grid > .stat-card:nth-child(3):last-child {
        grid-column: 1 / -1;
    }

    /* تیتر هدر داشبورد را کوچک‌تر و ریسپانسیو می‌کنیم تا کنار دکمه‌ی اعلان جا شود */
    .main-content header h2 {
        font-size: 1.15rem;
        line-height: 1.4;
    }

    .main-content header p {
        font-size: 0.8rem;
    }
}

/* گوشی‌های کوچک‌تر: یک پله کوچک‌تر */
@media (max-width: 400px) {
    .main-content header h2 {
        font-size: 1rem;
    }

    #enablePushBtn {
        font-size: 0.75em;
        padding: 5px 9px;
    }
}

/* =======================================================================
   جدول‌های ریسپانسیو + برچسب وضعیت (سراسری برای همه‌ی صفحات .table-container)
   ======================================================================= */
.table-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* برچسب وضعیت رنگی (پیل) — خوانا و حرفه‌ای */
.jg-status {
    display: inline-block;
    padding: 3px 12px;
    border-radius: 999px;
    font-size: 0.82em;
    font-weight: 600;
    white-space: nowrap;
    line-height: 1.7;
    background: #eef1f5;
    color: #475569;
}
.jg-status.st-warn   { background: #fff3e0; color: #b26a00; }  /* باز/در انتظار/زمان‌بندی */
.jg-status.st-ok     { background: #e6f7f1; color: #087f5b; }  /* حل‌شده/کامل/تأییدشده/فعال */
.jg-status.st-info   { background: #e7f1ff; color: #1560bd; }  /* قبول‌شده/در حال انجام */
.jg-status.st-danger { background: #fdecec; color: #c0392b; }  /* لغوشده/رد */

/* روی موبایل: هر ردیفِ جدول به یک «کارت» تبدیل می‌شود */
@media (max-width: 600px) {
    .table-container {
        overflow-x: visible;
    }

    .table-container table,
    .table-container thead,
    .table-container tbody,
    .table-container tr,
    .table-container td {
        display: block;
        width: 100%;
    }

    .table-container table {
        background: transparent;
        border-radius: 0;
        box-shadow: none;
    }

    /* سرستون‌ها را از دید پنهان کن (نامِ ستون از data-label می‌آید) */
    .table-container thead {
        position: absolute;
        left: -9999px;
        top: -9999px;
    }

    .table-container tr {
        margin-bottom: 14px;
        border: 1px solid #e5e9f0;
        border-radius: 14px;
        background: #fff;
        padding: 4px 14px;
        box-shadow: 0 1px 5px rgba(0, 0, 0, 0.06);
        overflow: hidden;
    }
    .table-container tr:hover {
        background: #fff;
    }

    .table-container td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        gap: 14px;
        padding: 11px 0;
        border-bottom: 1px solid #f1f4f9;
        text-align: left;
        white-space: normal;
        word-break: break-word;
        min-height: 24px;
    }
    .table-container td:last-child {
        border-bottom: none;
    }

    /* نامِ ستون سمت راست (label)، مقدار سمت چپ */
    .table-container td::before {
        content: attr(data-label);
        font-weight: 700;
        color: var(--primary);
        font-size: 0.85em;
        flex-shrink: 0;
    }
    /* سلولِ خالی را پنهان کن تا کارت شلوغ نشود */
    .table-container td:empty {
        display: none;
    }

    /* ستونِ «عملیات»: دکمه‌ها راست‌چین و بدون label */
    .table-container td[data-label="عملیات"] {
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
        padding-top: 12px;
    }
    .table-container td[data-label="عملیات"]::before {
        content: "";
    }

    /* پدینگِ کارتِ کانتینر روی موبایل کمی جمع‌تر */
    .container,
    .main-content {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* رفعِ باگ: جدول نباید روی موبایل min-width:600 داشته باشد وگرنه کارت‌ها اسکرول افقی می‌گیرند */
    .table-container table {
        min-width: 0 !important;
    }
}

/* =======================================================================
   بازطراحیِ مدرن (سبکِ اوبر، ساده، با همان رنگ‌ها) — این بلوک آخر است تا غالب شود
   ======================================================================= */
:root {
    --line: #E7ECF1;
    --ink: #0D2B38;
    --muted: #6B7C88;
    --radius-card: 18px;
    --radius-btn: 12px;
    --shadow-sm: 0 1px 2px rgba(13, 43, 56, 0.05);
    --shadow-md: 0 6px 24px rgba(13, 43, 56, 0.08);
}

body {
    background: #F5F7FA;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { letter-spacing: -0.3px; }

/* ---- دکمه‌ها ---- */
.btn-primary {
    border-radius: var(--radius-btn);
    padding: 12px 22px;
    font-weight: 700;
    letter-spacing: -0.2px;
    box-shadow: 0 2px 10px rgba(0, 194, 209, 0.28);
    transition: transform .08s ease, background-color .2s, box-shadow .2s;
}
.btn-primary:active { transform: translateY(1px); box-shadow: 0 1px 5px rgba(0, 194, 209, 0.25); }

.btn-secondary {
    background: #EDF1F5;
    color: var(--ink);
    border-radius: var(--radius-btn);
    padding: 12px 20px;
    font-weight: 600;
    transition: background-color .2s, transform .08s ease;
}
.btn-secondary:hover { background: #E1E7ED; }
.btn-secondary:active { transform: translateY(1px); }

/* لینک‌هایی که شکلِ دکمه دارند نباید خطِ زیر داشته باشند */
a.btn-primary, a.btn-secondary { text-decoration: none; }

/* رفعِ کنتراستِ دکمه‌ی «لغو» در همه‌ی مودال‌ها:
   استایل‌های درون‌خطیِ قدیمی (background: var(--secondary-text)) متن را ناخوانا می‌کردند */
.modal .btn-secondary, .modal-content .btn-secondary {
    background: #E9EEF3 !important;
    color: #0D2B38 !important;
    font-weight: 700;
}

/* =======================================================================
   jg-picker — پیکرِ تاریخ/ساعتِ دومرحله‌ای (درشت، خوانا، فیروزه‌ای)
   ======================================================================= */
.jgp-overlay {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(13, 43, 56, 0.5);
    backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.jgp-sheet {
    background: #fff;
    width: 100%; max-width: 380px;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(13, 43, 56, 0.3);
    overflow: hidden;
    animation: jgPop .22s cubic-bezier(.22,.61,.36,1) both;
}
.jgp-head {
    background: linear-gradient(120deg, var(--primary), #08A6B4);
    color: #fff;
    font-size: 1.1rem; font-weight: 800;
    padding: 16px 20px;
    letter-spacing: -0.3px;
}
.jgp-head small { font-weight: 500; opacity: .9; margin-right: 8px; }
.jgp-body { padding: 16px; }
.jgp-foot { display: flex; gap: 10px; padding: 0 16px 16px; }

.jgp-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.jgp-month { font-size: 1.25rem; font-weight: 800; color: #0D2B38; }
.jgp-month span { color: var(--primary); }
.jgp-navbtn {
    width: 42px; height: 42px; border: none; border-radius: 12px;
    background: #EEF3F7; color: #0D2B38; font-size: 1.5rem; font-weight: 700;
    cursor: pointer; font-family: inherit; line-height: 1;
}
.jgp-navbtn:active { transform: scale(.93); }

.jgp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.jgp-wd { margin-bottom: 6px; }
.jgp-wd div { text-align: center; font-size: .8rem; font-weight: 700; color: #6B7C88; padding: 4px 0; }
.jgp-wd div:last-child { color: #E05252; }

.jgp-day {
    aspect-ratio: 1;
    border: none; border-radius: 12px;
    background: #F5F8FA;
    font-family: inherit;
    font-size: 1.15rem; font-weight: 700;
    color: #0D2B38;
    cursor: pointer;
    transition: background .12s, transform .08s;
}
.jgp-day:active { transform: scale(.92); }
.jgp-day.friday { color: #E05252; background: #FDF3F3; }
.jgp-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.jgp-day.sel {
    background: var(--primary) !important;
    color: #fff !important;
    box-shadow: 0 4px 14px rgba(0, 194, 209, 0.45);
}

/* ساعت همیشه چپ، دقیقه همیشه راست (مثلِ ۰۷:۳۰).
   بدونِ direction:ltr، چون کلِ صفحه RTL است، ستونِ اولِ سورس (ساعت) سمتِ راست
   می‌افتد و جای ساعت و دقیقه برعکس دیده می‌شود. */
.jgp-timewrap { display: flex; direction: ltr; align-items: center; justify-content: center; gap: 14px; padding: 8px 0 4px; }
.jgp-timecol { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.jgp-timeval {
    font-size: 3rem; font-weight: 800; letter-spacing: 1px;
    color: #0D2B38;
    background: #F0F6F8;
    border-radius: 16px;
    min-width: 104px; text-align: center;
    padding: 8px 12px;
    font-variant-numeric: tabular-nums;
}
.jgp-timesep { font-size: 2.6rem; font-weight: 800; color: var(--primary); margin-top: -26px; }
.jgp-timelbl { font-size: .85rem; color: #6B7C88; font-weight: 600; }
.jgp-step {
    width: 100px; height: 38px; border: none; border-radius: 10px;
    background: #EEF3F7; color: var(--primary);
    font-size: 1rem; cursor: pointer; font-family: inherit;
}
.jgp-step:active { background: var(--primary); color: #fff; }

.jgp-quick { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 14px; }
.jgp-q {
    border: none; border-radius: 999px;
    background: #F0F6F8; color: #0D2B38;
    padding: 8px 14px; font-family: inherit; font-size: .95rem; font-weight: 700;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}
.jgp-q.sel, .jgp-q:active { background: var(--primary); color: #fff; }

.jgp-ok {
    flex: 1; border: none; border-radius: 12px;
    background: var(--primary); color: #fff;
    padding: 14px; font-size: 1.05rem; font-weight: 800; font-family: inherit;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 194, 209, .3);
}
.jgp-cancel {
    flex: 1; border: none; border-radius: 12px;
    background: #E9EEF3; color: #0D2B38;
    padding: 14px; font-size: 1.05rem; font-weight: 700; font-family: inherit;
    cursor: pointer;
}

/* ---- کارت ---- */
.card {
    border-radius: var(--radius-card);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
    padding: 22px;
}

/* ---- کارت‌های آماری (داشبورد) — تایلِ مدرن با آیکونِ چیپ ---- */
.dashboard-grid { gap: 16px; }
.stat-card {
    align-items: stretch;
    text-align: right;
    justify-content: flex-start;
    gap: 4px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-sm);
}
.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.stat-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--primary-bg);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin: 0 0 10px;
}
.stat-value { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin: 0; }
.stat-label { font-size: 13px; color: var(--muted); margin-top: 2px; }

/* ---- سایدبار: حالتِ فعالِ تمیزتر ---- */
.menu-item { font-weight: 500; }
.menu-item:hover, .menu-item.active { transform: none; }
.menu-item:hover { background: rgba(255, 255, 255, 0.08); }
.menu-item.active {
    background: var(--primary);
    color: #04333a;
    font-weight: 700;
    box-shadow: 0 6px 18px rgba(0, 194, 209, 0.35);
}

/* ---- ورودی‌ها: فوکوسِ حلقه‌ای مدرن ---- */
.form-control, .input-group input, .input-group select, .input-group textarea {
    border: 1px solid var(--line);
    border-radius: var(--radius-btn);
    padding: 12px 14px;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .input-group input:focus, .input-group select:focus, .input-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(0, 194, 209, 0.15);
}
.input-group label, .form-group label { font-weight: 600; color: var(--ink); font-size: .9rem; }

/* ---- پیل وضعیت: کمی درشت‌تر و مدرن‌تر ---- */
.jg-status { padding: 4px 13px; letter-spacing: -0.2px; }

/* ---- مودال: گوشه‌های نرم + بک‌دراپِ محو ---- */
.modal { background: rgba(13, 43, 56, 0.45); backdrop-filter: blur(3px); }
.modal > .modal-content {
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-md);
    padding: 24px;
    border: 1px solid var(--line);
}

/* تورِ ایمنیِ سراسری: هیچ مودالی — حتی اگر صفحه‌ای عرضِ ثابت (مثلاً 400px) تعریف
   کرده باشد — نباید از لبه‌ی صفحه بیرون بزند یا بلندتر از ارتفاعِ صفحه شود. */
.modal > .modal-content {
    box-sizing: border-box;
    max-width: 100%;
    max-height: 100%;
    overflow-y: auto;
}

/* ⚠️ مودال باید بالای همه چیز باشد — از جمله نوارِ ناوبریِ پایین (z-index: 1200).
   چند صفحه z-index: 1000 داشتند، پس نوارِ پایین روی کفِ مودال می‌افتاد و
   دکمه‌ی «ثبت» پشتش گم می‌شد. `!important` لازم است چون استایلِ داخلِ صفحه
   بعد از این فایل لود می‌شود و در تساویِ specificity برنده می‌شد. */
.modal {
    z-index: 1600 !important;
}

/* --- دکمه‌ی بستنِ آیکونی، بالای مودال (توسط ui.js تزریق می‌شود) --- */
.modal > .modal-content {
    position: relative;
}

.jg-modal-close {
    position: absolute;
    top: 10px;
    /* در چیدمانِ راست‌چین، دکمه‌ی بستن گوشه‌ی بالا-چپ می‌نشیند */
    left: 10px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: #EEF2F6;
    color: var(--secondary-text);
    cursor: pointer;
    padding: 0;
    z-index: 3;
    transition: background .15s, color .15s;
}

.jg-modal-close svg {
    width: 19px;
    height: 19px;
}

.jg-modal-close:hover {
    background: #FDECEC;
    color: #C0392B;
}

.jg-modal-close:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

/* عنوانِ مودال نباید زیرِ دکمه‌ی بستن برود */
.modal > .modal-content > h3:first-of-type,
.modal > .modal-content > h4:first-of-type {
    padding-left: 46px;
}

@media (max-width: 600px) {
    /* روی شیتِ موبایل دکمه کمی بزرگ‌تر و در دسترس‌تر */
    .jg-modal-close {
        width: 44px;
        height: 44px;
        top: 12px;
        left: 12px;
    }
}

/* =======================================================================
   نوارِ جستجو و فیلترِ فهرست‌ها  (frontend/js/filter.js)
   ======================================================================= */
.jg-filterbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.jg-filterbar__search {
    position: relative;
    flex: 1 1 240px;
    min-width: 0;
}
.jg-filterbar__search svg {
    position: absolute;
    inset-inline-start: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--secondary-text, #6B7A88);
    pointer-events: none;
}
.jg-filterbar__search input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    padding-inline-start: 38px;
    border: 1px solid var(--line, #E7ECF1);
    border-radius: 12px;
    background: #fff;
    font-family: inherit;
    font-size: .95rem;
    color: var(--ink, #0D2B38);
    min-height: 44px;               /* هدفِ لمسیِ WCAG 2.5.5 */
}
.jg-filterbar__search input:focus {
    outline: none;
    border-color: var(--primary, #00C2D1);
    box-shadow: 0 0 0 3px rgba(0, 194, 209, .15);
}
/* آیکونِ ✕ پیش‌فرضِ مرورگر در input[type=search] با RTL بد می‌نشیند */
.jg-filterbar__search input::-webkit-search-cancel-button { -webkit-appearance: none; }

.jg-filterbar__sel select {
    padding: 11px 14px;
    border: 1px solid var(--line, #E7ECF1);
    border-radius: 12px;
    background: #fff;
    font-family: inherit;
    font-size: .9rem;
    color: var(--ink, #0D2B38);
    min-height: 44px;
    cursor: pointer;
}
.jg-filterbar__sel select:focus {
    outline: none;
    border-color: var(--primary, #00C2D1);
    box-shadow: 0 0 0 3px rgba(0, 194, 209, .15);
}

.jg-filterbar__reset {
    border: 1px solid var(--line, #E7ECF1);
    background: #fff;
    color: var(--secondary-text, #6B7A88);
    border-radius: 12px;
    padding: 11px 16px;
    min-height: 44px;
    font-family: inherit;
    font-size: .88rem;
    cursor: pointer;
}
.jg-filterbar__reset:hover { background: #F6F8FB; color: var(--ink, #0D2B38); }

.jg-filterbar__count {
    color: var(--secondary-text, #6B7A88);
    font-size: .85rem;
    margin-inline-start: auto;
}

.jg-filterbar__empty {
    text-align: center;
    color: var(--secondary-text, #6B7A88);
    padding: 22px 12px;
    margin: 0 0 14px;
    background: #F6F8FB;
    border-radius: 12px;
}

/* ردیفِ فیلترشده. `hidden` روی <tr> در بعضی حالت‌های جدولِ کارتیِ موبایل
   بی‌اثر می‌شود، پس این کلاس تضمینِ پنهان‌شدن است. */
.jg-hidden { display: none !important; }

@media (max-width: 600px) {
    .jg-filterbar__sel { flex: 1 1 calc(50% - 5px); }
    .jg-filterbar__sel select { width: 100%; }
    .jg-filterbar__count { margin-inline-start: 0; width: 100%; }
}

/* نوارِ دکمه‌های پایانیِ فرم (لغو/ثبت) ته مودال می‌چسبد تا وقتی فرم بلند است و
   اسکرول می‌خورد، دکمه‌ی «ثبت» همیشه دیده شود.
   (باگ: در فرمِ درخواست جایگزین، دکمه‌ی ثبت ته فرمِ ۸۵۵ پیکسلی می‌افتاد و
   کاربر فکر می‌کرد دکمه‌ای وجود ندارد.)
   الگوی مشترکِ همه‌ی صفحه‌ها: <div class="flex" style="justify-content:flex-end"> */
   ⚠️ سلکتور عمداً فیلدهای ورودی را کنار می‌گذارد. قبلاً هر `.flex`ِ آخر را
   می‌چسباند و در مودالِ «مسیرهای کارخانه» ردیفِ ورودیِ «مبدأ/مقصد» را ته مودال
   می‌چسباند — با پس‌زمینه و سایه، طوری که شبیه خرابی دیده می‌شد و روی محتوا
   می‌افتاد. حالا فقط ردیفی می‌چسبد که ورودی ندارد، یعنی واقعاً نوارِ دکمه است. */
.modal-content form > .flex:last-of-type:not(:has(input, select, textarea)),
.modal-content > .flex:last-of-type:not(:has(input, select, textarea)) {
    position: sticky;
    bottom: -1px;
    background: #fff;
    padding: 12px 0;
    margin-top: 10px;
    box-shadow: 0 -10px 16px -12px rgba(13, 43, 56, 0.45);
    z-index: 2;
}
@media (min-width: 601px) {
    .modal { padding: 20px; }
    .modal > .modal-content { max-height: calc(100vh - 40px); }
}

/* دسکتاپ: جدول‌ها تمیزتر */
@media (min-width: 601px) {
    .table-container table { border-spacing: 0; }
    .table-container thead th { background: var(--secondary); }
    .table-container tbody tr { transition: background-color .15s; }
}

/* ---- موبایل: زیبایی کارت‌ها، دکمه‌ها و مودالِ کشویی (Bottom Sheet) ---- */
@media (max-width: 600px) {
    /* فقط دکمه‌های داخلِ مودال و فرم تمام‌عرض شوند — نه دکمه‌های هدر/آیکونی */
    .modal-content .btn-primary,
    .modal-content .btn-secondary,
    form .btn-primary,
    form .btn-secondary {
        width: 100%;
        padding: 14px 20px;
        font-size: 1.02rem;
    }

    /* هدرِ صفحات = اپ‌بارِ تمیز: عنوان + دکمه‌ی بازگشتِ جمع‌وجور در یک ردیف */
    .container > .flex:first-child,
    .main-content > .flex:first-child {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 8px 10px;
        margin-bottom: 16px;
    }
    .container > .flex:first-child > h2,
    .main-content > .flex:first-child > h2 {
        flex: 1 1 130px;
        font-size: 1.15rem;
        margin: 0;
    }
    .container > .flex:first-child > div {
        display: flex;
        gap: 8px;
        flex-wrap: wrap;
        align-items: center;
    }
    /* دکمه‌های هدر همیشه جمع‌وجور (نه تمام‌عرض) — قوی‌تر از قانونِ فرم بالا */
    .container > .flex:first-child .btn-primary,
    .container > .flex:first-child .btn-secondary,
    .main-content > .flex:first-child .btn-primary,
    .main-content > .flex:first-child .btn-secondary {
        width: auto;
        padding: 9px 14px;
        font-size: 0.9rem;
    }

    /* کارت‌های جدول: کمی لطیف‌تر */
    .table-container tr {
        border-radius: 16px;
        box-shadow: 0 2px 10px rgba(13, 43, 56, 0.06);
        padding: 6px 16px;
    }
    .table-container td { padding: 13px 0; }
    /* اولین سلولِ هر کارت (شناسه) کمی برجسته‌تر */
    .table-container tbody td:first-child { font-weight: 700; font-size: 1.02em; }

    /* مودال به‌صورت شیتِ پایین‌چسب */
    .modal {
        align-items: flex-end !important;
        /* پدینگِ صفحه روی شیت لازم نیست و ارتفاعِ مفید را می‌خورد */
        padding: 0 !important;
    }
    .modal > .modal-content {
        width: 100% !important;
        max-width: 100%;
        border-radius: 22px 22px 0 0;
        /* پدینگِ پایینِ سخاوتمند: دکمه‌ی «ثبت» در انتهای فرم نباید زیرِ لبه‌ی
           صفحه/نوچ یا نوارِ خانگیِ گوشی گیر کند. */
        padding: 22px 18px calc(34px + env(safe-area-inset-bottom));
        max-height: 88vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        animation: jgSheetUp .28s cubic-bezier(0.32, 0.72, 0, 1);
    }
    .card { padding: 18px; border-radius: 16px; }

    /* داشبوردِ موبایل: تایل‌های جمع‌وجور و مدرن، دوتایی در هر ردیف */
    .dashboard-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
    .stat-card { padding: 15px 14px; border-radius: 16px; }
    .stat-icon { width: 38px; height: 38px; border-radius: 11px; font-size: 20px; margin-bottom: 8px; }
    .stat-value { font-size: 23px; letter-spacing: -0.5px; }
    .stat-label { font-size: 12px; }
}

@keyframes jgSheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* =======================================================================
   انیمیشن‌های مینیمال و سبک (فقط CSS — بدون کتابخانه، بدون شبکه ≈ ۱ کیلوبایت)
   ======================================================================= */
@keyframes jgFadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes jgFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes jgSpin { to { transform: rotate(360deg); } }
@keyframes jgShimmer { 100% { transform: translateX(-100%); } }
@keyframes jgPop { 0% { transform: scale(.85); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

/* ورودِ نرمِ کارت‌ها و ردیف‌های جدول (با پله‌بندیِ ظریف) */
.card { animation: jgFadeUp .45s cubic-bezier(.22, .61, .36, 1) both; }
.stat-card { animation: jgFadeUp .5s cubic-bezier(.22, .61, .36, 1) both; }
.dashboard-grid .stat-card:nth-child(1) { animation-delay: .04s; }
.dashboard-grid .stat-card:nth-child(2) { animation-delay: .10s; }
.dashboard-grid .stat-card:nth-child(3) { animation-delay: .16s; }
.dashboard-grid .stat-card:nth-child(4) { animation-delay: .22s; }
.dashboard-grid .stat-card:nth-child(5) { animation-delay: .28s; }
.dashboard-grid .stat-card:nth-child(6) { animation-delay: .34s; }

.table-container tbody tr { animation: jgFadeUp .4s cubic-bezier(.22, .61, .36, 1) both; }
.table-container tbody tr:nth-child(1) { animation-delay: .02s; }
.table-container tbody tr:nth-child(2) { animation-delay: .06s; }
.table-container tbody tr:nth-child(3) { animation-delay: .10s; }
.table-container tbody tr:nth-child(4) { animation-delay: .14s; }
.table-container tbody tr:nth-child(5) { animation-delay: .18s; }
.table-container tbody tr:nth-child(6) { animation-delay: .22s; }
.table-container tbody tr:nth-child(n+7) { animation-delay: .26s; }

/* پیلِ وضعیت با یک پاپِ کوچک */
.jg-status { animation: jgPop .28s ease both; }

/* مودالِ دسکتاپ: ورودِ نرم */
@media (min-width: 601px) {
    .modal > .modal-content { animation: jgPop .2s cubic-bezier(.22, .61, .36, 1) both; }
}

/* اسپینرِ تمیز (کلاس jg-spinner) */
.jg-spinner {
    width: 26px; height: 26px;
    border-radius: 50%;
    border: 3px solid var(--line);
    border-top-color: var(--primary);
    animation: jgSpin .7s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

/* اسکلتِ لودینگِ درخشان (کلاس jg-skeleton) */
.jg-skeleton {
    position: relative;
    overflow: hidden;
    background: #eef1f5;
    border-radius: 8px;
    min-height: 14px;
}
.jg-skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    transform: translateX(100%);
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent);
    animation: jgShimmer 1.2s infinite;
}

/* دکمه‌ها: بازخوردِ لمسیِ نرم روی موبایل */
.btn-primary, .btn-secondary, .stat-card, .menu-item { will-change: transform; }

/* احترام به تنظیمِ کاهشِ حرکت (دسترس‌پذیری + کارایی) */
@media (prefers-reduced-motion: reduce) {
    *,
    .card, .stat-card, .table-container tbody tr, .jg-status, .modal > .modal-content {
        animation: none !important;
        transition: none !important;
    }
}

/* =======================================================================
   عناصرِ تصویری (SVGِ درون‌خطی) — هدرِ گرادیانی، آیکون تایل‌ها، حالتِ خالی، لودر
   ======================================================================= */

/* آیکونِ SVG داخلِ چیپِ تایل‌ها */
.stat-icon svg { width: 22px; height: 22px; display: block; }

/* هدرِ گرادیانیِ داشبورد (موجِ فیروزه‌ای) */
.dash-hero {
    background: linear-gradient(120deg, var(--primary) 0%, #08A6B4 52%, #0D2B38 128%);
    color: #fff;
    border-radius: 20px;
    padding: 22px 24px;
    box-shadow: 0 10px 26px rgba(0, 194, 209, 0.28);
    position: relative;
    overflow: hidden;
}
/* درخششِ ملایمِ گوشه (بدونِ تصویر) */
.dash-hero::after {
    content: '';
    position: absolute;
    top: -60px; left: -40px;
    width: 220px; height: 220px;
    background: radial-gradient(circle, rgba(255,255,255,.18), transparent 70%);
    pointer-events: none;
}
.dash-hero h2 { color: #fff; position: relative; }
.dash-hero p { color: rgba(255, 255, 255, 0.85) !important; position: relative; }
.dash-hero .btn-secondary { background: rgba(255, 255, 255, 0.18); color: #fff; }
.dash-hero .btn-secondary:hover { background: rgba(255, 255, 255, 0.28); }
.dash-hero .avatar { border-color: rgba(255, 255, 255, 0.7) !important; }

/* حالتِ خالیِ تصویری */
.jg-empty {
    text-align: center;
    padding: 34px 16px;
    color: var(--muted);
}
.jg-empty svg { width: 96px; height: 96px; margin: 0 auto 14px; display: block; animation: jgFloat 3s ease-in-out infinite; }
.jg-empty p { margin: 0; font-size: .95rem; }
@keyframes jgFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* لودرِ مرکزی */
.jg-loading { display: flex; justify-content: center; align-items: center; padding: 34px; }

@media (max-width: 600px) {
    .dash-hero { padding: 18px 18px; border-radius: 18px; }
    .jg-empty svg { width: 84px; height: 84px; }
}
@media (prefers-reduced-motion: reduce) {
    .jg-empty svg { animation: none !important; }
}

/* =======================================================================
   دکمه‌ی بازگشت + دکمه‌های آیکونیِ هدر (همه‌ی صفحات، همه‌ی نقش‌ها)
   ======================================================================= */
/* دکمه‌ی بازگشت: جمع‌وجور، با فِلِش، پدینگِ مناسب، جای ثابت در گوشه‌ی هدر */
a.btn-secondary[href="dashboard.php"] {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 15px;
    white-space: nowrap;
    flex: 0 0 auto;
    text-decoration: none;
}
a.btn-secondary[href="dashboard.php"]::before {
    content: "→";
    font-size: 1.05em;
    line-height: 1;
    margin-top: -1px;
}

/* =======================================================================
   نوارِ ناوبریِ پایین (موبایل — راننده و نماینده‌ی کارخانه) — از طرحِ Jahangasht App
   ======================================================================= */
.jg-bottom-nav, .jg-bottom-nav-spacer { display: none; }

@media (max-width: 768px) {
    .jg-bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 1200;
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--line);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
        justify-content: space-around;
        box-shadow: 0 -4px 20px rgba(13, 43, 56, 0.07);
    }
    .jg-bottom-nav-spacer { display: block; height: 72px; }

    .jg-bn-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        text-decoration: none;
        color: var(--muted);
        flex: 1;
        padding: 5px 2px;
        border-radius: 12px;
        transition: color .15s;
        -webkit-tap-highlight-color: transparent;
    }
    .jg-bn-icon { position: relative; width: 23px; height: 23px; }
    .jg-bn-icon svg { width: 23px; height: 23px; display: block; }
    .jg-bn-label { font-size: 10.5px; font-weight: 600; }

    .jg-bn-item.active { color: var(--primary); }
    .jg-bn-item.active .jg-bn-icon { animation: jgPop .25s ease; }
    .jg-bn-item:active { transform: scale(.94); }

    /* نقطه‌ی قرمزِ ضربان‌دار برای اعلانِ نخوانده */
    .jg-bn-dot {
        display: none;
        position: absolute;
        top: -2px;
        left: -2px;
        width: 8px;
        height: 8px;
        border-radius: 50%;
        background: var(--error);
        animation: jgPulseDot 1.6s ease-in-out infinite;
    }
}

@keyframes jgPulseDot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.45); }
    50% { box-shadow: 0 0 0 5px rgba(255, 59, 48, 0); }
}

/* =======================================================================
   تایم‌لاینِ مسیر (مبدأ → مقصد با نقطه و خط) + چیپِ زنده — از طرح
   ======================================================================= */
.jg-timeline { margin: 12px 0; }
.jg-tl-row { display: flex; align-items: center; gap: 10px; }
.jg-tl-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--primary); flex: 0 0 auto;
}
.jg-tl-dot.end { background: var(--secondary); border-radius: 3px; }
.jg-tl-line {
    width: 2px; height: 18px; margin-right: 4px;
    background: repeating-linear-gradient(to bottom, #C6D3DC 0 3px, transparent 3px 6px);
}
.jg-tl-label { font-weight: 600; font-size: .95rem; }

/* چیپِ وضعیتِ «زنده» با حلقه‌ی ضربان‌دار */
.jg-status.st-live { position: relative; }
.jg-status.st-live::before {
    content: '';
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    margin-left: 6px;
    vertical-align: middle;
    animation: jgPulseDot 1.6s ease-in-out infinite;
}

/* محوِ نرمِ صفحه هنگامِ لود (page-fade از طرح) */
body { animation: jgFadeIn .3s ease both; }

/* هاورِ بلندشدنِ ردیف‌های جدولِ دسکتاپ */
@media (min-width: 601px) {
    .table-container tbody tr:hover {
        background: #F7FAFC;
        box-shadow: inset 4px 0 0 var(--primary);
    }
}

/* دکمه‌ی منوی همبرگری: همیشه جمع‌وجور و مربعی (نه تمام‌عرض) */
#menuBtn {
    width: auto !important;
    flex: 0 0 auto;
    padding: 8px 11px !important;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}
/* دکمه‌ی فعال‌سازیِ اعلان: جمع‌وجور تا فضای هدر شلوغ نشود */
#enablePushBtn {
    width: auto !important;
    flex: 0 0 auto;
}

/* =======================================================================
   دکمه‌های عملیات جدول (ویرایش/حذف/بستن پرونده/…) — دکمه‌های واقعیِ چیپی
   (!important برای غلبه بر استایل‌های درون‌خطیِ قدیمیِ background:none)
   ======================================================================= */
.table-container td[data-label="عملیات"] button,
.table-container td[data-label="عملیات"] .action-btn {
    background: #EEF3F7 !important;
    color: var(--ink) !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 7px 14px !important;
    margin: 2px 0 2px 6px !important;
    font-family: inherit !important;
    font-size: 0.85rem !important;
    font-weight: 600 !important;
    cursor: pointer;
    line-height: 1.6;
    transition: filter .15s, transform .08s;
}
.table-container td[data-label="عملیات"] button:active { transform: translateY(1px); }

/* حذف/لغو → قرمزِ ملایم */
.table-container td[data-label="عملیات"] .delete,
.table-container td[data-label="عملیات"] button[onclick*="delete"],
.table-container td[data-label="عملیات"] button[onclick*="cancel"] {
    background: #FDECEC !important;
    color: #C0392B !important;
}
/* اکشن‌های مثبت (بستن پرونده/تکمیل/تایید) → سبزِ ملایم */
.table-container td[data-label="عملیات"] button[onclick*="resolve"],
.table-container td[data-label="عملیات"] button[onclick*="complete"],
.table-container td[data-label="عملیات"] .approve {
    background: #E6F7F1 !important;
    color: #087F5B !important;
}
/* ویرایش/مدارک → فیروزه‌ای ملایم */
.table-container td[data-label="عملیات"] button[onclick*="edit"],
.table-container td[data-label="عملیات"] .view-docs {
    background: #E6F9FA !important;
    color: #0891A6 !important;
}