/* ============================================================
   GECOL Gages — Admin Design System
   RTL Arabic · Offline-first (no external assets)
   ============================================================ */

:root {
    --bg: #f2f6fb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --ink: #0d2742;
    --ink-soft: #365068;
    --muted: #70829a;
    --line: #e2ebf5;
    --line-strong: #d2e0ee;
    --navy: #0b1f38;
    --navy-2: #0d2b4d;
    --teal: #0d9488;
    --teal-2: #14b8a6;
    --teal-soft: #e6f7f4;
    --amber: #f59e0b;
    --amber-soft: #fef4e2;
    --red: #e05252;
    --red-soft: #fdecec;
    --blue: #2f7dd1;
    --blue-soft: #eaf3fd;
    --purple: #7c5cd6;
    --purple-soft: #f1edfd;
    --slate-soft: #eef3f9;
    --shadow-sm: 0 4px 14px rgba(13, 39, 66, .05);
    --shadow: 0 14px 34px rgba(13, 39, 66, .07);
    --shadow-lg: 0 26px 60px rgba(13, 39, 66, .14);
    --radius: 16px;
    --radius-sm: 10px;
    --sidebar-w: 268px;
    --font: "Segoe UI", "Tahoma", "Noto Kufi Arabic", "Arial", sans-serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    font-size: 14.5px;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    direction: rtl;
}

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 { margin: 0; line-height: 1.35; font-weight: 700; }
p { margin: 0; }

.icon {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    flex: 0 0 auto;
}

/* ============================ Shell ============================ */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 24px 16px 18px;
    background:
        radial-gradient(120% 60% at 100% 0%, rgba(20, 184, 166, .22), transparent 60%),
        linear-gradient(180deg, #0a1d34 0%, #0b2645 55%, #0b2038 100%);
    color: #b9cde0;
    overflow-y: auto;
    z-index: 50;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 8px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
    color: #fff;
}

.brand-logo {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--teal-2), #0f766e);
    box-shadow: 0 8px 20px rgba(20, 184, 166, .35);
    color: #fff;
}

.brand-logo .icon { width: 24px; height: 24px; }

.brand-text { display: flex; flex-direction: column; }
.brand-text strong { font-size: 16.5px; letter-spacing: .2px; color: #fff; }
.brand-text small { font-size: 11.5px; color: #8fa9c4; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }

.nav-label {
    font-size: 11px;
    letter-spacing: .6px;
    color: #6f8cab;
    padding: 16px 12px 7px;
    font-weight: 600;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 13px;
    border-radius: 11px;
    color: #b9cde0;
    font-weight: 600;
    font-size: 13.8px;
    transition: background .18s ease, color .18s ease, transform .18s ease;
    position: relative;
}

.nav-link .icon { width: 19px; height: 19px; opacity: .85; }

.nav-link:hover {
    background: rgba(255, 255, 255, .06);
    color: #fff;
    transform: translateX(-2px);
}

.nav-link.active {
    background: linear-gradient(90deg, rgba(20, 184, 166, .28), rgba(20, 184, 166, .12));
    color: #fff;
    box-shadow: inset -3px 0 0 var(--teal-2);
}

.nav-link.active .icon { color: var(--teal-2); opacity: 1; }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }

.support-box {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
    border: 1px solid rgba(255, 255, 255, .06);
}

.support-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(20, 184, 166, .2);
    color: var(--teal-2);
}

.support-box strong { display: block; font-size: 12.5px; color: #eaf4ff; }
.support-box small { font-size: 11px; color: #8fa9c4; }
.version { text-align: center; font-size: 11px; color: #6f8cab; }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(7, 20, 36, .55);
    backdrop-filter: blur(2px);
    z-index: 45;
}

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

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 28px;
    background: rgba(255, 255, 255, .86);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--line);
}

.menu-btn { display: none; }

.crumb { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.crumb strong { color: var(--ink); font-weight: 700; }
.crumb-sep { color: var(--line-strong); }

.global-search {
    position: relative;
    flex: 1;
    max-width: 440px;
    margin-inline-start: auto;
}

.global-search .icon {
    position: absolute;
    inset-inline-start: 13px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--muted);
}

.global-search input {
    width: 100%;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    padding: 0 42px 0 14px;
    font: inherit;
    color: var(--ink);
    outline: none;
    transition: border .18s ease, box-shadow .18s ease, background .18s ease;
}

.global-search input:focus {
    background: #fff;
    border-color: var(--teal-2);
    box-shadow: 0 0 0 4px rgba(20, 184, 166, .13);
}

.topbar-actions { display: flex; align-items: center; gap: 12px; }

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 5px 6px 5px 14px;
    border-radius: 999px;
    background: var(--surface-soft);
    border: 1px solid var(--line);
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--teal-2), #0b6b63);
    color: #fff;
    font-weight: 700;
    font-size: 12.5px;
    letter-spacing: .3px;
}

.user-meta { display: flex; flex-direction: column; line-height: 1.3; }
.user-meta strong { font-size: 12.5px; }
.user-meta small { font-size: 10.5px; color: var(--muted); }

.content {
    flex: 1;
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 26px 28px 44px;
}

.app-footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 16px 24px 26px;
    font-size: 11.5px;
    color: var(--muted);
    flex-wrap: wrap;
}

.dot-sep { width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }

/* ============================ Page head ============================ */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
    flex-wrap: wrap;
}

.page-head h1 { font-size: 25px; letter-spacing: -.2px; }

.page-sub {
    color: var(--muted);
    font-size: 13px;
    margin-top: 4px;
}

.head-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ============================ Buttons ============================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font: inherit;
    font-weight: 700;
    font-size: 13.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
    color: var(--ink);
}

.btn .icon { width: 17px; height: 17px; }

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(135deg, var(--teal-2), #0b7f74);
    color: #fff;
    box-shadow: 0 10px 22px rgba(13, 148, 136, .26);
}

.btn-primary:hover { box-shadow: 0 14px 26px rgba(13, 148, 136, .34); }

.btn-dark {
    background: linear-gradient(135deg, #123456, #0a1f37);
    color: #fff;
    box-shadow: 0 10px 22px rgba(11, 31, 56, .2);
}

.btn-ghost {
    background: #fff;
    border-color: var(--line-strong);
    color: var(--ink-soft);
}

.btn-ghost:hover { border-color: var(--teal-2); color: var(--teal); }

.btn-danger {
    background: var(--red-soft);
    color: #b93b3b;
    border-color: #f8d3d3;
}

.btn-danger:hover { background: #fbdcdc; }

.btn-sm { height: 36px; padding: 0 13px; font-size: 12.5px; border-radius: 9px; }
.btn-lg { height: 50px; padding: 0 26px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }

.btn[disabled] { opacity: .55; pointer-events: none; }

.icon-btn {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background .16s ease, color .16s ease, border-color .16s ease;
}

.icon-btn:hover { background: var(--teal-soft); color: var(--teal); border-color: #bdece5; }
.icon-btn .icon { width: 18px; height: 18px; }

.row-actions { display: flex; align-items: center; gap: 6px; }

/* ============================ Cards ============================ */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 17px 20px;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
}

.card-head h2, .card-title { font-size: 15.5px; }
.card-head .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 0; }

.card + .card { margin-top: 20px; }

/* ============================ Stats ============================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-bottom: 22px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: transform .2s ease, box-shadow .2s ease;
}

.stat-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }

.stat-card::after {
    content: "";
    position: absolute;
    inset-inline-end: -30px;
    top: -40px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--tile-soft, var(--teal-soft));
    opacity: .55;
    pointer-events: none;
}

.stat-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; position: relative; z-index: 1; }
.stat-label { font-size: 12.5px; color: var(--muted); font-weight: 600; }

.tile {
    width: 46px;
    height: 46px;
    border-radius: 13px;
    display: grid;
    place-items: center;
    background: var(--tile-soft, var(--teal-soft));
    color: var(--tile, var(--teal));
}

.tile .icon { width: 22px; height: 22px; }

.stat-value { font-size: 31px; font-weight: 800; line-height: 1.15; letter-spacing: -.5px; position: relative; z-index: 1; }
.stat-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 11.8px; color: var(--muted); position: relative; z-index: 1; }

.trend { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: var(--teal-soft); color: #0b7f74; font-weight: 700; font-size: 11px; }
.trend.warn { background: var(--amber-soft); color: #a86a04; }

.tile-teal { --tile: var(--teal); --tile-soft: var(--teal-soft); }
.tile-blue { --tile: var(--blue); --tile-soft: var(--blue-soft); }
.tile-amber { --tile: #c07c08; --tile-soft: var(--amber-soft); }
.tile-purple { --tile: var(--purple); --tile-soft: var(--purple-soft); }

/* ============================ Layout grids ============================ */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.65fr) minmax(280px, .9fr); }
.grid-even { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.stack { display: flex; flex-direction: column; gap: 20px; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.flex-center { display: flex; align-items: center; gap: 10px; }
.gap-6 { gap: 6px; } .gap-10 { gap: 10px; } .gap-14 { gap: 14px; } .gap-20 { gap: 20px; }
.wrap { flex-wrap: wrap; }
.mt-6 { margin-top: 6px; } .mt-12 { margin-top: 12px; } .mt-18 { margin-top: 18px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; } .mb-12 { margin-bottom: 12px; } .mb-18 { margin-bottom: 18px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.strong { font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }

/* ============================ Tables ============================ */
.table-wrap { overflow-x: auto; }

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
    min-width: 720px;
}

table.data thead th {
    text-align: right;
    font-size: 11.8px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface-soft);
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    letter-spacing: .2px;
}

table.data tbody td {
    padding: 13px 16px;
    border-bottom: 1px solid #eef4fa;
    vertical-align: middle;
    white-space: nowrap;
}

table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr { transition: background .15s ease; }
table.data tbody tr:hover { background: #f8fbff; }

.cell-main { font-weight: 700; color: var(--ink); }
.cell-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.mono { font-family: "Consolas", "Courier New", monospace; font-size: 12.5px; direction: ltr; text-align: right; letter-spacing: .3px; }

.table-actions-col { width: 1%; }

.person { display: flex; align-items: center; gap: 10px; }
.person .avatar { width: 34px; height: 34px; font-size: 11.5px; }
.person .avatar.alt { background: linear-gradient(135deg, #7c5cd6, #4c34a0); }
.person .avatar.amber { background: linear-gradient(135deg, #f2a93b, #c07c08); }

/* ============================ Badges ============================ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    white-space: nowrap;
    line-height: 1.6;
}

.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .75; }

.badge-success { background: var(--teal-soft); color: #0b7f74; }
.badge-info { background: var(--blue-soft); color: #1f66b0; }
.badge-warning { background: var(--amber-soft); color: #a86a04; }
.badge-danger { background: var(--red-soft); color: #b93b3b; }
.badge-purple { background: var(--purple-soft); color: #6041bd; }
.badge-slate { background: var(--slate-soft); color: #5a6f86; }
.badge-dark { background: #0b1f38; color: #fff; }
.badge-outline { background: #fff; border: 1px solid var(--line-strong); color: var(--ink-soft); }

/* ============================ Forms ============================ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 20px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.field .hint { font-size: 11px; color: var(--muted); }
.required::after { content: " *"; color: var(--red); }

.input, .select, .textarea {
    width: 100%;
    height: 44px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #fbfdff;
    padding: 0 14px;
    font: inherit;
    font-size: 13.5px;
    color: var(--ink);
    outline: none;
    transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.textarea { height: auto; min-height: 92px; padding: 11px 14px; resize: vertical; }

.select {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2370829a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 14px center;
    padding-left: 38px;
}

.input:focus, .select:focus, .textarea:focus {
    border-color: var(--teal-2);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(20, 184, 166, .13);
}

.input::placeholder, .textarea::placeholder { color: #9aabc0; }

.input:disabled, .select:disabled, .textarea:disabled { background: #f1f5fa; color: var(--muted); }

.field-error { color: var(--red); font-size: 11.5px; }

.form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 20px;
    margin-top: 4px;
    border-top: 1px solid var(--line);
}

.check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}

.check input {
    width: 18px;
    height: 18px;
    accent-color: var(--teal);
    cursor: pointer;
}

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
    width: 44px;
    height: 24px;
    border-radius: 999px;
    background: #cfdae7;
    position: relative;
    transition: background .2s ease;
    flex: 0 0 auto;
}
.switch .track::after {
    content: "";
    position: absolute;
    top: 3px;
    inset-inline-start: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 2px 6px rgba(13, 39, 66, .2);
    transition: transform .2s ease;
}
.switch input:checked + .track { background: var(--teal); }
.switch input:checked + .track::after { transform: translateX(-20px); }

/* ============================ Filters ============================ */
.filters {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: #fcfdff;
    border-radius: var(--radius) var(--radius) 0 0;
}

.filters .field { min-width: 170px; flex: 1 1 170px; }
.filters .field.search { flex: 2 1 260px; }
.filters .field > label { font-size: 11px; }
.filters .btn { height: 44px; }

/* ============================ Pagination ============================ */
.pager-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 20px;
    border-top: 1px solid var(--line);
    flex-wrap: wrap;
}

.pager-info { font-size: 12px; color: var(--muted); }
.pager { display: flex; align-items: center; gap: 5px; }
.page-link {
    min-width: 34px;
    height: 34px;
    padding: 0 9px;
    display: inline-grid;
    place-items: center;
    border-radius: 9px;
    border: 1px solid var(--line);
    background: #fff;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--ink-soft);
    transition: all .16s ease;
}
.page-link:hover { border-color: var(--teal-2); color: var(--teal); }
.page-link.active { background: var(--teal); border-color: var(--teal); color: #fff; box-shadow: 0 6px 14px rgba(13, 148, 136, .25); }
.page-link.disabled { opacity: .45; pointer-events: none; }

/* ============================ Charts ============================ */
.chart-bars {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    height: 210px;
    padding: 10px 4px 0;
}

.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bar-track { width: 100%; max-width: 46px; flex: 1; display: flex; align-items: flex-end; }
.bar {
    width: 100%;
    border-radius: 9px 9px 4px 4px;
    background: linear-gradient(180deg, var(--teal-2), #0b7f74);
    min-height: 4px;
    position: relative;
    transition: filter .16s ease;
    box-shadow: 0 8px 16px rgba(13, 148, 136, .18);
}
.bar:hover { filter: brightness(1.08); }
.bar .bar-value {
    position: absolute;
    top: -22px;
    inset-inline: 0;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-soft);
}
.bar-label { font-size: 10.5px; color: var(--muted); text-align: center; white-space: nowrap; }

.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut {
    width: 158px;
    height: 158px;
    border-radius: 50%;
    position: relative;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(13, 39, 66, .04);
}
.donut::after { content: ""; position: absolute; inset: 30px; border-radius: 50%; background: #fff; box-shadow: 0 6px 18px rgba(13, 39, 66, .06) inset; }
.donut-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1;
    line-height: 1.25;
}
.donut-center strong { font-size: 23px; font-weight: 800; }
.donut-center small { font-size: 10.5px; color: var(--muted); }
.legend { display: flex; flex-direction: column; gap: 10px; flex: 1; min-width: 150px; }
.legend-item { display: flex; align-items: center; gap: 9px; font-size: 12.5px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.legend-item .count { margin-inline-start: auto; font-weight: 700; color: var(--ink-soft); }

.progress-list { display: flex; flex-direction: column; gap: 15px; }
.progress-item .progress-head { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 6px; }
.progress-track { height: 8px; border-radius: 999px; background: var(--slate-soft); overflow: hidden; }
.progress-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--teal-2), #0b7f74); }
.progress-fill.blue { background: linear-gradient(90deg, #5aa5e8, #2f7dd1); }
.progress-fill.amber { background: linear-gradient(90deg, #f6c05c, #e89a0c); }
.progress-fill.purple { background: linear-gradient(90deg, #a48bf0, #7c5cd6); }

/* ============================ Map ============================ */
.map-canvas {
    position: relative;
    height: 540px;
    border-radius: var(--radius);
    overflow: hidden;
    background:
        linear-gradient(rgba(47, 125, 209, .07) 1px, transparent 1px) 0 0 / 100% 54px,
        linear-gradient(90deg, rgba(47, 125, 209, .07) 1px, transparent 1px) 0 0 / 54px 100%,
        radial-gradient(circle at 25% 25%, #eaf7f3, #e4eef8 55%, #dbe8f4);
    border: 1px solid var(--line);
}

.map-canvas .road {
    position: absolute;
    background: rgba(255, 255, 255, .75);
    border: 1px solid rgba(47, 125, 209, .1);
    border-radius: 999px;
    transform: rotate(-12deg);
    pointer-events: none;
}

.map-point {
    position: absolute;
    width: 13px;
    height: 13px;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid #fff;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, .18), 0 4px 10px rgba(13, 39, 66, .18);
    cursor: pointer;
    transition: transform .16s ease, box-shadow .16s ease;
    z-index: 2;
}
.map-point:hover { transform: translate(-50%, -50%) scale(1.35); z-index: 5; }
.map-point.teal { background: var(--teal); }
.map-point.blue { background: var(--blue); }
.map-point.amber { background: var(--amber); }
.map-point.purple { background: var(--purple); }
.map-point.red { background: var(--red); }

.map-tooltip {
    position: absolute;
    min-width: 170px;
    max-width: 230px;
    background: #0b1f38;
    color: #fff;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 11.5px;
    line-height: 1.6;
    box-shadow: var(--shadow-lg);
    z-index: 10;
    pointer-events: none;
    opacity: 0;
    transform: translate(-50%, -115%);
    transition: opacity .14s ease;
}
.map-tooltip.show { opacity: 1; }
.map-tooltip strong { display: block; font-size: 12.5px; margin-bottom: 3px; }
.map-tooltip span { color: #a9c1d8; display: block; }

.map-legend {
    position: absolute;
    inset-inline-start: 14px;
    bottom: 14px;
    background: rgba(255, 255, 255, .93);
    backdrop-filter: blur(6px);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 13px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    font-size: 11.5px;
    box-shadow: var(--shadow-sm);
    z-index: 3;
}
.map-legend .legend-item { gap: 8px; }

/* ============================ Alerts / toasts / empty ============================ */
.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
    font-size: 13px;
    font-weight: 600;
    animation: slideDown .3s ease both;
    border: 1px solid transparent;
}

.toast .icon { width: 18px; height: 18px; }
.toast-success { background: var(--teal-soft); color: #0a6b62; border-color: #c8eee8; }
.toast-error { background: var(--red-soft); color: #a93434; border-color: #f7d4d4; }

.alert {
    display: flex;
    gap: 10px;
    padding: 13px 16px;
    border-radius: 12px;
    font-size: 12.8px;
    margin-bottom: 16px;
    border: 1px solid transparent;
}
.alert .icon { width: 18px; height: 18px; margin-top: 2px; }
.alert-info { background: var(--blue-soft); color: #1f5f9e; border-color: #d3e6f9; }
.alert-warn { background: var(--amber-soft); color: #8f5c03; border-color: #f7e3bd; }
.alert-danger { background: var(--red-soft); color: #a93434; border-color: #f7d4d4; }

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 48px 20px;
    text-align: center;
    color: var(--muted);
}
.empty .empty-icon {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--line);
    color: #9db1c7;
    margin-bottom: 4px;
}
.empty .empty-icon .icon { width: 26px; height: 26px; }
.empty strong { color: var(--ink-soft); font-size: 14px; }
.empty span { font-size: 12px; }

/* ============================ Detail blocks ============================ */
.detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 20px; }
.detail-item { display: flex; flex-direction: column; gap: 3px; }
.detail-item .dt { font-size: 11px; color: var(--muted); font-weight: 600; }
.detail-item .dd { font-size: 13.5px; font-weight: 600; color: var(--ink); }

.mini-list { display: flex; flex-direction: column; }
.mini-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #eff4fa; }
.mini-item:last-child { border-bottom: none; }
.mini-item .tile { width: 38px; height: 38px; border-radius: 11px; }
.mini-item .tile .icon { width: 18px; height: 18px; }
.mini-item .grow { flex: 1; min-width: 0; }
.mini-item .grow strong { display: block; font-size: 12.8px; }
.mini-item .grow small { font-size: 11px; color: var(--muted); }

.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 12px; padding-bottom: 16px; position: relative; }
.timeline-item::before { content: ""; position: absolute; inset-inline-start: 15px; top: 32px; bottom: 0; width: 2px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--teal-soft); color: var(--teal); display: grid; place-items: center; flex: 0 0 auto; z-index: 1; border: 3px solid #fff; }
.timeline-dot .icon { width: 15px; height: 15px; }

/* ============================ Login ============================ */
.auth-body {
    background: #f2f6fb;
    min-height: 100vh;
}

.auth-shell { display: grid; grid-template-columns: 1.02fr .98fr; min-height: 100vh; }
.auth-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 54px 58px;
    color: #eaf4ff;
    background:
        radial-gradient(90% 70% at 100% 0%, rgba(20, 184, 166, .35), transparent 60%),
        radial-gradient(70% 60% at 0% 100%, rgba(47, 125, 209, .28), transparent 60%),
        linear-gradient(150deg, #0a1d34, #0c2c4f 60%, #0a2340);
}

.auth-brand .rings {
    position: absolute;
    inset: auto -140px -160px auto;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 0 0 60px rgba(255, 255, 255, .03), 0 0 0 130px rgba(255, 255, 255, .025);
    pointer-events: none;
}

.auth-brand .brand { border: none; padding: 0; }
.auth-brand h1 { font-size: 37px; line-height: 1.35; margin: 32px 0 14px; color: #fff; letter-spacing: -.4px; }
.auth-brand .lead { font-size: 14.5px; color: #b6cbe0; max-width: 460px; line-height: 1.9; }

.auth-features { display: flex; flex-direction: column; gap: 14px; margin-top: 36px; }
.auth-feature { display: flex; gap: 13px; align-items: flex-start; }
.auth-feature .fi {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(20, 184, 166, .16);
    border: 1px solid rgba(20, 184, 166, .25);
    color: #5eead4;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
}
.auth-feature strong { display: block; font-size: 13.5px; color: #fff; }
.auth-feature span { font-size: 12px; color: #9fb8cf; }

.auth-brand .auth-foot { font-size: 11.5px; color: #7f9bb6; display: flex; gap: 10px; align-items: center; }

.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 430px; }
.auth-card .eyebrow { font-size: 12px; font-weight: 700; color: var(--teal); letter-spacing: .4px; }
.auth-card h2 { font-size: 27px; margin: 6px 0 6px; }
.auth-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 26px; }

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form .field { gap: 8px; }
.input-wrap { position: relative; }
.input-wrap .icon { position: absolute; inset-inline-start: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; color: var(--muted); }
.input-wrap .input { padding-inline-start: 44px; height: 48px; background: #fff; }
.toggle-pass {
    position: absolute;
    inset-inline-end: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 34px;
    height: 34px;
    border: none;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 8px;
    display: grid;
    place-items: center;
}
.toggle-pass:hover { background: var(--surface-soft); color: var(--teal); }

.auth-error {
    display: flex;
    gap: 9px;
    align-items: center;
    background: var(--red-soft);
    color: #a93434;
    padding: 11px 13px;
    border-radius: 10px;
    font-size: 12.5px;
    border: 1px solid #f7d4d4;
}

.demo-hint {
    margin-top: 22px;
    padding: 13px 15px;
    border-radius: 12px;
    background: var(--surface-soft);
    border: 1px dashed var(--line-strong);
    font-size: 12px;
    color: var(--muted);
    line-height: 1.9;
}
.demo-hint strong { color: var(--ink-soft); }
.demo-hint code { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; font-size: 11.5px; color: var(--teal); direction: ltr; display: inline-block; }

/* ============================ Misc ============================ */
.divider { height: 1px; background: var(--line); border: none; margin: 20px 0; }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 7px; background: var(--surface-soft); border: 1px solid var(--line); font-size: 11px; color: var(--ink-soft); }

.avatar-square {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center;
    background: var(--teal-soft); color: var(--teal);
    font-weight: 800; font-size: 13px;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.on { background: var(--teal); box-shadow: 0 0 0 3px rgba(13, 148, 136, .15); }
.status-dot.off { background: #b6c4d3; }

.fade-in { animation: fadeUp .36s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #c8d6e5; border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #aebfd2; }

/* ============================ Responsive ============================ */
@media (max-width: 1180px) {
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: minmax(0, 1fr); }
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed;
        inset-block: 0;
        inset-inline-end: 0;
        width: min(84vw, 300px);
        transform: translateX(105%);
        transition: transform .28s cubic-bezier(.4, 0, .2, 1);
        box-shadow: -20px 0 50px rgba(7, 20, 36, .3);
    }
    .sidebar.open { transform: none; }
    .sidebar-overlay.show { display: block; }
    .menu-btn { display: inline-grid; }
    .global-search { display: none; }
    .topbar { padding: 10px 16px; }
    .content { padding: 20px 16px 34px; }
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .auth-main { min-height: 100vh; }
}

@media (max-width: 720px) {
    .stats-grid, .grid-2, .grid-3, .grid-4, .grid-even, .detail-grid, .form-grid { grid-template-columns: minmax(0, 1fr); }
    .page-head { align-items: flex-start; }
    .page-head h1 { font-size: 21px; }
    .user-meta { display: none; }
    .user-chip { padding: 4px; border: none; background: transparent; }
    .topbar-actions .btn span { display: none; }
    .filters { padding: 13px; }
    .filters .field { min-width: 100%; flex: 1 1 100%; }
    .pager-bar { justify-content: center; }
    .map-canvas { height: 380px; }
    .card-head { padding: 14px 15px; }
    .card-body { padding: 15px; }
    .stat-value { font-size: 26px; }
}

@media print {
    .sidebar, .topbar, .app-footer, .toast { display: none !important; }
    .app-shell { display: block; }
    .content { padding: 0; }
    body { background: #fff; }
}

/* ==== Statement print sheet ==== */
.print-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    margin-bottom: 18px;
}
.print-sheet {
    background: #fff; color: #16202e; max-width: 1120px; margin: 0 auto;
    padding: 26px 32px 30px; border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.print-brand { display: flex; align-items: flex-start; justify-content: space-between; gap: 26px; border-bottom: 2px solid #16202e; padding-bottom: 14px; }
.print-brand-main { display: flex; align-items: center; gap: 12px; }
.print-logo { width: 46px; height: 46px; border-radius: 11px; background: #0e2a47; color: #fff; display: grid; place-items: center; }
.print-company { font-size: 17px; font-weight: 800; line-height: 1.3; }
.print-company small { display: block; font-size: 11px; font-weight: 500; color: #5a6a7a; margin-top: 3px; }
.print-meta { text-align: left; font-size: 11px; color: #46586b; line-height: 1.9; }
.print-meta b { color: #16202e; }
.print-title { text-align: center; margin: 18px 0 14px; }
.print-title h2 { margin: 0; font-size: 21px; letter-spacing: -.2px; }
.print-title p { margin: 5px 0 0; font-size: 11px; color: #5a6a7a; }
.print-info { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px 18px; font-size: 11px; margin-bottom: 13px; }
.print-info div { display: flex; gap: 5px; border-bottom: 1px dotted #cfd8e2; padding-bottom: 3px; }
.print-info span:first-child { color: #5a6a7a; }
.print-info span:last-child { font-weight: 700; }
.print-table { width: 100%; border-collapse: collapse; font-size: 9.5px; }
.print-table th, .print-table td { border: 1px solid #9aa8b7; padding: 4px 5px; text-align: center; vertical-align: middle; }
.print-table th { background: #eef3f8; font-size: 9px; font-weight: 800; }
.print-table tbody tr:nth-child(even) { background: #f8fafc; }
.print-table .txt-right { text-align: right; }
.print-summary { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; font-size: 11px; }
.print-signatures { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; margin-top: 30px; text-align: center; font-size: 10.5px; }
.print-signatures .sig-title { font-weight: 800; margin-bottom: 4px; }
.print-signatures .sig-name { color: #46586b; min-height: 16px; }
.print-signatures .sig-line { border-top: 1px solid #7d8b99; margin-top: 30px; padding-top: 5px; color: #5a6a7a; font-size: 9px; }
.print-foot { margin-top: 20px; padding-top: 8px; border-top: 1px solid #d6dee6; display: flex; justify-content: space-between; font-size: 9px; color: #7d8b99; }
.print-empty { padding: 40px; text-align: center; color: #5a6a7a; }

@media print {
    @page { size: A4 landscape; margin: 8mm; }
    .print-toolbar { display: none !important; }
    .print-sheet { border: none; box-shadow: none; max-width: none; padding: 0; }
    .print-table th, .print-table td { padding: 3px 4px; }
    .print-signatures { margin-top: 22px; }
    .print-table tr { break-inside: avoid; }
}

/* ==== GIS page ==== */
.map-shell { position: relative; }
.map-toolbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; }
.map-toolbar .map-controls { display: flex; align-items: center; gap: 6px; }
.map-legend { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; min-height: 32px; }
.map-legend .legend-item { font-size: 11.5px; color: var(--ink-soft); display: inline-flex; align-items: center; gap: 6px; }
.map-legend .legend-item i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
#gis-svg { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map-canvas.dragging #gis-svg { cursor: grabbing; }
.gis-point { cursor: pointer; outline: none; }
.gis-point circle { transition: opacity .15s ease; }
.gis-point:hover circle:last-child, .gis-point:focus circle:last-child { stroke-width: 3; }
.gis-tooltip {
    position: absolute; z-index: 12; pointer-events: none; min-width: 170px; max-width: 260px;
    background: #0b1f38; color: #fff; border-radius: 10px; padding: 10px 12px;
    font-size: 11.5px; line-height: 1.65; box-shadow: var(--shadow-lg);
}
.gis-tooltip strong { display: block; font-size: 12.5px; margin-bottom: 3px; }
.gis-tooltip span { display: block; color: #a9c1d8; }
.map-empty[hidden], .gis-tooltip[hidden], .map-detail[hidden] { display: none !important; }
.map-empty {
    position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 5px; color: var(--ink-soft); font-size: 13px; text-align: center;
    background: rgba(242, 247, 251, .7); z-index: 4;
}
.map-empty strong { font-size: 15px; color: var(--ink); }
.map-detail {
    position: absolute; inset-inline-end: 16px; top: 16px; width: 310px; max-width: calc(100% - 32px);
    background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px;
    box-shadow: var(--shadow-lg); z-index: 8;
}
.map-detail-close { position: absolute; inset-inline-end: 8px; top: 8px; }
.map-detail .detail-code { font-size: 15px; font-weight: 800; color: var(--ink); padding-inline-end: 30px; }
.map-detail .detail-sub { font-size: 11px; color: var(--muted); margin-bottom: 10px; }
.detail-list { display: flex; flex-direction: column; gap: 6px; margin: 10px 0 14px; }
.detail-list > div { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; border-bottom: 1px dotted var(--line); padding-bottom: 5px; }
.detail-list span { color: var(--muted); }
.detail-list b { text-align: left; font-weight: 700; color: var(--ink); }
@media (max-width: 720px) {
    .map-detail { inset-inline: 10px; top: auto; bottom: 10px; width: auto; }
    .map-canvas { height: 460px; }
}

/* ensure the GIS legend sits in the toolbar, not over the canvas */
.map-toolbar .map-legend {
    position: static; inset: auto; background: transparent; border: 0; box-shadow: none;
    padding: 4px 0; flex-direction: row; flex-wrap: wrap;
}

.map-districts { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 0 12px; }
.district-chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px;
    background: var(--surface-2, #f4f8fb); border: 1px solid var(--line);
    border-radius: 999px; font-size: 10.5px; color: var(--ink-soft);
}
.district-chip b { color: var(--teal-2, #0f766e); font-size: 11px; }
