/* ============================================================
   ماهان | سامانه اقساط — Design System
   ============================================================ */
:root {
    --bg: #f1f5f9;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --sidebar-bg: #0b1220;
    --sidebar-bg-2: #111a2e;
    --border: #e6e8ee;
    --border-strong: #d4d8e2;

    --text: #0f172a;
    --text-muted: #64748b;
    --text-soft: #94a3b8;

    --primary: #4f46e5;
    --primary-600: #4338ca;
    --primary-700: #3730a3;
    --primary-soft: #eef2ff;

    --success: #15803d;
    --success-soft: #ecfdf5;
    --warning: #b45309;
    --warning-soft: #fffbeb;
    --danger: #dc2626;
    --danger-soft: #fef2f2;
    --info: #0369a1;
    --info-soft: #ecfeff;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 6px 18px rgba(15, 23, 42, .07);
    --shadow-lg: 0 18px 45px rgba(15, 23, 42, .12);

    --radius-sm: 10px;
    --radius: 14px;
    --radius-lg: 20px;

    --sidebar-w: 264px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    font-family: "Vazirmatn", "Vazir", "Segoe UI", Tahoma, sans-serif;
    background: var(--bg);
    margin: 0;
    color: var(--text);
    direction: rtl;
    text-align: right;
    font-size: 15px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary-600); }

h1, h2, h3, h4 {
    color: var(--text);
    letter-spacing: -0.3px;
    margin: 0 0 .4em;
    font-weight: 800;
}
h2 { font-size: 1.4rem; }
h3 { font-size: 1.12rem; }

p { color: var(--text-muted); }

.muted { color: var(--text-muted); }
.hint { color: var(--text-soft); font-size: 12px; }

/* ============================================================
   App shell (authenticated layout)
   ============================================================ */
.app-shell {
    display: flex;
    min-height: 100vh;
    align-items: stretch;
}

.sidebar {
    width: var(--sidebar-w);
    flex-shrink: 0;
    background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-bg-2) 100%);
    color: #e2e8f0;
    display: flex;
    flex-direction: column;
    padding: 22px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 18px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.sidebar .brand .logo {
    width: 42px; height: 42px;
    border-radius: 12px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: #fff; font-weight: 800; font-size: 18px;
    box-shadow: 0 8px 18px rgba(79, 70, 229, .45);
}
.sidebar .brand .brand-text b { display: block; font-size: 15px; color: #fff; font-weight: 800; }
.sidebar .brand .brand-text span { font-size: 11.5px; color: #93a4c3; }

.side-nav { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.side-nav .nav-title {
    font-size: 11px; color: #64748b; font-weight: 700;
    padding: 14px 12px 6px; letter-spacing: .4px;
}
.side-nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 10px 12px;
    border-radius: 11px;
    color: #c5cfe0;
    text-decoration: none;
    font-weight: 600; font-size: 14px;
    transition: background .15s ease, color .15s ease;
}
.side-nav a svg { width: 19px; height: 19px; opacity: .9; flex-shrink: 0; }
.side-nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-nav a.active {
    background: linear-gradient(135deg, rgba(79, 70, 229, .9), rgba(124, 58, 237, .9));
    color: #fff;
    box-shadow: 0 8px 18px rgba(79, 70, 229, .35);
}
.side-nav a.active svg { opacity: 1; }

.sidebar-foot { margin-top: auto; padding-top: 16px; }
.user-card {
    display: flex; align-items: center; gap: 10px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 10px;
}
.user-card .avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #334155, #475569);
    color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px;
    flex-shrink: 0;
}
.user-card .u-name { font-size: 13px; color: #fff; font-weight: 700; }
.user-card .u-role { font-size: 11px; color: #93a4c3; }
.logout-form { margin: 0; }
.logout-form button {
    width: 100%;
    background: rgba(239, 68, 68, .12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, .25);
    padding: 9px 12px;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 700;
    display: flex; align-items: center; justify-content: center; gap: 8px;
    margin: 0;
    transition: background .15s ease;
}
.logout-form button:hover { background: rgba(239, 68, 68, .2); transform: none; box-shadow: none; }
.logout-form button svg { width: 17px; height: 17px; }

/* main column */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: rgba(255, 255, 255, .85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky; top: 0; z-index: 20;
}
.topbar .page-title { font-size: 1.15rem; font-weight: 800; }
.topbar .top-actions { display: flex; align-items: center; gap: 10px; }
.menu-toggle {
    display: none;
    background: var(--surface); border: 1px solid var(--border);
    width: 40px; height: 40px; border-radius: 10px;
    cursor: pointer; padding: 0; margin: 0;
    color: var(--text);
}
.menu-toggle:hover { transform: none; box-shadow: none; background: var(--surface-2); }
.menu-toggle svg { width: 20px; height: 20px; }

.content { padding: 28px; max-width: 1280px; width: 100%; margin: 0 auto; }

.footer { text-align: center; padding: 18px; color: var(--text-soft); font-size: 13px; }

/* sidebar mobile backdrop */
.backdrop {
    display: none;
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 30;
}

/* ============================================================
   Auth layout (login / OTP)
   ============================================================ */
.auth-wrap {
    min-height: 100vh;
    display: grid; place-items: center;
    padding: 24px;
    background:
        radial-gradient(1200px 500px at 80% -10%, rgba(124, 58, 237, .18), transparent 60%),
        radial-gradient(1000px 500px at 0% 110%, rgba(79, 70, 229, .16), transparent 55%),
        linear-gradient(135deg, #0b1220 0%, #131c33 100%);
}
.auth-card {
    width: 100%; max-width: 420px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 34px 30px;
}
.auth-card .auth-brand {
    display: flex; align-items: center; gap: 12px; margin-bottom: 18px;
}
.auth-card .auth-brand .logo {
    width: 46px; height: 46px; border-radius: 13px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 19px;
    box-shadow: 0 10px 22px rgba(79, 70, 229, .4);
}
.auth-card .auth-brand b { font-size: 16px; }
.auth-card .auth-brand span { font-size: 12px; color: var(--text-muted); display: block; }

/* ============================================================
   Buttons
   ============================================================ */
button,
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-600) 100%);
    color: #fff;
    border: none;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    font-family: inherit;
    text-decoration: none;
    line-height: 1.4;
    transition: transform .08s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease;
    box-shadow: 0 6px 14px rgba(79, 70, 229, .25);
}
button:hover,
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(79, 70, 229, .34); }
button:active, .btn:active { transform: translateY(0); }

.outline {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    border: 1px solid var(--border-strong);
    color: var(--text);
    background: var(--surface);
    padding: 9px 16px;
    border-radius: var(--radius-sm);
    text-decoration: none;
    font-weight: 700; font-size: 14px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: background .15s ease, border-color .15s ease;
}
.outline:hover { background: var(--surface-2); border-color: var(--text-soft); transform: none; box-shadow: var(--shadow-sm); }

.btn-danger { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 6px 14px rgba(220, 38, 38, .25); }
.btn-danger:hover { box-shadow: 0 10px 22px rgba(220, 38, 38, .34); }
.btn-success { background: linear-gradient(135deg, #16a34a, #15803d); box-shadow: 0 6px 14px rgba(21, 128, 61, .25); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; box-shadow: none; }
.btn-block { width: 100%; }

/* ============================================================
   Forms
   ============================================================ */
form label,
.inline-form label { display: block; margin-top: 14px; margin-bottom: 6px; font-weight: 700; color: var(--text); font-size: 13.5px; }

form input, form select, form textarea {
    width: 100%;
    padding: 11px 13px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    transition: border-color .15s ease, box-shadow .15s ease;
}
form input::placeholder, form textarea::placeholder { color: var(--text-soft); }
form input:focus, form select:focus, form textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, .14);
}
form input[type="checkbox"] { width: auto; margin-left: 8px; transform: scale(1.15); }
.helptext, .helptext small { color: var(--text-soft); font-size: 12px; }
ul.errorlist {
    list-style: none; margin: 6px 0 0; padding: 8px 12px;
    background: var(--danger-soft); border: 1px solid #fecaca;
    color: var(--danger); border-radius: 8px; font-size: 12.5px;
}

.form-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 22px 24px; box-shadow: var(--shadow); max-width: 720px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

.inline-form {
    border: 1px solid var(--border);
    padding: 14px;
    margin-bottom: 12px;
    border-radius: var(--radius);
    background: var(--surface-2);
}
.field-row { display: flex; gap: 12px; align-items: flex-end; }
.field-row .field { flex: 1; }

/* ============================================================
   Cards & stats
   ============================================================ */
.card-grid {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    margin: 4px 0 8px;
}
.card {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    transition: transform .15s ease, box-shadow .2s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stats { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); margin: 6px 0 10px; }
.stat {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex; align-items: center; gap: 14px;
    box-shadow: var(--shadow-sm);
    transition: transform .15s ease, box-shadow .2s ease;
    overflow: hidden;
}
/* Amounts here run to ten digits (billions of Toman). Without min-width:0 the
   text block refuses to shrink and the number spills out of the card. */
.stat > * { min-width: 0; }
.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
    width: 48px; height: 48px; border-radius: 13px;
    display: grid; place-items: center; flex-shrink: 0;
}
.stat-icon svg { width: 23px; height: 23px; }
.stat-icon--indigo { background: var(--primary-soft); color: var(--primary); }
.stat-icon--green { background: var(--success-soft); color: var(--success); }
.stat-icon--amber { background: var(--warning-soft); color: var(--warning); }
.stat-icon--red { background: var(--danger-soft); color: var(--danger); }
.stat-icon--cyan { background: var(--info-soft); color: var(--info); }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.stat-value {
    /* Amounts reach ten digits. Never break a number across lines — fit-stat-values
       in js/ui.js shrinks the font until the whole figure fits the card. */
    font-size: 1.55rem;
    font-weight: 800; color: var(--text); letter-spacing: -.5px; line-height: 1.25;
    white-space: nowrap; font-variant-numeric: tabular-nums;
}
.stat-value .unit { font-size: .8rem; color: var(--text-soft); font-weight: 600; margin-right: 3px; }
.stat-sub { font-size: 11.5px; color: var(--text-soft); overflow-wrap: anywhere; }

/* ============================================================
   Section title
   ============================================================ */
.section-title {
    display: flex; align-items: center; gap: 12px;
    justify-content: space-between; flex-wrap: wrap;
    margin: 30px 0 14px;
}
.section-title h2, .section-title h3 { margin: 0; }
.section-title .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ============================================================
   Tables
   ============================================================ */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
    margin-top: 14px;
}
table { width: 100%; border-collapse: collapse; }
/* Amounts must never break mid-number; the .table-card scrolls horizontally. */
tbody td, tfoot th { font-variant-numeric: tabular-nums; }
.table-card table { min-width: max-content; }
thead th {
    background: var(--surface-2);
    color: var(--text-muted);
    font-weight: 700;
    font-size: 12.5px;
    text-align: right;
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    vertical-align: middle;
    color: var(--text);
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f9fafb; }
td .btn, td .outline { margin-top: 0; }
td form { display: inline-flex; margin: 2px; }
td form button { margin-top: 0; }
.cell-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   Badges / pills / chips
   ============================================================ */
.pill {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 4px 11px;
    border-radius: 999px;
    font-size: 12px; font-weight: 700;
    border: 1px solid transparent;
}
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.pill.success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.pill.warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.pill.danger { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.pill.info { background: var(--info-soft); color: var(--info); border-color: #bae6fd; }

.chip {
    display: inline-block; padding: 5px 11px; border-radius: 999px;
    background: var(--primary-soft); margin: 2px; color: var(--primary-700);
    font-size: 12px; font-weight: 700;
}

/* ============================================================
   Messages / alerts
   ============================================================ */
.messages { list-style: none; padding: 0; margin: 0 0 18px; display: flex; flex-direction: column; gap: 10px; }
.message {
    padding: 13px 16px;
    border-radius: var(--radius-sm);
    background: var(--info-soft);
    border: 1px solid #bae6fd;
    color: var(--info);
    font-weight: 600; font-size: 14px;
    display: flex; align-items: center; gap: 9px;
}
.message::before { content: "i"; flex-shrink: 0; width: 20px; height: 20px; border-radius: 50%; background: currentColor; color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; font-style: italic; }
.message.error { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }
.message.error::before { content: "!"; }
.message.success { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.message.success::before { content: "✓"; font-style: normal; }
.message.warning { background: var(--warning-soft); color: var(--warning); border-color: #fde68a; }
.message.warning::before { content: "!"; }

/* ============================================================
   Lists
   ============================================================ */
.list-clean { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.list-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-sm);
}
.data-list { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 8px; }
.data-list li {
    background: var(--surface); border: 1px solid var(--border); border-radius: 11px;
    padding: 12px 15px; font-size: 14px; display: flex; align-items: center; gap: 10px;
}
.data-list li .lead { font-weight: 700; }

.empty-state {
    text-align: center; padding: 36px 20px; color: var(--text-soft);
    background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}

/* ============================================================
   Charts
   ============================================================ */
.chart-grid {
    display: grid; gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    margin: 8px 0 4px;
}
.chart-card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px 18px 14px; box-shadow: var(--shadow-sm);
}
.chart-card h4 { margin: 0 0 14px; font-size: 14px; color: var(--text); font-weight: 800; }
.chart-box { position: relative; height: 260px; }

/* Jalali datepicker input */
input.jdp { cursor: pointer; background-image: none; }
.jdp-container { z-index: 9999 !important; }

/* ============================================================
   Notification bell
   ============================================================ */
.bell { position: relative; }
.bell-btn {
    background: var(--surface); border: 1px solid var(--border);
    width: 42px; height: 42px; border-radius: 11px; color: var(--text);
    display: grid; place-items: center; cursor: pointer; margin: 0; padding: 0;
    box-shadow: none; position: relative;
}
.bell-btn:hover { background: var(--surface-2); transform: none; box-shadow: none; }
.bell-btn svg { width: 20px; height: 20px; }
.bell-badge {
    position: absolute; top: -5px; left: -5px;
    background: var(--danger); color: #fff; font-size: 11px; font-weight: 800;
    min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center;
    padding: 0 4px; border: 2px solid var(--surface);
}
.bell-menu {
    position: absolute; top: 52px; left: 0; width: 320px; max-width: 86vw;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow-lg); overflow: hidden; z-index: 50;
    display: none;
}
.bell.open .bell-menu { display: block; }
.bell-head { padding: 12px 16px; font-weight: 800; border-bottom: 1px solid var(--border); }
.bell-list { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow-y: auto; }
.bell-list li { padding: 11px 16px; border-bottom: 1px solid var(--border); font-size: 13px; }
.bell-list li a { color: var(--text); text-decoration: none; display: block; }
.bell-list li.unread { background: var(--primary-soft); }
.bell-time { display: block; color: var(--text-soft); font-size: 11px; margin-top: 3px; }
.bell-empty { color: var(--text-soft); }
.bell-foot { display: block; text-align: center; padding: 11px; font-weight: 700; text-decoration: none; color: var(--primary-600); }

/* ============================================================
   Filter bar + pagination
   ============================================================ */
.filter-bar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 14px 16px; box-shadow: var(--shadow-sm); margin: 14px 0;
}
.filter-bar .fb-field { display: flex; flex-direction: column; gap: 4px; }
.filter-bar label { margin: 0; font-size: 12px; color: var(--text-muted); font-weight: 700; }
.filter-bar input, .filter-bar select { margin: 0; padding: 9px 11px; min-width: 150px; }
.filter-bar .grow { flex: 1; min-width: 180px; }
.filter-bar input, .filter-bar select { width: 100%; }

.pagination { display: flex; align-items: center; gap: 12px; justify-content: center; margin: 18px 0 4px; }
.pagination .page-info { color: var(--text-muted); font-size: 13px; }
.pagination .disabled { opacity: .45; pointer-events: none; }

/* ============================================================
   Product cards with image + stock
   ============================================================ */
.product-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.product-thumb {
    height: 140px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden;
    border-bottom: 1px solid var(--border);
}
.product-thumb img { width: 100%; height: 100%; object-fit: cover; }
.product-thumb .no-img { color: var(--text-soft); font-size: 13px; }
.product-card .pc-body { padding: 14px; display: flex; flex-direction: column; gap: 6px; }
.stock-bar { height: 6px; border-radius: 4px; background: #eef0f4; overflow: hidden; margin-top: 4px; }
.stock-bar > span { display: block; height: 100%; background: var(--success); }
.stock-bar.low > span { background: var(--warning); }
.stock-bar.out > span { background: var(--danger); }

/* ============================================================
   Calendar
   ============================================================ */
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 14px 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-grid .dow { text-align: center; font-weight: 800; color: var(--text-muted); font-size: 12.5px; padding: 6px 0; }
.cal-cell {
    min-height: 92px; background: var(--surface); border: 1px solid var(--border);
    border-radius: 10px; padding: 7px; display: flex; flex-direction: column; gap: 4px;
}
.cal-cell.empty { background: transparent; border: none; }
.cal-cell.today { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(79,70,229,.18) inset; }
.cal-day { font-weight: 800; font-size: 13px; color: var(--text); }
.cal-cell.today .cal-day { color: var(--primary); }
.cal-evt {
    font-size: 11px; padding: 3px 6px; border-radius: 6px; background: var(--primary-soft);
    color: var(--primary-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-decoration: none; display: block;
}
.cal-evt.paid { background: var(--success-soft); color: var(--success); }
.cal-evt.overdue { background: var(--danger-soft); color: var(--danger); }

/* ============================================================
   Credit score
   ============================================================ */
.credit-gauge { display: flex; align-items: center; gap: 16px; }
.gauge-ring {
    --val: 0; width: 92px; height: 92px; border-radius: 50%; flex-shrink: 0;
    background: conic-gradient(var(--gc, var(--primary)) calc(var(--val) * 1%), #eef0f4 0);
    display: grid; place-items: center;
}
.gauge-ring::after {
    content: ""; width: 70px; height: 70px; border-radius: 50%; background: var(--surface);
    grid-area: 1 / 1; box-shadow: inset 0 0 0 1px var(--border);
}
.gauge-ring .gauge-num { grid-area: 1 / 1; z-index: 1; font-size: 22px; font-weight: 800; }

/* small responsive tweak for calendar */
@media (max-width: 640px) {
    .cal-cell { min-height: 64px; }
    .cal-evt { display: none; }
    .cal-cell.has-events .cal-day::after { content: " •"; color: var(--primary); }
}

/* ============================================================
   Select2 (RTL)
   ============================================================ */
.select2-container { width: 100% !important; }
.select2-container--default .select2-selection--single {
    height: 44px; border-radius: var(--radius-sm);
    border: 1px solid var(--border-strong); padding: 7px 12px; background: var(--surface);
}
.select2-container--default .select2-selection--single .select2-selection__arrow { top: 9px; right: auto; left: 10px; }
.select2-container--default .select2-selection--single .select2-selection__rendered { line-height: 28px; color: var(--text); }
.select2-dropdown { border-color: var(--border-strong); border-radius: var(--radius-sm); }
.select2-container--default .select2-results__option--highlighted[aria-selected] { background: var(--primary); }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 900px) {
    :root { --sidebar-w: 240px; }
    .sidebar {
        position: fixed; right: 0; top: 0; z-index: 40;
        transform: translateX(100%);
        transition: transform .25s ease;
        box-shadow: -12px 0 40px rgba(0,0,0,.3);
    }
    body.nav-open .sidebar { transform: translateX(0); }
    body.nav-open .backdrop { display: block; }
    .menu-toggle { display: inline-grid; place-items: center; }
}

@media (max-width: 600px) {
    .content { padding: 18px 14px; }
    .topbar { padding: 12px 16px; }
    .stat-value { font-size: 1.3rem; }
    thead th, tbody td { padding: 11px 12px; font-size: 12.5px; }
    .auth-card { padding: 26px 20px; }
    h2 { font-size: 1.25rem; }
}

/* ============================================================
   Demo-mode banner
   ============================================================ */
.demo-banner {
    position: relative; z-index: 60;
    display: flex; align-items: center; justify-content: center;
    gap: 10px; flex-wrap: wrap;
    padding: 8px 18px;
    background: repeating-linear-gradient(135deg, #78350f, #78350f 14px, #8a3f12 14px, #8a3f12 28px);
    color: #fef3c7; font-size: 13px; line-height: 1.6; text-align: center;
}
.demo-banner b {
    background: #fef3c7; color: #78350f;
    padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 800;
}
