/* ============================================================
   PAGAR QUICK RESPONSE — Premium UI
   Identitas "Hitam Merah Emas": hitam, merah, dan aksen emas.
   ============================================================ */

@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/roboto-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Roboto';
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url('../fonts/roboto-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --navy: #141416;          /* hitam */
    --navy-2: #08080a;
    --red: #b91c1c;           /* merah */
    --red-2: #e53935;
    --blue: #b91c1c;          /* aksen teks utama (merah) */
    --blue-soft: #fdecec;
    --gold: #d4af37;          /* emas */
    --gold-2: #f2d77a;
    --gold-deep: #a67c00;
    --gold-soft: rgba(212, 175, 55, .14);
    --bg: #f6f5f2;
    --surface: #ffffff;
    --line: #e7e2d8;
    --line-strong: #d9d2c4;
    --text: #16181d;
    --muted: #7b7568;
    --danger: #c81e1e;
    --success: #2f7d52;
    --radius: 18px;
    --radius-sm: 12px;
    --shadow-sm: 0 1px 2px rgba(16, 18, 22, .04), 0 8px 24px -20px rgba(16, 18, 22, .35);
    --shadow-md: 0 2px 4px rgba(16, 18, 22, .04), 0 24px 50px -34px rgba(16, 18, 22, .45);
    --shadow-lg: 0 30px 80px -40px rgba(0, 0, 0, .55);
    --font-sans: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
    --font-display: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
    --font-serif: "Roboto", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- Varian tema ---------- */
.theme-midnight {
    --navy: #141416;
    --navy-2: #08080a;
    --red: #b91c1c;
    --red-2: #e53935;
    --blue: #b91c1c;
    --blue-soft: #fdecec;
    --gold: #d4af37;
    --gold-2: #f2d77a;
    --gold-deep: #a67c00;
    --gold-soft: rgba(212, 175, 55, .14);
    --bg: #f6f5f2;
    --surface: #ffffff;
    --line: #e7e2d8;
    --line-strong: #d9d2c4;
    --text: #16181d;
    --muted: #7b7568;
}

.theme-blue {
    --navy: #0b2545;
    --navy-2: #103563;
    --blue: #1d4ed8;
    --blue-soft: #dbeafe;
    --gold: #e0a52b;
    --gold-2: #f7d07a;
    --gold-deep: #b47c10;
    --gold-soft: rgba(224, 165, 43, .14);
    --bg: #f1f5f9;
    --surface: #ffffff;
    --line: #e2e8f0;
    --line-strong: #cbd5e1;
    --text: #0f172a;
    --muted: #64748b;
}
.theme-blue .sidebar { background: linear-gradient(180deg, #0b2545 0%, #0a1e38 100%); }
.theme-blue .brand-shield { background: linear-gradient(145deg, #f6b73c, #d97706); color: #0b2545; box-shadow: 0 6px 16px rgba(245, 158, 11, .28); }
.theme-blue .landing-hero { background: radial-gradient(1200px 500px at 80% -10%, rgba(59, 130, 246, .35), transparent 60%), linear-gradient(135deg, #081c34, #0b2545 55%, #123a6b); }
.theme-blue .auth-brand { background: radial-gradient(900px 420px at 90% 0%, rgba(59, 130, 246, .3), transparent 60%), linear-gradient(150deg, #081c34, #0b2545 60%, #103563); }
.theme-blue .sidebar-nav .nav-link.active { background: rgba(59, 130, 246, .18); }
.theme-blue .sidebar-nav .nav-link.active i { color: var(--gold); }
.theme-blue .btn-primary { background: linear-gradient(145deg, #2563eb, #1d4ed8); border-color: #1d4ed8; }
.theme-blue .btn-primary:hover, .theme-blue .btn-primary:focus { background: linear-gradient(145deg, #3b82f6, #2563eb); border-color: #1e40af; }
.theme-blue .avatar { background: linear-gradient(145deg, #3b82f6, #1d4ed8); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.theme-blue .mobile-topbar,
.theme-blue .public-header { background: linear-gradient(135deg, #0b2545, #123a6b); }

.theme-gray {
    --navy: #2b3038;
    --navy-2: #14171c;
    --blue: #4b5563;
    --blue-soft: #e9e9e6;
    --gold: #a9aeb6;
    --gold-2: #d6d9de;
    --gold-deep: #5b6270;
    --gold-soft: rgba(169, 174, 182, .16);
    --bg: #f4f4f2;
    --surface: #ffffff;
    --line: #e4e3de;
    --line-strong: #d3d2cb;
    --text: #1b1d21;
    --muted: #6f7378;
}
.theme-gray .sidebar { background: linear-gradient(180deg, #3a3f47 0%, #171a1f 100%); }
.theme-gray .brand-shield { background: linear-gradient(145deg, #d6d9de, #8b9199); color: #1f2329; box-shadow: 0 6px 16px rgba(107, 114, 128, .28); }
.theme-gray .landing-hero { background: radial-gradient(1200px 500px at 80% -10%, rgba(107, 114, 128, .35), transparent 60%), linear-gradient(135deg, #1f2937, #374151 55%, #4b5563); }
.theme-gray .auth-brand { background: radial-gradient(900px 420px at 90% 0%, rgba(107, 114, 128, .3), transparent 60%), linear-gradient(150deg, #1f2937, #374151 60%, #4b5563); }
.theme-gray .mobile-topbar,
.theme-gray .public-header { background: linear-gradient(135deg, #4b5563, #1f2937); }
.theme-gray .sidebar-nav .nav-link.active { background: linear-gradient(90deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .02)); }

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
    background:
        radial-gradient(1100px 520px at 100% -12%, rgba(212, 175, 55, .09), transparent 62%),
        radial-gradient(900px 480px at -10% 110%, rgba(212, 175, 55, .05), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-sans);
    font-size: .94rem;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { text-decoration: none; }

::selection { background: rgba(212, 175, 55, .28); color: #111; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cfc8b8; border: 2px solid transparent; background-clip: content-box; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #b9b09c; background-clip: content-box; }

/* ---------------- Layout utama ---------------- */
.app-shell { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 264px;
    background:
        radial-gradient(560px 240px at 50% -8%, rgba(185, 28, 28, .26), transparent 70%),
        linear-gradient(180deg, #18181b 0%, #08080a 100%);
    color: #c9ccd4;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    transition: transform .25s ease, width .25s ease;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, .04), 18px 0 50px -40px rgba(0, 0, 0, .8);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(212, 175, 55, .16);
}

.brand-shield {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    background: linear-gradient(145deg, var(--gold-2), var(--gold) 45%, var(--red));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 22px;
    box-shadow: 0 8px 20px -8px rgba(185, 28, 28, .7), inset 0 1px 0 rgba(255, 255, 255, .4);
    flex: 0 0 auto;
}

.brand-name {
    color: #fff;
    font-family: var(--font-serif);
    font-weight: 700;
    font-size: 1.2rem;
    line-height: 1.1;
    letter-spacing: .01em;
}

.brand-sub {
    font-size: .64rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: #9c927c;
    margin-top: 2px;
}

.sidebar-nav {
    padding: 16px 12px;
    overflow-y: auto;
    flex: 1 1 auto;
}

.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(212, 175, 55, .35); border: 0; }

.nav-section {
    font-size: .62rem;
    text-transform: uppercase;
    letter-spacing: .16em;
    color: #837a66;
    padding: 16px 13px 7px;
    font-weight: 700;
}

.sidebar-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #b9bec8;
    padding: 11px 13px;
    border-radius: 11px;
    font-weight: 500;
    margin-bottom: 3px;
    border-left: 3px solid transparent;
    transition: background .18s ease, color .18s ease, border-color .18s ease;
}

.sidebar-nav .nav-link i {
    font-size: 1.05rem;
    width: 21px;
    text-align: center;
    color: #9aa0ab;
    transition: color .18s ease;
}

.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .055); color: #fff; }
.sidebar-nav .nav-link:hover i { color: var(--gold-2); }

.sidebar-nav .nav-link.active {
    background: linear-gradient(90deg, rgba(212, 175, 55, .20), rgba(212, 175, 55, .04));
    color: #fff;
    border-left-color: var(--gold);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05);
}
.sidebar-nav .nav-link.active i { color: var(--gold-2); }

.sidebar-nav .nav-link .badge { margin-left: auto; }

.sidebar-footer {
    padding: 14px;
    border-top: 1px solid rgba(212, 175, 55, .16);
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: 13px;
    background: rgba(255, 255, 255, .045);
    border: 1px solid rgba(212, 175, 55, .14);
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, #2b323e, #14181f);
    color: var(--gold-2);
    font-weight: 700;
    font-size: .82rem;
    flex: 0 0 auto;
    box-shadow: inset 0 0 0 1px rgba(212, 175, 55, .55);
}

.avatar.sm { width: 30px; height: 30px; font-size: .7rem; }
.avatar.lg { width: 64px; height: 64px; font-size: 1.25rem; }

.app-main { margin-left: 264px; min-height: 100vh; display: flex; flex-direction: column; }

/* Sidebar collapse (desktop) */
body.sidebar-collapsed .sidebar { width: 76px; }
body.sidebar-collapsed .app-main { margin-left: 76px; }
body.sidebar-collapsed .nav-text,
body.sidebar-collapsed .brand-name,
body.sidebar-collapsed .brand-sub,
body.sidebar-collapsed .nav-section,
body.sidebar-collapsed .sidebar-user .min-w-0 { display: none; }
body.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 22px 0 18px; gap: 0; }
body.sidebar-collapsed .sidebar-user { justify-content: center; padding: 9px 0; }
body.sidebar-collapsed .sidebar-user .avatar { display: none; }
body.sidebar-collapsed .sidebar-nav .nav-link { justify-content: center; padding: 11px 0; gap: 0; border-left-width: 0; }
body.sidebar-collapsed .sidebar-nav .nav-link .badge { display: none; }
body.sidebar-collapsed .sidebar-footer { padding: 14px 8px; }
#sidebarCollapse { display: inline-flex; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 1020;
    background: rgba(250, 249, 246, .88);
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 14px 40px -34px rgba(16, 18, 22, .55);
    padding: 13px 28px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.topbar h1 {
    position: relative;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.01em;
    margin: 0;
    padding-left: 14px;
}
.topbar h1::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 21px;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--gold-2), var(--gold));
}

/* Tanpa animasi opacity: elemen yang sedang beranimasi opacity membentuk stacking
   context, sehingga modal di dalamnya bisa tertutup backdrop Bootstrap. Modal
   juga dipindahkan ke <body> oleh app.js sebagai pengaman. */
.page-content { padding: 26px 28px 46px; flex: 1 1 auto; }

.sidebar-toggle { display: none; }

/* ---------------- Komponen ---------------- */
.card {
    background: linear-gradient(180deg, #ffffff 0%, #fdfcf9 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition: box-shadow .22s ease, border-color .22s ease;
}
.card:hover { box-shadow: var(--shadow-md); }

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--line);
    font-weight: 700;
    letter-spacing: .01em;
    border-radius: var(--radius) var(--radius) 0 0 !important;
    padding: 15px 20px;
}

.card-body { padding: 18px 20px; }
.card-body.p-2 { padding: .5rem !important; }

.stat-card {
    position: relative;
    background: linear-gradient(160deg, #ffffff 0%, #fbf8f1 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    height: 100%;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.stat-card::after {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--gold-2), var(--gold));
    opacity: .55;
    transition: opacity .2s ease;
}
.stat-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.stat-card:hover::after { opacity: 1; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    font-size: 1.25rem;
    flex: 0 0 auto;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .6);
}

.stat-value { font-family: var(--font-display); font-size: 1.6rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; }
.stat-label { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; margin-top: 5px; }

.bg-soft-blue { background: #eef2f8; color: #3c4d68; }
.bg-soft-green { background: #eaf5ee; color: #2f6b45; }
.bg-soft-gold { background: #f9f0d8; color: #8a6a1f; }
.bg-soft-red { background: #fbecec; color: #a33a3a; }
.bg-soft-purple { background: #f0edf7; color: #5b4a86; }
.bg-soft-slate { background: #eef0f2; color: #3b424c; }

.map-box { height: 430px; border-radius: 14px; overflow: hidden; z-index: 1; }
.map-box.sm { height: 280px; }
.map-box.lg { height: 560px; }
.leaflet-container { font-family: inherit; }
.leaflet-popup-content-wrapper { border-radius: 14px; box-shadow: var(--shadow-md); }
.leaflet-popup-content { font-size: .82rem; }

.badge {
    font-weight: 600;
    letter-spacing: .02em;
    border-radius: 7px;
    padding: .38em .62em;
}
.badge.text-bg-light { background: #faf8f3 !important; color: var(--text) !important; }
.badge.text-bg-warning { background: #f5e6bd !important; color: #7a5c12 !important; }
.badge.text-bg-danger { background: #b93a3a !important; }
.badge.text-bg-success { background: #2f7d52 !important; }
.badge.text-bg-primary { background: #f3e7c8 !important; color: #6f5716 !important; }

.table { --bs-table-color: var(--text); --bs-table-hover-bg: #faf7f0; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .8rem; vertical-align: middle; }
.table thead th {
    font-size: .69rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
    font-weight: 700;
    background: #faf8f3;
    border-bottom: 1px solid var(--line-strong);
    white-space: nowrap;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { background: #faf7f0; }

.btn {
    border-radius: 11px;
    font-weight: 600;
    letter-spacing: .01em;
    padding: .5rem .95rem;
    transition: all .18s ease;
}
.btn-sm { padding: .34rem .7rem; border-radius: 9px; }
.btn-lg { border-radius: 13px; }

.btn-primary {
    background: linear-gradient(145deg, var(--red-2), var(--red));
    border-color: #991b1b;
    color: #fff;
    box-shadow: 0 10px 24px -16px rgba(185, 28, 28, .75), inset 0 1px 0 rgba(255, 255, 255, .18);
}
.btn-primary:hover, .btn-primary:focus {
    background: linear-gradient(145deg, #ef4444, #b91c1c);
    border-color: var(--gold);
    color: #fff;
    box-shadow: 0 12px 28px -16px rgba(185, 28, 28, .85), 0 0 0 3px rgba(212, 175, 55, .18);
}
.btn-primary:active { background: #7f1d1d !important; border-color: var(--gold) !important; }

.btn-light {
    background: #ffffff;
    border-color: var(--line-strong);
    color: var(--text);
}
.btn-light:hover, .btn-light:focus {
    background: #faf7f0;
    border-color: var(--gold);
    color: var(--text);
}

.btn-outline-primary { color: #2a2f38; border-color: var(--line-strong); }
.btn-outline-primary:hover, .btn-outline-primary:focus {
    background: linear-gradient(145deg, #222932, #10141a);
    border-color: #10141a;
    color: #fff;
}

.btn-outline-light { border-color: rgba(255, 255, 255, .35); color: #fff; }
.btn-outline-light:hover { background: rgba(255, 255, 255, .14); border-color: var(--gold-2); color: #fff; }

.btn-outline-secondary { color: #5b564c; border-color: var(--line-strong); }
.btn-outline-secondary:hover, .btn-outline-secondary:focus { background: #f3eee2; border-color: var(--gold); color: #2a2f38; }

.btn-warning {
    background: linear-gradient(145deg, var(--gold-2), var(--gold));
    border-color: var(--gold);
    color: #1d1809;
    box-shadow: 0 10px 24px -16px rgba(212, 175, 55, .8), inset 0 1px 0 rgba(255, 255, 255, .4);
}
.btn-warning:hover, .btn-warning:focus {
    background: linear-gradient(145deg, #f0daa6, #cfae61);
    border-color: var(--gold-deep);
    color: #1d1809;
}

.btn-link { text-decoration: none; }
.btn-link:hover { color: var(--gold-deep); }

.btn-panic {
    width: 100%;
    border: 0;
    border-radius: 22px;
    padding: 30px 20px;
    background: radial-gradient(120% 140% at 50% 0%, #e25454 0%, #c0392b 45%, #8f241c 100%);
    color: #fff;
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: .02em;
    box-shadow: 0 22px 46px -20px rgba(180, 40, 40, .75), inset 0 0 0 1px rgba(255, 255, 255, .16);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    transition: transform .12s ease, box-shadow .2s ease;
}
.btn-panic:hover { box-shadow: 0 26px 54px -20px rgba(180, 40, 40, .85), inset 0 0 0 1px rgba(255, 255, 255, .22); }
.btn-panic:active { transform: scale(.98); }
.btn-panic i { font-size: 2.5rem; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .25)); }

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 10px;
    border-radius: 16px;
    background: linear-gradient(160deg, #ffffff, #fbf8f1);
    border: 1px solid var(--line);
    color: var(--text);
    font-weight: 600;
    font-size: .8rem;
    text-align: center;
    height: 100%;
    box-shadow: var(--shadow-sm);
    transition: .18s ease;
}
.quick-action:hover {
    border-color: var(--gold);
    color: var(--gold-deep);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}
.quick-action i { font-size: 1.5rem; color: var(--gold-deep); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
    content: ""; position: absolute; left: -19px; top: 4px; width: 10px; height: 10px; border-radius: 50%;
    background: #fff; border: 2px solid var(--gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, .12);
}
.timeline-item.danger::before { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(185, 58, 58, .12); }

.photo-card { border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #fff; height: 100%; box-shadow: var(--shadow-sm); }
.photo-card img { width: 100%; height: 190px; object-fit: cover; display: block; background: #e8e4dc; }
.photo-card .body { padding: 12px 14px; }

.chat-shell {
    height: calc(100vh - 220px);
    min-height: 420px;
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.chat-body { flex: 1 1 auto; overflow-y: auto; padding: 20px; background: #f8f6f1; }
.chat-footer { border-top: 1px solid var(--line); padding: 12px 14px; background: #fff; }
.chat-msg { display: flex; gap: 9px; margin-bottom: 14px; max-width: 78%; }
.chat-msg.mine { margin-left: auto; flex-direction: row-reverse; }
.chat-bubble {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 15px;
    padding: 9px 14px;
    box-shadow: 0 1px 2px rgba(16, 18, 22, .04);
}
.chat-msg.mine .chat-bubble {
    background: linear-gradient(145deg, #222932, #10141a);
    border-color: #10141a;
    color: #fff;
    box-shadow: 0 10px 24px -18px rgba(0, 0, 0, .8);
}
.chat-meta { font-size: .68rem; color: var(--muted); margin-bottom: 2px; }
.chat-msg.mine .chat-meta { text-align: right; color: #8b857a; }
.chat-bubble.public-src { border-left: 3px solid var(--gold); }
.chat-date-sep { text-align: center; font-size: .68rem; color: var(--muted); margin: 12px 0; }
.reply-bar { display: none; background: #fbf4e2; border-bottom: 1px solid #eddfb8; padding: 8px 14px; font-size: .8rem; }
.reply-bar.show { display: flex; align-items: center; gap: 8px; }

.help-card { border: 1px solid #eccfcf; background: #fff; border-radius: 15px; padding: 15px; box-shadow: var(--shadow-sm); }
.help-card.open { box-shadow: 0 0 0 3px rgba(185, 58, 58, .08), var(--shadow-md); }

.empty-state { text-align: center; color: var(--muted); padding: 38px 16px; }
.empty-state i { font-size: 2.4rem; opacity: .35; display: block; margin-bottom: 8px; color: var(--gold-deep); }

/* Form */
.form-label { font-size: .84rem; }
.form-control, .form-select {
    border-radius: 11px;
    border-color: var(--line-strong);
    padding: .55rem .85rem;
    color: var(--text);
    background-color: #fff;
}
.form-control::placeholder { color: #a8a294; }
.form-control:focus, .form-select:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 .2rem rgba(212, 175, 55, .18);
}
.input-group-text { border-color: var(--line-strong); background: #fbf9f4; color: var(--muted); border-radius: 11px; }
.form-check-input:checked { background-color: var(--gold-deep); border-color: var(--gold-deep); }
.form-check-input:focus { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(212, 175, 55, .18); }
.form-text { color: var(--muted); }

/* Modal, dropdown, alert, toast */
.modal-content {
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    background: #fffdf9;
}
.modal { z-index: 1060; }
.modal-backdrop { z-index: 1055; }
.blink-marker { animation: mpBlink 1s infinite; }
.mp-marker.selected { background: linear-gradient(145deg, #ffc107, #e0a800); color: #1a1a1a; animation: mpPulse 1.2s infinite; }
.mp-marker.busy { background: linear-gradient(145deg, #fd7e14, #dc6502); color: #fff; }
@keyframes mpBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
.modal-header { border-bottom: 1px solid var(--line); padding: 16px 22px; }
.modal-footer { border-top: 1px solid var(--line); padding: 14px 22px; }
.modal-title { font-family: var(--font-display); font-weight: 700; letter-spacing: -.01em; }

.dropdown-menu {
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow-md);
    padding: .4rem;
    background: #fffdf9;
}
.dropdown-item { border-radius: 9px; padding: .5rem .7rem; }
.dropdown-item:hover, .dropdown-item:focus { background: #f7f2e6; }
.dropdown-divider { border-color: var(--line); }

.alert { border-radius: 14px; border-width: 1px; }
.alert-warning { background: #fdf6e3; border-color: #eddfb8; color: #6f5716; }
.alert-danger { background: #fbecec; border-color: #eccfcf; color: #8f2f2f; }
.alert-info { background: #eef4f7; border-color: #d4e2ea; color: #2f5568; }
.alert-success { background: #eaf5ee; border-color: #cfe6d8; color: #276040; }
.alert-light { background: #fbf9f4; border-color: var(--line); }

.toast {
    border-radius: 14px;
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    background: #fffdf9;
}

.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 253, 249, .96);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    display: flex;
    z-index: 1030;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -10px 30px -24px rgba(16, 18, 22, .55);
}
.mobile-bottom-nav a {
    flex: 1 1 0;
    text-align: center;
    padding: 8px 2px 7px;
    color: var(--muted);
    font-size: .62rem;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: color .18s ease;
}
.mobile-bottom-nav a i { font-size: 1.24rem; }
.mobile-bottom-nav a.active { color: var(--gold-deep); }
.mobile-bottom-nav a.active i { filter: drop-shadow(0 3px 6px rgba(212, 175, 55, .35)); }
.mobile-bottom-nav a.panic-link i { color: var(--danger); }

.mobile-shell { padding-bottom: 78px; }
.mobile-topbar {
    background:
        radial-gradient(520px 200px at 90% -30%, rgba(185, 28, 28, .28), transparent 65%),
        linear-gradient(135deg, #18181b, #08080a);
    color: #fff;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(212, 175, 55, .3);
}
.mobile-topbar .brand-name { font-size: 1rem; }
.mobile-content { padding: 16px; }

.patrol-hud {
    position: absolute;
    top: 12px;
    left: 12px;
    right: 12px;
    z-index: 500;
    display: flex;
    gap: 8px;
}
.patrol-hud .hud-item {
    flex: 1 1 0;
    background: rgba(14, 17, 22, .86);
    color: #fff;
    border: 1px solid rgba(212, 175, 55, .3);
    border-radius: 13px;
    padding: 9px 10px;
    text-align: center;
    backdrop-filter: blur(8px);
    box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .7);
}
.patrol-hud .hud-value { font-size: 1.02rem; font-weight: 800; line-height: 1.1; color: var(--gold-2); }
.patrol-hud .hud-label { font-size: .58rem; text-transform: uppercase; letter-spacing: .08em; opacity: .72; }

.patrol-map-wrap { position: relative; height: calc(100vh - 230px); min-height: 380px; border-radius: 16px; overflow: hidden; }
.patrol-map-wrap .map-box { height: 100%; border-radius: 0; }

/* Tombol cepat patroli berada di dalam bilah bawah, sejajar dengan
   tombol STOP, agar tidak tertutup bilah STOP pada layar ponsel. */
.patrol-map-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}
.patrol-map-actions .btn {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    box-shadow: 0 8px 20px -8px rgba(0, 0, 0, .55);
}
.patrol-map-actions .btn.following {
    background: var(--gold-2);
    border-color: var(--gold-2);
    color: #16110a;
}

.patrol-stop-bar {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    z-index: 1035;
}

/* Layar patroli aktif: peta mengisi sisa tinggi layar dan bilah STOP
   berada di alur normal, sehingga tidak menutupi status GPS maupun tombol. */
body.patrol-active .mobile-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100dvh;
}
body.patrol-active main {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}
body.patrol-active .patrol-screen {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    padding: 12px 12px 0;
}
body.patrol-active .patrol-map-wrap {
    flex: 1 1 0;
    height: auto;
    min-height: 200px;
}
body.patrol-active .patrol-stop-bar {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    padding: 10px 0 calc(12px + env(safe-area-inset-bottom));
}
@media (max-width: 360px) {
    body.patrol-active .patrol-map-actions { gap: 6px; }
    body.patrol-active .patrol-map-actions .btn { width: 42px; height: 42px; }
    body.patrol-active #stopPatrol { font-size: .88rem; padding-left: .5rem; padding-right: .5rem; }
}

/* ---------------- Marker peta ---------------- */
.mp-marker {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 800;
    font-size: .68rem;
    border: 3px solid #fff;
    box-shadow: 0 4px 12px rgba(16, 18, 22, .4);
}
.mp-marker.online { background: linear-gradient(145deg, #2f9e63, #1f6b43); }
.mp-marker.offline { background: linear-gradient(145deg, #9aa0ab, #5b6270); }
.mp-marker.me {
    width: 44px;
    height: 44px;
    color: #16110a;
    background: linear-gradient(145deg, #e7c778, #b98f36);
    border-color: #fffdf7;
    box-shadow: 0 0 0 6px rgba(212, 175, 55, .22), 0 6px 16px rgba(16, 18, 22, .45);
    animation: mpPulse 2s infinite;
}
.mp-marker.help {
    background: linear-gradient(145deg, #e25454, #8f241c);
    font-size: 1.15rem;
    animation: mpPulse 1.4s infinite;
}
.mp-marker.help::after {
    content: "";
    position: absolute;
    inset: -8px;
    border-radius: 50%;
    border: 2px solid rgba(226, 84, 84, .6);
    animation: mpPulseRing 1.4s infinite;
}
@keyframes mpPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.08); }
}
@keyframes mpPulseRing {
    0% { transform: scale(.8); opacity: .9; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* ---------------- Landing & auth ---------------- */
.landing-hero {
    background:
        radial-gradient(1050px 540px at 85% -12%, rgba(185, 28, 28, .3), transparent 62%),
        radial-gradient(760px 460px at -5% 105%, rgba(212, 175, 55, .14), transparent 60%),
        linear-gradient(135deg, #0a0a0c 0%, #141416 52%, #1c1c1f 100%);
    color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.landing-nav { padding: 22px 0; }
.landing-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(185, 28, 28, .18);
    border: 1px solid rgba(242, 215, 122, .35);
    color: var(--gold-2);
    padding: 6px 14px;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 600;
    letter-spacing: .02em;
}
.landing-title {
    font-family: var(--font-serif);
    font-size: clamp(2.1rem, 5vw, 3.7rem);
    font-weight: 700;
    line-height: 1.06;
    letter-spacing: -.015em;
}
.landing-sub { color: #b6b1a6; font-size: 1.02rem; max-width: 620px; }
.feature-card {
    background: rgba(255, 255, 255, .035);
    border: 1px solid rgba(212, 175, 55, .2);
    border-radius: 16px;
    padding: 20px;
    height: 100%;
    color: #dedad0;
    backdrop-filter: blur(6px);
    transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.feature-card:hover { transform: translateY(-3px); border-color: rgba(212, 175, 55, .5); background: rgba(255, 255, 255, .055); }
.feature-card i { font-size: 1.5rem; color: var(--gold-2); }
.hero-panel {
    background: rgba(255, 255, 255, .045);
    border: 1px solid rgba(212, 175, 55, .28);
    border-radius: 22px;
    padding: 22px;
    backdrop-filter: blur(10px);
    box-shadow: 0 40px 90px -50px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.hero-map {
    height: 260px;
    border-radius: 14px;
    overflow: hidden;
    background: #0f1319;
}
.hero-map svg { display: block; width: 100%; height: 100%; }
.hero-route-flow {
    stroke-dasharray: 6 14;
    animation: heroRouteFlow 2.4s linear infinite;
}
@keyframes heroRouteFlow { to { stroke-dashoffset: -20; } }
.hero-alert-ring {
    transform-box: fill-box;
    transform-origin: center;
    animation: heroAlertPulse 2s ease-out infinite;
}
@keyframes heroAlertPulse {
    0% { transform: scale(.6); opacity: .85; }
    100% { transform: scale(2.1); opacity: 0; }
}
.hero-rotator circle { transform-box: fill-box; transform-origin: center; }
.rotator-blue { animation: rotatorBlue .7s steps(1, end) infinite; }
.rotator-red { animation: rotatorRed .7s steps(1, end) infinite; opacity: .12; }
.rotator-glow { animation: rotatorGlow .7s ease-in-out infinite alternate; }
@keyframes rotatorBlue {
    0%, 49% { opacity: 1; transform: scale(1.05); }
    50%, 100% { opacity: .12; transform: scale(.9); }
}
@keyframes rotatorRed {
    0%, 49% { opacity: .12; transform: scale(.9); }
    50%, 100% { opacity: 1; transform: scale(1.05); }
}
@keyframes rotatorGlow {
    from { opacity: .25; transform: scale(.9); }
    to { opacity: .7; transform: scale(1.15); }
}
@media (prefers-reduced-motion: reduce) {
    .hero-route-flow, .hero-alert-ring,
    .rotator-blue, .rotator-red, .rotator-glow { animation: none; }
}

.auth-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; background: #fff; }
.auth-brand {
    background:
        radial-gradient(900px 460px at 90% 0%, rgba(185, 28, 28, .28), transparent 62%),
        radial-gradient(700px 420px at 0% 100%, rgba(212, 175, 55, .12), transparent 60%),
        linear-gradient(150deg, #0a0a0c, #141416 60%, #1c1c1f);
    color: #fff;
    padding: 54px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    border-right: 1px solid rgba(212, 175, 55, .2);
}
.auth-brand h2 { font-family: var(--font-serif); letter-spacing: -.015em; }
.auth-form-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    background:
        radial-gradient(700px 400px at 100% 0%, rgba(212, 175, 55, .08), transparent 60%),
        #faf8f3;
}
.auth-card { width: 100%; max-width: 430px; }
.auth-card .card { border-radius: 20px; box-shadow: var(--shadow-md); }
.auth-card .card-body h3 { font-family: var(--font-display); letter-spacing: -.01em; }
.auth-feature { display: flex; gap: 12px; margin-bottom: 16px; color: #b6b1a6; font-size: .88rem; }
.auth-feature i { color: var(--gold-2); font-size: 1.1rem; }

.public-shell { min-height: 100vh; background: var(--bg); }
.public-header {
    background:
        radial-gradient(600px 220px at 90% -40%, rgba(185, 28, 28, .26), transparent 65%),
        linear-gradient(135deg, #18181b, #08080a);
    color: #fff;
    padding: 18px;
    border-bottom: 1px solid rgba(212, 175, 55, .3);
}
.public-content { max-width: 760px; margin: 0 auto; padding: 18px 16px 92px; }

/* ---------------- Utilitas ---------------- */
.text-gold { color: var(--gold-2) !important; }
.text-warning { color: var(--gold) !important; }
.text-muted { color: var(--muted) !important; }
.text-primary { color: var(--blue) !important; }
.link-primary { color: var(--blue) !important; }
.border-warning { border-color: var(--gold) !important; }
.min-w-0 { min-width: 0; }
.rounded-4 { border-radius: 16px !important; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }

/* ---------------- Responsive ---------------- */
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); width: 264px !important; }
    .sidebar.open { transform: translateX(0); box-shadow: 0 0 60px rgba(0, 0, 0, .45); }
    .app-main { margin-left: 0 !important; }
    .sidebar-toggle { display: inline-flex; }
    #sidebarCollapse { display: none !important; }
    .page-content { padding: 20px 16px 34px; }
    .topbar { padding: 11px 16px; }
    .topbar h1 { font-size: 1rem; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
    .map-box { height: 340px; }
    .map-box.lg { height: 420px; }
    .chat-shell { height: calc(100vh - 190px); }
}

@media (max-width: 575.98px) {
    .page-content { padding: 15px 12px 30px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-value { font-size: 1.3rem; }
    .stat-icon { width: 42px; height: 42px; font-size: 1.08rem; }
    .table-responsive { border-radius: 12px; }
    .card-body { padding: 14px 15px; }
    .card-header { padding: 13px 15px; }
    .topbar h1 { padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

@media print {
    .sidebar, .topbar, .mobile-bottom-nav, .no-print { display: none !important; }
    .app-main { margin-left: 0; }
    .page-content { padding: 0; }
    body { background: #fff; }
    .card { box-shadow: none; }
}
