/**
 * سامانه هوشمند پایش اشتغال و مدیریت کارفرمایان
 * Glassmorphism Golden Theme
 * Inspired by warm amber glass UI
 */

@import url('https://cdn.jsdelivr.net/gh/rastikerdar/vazirmatn@v33.003/Vazirmatn-font-face.css');

:root {
    /* Green glass palette (sage / forest) — legacy --gold-* names kept as aliases so every page follows the theme */
    --gold-50:  #EEF7F1;
    --gold-100: #D6EADC;
    --gold-200: #B3D6BF;
    --gold-300: #4FA377;
    --gold-400: #2F8A5C;
    --gold-500: #1F7A4D;
    --gold-600: #17633D;
    --gold-700: #124E31;
    --gold-800: #0D3B25;
    --gold-900: #08291A;

    --bg-deep:      #9DB5A3;
    --bg-dark:      #C3D5C8;
    --bg-card:      rgba(255, 255, 255, 0.42);
    --bg-card-hover: rgba(255, 255, 255, 0.58);
    --bg-glass:     rgba(255, 255, 255, 0.35);
    --bg-glass-strong: rgba(255, 255, 255, 0.6);

    --text-primary:   #14352A;
    --text-secondary: #2D5645;
    --text-muted:     #5B7A69;
    --text-gold:      #1B6B44;

    --accent-green:   #168A4E;
    --accent-yellow:  #B7791F;
    --accent-red:     #CF3B3B;
    --accent-blue:    #2B6CB0;
    --accent-orange:  #C2610F;

    --border-glass:   rgba(255, 255, 255, 0.65);
    --border-strong:  rgba(31, 122, 77, 0.35);
    --glow-gold:      0 0 18px rgba(31, 122, 77, 0.22);
    --glow-soft:      0 4px 24px rgba(30, 70, 50, 0.15);

    --shadow-card:    0 8px 28px rgba(30, 70, 50, 0.18), inset 0 1px 0 rgba(255,255,255,.7);
    --shadow-elevated: 0 12px 38px rgba(30, 70, 50, 0.28);

    --green-deep: #1E5A3A;
    --green-grad: linear-gradient(145deg, #2F7A55 0%, #164A31 100%);

    --radius-sm:  12px;
    --radius-md:  18px;
    --radius-lg:  24px;
    --radius-xl:  30px;

    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========== RESET & BASE ========== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 15px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Vazirmatn', Tahoma, sans-serif;
    background: var(--bg-deep);
    background-image:
        radial-gradient(ellipse at 15% 10%, rgba(255, 255, 255, 0.45) 0%, transparent 50%),
        radial-gradient(ellipse at 85% 90%, rgba(40, 110, 75, 0.25) 0%, transparent 55%),
        linear-gradient(160deg, #C3D5C8 0%, #9FB7A6 50%, #B4C8B9 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.7;
    direction: rtl;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--gold-600);
    text-decoration: none;
    transition: var(--transition);
}
a:hover {
    color: var(--gold-800);
}

img {
    max-width: 100%;
    height: auto;
}

/* ========== GLASSMORPHISM CARDS ========== */
.glass {
    background: var(--bg-card);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.glass:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-elevated), var(--glow-gold);
}

.glass-strong {
    background: var(--bg-glass-strong);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated);
}

.glass-panel {
    background: linear-gradient(
        145deg,
        rgba(244, 250, 246, 0.65) 0%,
        rgba(244, 250, 246, 0.55) 100%
    );
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
}

/* ========== TYPOGRAPHY ========== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.25rem; }
h4 { font-size: 1.1rem; }

.text-gold { color: var(--text-gold); }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }

/* ========== BUTTONS ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1.35rem;
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    user-select: none;
}

.btn-primary {
    background: linear-gradient(135deg, var(--gold-500) 0%, var(--gold-600) 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(31, 122, 77, 0.35);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--gold-400) 0%, var(--gold-500) 100%);
    box-shadow: 0 6px 20px rgba(31, 122, 77, 0.5);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-glass);
    color: var(--text-primary);
    border: 1px solid var(--border-glass);
}
.btn-secondary:hover {
    background: var(--bg-glass-strong);
    border-color: var(--border-strong);
}

.btn-success {
    background: linear-gradient(135deg, #22C55E 0%, #16A34A 100%);
    color: #fff;
}
.btn-danger {
    background: linear-gradient(135deg, #EF4444 0%, #DC2626 100%);
    color: #fff;
}
.btn-warning {
    background: linear-gradient(135deg, #F59E0B 0%, #D97706 100%);
    color: #fff;
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}
.btn-ghost:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.btn-sm {
    padding: 0.4rem 0.9rem;
    font-size: 0.85rem;
}
.btn-lg {
    padding: 0.85rem 1.8rem;
    font-size: 1.05rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ========== FORMS ========== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.45rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    font-family: inherit;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    outline: none;
    transition: var(--transition);
}
.form-control:focus {
    border-color: var(--gold-500);
    box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.2);
    background: rgba(255, 255, 255, 0.85);
}
.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%232D5645' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 1rem center;
    padding-left: 2.5rem;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

/* ========== LAYOUT ========== */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 280px;
    background: linear-gradient(180deg, rgba(244, 250, 246, 0.9) 0%, rgba(235, 245, 238, 0.95) 100%);
    backdrop-filter: blur(20px);
    border-left: 1px solid var(--border-glass);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    right: 0;
    height: 100vh;
    z-index: 1000;
    transition: var(--transition);
}

.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-glass);
    text-align: center;
}

.sidebar-logo {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-gold);
    line-height: 1.5;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.75rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.8rem 1.1rem;
    margin-bottom: 0.3rem;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.95rem;
    transition: var(--transition);
    cursor: pointer;
}
.nav-item:hover,
.nav-item.active {
    background: var(--bg-glass-strong);
    color: var(--text-gold);
    box-shadow: inset 0 0 0 1px var(--border-glass);
}
.nav-item i,
.nav-item .nav-icon {
    width: 22px;
    text-align: center;
    font-size: 1.15rem;
}

.main-content {
    flex: 1;
    margin-right: 280px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.75rem;
    background: rgba(235, 245, 238, 0.7);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-glass);
    position: sticky;
    top: 0;
    z-index: 900;
}

.page-content {
    padding: 1.75rem;
    flex: 1;
}

/* ========== STAT CARDS ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    padding: 1.35rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(31, 122, 77, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    transform: translate(30%, -30%);
}
.stat-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-3px);
    box-shadow: var(--glow-gold);
}

.stat-value {
    font-size: 1.9rem;
    font-weight: 700;
    color: var(--text-gold);
    line-height: 1.2;
    margin-bottom: 0.3rem;
}
.stat-label {
    font-size: 0.88rem;
    color: var(--text-muted);
}

/* ========== TABLES ========== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-glass);
    background: var(--bg-card);
    backdrop-filter: blur(12px);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
table.data-table th {
    background: rgba(31, 122, 77, 0.10);
    color: var(--text-gold);
    font-weight: 600;
    padding: 0.9rem 1rem;
    text-align: right;
    border-bottom: 1px solid var(--border-glass);
    white-space: nowrap;
}
table.data-table td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid rgba(31, 122, 77, 0.08);
    color: var(--text-secondary);
}
table.data-table tr:hover td {
    background: rgba(31, 122, 77, 0.05);
}

/* ========== BADGES ========== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.7rem;
    font-size: 0.78rem;
    font-weight: 500;
    border-radius: 50px;
    white-space: nowrap;
}
.badge-success { background: rgba(74, 222, 128, 0.15); color: var(--accent-green); border: 1px solid rgba(74, 222, 128, 0.3); }
.badge-warning { background: rgba(250, 204, 21, 0.15); color: var(--accent-yellow); border: 1px solid rgba(250, 204, 21, 0.3); }
.badge-danger  { background: rgba(248, 113, 113, 0.15); color: var(--accent-red); border: 1px solid rgba(248, 113, 113, 0.3); }
.badge-info    { background: rgba(96, 165, 250, 0.15); color: var(--accent-blue); border: 1px solid rgba(96, 165, 250, 0.3); }
.badge-gold    { background: rgba(31, 122, 77, 0.2); color: var(--gold-300); border: 1px solid rgba(31, 122, 77, 0.35); }

/* ========== MAP ========== */
.map-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 140px);
    min-height: 500px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-glass);
    box-shadow: var(--shadow-elevated);
}

.map-search-box {
    position: absolute;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    width: 90%;
    max-width: 620px;
}

.map-search-input {
    width: 100%;
    padding: 1rem 1.4rem;
    font-size: 1.05rem;
    background: rgba(235, 245, 238, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    box-shadow: var(--shadow-elevated), var(--glow-gold);
    outline: none;
}
.map-search-input:focus {
    border-color: var(--gold-400);
    box-shadow: 0 0 0 3px rgba(31, 122, 77, 0.25), var(--shadow-elevated);
}

.map-controls {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.map-control-btn {
    min-width: 42px;
    padding: 0 0.75rem;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(235, 245, 238, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.85rem;
    font-family: inherit;
}
.map-control-btn:hover,
.map-control-btn.active {
    background: var(--bg-glass-strong);
    color: var(--text-gold);
    border-color: var(--border-strong);
}

.map-results-panel {
    position: absolute;
    top: 80px;
    left: 16px;
    width: 340px;
    max-height: calc(100% - 100px);
    overflow-y: auto;
    z-index: 1000;
    background: rgba(235, 245, 238, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-elevated);
    padding: 1rem;
}

.result-item {
    padding: 0.9rem;
    margin-bottom: 0.6rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-glass);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
}
.result-item:hover {
    border-color: var(--gold-500);
    background: var(--bg-glass-strong);
}
.result-item .rank {
    font-weight: 700;
    color: var(--text-gold);
    font-size: 1.1rem;
}

/* ========== PULSE ANIMATION (GIS) ========== */
@keyframes pulse-ring {
    0% { transform: scale(0.5); opacity: 0.8; }
    100% { transform: scale(2.2); opacity: 0; }
}
.pulse-marker {
    position: relative;
}
.pulse-marker::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border-radius: 50%;
    border: 2px solid var(--gold-400);
    animation: pulse-ring 1.8s ease-out infinite;
}
.pulse-green::after { border-color: var(--accent-green); }
.pulse-yellow::after { border-color: var(--accent-yellow); }
.pulse-orange::after { border-color: var(--accent-orange); }
.pulse-red::after { border-color: var(--accent-red); }

/* ========== NOTIFICATION BELL ========== */
.notif-bell {
    position: relative;
    cursor: pointer;
    font-size: 1.3rem;
    color: var(--text-secondary);
}
.notif-badge {
    position: absolute;
    top: -6px;
    left: -8px;
    min-width: 18px;
    height: 18px;
    background: var(--accent-red);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ========== LOGIN PAGE ========== */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--bg-deep);
    background-image:
        radial-gradient(ellipse at 30% 20%, rgba(31, 122, 77, 0.2) 0%, transparent 50%),
        radial-gradient(ellipse at 70% 80%, rgba(31, 122, 77, 0.15) 0%, transparent 50%);
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem 2rem;
    background: linear-gradient(145deg, rgba(244, 250, 246, 0.7) 0%, rgba(244, 250, 246, 0.8) 100%);
    backdrop-filter: blur(24px);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-elevated), var(--glow-gold);
    text-align: center;
}

.login-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-gold);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}
.login-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

/* ========== EMPTY STATE ========== */
.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}
.empty-state .empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    opacity: 0.4;
}
.empty-state h3 {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

/* ========== LOADING ========== */
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border-glass);
    border-top-color: var(--gold-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.skeleton {
    background: linear-gradient(90deg, rgba(31, 122, 77, 0.06) 25%, rgba(31, 122, 77, 0.12) 50%, rgba(31, 122, 77, 0.06) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.4s ease infinite;
    border-radius: var(--radius-sm);
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ========== MODAL ========== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 45, 30, 0.45);
    backdrop-filter: blur(6px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}
.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}
.modal {
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(145deg, rgba(244, 250, 246, 0.95) 0%, rgba(235, 245, 238, 0.98) 100%);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-elevated);
    padding: 1.75rem;
}

/* ========== MOBILE ========== */
@media (max-width: 992px) {
    .sidebar {
        transform: translateX(100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-right: 0;
    }
    .map-results-panel {
        width: calc(100% - 32px);
        left: 16px;
        right: 16px;
        max-height: 40vh;
        bottom: 16px;
        top: auto;
    }
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 576px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .page-content {
        padding: 1rem;
    }
    .login-card {
        padding: 2rem 1.25rem;
    }
}

/* ========== SCROLLBAR ========== */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: var(--gold-700);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--gold-500);
}

/* ========== UTILITIES ========== */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.w-100 { width: 100%; }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.hidden { display: none !important; }


/* MOBILE ENHANCEMENTS */
@media (max-width: 768px) {
    .sidebar {
        width: 100%;
        max-width: 300px;
        box-shadow: -4px 0 24px rgba(20,60,40,0.3);
    }
    .topbar {
        padding: 0.75rem 1rem;
    }
    .page-content {
        padding: 1rem;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
        gap: 0.75rem;
    }
    .stat-value { font-size: 1.45rem; }
    .stat-card { padding: 1rem; }
    .table-wrapper {
        border-radius: 12px;
    }
    table.data-table thead { display: none; }
    table.data-table tr {
        display: block;
        margin-bottom: 0.75rem;
        background: var(--bg-card);
        border: 1px solid var(--border-glass);
        border-radius: 12px;
        padding: 0.75rem;
    }
    table.data-table td {
        display: flex;
        justify-content: space-between;
        border: none;
        padding: 0.35rem 0;
        font-size: 0.88rem;
    }
    table.data-table td::before {
        content: attr(data-label);
        font-weight: 600;
        color: var(--text-muted);
        margin-left: 0.75rem;
    }
    .map-container {
        height: calc(100vh - 120px);
        min-height: 400px;
        border-radius: 0;
    }
    .map-search-box {
        width: 94%;
        top: 10px;
    }
    .map-search-input {
        padding: 0.85rem 1.1rem;
        font-size: 0.95rem;
        border-radius: 16px;
    }
    .map-controls {
        top: auto;
        bottom: 20px;
        left: 10px;
        flex-direction: row;
        flex-wrap: wrap;
        max-width: 50%;
    }
    .btn { min-height: 42px; }
    .form-control { min-height: 44px; font-size: 16px; /* prevent iOS zoom */ }
    .modal { margin: 0.5rem; max-height: 92vh; }
    .login-card { margin: 1rem; }
}


/* =====================================================================
   GREEN GLASS UI KIT (icons, tiles, hero, nav) — matches reference design
   ===================================================================== */
.ico {
    width: 1.25em; height: 1.25em; flex: none;
    fill: none; stroke: currentColor; stroke-width: 1.8;
    stroke-linecap: round; stroke-linejoin: round;
    vertical-align: -0.25em;
}
.ico-tile {
    display: inline-grid; place-items: center; flex: none;
    width: 46px; height: 46px; border-radius: 50%;
    color: #1E6B45;
    background: radial-gradient(circle at 30% 22%, #fff 0%, #E4F0E7 48%, #BCD5C4 100%);
    box-shadow: 0 6px 14px rgba(30, 70, 50, 0.25), inset 0 2px 3px #fff, inset 0 -3px 6px rgba(30, 90, 60, 0.18);
    border: 1px solid rgba(255, 255, 255, 0.8);
}
.ico-tile .ico { width: 56%; height: 56%; }
.ico-tile.sq { border-radius: 16px; }
.ico-tile.sm { width: 34px; height: 34px; }
.ico-tile.lg { width: 60px; height: 60px; }
.ico-tile.red { color: #C53030; background: radial-gradient(circle at 30% 22%, #fff 0%, #FBE3E3 50%, #F2B8B8 100%); }
.ico-tile.amber { color: #B7791F; background: radial-gradient(circle at 30% 22%, #fff 0%, #FBF0D9 50%, #EBCB8B 100%); }
.ico-tile.blue { color: #2B6CB0; background: radial-gradient(circle at 30% 22%, #fff 0%, #E1ECF8 50%, #B3CDEA 100%); }

/* Sidebar */
.sidebar {
    background: linear-gradient(180deg, rgba(240, 248, 243, 0.82) 0%, rgba(205, 224, 212, 0.88) 100%);
    border-left: 1px solid rgba(255,255,255,0.7);
    box-shadow: -8px 0 30px rgba(30, 70, 50, 0.15);
}
.sidebar-header { border-bottom: 1px solid rgba(31,122,77,0.15); }
.sidebar-logo-img { filter: drop-shadow(0 3px 8px rgba(30,90,60,0.35)) !important; }
.nav-item { font-weight: 500; padding: 0.55rem 0.8rem; }
.nav-item .nav-icon {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%;
    font-size: 1rem; color: #1E6B45;
    background: radial-gradient(circle at 30% 22%, #fff 0%, #E4F0E7 55%, #C3D9CA 100%);
    box-shadow: 0 3px 8px rgba(30,70,50,0.2), inset 0 1px 2px #fff;
    transition: var(--transition);
}
.nav-item .nav-icon .ico { width: 20px; height: 20px; }
.nav-item:hover { background: rgba(255,255,255,0.55); color: var(--green-deep); box-shadow: none; }
.nav-item.active {
    background: var(--green-grad); color: #fff;
    box-shadow: 0 6px 16px rgba(20, 70, 45, 0.35);
}
.nav-item.active .nav-icon { background: rgba(255,255,255,0.18); color: #fff; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35); }
.nav-item .badge { margin-right: auto; }

/* Topbar as floating glass header */
.topbar {
    margin: 0.9rem 1.25rem 0; padding: 0.7rem 1.1rem;
    border-radius: var(--radius-lg); border: 1px solid rgba(255,255,255,0.75);
    background: rgba(255,255,255,0.5); box-shadow: var(--shadow-card);
}
.topbar-actions { display: flex; align-items: center; gap: 0.6rem; }
.icon-btn {
    position: relative; display: inline-grid; place-items: center; width: 40px; height: 40px;
    border-radius: 50%; border: 1px solid rgba(255,255,255,0.8); cursor: pointer; color: #1E6B45;
    background: radial-gradient(circle at 30% 22%, #fff 0%, #E4F0E7 70%, #CFE2D5 100%);
    box-shadow: 0 3px 8px rgba(30,70,50,0.18);
    font-family: inherit;
}
.icon-btn .ico { width: 20px; height: 20px; }
.notif-bell { font-size: inherit; }
.avatar {
    display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 50%;
    background: var(--green-grad); color: #fff; font-weight: 700;
    border: 2px solid #fff; box-shadow: 0 3px 10px rgba(30,70,50,0.3);
}
.mobile-toggle { color: var(--green-deep) !important; }

/* Hero banner (dark green card) */
.hero-card {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; padding: 1.5rem 1.75rem; margin-bottom: 1.5rem;
    border-radius: var(--radius-lg); color: #fff;
    background:
        radial-gradient(circle at 15% 20%, rgba(120, 220, 160, 0.35) 0%, transparent 45%),
        linear-gradient(135deg, #2E6B4B 0%, #14402B 100%);
    box-shadow: 0 14px 34px rgba(20, 60, 40, 0.4), inset 0 1px 0 rgba(255,255,255,0.25);
    border: 1px solid rgba(255,255,255,0.25);
}
.hero-card::after {
    content: ''; position: absolute; inset: auto auto -60px -40px; width: 220px; height: 220px; border-radius: 50%;
    background: radial-gradient(circle, rgba(140,255,190,0.28), transparent 65%);
}
.hero-card h2, .hero-card h1 { color: #fff; font-size: 1.35rem; margin-bottom: 0.25rem; }
.hero-card p { color: rgba(255,255,255,0.8); font-size: 0.9rem; margin-bottom: 0.9rem; }
.hero-card .btn-hero {
    display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.5rem 1.2rem; border-radius: 50px;
    background: linear-gradient(180deg, #A6E6BF 0%, #62C58D 100%); color: #0F3B25; font-weight: 700; font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25); position: relative; z-index: 1;
}
.hero-card .hero-art { position: relative; z-index: 1; flex: none; }
.hero-card .hero-art .ico-tile { width: 84px; height: 84px; background: rgba(255,255,255,0.14); color: #CFF5DD; box-shadow: inset 0 0 0 1px rgba(255,255,255,0.35), 0 8px 20px rgba(0,0,0,0.25); }
.hero-card .hero-art .ico { stroke-width: 1.5; }

/* Stat cards with icon tile */
.stat-card { display: flex; align-items: center; gap: 0.9rem; padding: 1rem 1.1rem; background: rgba(255,255,255,0.45); box-shadow: var(--shadow-card); border-color: rgba(255,255,255,0.75); }
.stat-card::before { display: none; }
.stat-card .stat-body { min-width: 0; }
.stat-value { font-size: 1.6rem; color: var(--green-deep); margin-bottom: 0; }
.stat-label { font-size: 0.82rem; }

/* Quick action tiles (the "menu icons" set) */
.quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 0.8rem; }
.quick-tile {
    display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 0.9rem 0.4rem;
    text-align: center; font-size: 0.82rem; font-weight: 500; color: var(--text-secondary);
    border-radius: var(--radius-md); background: rgba(255,255,255,0.4); border: 1px dashed rgba(31,122,77,0.3);
}
.quick-tile:hover { background: rgba(255,255,255,0.7); color: var(--green-deep); transform: translateY(-2px); }

/* Glass inputs & tables */
.form-control { background: rgba(255,255,255,0.6); }
.form-control:focus { background: #fff; }
table.data-table th { background: rgba(31,122,77,0.12); }
.badge-gold { color: var(--gold-700); }
.btn-secondary { color: var(--green-deep); background: rgba(255,255,255,0.55); border: 1px solid rgba(255,255,255,0.85); box-shadow: 0 2px 8px rgba(30,70,50,0.1); }
.btn-ghost { color: var(--text-secondary); }
.btn-primary { border: 1px solid rgba(255,255,255,0.25); }
.btn .ico { width: 1.15em; height: 1.15em; }
.login-card { background: rgba(255,255,255,0.5); }
.modal { background: linear-gradient(145deg, rgba(250,253,251,0.97), rgba(228,240,232,0.97)); }
.map-search-input { background: rgba(255,255,255,0.88); }
.map-results-panel { background: rgba(250,253,251,0.94); }
.map-control-btn { background: rgba(255,255,255,0.88); }
::-webkit-scrollbar-thumb { background: var(--gold-300); }

/* Floating bottom navigation pill */
.mobile-bottom-nav {
    display: none; position: fixed; z-index: 1100;
    left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom));
    max-width: 560px; margin: 0 auto;
    padding: 0.45rem 0.5rem; justify-content: space-around; align-items: flex-end;
    background: rgba(240, 248, 243, 0.78); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,0.85); border-radius: 28px;
    box-shadow: 0 10px 30px rgba(20, 60, 40, 0.3), inset 0 1px 0 #fff;
}
.mobile-bottom-nav a {
    display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 52px;
    padding: 0.2rem 0.2rem; font-size: 0.68rem; color: var(--text-muted); text-decoration: none; position: relative;
}
.mobile-bottom-nav a .nav-ico { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; transition: var(--transition); }
.mobile-bottom-nav a .ico { width: 22px; height: 22px; }
.mobile-bottom-nav a.active { color: var(--green-deep); font-weight: 700; }
.mobile-bottom-nav a.active .nav-ico {
    width: 46px; height: 46px; margin-top: -22px; color: #fff; background: var(--green-grad);
    border: 3px solid rgba(240,248,243,0.95); box-shadow: 0 6px 14px rgba(20,70,45,0.45);
}
.mobile-bottom-nav a.danger { color: #B83232; }
.mobile-bottom-nav.bn-always { display: flex; }
body.has-bn { padding-bottom: 92px; }
@media (max-width: 768px) {
    .mobile-bottom-nav { display: flex; }
    .main-content { padding-bottom: 92px; }
    .topbar { margin: 0.6rem 0.75rem 0; }
    .hero-card { padding: 1.1rem; }
    .hero-card .hero-art .ico-tile { width: 64px; height: 64px; }
    .stat-card { padding: 0.8rem; gap: 0.6rem; }
    .ico-tile { width: 40px; height: 40px; }
}

@media (max-width: 576px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 0.6rem; }
    .stat-card { flex-direction: column; text-align: center; gap: 0.4rem; padding: 0.8rem 0.5rem; }
    .stat-card .stat-body { width: 100%; }
    .topbar-actions .text-secondary { display: none; }
    .topbar h2 { font-size: 1rem !important; }
    .quick-grid { grid-template-columns: repeat(3, 1fr); }
}
.sidebar-logo-img { border-radius: 14px; }

/* Map icon controls (basemap + traffic) */
.map-ico-ctl { display: flex; flex-direction: column; gap: 0.5rem; margin: 16px 16px 0 0 !important; }
.map-ico-btn {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    width: 58px; height: 58px; border-radius: 18px; cursor: pointer; font-family: inherit;
    font-size: 0.68rem; font-weight: 600; color: #1E6B45;
    background: rgba(255,255,255,0.92); border: 1px solid rgba(255,255,255,0.9);
    box-shadow: 0 6px 16px rgba(20,60,40,0.3); transition: var(--transition);
}
.map-ico-btn .ico { width: 24px; height: 24px; }
.map-ico-btn:hover { background: #fff; transform: translateY(-1px); }
.map-ico-btn.active { color: #fff; background: var(--green-grad); }
.leaflet-top.leaflet-right .leaflet-control { clear: none; }

/* =====================================================================
   MOBILE MAIN MENU — full-screen centered overlay (dashboard hidden behind)
   ===================================================================== */
.mobile-toggle {
    display: none; width: 42px; height: 42px; border-radius: 50%; cursor: pointer; padding: 0;
    align-items: center; justify-content: center; font-family: inherit;
    background: radial-gradient(circle at 30% 22%, #fff 0%, #E4F0E7 70%, #CFE2D5 100%);
    border: 1px solid rgba(255,255,255,0.85); color: var(--green-deep); box-shadow: 0 3px 8px rgba(30,70,50,0.2);
}
.mobile-toggle .ico { width: 22px; height: 22px; }
.menu-close { display: none; }
@media (max-width: 992px) {
    .mobile-toggle { display: inline-flex !important; margin-left: 0.6rem; }
    .topbar > .mobile-toggle { margin-left: 0.6rem; }
    .sidebar {
        position: fixed; inset: 0; width: 100% !important; max-width: none !important;
        height: 100vh; height: 100dvh; z-index: 3000; transform: none !important;
        opacity: 0; visibility: hidden; pointer-events: none;
        transition: opacity .25s ease, visibility .25s;
        background: rgba(222, 236, 227, 0.97);
        -webkit-backdrop-filter: blur(22px); backdrop-filter: blur(22px);
        border: 0; box-shadow: none;
    }
    .sidebar.open { opacity: 1; visibility: visible; pointer-events: auto; }
    .sidebar .sidebar-header { padding: 1rem 1rem 0.6rem; border-bottom: 0; flex: none; }
    .sidebar .sidebar-logo-img { width: 52px; height: 52px; margin-bottom: 0.3rem; }
    .sidebar-nav {
        flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
        width: 100%; max-width: 440px; margin: 0 auto; padding: 0.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom));
        display: flex; flex-direction: column;
    }
    /* centre the list when it is short, scroll from the top when it is long */
    .sidebar-nav > :first-child { margin-top: auto; }
    .sidebar-nav > :last-child { margin-bottom: auto; }
    .sidebar .nav-item { padding: 0.5rem 0.9rem; margin-bottom: 0.35rem; background: rgba(255,255,255,0.45); border: 1px solid rgba(255,255,255,0.7); }
    .sidebar .nav-item.active { background: var(--green-grad); }
    .menu-close {
        display: inline-grid; place-items: center; position: absolute; top: 14px; left: 14px; z-index: 2;
        width: 42px; height: 42px; border-radius: 50%; cursor: pointer; color: var(--green-deep); font-family: inherit;
        background: radial-gradient(circle at 30% 22%, #fff 0%, #E4F0E7 70%, #CFE2D5 100%);
        border: 1px solid rgba(255,255,255,0.85); box-shadow: 0 3px 8px rgba(30,70,50,0.25);
    }
    .menu-close .ico { width: 22px; height: 22px; }
    .mobile-bottom-nav { transition: opacity .2s; }
    body.menu-open .mobile-bottom-nav { opacity: 0; pointer-events: none; }
}
body.menu-open, html.menu-open { overflow: hidden !important; }


/* =====================================================================
   MOBILE FIXES v5: Safari bottom toolbar + map controls layout
   --bn-gap is measured by icons.js (extra space when the browser toolbar overlaps the page)
   ===================================================================== */
:root { --bn-gap: 0px; }
.mobile-bottom-nav { bottom: calc(10px + env(safe-area-inset-bottom, 0px) + var(--bn-gap, 0px)); }
body.has-bn { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px) + var(--bn-gap, 0px)); }
@media (max-width: 768px) {
    .main-content { padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px) + var(--bn-gap, 0px)); }
    .topbar { margin-top: calc(0.6rem + env(safe-area-inset-top, 0px)); }

    /* map: basemap/traffic buttons go below the search box instead of on top of it */
    .map-container .leaflet-top.leaflet-right .map-ico-ctl { margin: 70px 10px 0 0 !important; gap: 0.4rem; }
    .map-ico-btn { width: 46px; height: 46px; border-radius: 14px; font-size: 0.58rem; }
    .map-ico-btn .ico { width: 20px; height: 20px; }

    /* map: heat button joins the right-side button column; zoom buttons hidden (pinch to zoom) */
    .map-controls {
        top: 190px; bottom: auto; left: auto; right: 10px; max-width: none; flex-direction: column;
    }
    .map-control-btn { min-width: 46px; height: 46px; border-radius: 14px; font-size: 0.7rem; padding: 0 0.4rem; }
    .map-container .leaflet-control-zoom { display: none; }

    /* results panel stays above the floating bottom menu and leaves most of the map visible */
    .map-results-panel {
        bottom: calc(96px + env(safe-area-inset-bottom, 0px) + var(--bn-gap, 0px));
        max-height: 30vh; max-height: 30dvh;
    }
}
@supports (height: 100dvh) {
    @media (max-width: 768px) {
        .map-container { height: calc(100dvh - 120px); }
    }
}

/* profile photos */
.avatar-img { object-fit: cover; padding: 0; }


/* ===== لوگوی جدید سامانه (نشان دایره‌ای) ===== */
.sidebar-logo-img { width: 84px !important; height: 84px !important; object-fit: contain; border-radius: 50% !important; margin: 0 auto 0.5rem !important; display: block; filter: drop-shadow(0 4px 10px rgba(20,70,45,0.4)) !important; }
.brand-logo { width: 48px; height: 48px; object-fit: contain; border-radius: 50%; flex: none; filter: drop-shadow(0 2px 6px rgba(20,70,45,0.35)); }
.login-logo { border-radius: 50%; }
@media (max-width: 768px) { .sidebar .sidebar-logo-img { width: 68px !important; height: 68px !important; } .brand-logo { width: 40px; height: 40px; } }


/* =====================================================================
   MOBILE FIT v8: صفحه همیشه دقیقاً به اندازهٔ گوشی — بدون اسکرول افقی، بدون نیاز به زوم‌اوت
   (به‌همراه assets/js/mobile-fit.js که برچسب جدول‌ها را می‌گذارد و سرریزها را مهار می‌کند)
   ===================================================================== */
@media (max-width: 992px) {
    html { overflow-x: hidden; max-width: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
    body { max-width: 100vw; overflow-x: hidden; overscroll-behavior-x: none; touch-action: pan-y pinch-zoom; }
    .app-wrapper, .main-content, .page-content, .glass, .glass-panel, .glass-strong, .hero-card, .stat-card, .modal, form, fieldset { min-width: 0; max-width: 100%; }
    .page-content { overflow-x: clip; }
    img, svg:not(.ico), video, canvas, iframe { max-width: 100%; height: auto; }
    pre, code { white-space: pre-wrap; overflow-wrap: anywhere; }
    h1, h2, h3, h4, p, td, th, label, .stat-label { overflow-wrap: anywhere; }
    input, select, textarea, .form-control { max-width: 100%; min-width: 0; }
    .d-flex { flex-wrap: wrap; }
    .topbar, .topbar .d-flex, .topbar-actions, .mobile-bottom-nav, .d-flex.align-center.gap-2 > img { flex-wrap: nowrap; }
    .topbar { min-width: 0; }
    [style*="min-width"]:not(.mobile-bottom-nav):not(.mobile-bottom-nav *) { min-width: 0 !important; }
    [style*="white-space:nowrap"], [style*="white-space: nowrap"] { white-space: normal !important; }
    .modal-overlay .modal, .modal { width: calc(100% - 1rem); max-width: 100%; }
    .btn { max-width: 100%; white-space: normal; }
    .leaflet-container { max-width: 100%; }
}

/* جدول‌ها: در گوشی به‌صورت کارت‌های زیر هم (بدون اسکرول چپ و راست) */
@media (max-width: 768px) {
    .table-wrapper { overflow-x: visible !important; background: transparent; border: 0; backdrop-filter: none; }
    table.data-table, table.acc-table, table.rp-table { display: block; width: 100%; min-width: 0 !important; border-spacing: 0; }
    table.data-table thead, table.acc-table thead, table.rp-table thead { display: none; }
    table.data-table tbody, table.acc-table tbody, table.rp-table tbody { display: block; }
    table.data-table tr, table.acc-table tr, table.rp-table tr {
        display: block; margin-bottom: .7rem; padding: .6rem .8rem; background: var(--bg-card);
        border: 1px solid var(--border-glass); border-radius: 14px;
    }
    table.data-table td, table.acc-table td, table.rp-table td {
        display: flex; align-items: center; justify-content: space-between; gap: .75rem; text-align: right;
        width: 100%; min-width: 0 !important; padding: .4rem 0; border: 0 !important; background: transparent !important; border-radius: 0 !important;
        font-size: .88rem;
    }
    table.data-table td:empty, table.acc-table td:empty { display: none; }
    table.data-table td::before, table.acc-table td::before, table.rp-table td::before {
        content: attr(data-label); flex: none; max-width: 42%; font-weight: 600; color: var(--text-muted); font-size: .8rem;
    }
    table.data-table td[data-label=""]::before, table.acc-table td:not([data-label])::before { content: none; }
    table.data-table td:first-child, table.acc-table td:first-child { font-weight: 700; color: var(--text-primary); padding-bottom: .45rem; border-bottom: 1px dashed rgba(31,122,77,.25) !important; margin-bottom: .2rem; }
    table.data-table td > *:not(.btn):not(.badge):not(a):not(label):not(input):not(select) { min-width: 0; }
    table.acc-table td:first-child { display: block; }
    table.acc-table td:first-child::before { content: none; }
}

/* نوار پایین: حتی با ۸ آیکن در عرض گوشی جا می‌شود */
@media (max-width: 768px) {
    .mobile-bottom-nav { left: 8px; right: 8px; padding: .4rem .25rem; overflow: visible; }
    .mobile-bottom-nav a { flex: 1 1 0; min-width: 0 !important; max-width: 100%; padding: .2rem 0; font-size: .64rem; }
    .mobile-bottom-nav a .nav-lbl { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
    .mobile-bottom-nav.many a .nav-lbl { font-size: .54rem; }
    .mobile-bottom-nav a { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
    .mobile-bottom-nav a .nav-ico { width: 32px; height: 32px; flex: none; }
    .mobile-bottom-nav.many a { font-size: .56rem; }
    .mobile-bottom-nav.many a .nav-ico { width: 28px; height: 28px; }
    .mobile-bottom-nav.many a .ico { width: 19px; height: 19px; }
    .mobile-bottom-nav a.active .nav-ico { width: 42px; height: 42px; margin-top: -20px; }
    .mobile-bottom-nav.many a.active .nav-ico { width: 38px; height: 38px; margin-top: -18px; }
}
@media (max-width: 992px) {
    /* شبکه‌های درون‌خطی: ستون‌ها هرگز از عرض صفحه بزرگ‌تر نشوند */
    [style*="grid-template-columns:1fr 1fr"], [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
    [style*="display:grid"] > *, [style*="display: grid"] > * { min-width: 0; max-width: 100%; }
}
@media (max-width: 768px) {
    input.form-control, select.form-control, textarea.form-control { width: 100% !important; }
}
@media (max-width: 480px) {
    [style*="grid-template-columns:1fr 1fr"], [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: minmax(0, 1fr) !important; }
    .page-content { padding: .8rem; }
}
