/* ================================================================
   Bebnine Smart Platform — Professional Theme
   Dark sidebar · Colorful cards · Charts · Maps
   ================================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@300;400;500;700;800;900&display=swap');

/* ---------- Design Tokens ---------- */
:root {
    
    color-scheme: light;
    --bg:          #f0f4f8;
    --panel:       #ffffff;
    --panel-soft:  #f8fafc;
    --line:        #e2e8f0;
    --text:        #0f172a;
    --muted:       #64748b;
    --primary:     #6366f1;
    --primary-dark:#4f46e5;
    --success:     #10b981;
    --warning:     #f59e0b;
    --danger:      #ef4444;
    --info:        #3b82f6;
    --sb-bg:       #0f172a;
    --sb-border:   rgba(255,255,255,.06);
    --sb-text:     #94a3b8;
    --sb-active:   rgba(99,102,241,.22);
    --sb-active-border: #818cf8;
    --sb-hover:    rgba(255,255,255,.05);
    --g1: linear-gradient(135deg,#667eea,#764ba2);
    --g2: linear-gradient(135deg,#f093fb,#f5576c);
    --g3: linear-gradient(135deg,#4facfe,#00f2fe);
    --g4: linear-gradient(135deg,#43e97b,#38f9d7);
    --g5: linear-gradient(135deg,#fa709a,#fee140);
    --g6: linear-gradient(135deg,#a18cd1,#fbc2eb);
    --g7: linear-gradient(135deg,#fd7f6f,#b8a9c9);
    --g8: linear-gradient(135deg,#30cfd0,#667eea);
    --g9: linear-gradient(135deg,#d97706,#fbbf24);
    --radius: 12px;
    --shadow-sm: 0 1px 3px rgba(15,23,42,.06),0 1px 2px rgba(15,23,42,.04);
    --shadow:    0 4px 16px rgba(15,23,42,.08),0 1px 4px rgba(15,23,42,.04);
    --shadow-lg: 0 12px 40px rgba(15,23,42,.12),0 4px 12px rgba(15,23,42,.06);
    --t: .18s cubic-bezier(.4,0,.2,1);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Tajawal', 'Segoe UI', system-ui, sans-serif;
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

/* ================================================================
   APP SHELL
   ================================================================ */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 268px minmax(0, 1fr);
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--sb-bg);
    overflow-y: auto;
    z-index: 50;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 4px; }

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 16px 18px;
    border-bottom: 1px solid var(--sb-border);
    flex-shrink: 0;
}

.brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 4px 14px rgba(99,102,241,.45);
}

.brand strong { color: #fff; font-size: 13.5px; font-weight: 800; display: block; line-height: 1.2; }
.brand small  { color: var(--sb-text); font-size: 11px; }

.nav {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 12px 8px;
    flex: 1;
}

.nav-label {
    color: rgba(148,163,184,.4);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .1em;
    padding: 12px 8px 4px;
}

.nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 8px;
    color: var(--sb-text);
    font-weight: 600;
    font-size: 13px;
    transition: var(--t);
    position: relative;
}

.nav a i { width: 16px; text-align: center; font-size: 13px; flex-shrink: 0; }

.nav a:hover {
    background: var(--sb-hover);
    color: #e2e8f0;
}

.nav a.active {
    background: var(--sb-active);
    color: #c7d2fe;
    border-inline-end: 3px solid var(--sb-active-border);
}

.nav a.active i { color: #818cf8; }

.sidebar-sponsor {
    margin: 6px 12px 10px;
    padding: 12px;
    display: grid;
    gap: 2px;
    border: 1px solid rgba(129,140,248,.3);
    border-radius: 11px;
    color: #cbd5e1;
    background: linear-gradient(135deg, rgba(99,102,241,.18), rgba(15,118,110,.12));
    text-align: center;
    flex-shrink: 0;
}
.sidebar-sponsor span { color: #94a3b8; font-size: 9px; font-weight: 700; }
.sidebar-sponsor strong { color: #fff; font-size: 15px; letter-spacing: .04em; }
.sidebar-sponsor a { color: #c7d2fe; font-size: 10px; }
.sidebar-sponsor a:hover { color: #fff; }

.sidebar-footer {
    padding: 14px 16px;
    border-top: 1px solid var(--sb-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-shrink: 0;
}

.sidebar-footer .user-info strong { color: #e2e8f0; font-size: 13px; display: block; }
.sidebar-footer .user-info small  { color: var(--sb-text); font-size: 11px; }
.sidebar-footer form { flex-shrink: 0; }

.dashboard-sponsor {
    margin-top: 28px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    color: var(--muted);
    background: var(--panel);
    font-size: 12px;
}
.dashboard-sponsor strong { color: var(--primary); font-size: 14px; }
.dashboard-sponsor a { color: var(--text); font-weight: 700; }
.dashboard-sponsor a:hover { color: var(--primary); }

/* ================================================================
   MAIN AREA
   ================================================================ */
.main {
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.mobile-header {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px 0;
}

.page-title h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    line-height: 1.2;
}

.page-title p {
    color: var(--muted);
    font-size: 13px;
    margin-top: 3px;
}

.topbar-clock {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 14px;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--muted);
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}

.topbar-clock i { color: var(--primary); }

.content-wrap {
    padding: 20px 24px 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

/* ================================================================
   ALERTS
   ================================================================ */
.notice-box, .status-box, .error-box {
    border-radius: var(--radius);
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 500;
}

.notice-box { background: #fff7ed; border: 1px solid #fed7aa; color: #9a3412; }
.status-box  { background: #ecfdf5; border: 1px solid #a7f3d0; color: #065f46; }
.error-box   { background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; }

/* ================================================================
   METRIC CARDS
   ================================================================ */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.metric {
    border-radius: var(--radius);
    padding: 20px;
    color: #fff;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform var(--t), box-shadow var(--t);
    cursor: default;
}

.metric::before {
    content: '';
    position: absolute;
    top: -18px;
    inset-inline-end: -18px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(255,255,255,.13);
}

.metric::after {
    content: '';
    position: absolute;
    bottom: -25px;
    inset-inline-end: 15px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,.08);
}

.metric:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }

.metric:nth-child(1)  { background: var(--g1); }
.metric:nth-child(2)  { background: var(--g2); }
.metric:nth-child(3)  { background: var(--g3); }
.metric:nth-child(4)  { background: var(--g4); }
.metric:nth-child(5)  { background: var(--g5); }
.metric:nth-child(6)  { background: var(--g6); }
.metric:nth-child(7)  { background: var(--g7); }
.metric:nth-child(8)  { background: var(--g8); }
.metric:nth-child(9)  { background: var(--g9); }

/* Public reports inbox */
.report-admin-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; }
.report-admin-stat { display:flex; align-items:center; gap:12px; padding:16px; border:1px solid var(--line); border-radius:12px; background:var(--panel); box-shadow:var(--shadow-sm); transition:transform var(--t),box-shadow var(--t); }
.report-admin-stat:hover { transform:translateY(-2px); box-shadow:var(--shadow); }
.report-admin-stat > span { width:42px; height:42px; display:grid; place-items:center; border-radius:12px; color:var(--report-stat-color); background:color-mix(in srgb,var(--report-stat-color) 12%,white); }
.report-admin-stat strong,.report-admin-stat small { display:block; }
.report-admin-stat strong { font-size:20px; line-height:1.1; }
.report-admin-stat small { margin-top:4px; color:var(--muted); font-size:11px; font-weight:700; }
.report-admin-filter form { display:grid; grid-template-columns:2fr 1fr 1fr auto auto; align-items:end; gap:10px; }
.report-admin-filter .field label,.report-admin-action .field label { display:block; margin-bottom:5px; color:var(--muted); font-size:10px; font-weight:800; text-transform:uppercase; }
.report-admin-filter input,.report-admin-filter select,.report-admin-action select,.report-admin-action textarea { width:100%; padding:8px 10px; border:1px solid var(--line); border-radius:8px; color:var(--text); background:#fff; outline:none; }
.report-admin-list { display:grid; gap:16px; }
.report-admin-card { overflow:hidden; border:1px solid var(--line); border-radius:14px; background:var(--panel); box-shadow:var(--shadow-sm); }
.report-admin-card-header { display:flex; align-items:flex-start; justify-content:space-between; gap:18px; padding:18px 20px; border-bottom:1px solid var(--line); background:var(--panel-soft); }
.report-admin-reference { display:flex; align-items:center; gap:7px; flex-wrap:wrap; color:var(--muted); font-size:11px; font-weight:800; direction:ltr; justify-content:flex-end; }
.report-admin-card-header h2 { margin:7px 0 3px; font-size:17px; }
.report-admin-date { color:var(--muted); font-size:10px; }
.report-admin-category { flex-shrink:0; padding:7px 10px; border-radius:9px; color:#8a5a05; background:#fff4d8; font-size:11px; font-weight:800; }
.report-admin-card-body { display:grid; grid-template-columns:minmax(0,1fr) 290px; }
.report-admin-details { padding:20px; min-width:0; }
.report-admin-description { margin:0; color:#334155; white-space:pre-line; }
.report-admin-meta { display:flex; flex-wrap:wrap; gap:8px 15px; margin-top:16px; color:var(--muted); font-size:11px; }
.report-admin-meta span,.report-admin-meta a { display:inline-flex; align-items:center; gap:5px; }
.report-admin-meta a { color:var(--primary); font-weight:700; }
.report-admin-location { margin-top:13px; padding:9px 11px; border-radius:8px; color:#475569; background:#f8fafc; font-size:11px; }
.report-admin-photos { display:grid; grid-template-columns:repeat(5,minmax(70px,110px)); gap:8px; margin-top:16px; }
.report-admin-photos a { overflow:hidden; border:1px solid var(--line); border-radius:10px; background:#f1f5f9; }
.report-admin-photos img { width:100%; aspect-ratio:1; display:block; object-fit:cover; transition:transform var(--t); }
.report-admin-photos a:hover img { transform:scale(1.05); }
.report-admin-no-photo { margin-top:16px; padding:13px; border:1px dashed var(--line); border-radius:9px; color:var(--muted); text-align:center; font-size:11px; }
.report-admin-action { display:flex; flex-direction:column; gap:10px; padding:18px; border-inline-start:1px solid var(--line); background:#fbfdfd; }
.report-admin-action h3 { margin:0 0 2px; font-size:13px; }
.report-admin-action textarea { resize:vertical; }
.report-admin-action .button { margin-top:auto; }
.whish-admin-card .report-admin-card-header { border-top:3px solid #7100ff; }
.whish-admin-amount { min-width:180px; display:grid; text-align:left; }
.whish-admin-amount small { color:var(--muted); font-size:10px; }
.whish-admin-amount strong { color:#410099; font-size:21px; }
.whish-admin-data { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.whish-admin-data > div { min-width:0; display:grid; padding:11px 12px; border:1px solid var(--line); border-radius:10px; background:#fafafa; }
.whish-admin-data small { color:var(--muted); font-size:9px; }
.whish-admin-data strong,.whish-admin-data a { overflow-wrap:anywhere; font-size:12px; font-weight:800; }
.whish-admin-data a { color:var(--primary); }
.whish-admin-links { display:flex; flex-wrap:wrap; gap:8px; margin-top:14px; }
.badge.new { background:#dbeafe;color:#1d4ed8; }
.badge.in_review { background:#ede9fe;color:#6d28d9; }
.badge.in_progress { background:#fef3c7;color:#92400e; }
.badge.resolved { background:#d1fae5;color:#065f46; }
.badge.rejected { background:#fee2e2;color:#991b1b; }

.metric-icon {
    width: 38px;
    height: 38px;
    background: rgba(255,255,255,.22);
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 16px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.metric > span, .metric-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    opacity: .88;
    position: relative;
    z-index: 1;
    display: block;
}

.metric > strong, .metric-value {
    font-size: 26px;
    font-weight: 900;
    line-height: 1.1;
    margin-top: 4px;
    position: relative;
    z-index: 1;
    display: block;
}

/* ================================================================
   PANELS & TABLES
   ================================================================ */
.panel, .table-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.panel { padding: 20px; }

.table-header, .panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-soft);
}

.table-header h2, .panel-header h2, .panel > h2 {
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.table-header h2 i, .panel-header h2 i, .panel > h2 i { color: var(--primary); }
.panel > h2 { margin-bottom: 14px; }

.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; }
thead tr { background: var(--panel-soft); }

th {
    padding: 11px 14px;
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--muted);
    white-space: nowrap;
    text-align: start;
    border-bottom: 2px solid var(--line);
}

td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    text-align: start;
    vertical-align: middle;
    font-size: 13px;
    white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #f8fafc; }

/* ================================================================
   CONTENT GRID
   ================================================================ */
.content-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.6fr) minmax(300px, .8fr);
    gap: 16px;
}

/* ================================================================
   CHARTS
   ================================================================ */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 16px;
}

.chart-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--panel-soft);
}

.chart-header h3 {
    font-size: 13.5px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chart-header h3 i { color: var(--primary); }
.chart-body { padding: 20px; position: relative; }

/* ================================================================
   BADGES
   ================================================================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

.badge.good, .badge.completed, .badge.excellent { background: #d1fae5; color: #065f46; }
.badge.in_progress, .badge.medium, .badge.needs_improvement { background: #fef3c7; color: #92400e; }
.badge.urgent, .badge.stopped, .badge.high { background: #fee2e2; color: #991b1b; }
.badge.low, .badge.pending { background: #e0e7ff; color: #3730a3; }
.badge.approved { background:#d1fae5; color:#065f46; }
.badge.trial_unverified { background:#fef3c7; color:#92400e; }
.badge.needs_verification { background:#ffedd5; color:#9a3412; }
.badge.verified { background:#d1fae5; color:#065f46; }

/* Progress bar */
.progress-wrap { display: flex; align-items: center; gap: 8px; }
.progress-bar { flex: 1; height: 5px; background: #e2e8f0; border-radius: 999px; overflow: hidden; min-width: 60px; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, #6366f1, #818cf8); }
.progress-fill.fill-success { background: linear-gradient(90deg, #10b981, #34d399); }
.progress-fill.fill-warning { background: linear-gradient(90deg, #f59e0b, #fcd34d); }
.progress-fill.fill-danger  { background: linear-gradient(90deg, #ef4444, #f87171); }

/* ================================================================
   BUTTONS
   ================================================================ */
.button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    border-radius: 8px;
    min-height: 36px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    cursor: pointer;
    font-weight: 700;
    font-size: 12.5px;
    transition: var(--t);
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(99,102,241,.28);
}

.button:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(99,102,241,.38); }
.button:active { transform: none; }

.button.secondary {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-sm);
}

.button.secondary:hover { background: var(--panel-soft); box-shadow: var(--shadow); }
.button.danger { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; box-shadow: none; }
.button.sm { min-height: 28px; padding: 4px 10px; font-size: 11.5px; }

.form-actions,
.row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.row-actions form {
    margin: 0;
}

/* ================================================================
   FORM ELEMENTS
   ================================================================ */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.field { display: grid; gap: 6px; }

.field label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.field input, .field select, .field textarea {
    width: 100%;
    min-height: 40px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    padding: 8px 12px;
    background: var(--panel);
    color: var(--text);
    transition: border-color var(--t), box-shadow var(--t);
}

.field input:focus, .field select:focus, .field textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
    outline: none;
}

.field textarea { min-height: 88px; resize: vertical; }
.field-help { color: var(--muted); font-size: 11px; line-height: 1.5; }
.field-error { color: #b91c1c; font-size: 11px; line-height: 1.5; }
.check-field { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.check-field input { width: 18px; height: 18px; accent-color: var(--primary); }

/* ================================================================
   PIN ROW
   ================================================================ */
.pin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
}

.pin-row:last-child { border-bottom: 0; }

/* ================================================================
   LIVE MAP
   ================================================================ */
.map-stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

.map-stat {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}

.map-stat i { font-size: 22px; display: block; margin-bottom: 6px; }
.map-stat span { display: block; font-size: 10px; font-weight: 700; color: var(--muted); text-transform: uppercase; margin-bottom: 2px; }
.map-stat strong { font-size: 24px; font-weight: 900; }

.map-stat.emp-stat  i { color: #3b82f6; }
.map-stat.veh-stat  i { color: #10b981; }
.map-stat.proj-stat i { color: #f59e0b; }
.map-stat.nbr-stat  i { color: #8b5cf6; }

.map-wrapper {
    display: grid;
    grid-template-columns: minmax(0,1fr) 300px;
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
    height: 560px;
}

.live-map-container { position: relative; height: 100%; }
#liveMap { width: 100%; height: 100%; z-index: 1; }

.map-sidebar {
    background: var(--panel);
    border-inline-start: 1px solid var(--line);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.map-sidebar-header {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 800;
    font-size: 13px;
    background: var(--panel-soft);
    flex-shrink: 0;
}

.map-sidebar-header i { color: var(--primary); }

.map-tab-bar {
    display: flex;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
    flex-shrink: 0;
}

.map-tab {
    flex: 1;
    padding: 8px 2px;
    font-size: 10.5px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    color: var(--muted);
    border: 0;
    border-bottom: 2px solid transparent;
    background: none;
    transition: var(--t);
}

.map-tab.active { color: var(--primary); border-bottom-color: var(--primary); background: rgba(99,102,241,.04); }

.map-items { flex: 1; overflow-y: auto; }

.map-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    transition: background var(--t);
    border-bottom: 1px solid var(--line);
}

.map-item:last-child { border-bottom: 0; }
.map-item:hover { background: var(--panel-soft); }

.map-item-icon {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    display: grid;
    place-items: center;
    font-size: 12px;
    flex-shrink: 0;
}

.map-item-icon.emp  { background: #dbeafe; color: #1d4ed8; }
.map-item-icon.veh  { background: #d1fae5; color: #065f46; }
.map-item-icon.proj { background: #fef3c7; color: #92400e; }
.map-item-icon.nbr  { background: #ede9fe; color: #5b21b6; }

.map-item-info { flex: 1; min-width: 0; }
.map-item-name { font-size: 12px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-item-sub  { font-size: 10.5px; color: var(--muted); }

/* ================================================================
   MISC
   ================================================================ */
.module-layout {
    display: grid;
    grid-template-columns: minmax(280px, 360px) minmax(0,1fr);
    gap: 16px;
}

.edit-panel {
    max-width: 760px;
}

.profile-strip {
    display: grid;
    grid-template-columns: auto minmax(0,1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 20px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.profile-strip h2 { font-size: 18px; margin-bottom: 4px; }
.profile-strip p  { color: var(--muted); font-size: 13px; }
.profile-status   { display: grid; justify-items: end; gap: 8px; }

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-size: 20px;
    font-weight: 900;
    box-shadow: 0 4px 12px rgba(99,102,241,.3);
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 16px;
}

.settings-actions {
    position: sticky;
    bottom: 0;
    grid-column: 1/-1;
    display: flex;
    justify-content: flex-start;
    padding: 14px 20px;
    background: rgba(255,255,255,.92);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.setting-toggle {
    display: flex;
    justify-content: flex-start;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: var(--panel-soft);
    cursor: pointer;
    transition: border-color var(--t);
}

.setting-toggle:hover { border-color: var(--primary); }
.setting-toggle span  { display: grid; gap: 3px; }

.super-admin-account,
.danger-zone {
    margin-top: 18px;
}

.settings-section-heading {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 22px;
}

.settings-section-heading h2 { margin: 4px 0 2px; font-size: 19px; }
.settings-section-heading p { margin: 0; color: var(--muted); font-size: 12px; }

.settings-section-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 8px 20px rgba(99,102,241,.2);
    font-size: 18px;
}

.admin-role-badge,
.danger-kicker {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--primary);
    background: rgba(99,102,241,.09);
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .08em;
}

.super-admin-form { display: grid; gap: 16px; }
.account-security-note { display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px; border-radius: 9px; color: #315e58; background: #ecf8f5; font-size: 11.5px; }
.account-security-note i { margin-top: 3px; color: #0f766e; }

.inline-form-errors { display: grid; gap: 3px; padding: 11px 13px; border: 1px solid #fecaca; border-radius: 9px; color: #b91c1c; background: #fff7f7; font-size: 11.5px; }

.danger-zone { border-color: #fecaca; box-shadow: 0 8px 28px rgba(185,28,28,.06); }
.danger-heading .settings-section-icon { color: #b91c1c; background: #fee2e2; box-shadow: none; }
.danger-kicker { color: #b91c1c; background: #fee2e2; }

.reset-preservation-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.reset-list { display: grid; align-content: start; gap: 6px; padding: 14px; border-radius: 10px; font-size: 11.5px; }
.reset-list strong { margin-bottom: 3px; font-size: 12.5px; }
.reset-list span::before { content: '•'; margin-inline-end: 6px; }
.reset-list.deletes { color: #8e2424; background: #fff4f4; border: 1px solid #fee2e2; }
.reset-list.preserves { color: #286156; background: #effaf7; border: 1px solid #d4efe8; }

.danger-reset-form { display: grid; grid-template-columns: minmax(220px,1fr) minmax(220px,1fr); align-items: end; gap: 14px; padding-top: 18px; border-top: 1px solid #fee2e2; }
.reset-acknowledgement { grid-column: 1/-1; display: flex; align-items: flex-start; gap: 9px; padding: 12px; border: 1px solid #fecaca; border-radius: 9px; color: #7f1d1d; background: #fffafa; font-size: 11.5px; cursor: pointer; }
.reset-acknowledgement input { width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--danger); }
.danger-errors { grid-column: 1/-1; }
.destructive-button { grid-column: 1/-1; width: fit-content; }
.destructive-button:not(:disabled) { color: #fff; background: #b91c1c; border-color: #b91c1c; box-shadow: 0 4px 12px rgba(185,28,28,.18); }
.destructive-button:disabled { opacity: .45; cursor: not-allowed; }

/* Platform account and permission management */
.account-create-panel { margin-bottom: 22px; }
.account-page-heading { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.account-page-heading > span { width: 46px; height: 46px; display: grid; place-items: center; flex: 0 0 auto; color: #fff; border-radius: 13px; background: linear-gradient(135deg,var(--primary),var(--primary-dark)); box-shadow: 0 7px 18px rgba(15,118,110,.18); }
.account-page-heading h2,.accounts-overview-head h2 { margin: 0; font-size: 18px; }
.account-page-heading p,.accounts-overview-head p { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; }
.account-create-form,.account-editor form { display: grid; gap: 16px; }

.permission-selector { padding: 15px; border: 1px solid var(--line); border-radius: 11px; background: #f8fbfa; transition: opacity var(--t); }
.permission-selector.is-readonly { opacity: .68; }
.permission-selector-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.permission-selector-head strong { font-size: 13px; }
.permission-selector-head span { color: var(--muted); font-size: 10.5px; }
.permission-module-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 9px; }
.permission-module-grid fieldset { min-width: 0; margin: 0; padding: 11px; border: 1px solid #dce9e6; border-radius: 9px; background: #fff; }
.permission-module-grid legend { padding: 0 6px; color: var(--primary); font-size: 10.5px; font-weight: 900; }
.permission-module-grid label { display: flex; align-items: flex-start; gap: 7px; padding: 5px 0; color: var(--text); font-size: 10.5px; cursor: pointer; }
.permission-module-grid input { width: 16px; height: 16px; margin-top: 1px; flex: 0 0 auto; accent-color: var(--primary); }

.accounts-overview { display: grid; gap: 14px; }
.accounts-overview-head { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.accounts-summary { display: flex; gap: 8px; }
.accounts-summary span { padding: 7px 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; background: #fff; font-size: 10.5px; }
.accounts-summary b { margin-inline-end: 3px; color: var(--primary); font-size: 14px; }
.platform-account-list { display: grid; gap: 12px; }
.platform-account-card { overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); box-shadow: var(--shadow-sm); }
.platform-account-card.is-disabled { opacity: .78; }
.platform-account-card > header { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 13px; padding: 16px 18px; }
.account-avatar { width: 44px; height: 44px; display: grid; place-items: center; color: #fff; border-radius: 13px; background: linear-gradient(135deg,var(--primary),var(--primary-dark)); font-size: 17px; font-weight: 900; }
.account-identity { min-width: 0; display: grid; gap: 2px; }
.account-identity > div { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.account-identity h3 { margin: 0; font-size: 14px; }
.account-identity > span { color: var(--muted); font-size: 11px; }
.account-identity small { color: #4f6c68; font-size: 10.5px; }
.current-account-badge { padding: 2px 7px; color: #8a5a05; border-radius: 999px; background: #fff4d8; font-size: 9px; font-weight: 900; }
.account-state { display: flex; align-items: flex-end; flex-direction: column; gap: 5px; }
.role-chip,.status-chip { padding: 4px 8px; border-radius: 999px; font-size: 9.5px; font-weight: 800; }
.role-chip { color: var(--primary); background: #e9f5f2; }
.status-chip.active { color: #087953; background: #e5f7f0; }
.status-chip.disabled { color: #a13232; background: #fdeaea; }
.account-permission-preview { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px; padding: 10px 18px; color: var(--muted); border-top: 1px solid var(--line); background: #f8fbfa; font-size: 10.5px; }
.account-permission-preview span:first-child { color: var(--primary); font-weight: 800; }
.account-editor { border-top: 1px solid var(--line); }
.account-editor summary { padding: 11px 18px; color: var(--primary); background: #fff; cursor: pointer; font-size: 11.5px; font-weight: 800; }
.account-editor[open] summary { border-bottom: 1px solid var(--line); background: #f5faf8; }
.account-editor form { padding: 18px; }
.account-active-toggle { display: flex; align-items: flex-start; gap: 9px; padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: #f8fbfa; cursor: pointer; }
.account-active-toggle input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); }
.account-active-toggle span { display: grid; }
.account-active-toggle strong { font-size: 11.5px; }
.account-active-toggle small { color: var(--muted); font-size: 10px; }
.setting-toggle small { color: var(--muted); font-size: 11px; }

.pagination,
.pagination-wrap {
    padding: 14px 20px;
}

.admin-pagination {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    direction: rtl;
}

.admin-pagination-summary {
    margin: 0;
    color: var(--muted);
    font-size: 11.5px;
    white-space: nowrap;
}

.admin-pagination-summary strong { color: var(--text); font-weight: 800; }

.admin-pagination-links {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 6px;
}

.pagination-button,
.pagination-page,
.pagination-ellipsis {
    height: 36px;
    border-radius: 9px;
    font-size: 11px;
}

.pagination-button,
.pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--text);
    font-weight: 800;
    transition: color var(--t), border-color var(--t), background var(--t), transform var(--t), box-shadow var(--t);
}

.pagination-button {
    min-width: 82px;
    padding: 0 12px;
    gap: 7px;
}

.pagination-page { min-width: 36px; padding: 0 9px; }

.pagination-button:hover,
.pagination-page:hover {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--line));
    background: color-mix(in srgb, var(--primary) 7%, var(--panel));
    transform: translateY(-1px);
}

.pagination-page.active {
    color: #fff;
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--primary) 25%, transparent);
}

.pagination-button.disabled {
    color: var(--muted);
    background: var(--panel-soft);
    cursor: not-allowed;
    opacity: .5;
}

.pagination-ellipsis {
    min-width: 28px;
    display: inline-grid;
    place-items: center;
    color: var(--muted);
}

.admin-pagination svg,
.admin-pagination i {
    width: 13px !important;
    height: 13px !important;
    flex: 0 0 13px;
    font-size: 11px;
}

@media (max-width: 650px) {
    .pagination,
    .pagination-wrap { padding-inline: 12px; }
    .admin-pagination { flex-direction: column; align-items: stretch; }
    .admin-pagination-summary { text-align: center; white-space: normal; }
    .admin-pagination-links { justify-content: center; }
    .pagination-button { min-width: 38px; padding-inline: 10px; }
    .pagination-button span { display: none; }
}

.empty-state { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-state i { font-size: 40px; opacity: .25; display: block; margin-bottom: 12px; }
.muted { color: var(--muted); }

.map-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }

.map-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
}

.map-card h2 {
    font-size: 14px;
    font-weight: 800;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ================================================================
   LOGIN
   ================================================================ */
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(ellipse at 20% 50%, rgba(99,102,241,.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(139,92,246,.12) 0%, transparent 40%),
        radial-gradient(ellipse at 60% 80%, rgba(59,130,246,.10) 0%, transparent 40%),
        #f1f5f9;
}

.login-card {
    width: min(100%, 420px);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.login-mark {
    width: 50px;
    height: 50px;
    border-radius: 13px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 22px;
    box-shadow: 0 6px 18px rgba(99,102,241,.4);
    margin-bottom: 20px;
}

.login-card h1 { font-size: 22px; margin-bottom: 6px; font-weight: 800; }
.login-card p  { color: var(--muted); font-size: 13px; margin-bottom: 24px; }

.login-sponsor {
    margin-top: 22px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    display: grid;
    gap: 3px;
    text-align: center;
    background: color-mix(in srgb, var(--primary) 6%, white);
}
.login-sponsor > span { color: var(--muted); font-size: 10px; }
.login-sponsor strong { color: var(--primary); font-size: 17px; }
.login-sponsor div { display: flex; justify-content: center; gap: 7px; color: var(--muted); font-size: 11px; }
.login-sponsor a { font-weight: 700; }

/* Municipal taxpayer file */
.taxpayer-header { display:flex; align-items:center; justify-content:space-between; gap:20px; margin-bottom:18px; }
.taxpayer-header h2 { margin:8px 0 2px; font-size:24px; }
.taxpayer-header p { margin:0; color:var(--muted); }
.taxpayer-reference { min-width:230px; display:grid; gap:3px; padding:16px 19px; text-align:center; border:1px solid var(--line); border-radius:14px; background:#f6faf9; }
.taxpayer-reference small, .taxpayer-reference span { color:var(--muted); font-size:10px; }
.taxpayer-reference strong { color:var(--primary); font-size:20px; letter-spacing:.05em; }
.revenue-cards { margin-bottom:20px; }
.revenue-cards .metric strong { font-size:19px; }
.revenue-cards .metric em { font-size:10px; font-style:normal; color:var(--muted); }
.taxpayer-grid { display:grid; grid-template-columns:1fr 1fr; gap:20px; }

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 1100px) {
    .content-grid { grid-template-columns: 1fr; }
    .report-admin-card-body { grid-template-columns: 1fr; }
    .report-admin-action { border-inline-start:0; border-top:1px solid var(--line); }
    .report-admin-filter form { grid-template-columns:2fr 1fr 1fr; }
}

@media (max-width: 980px) {
    .app-shell { display: flex; flex-direction: column; }
    .sidebar { order: 2; position: static; height: auto; max-height: none; }
    .sidebar .brand { display: none; }
    .nav { flex-direction: row; flex-wrap: wrap; gap: 4px; padding: 10px; }
    .nav-label { display: none; }
    .nav a { font-size: 12px; padding: 7px 10px; }
    .nav a.active { border-inline-end: 0; border-bottom: 2px solid var(--sb-active-border); }
    .main { order: 1; }
    .mobile-header { display: flex; }
    .topbar { padding: 14px 16px 0; }
    .content-wrap { padding: 14px; }
    .module-layout { grid-template-columns: 1fr; }
    .map-wrapper { grid-template-columns: 1fr; height: auto; }
    .map-sidebar { max-height: 280px; border-inline-start: 0; border-top: 1px solid var(--line); }
    #liveMap { height: 380px; }
    .charts-grid { grid-template-columns: 1fr; }
    .map-stats-bar { grid-template-columns: repeat(2,1fr); }
    .report-admin-stats { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .taxpayer-grid { grid-template-columns:1fr; }
    .whish-admin-data { grid-template-columns:1fr 1fr; }
}

@media (max-width: 640px) {
    .topbar { flex-direction: column; align-items: flex-start; }
    .cards { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
    .metric > strong { font-size: 22px; }
    .profile-strip { grid-template-columns: auto 1fr; }
    .profile-status { display: none; }
    .settings-grid { grid-template-columns: 1fr; }
    .reset-preservation-grid,
    .danger-reset-form { grid-template-columns: 1fr; }
    .settings-section-heading { align-items: flex-start; }
    .accounts-overview-head { align-items: flex-start; flex-direction: column; }
    .platform-account-card > header { grid-template-columns: auto minmax(0,1fr); }
    .account-state { grid-column: 1/-1; align-items: flex-start; flex-direction: row; }
    .permission-selector-head { align-items: flex-start; flex-direction: column; gap: 3px; }
    .map-stats-bar { grid-template-columns: repeat(2,1fr); }
    .report-admin-filter form { grid-template-columns:1fr; }
    .report-admin-card-header { flex-direction:column; }
    .report-admin-photos { grid-template-columns:repeat(3,minmax(0,1fr)); }
    .taxpayer-header { align-items:stretch; flex-direction:column; }
    .whish-admin-data { grid-template-columns:1fr; }
    .whish-admin-amount { text-align:right; }
}
