/* =============================================
   COMS - Cendekia Ops Monitoring System
   Modern Green Theme
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=DM+Serif+Display&display=swap');

:root {
    --primary: #16a34a;
    --primary-light: #16a34a20;
    --primary-hover: #15803d;
    --primary-dark: #064e3b;
    --primary-50: #f0fdf4;
    --primary-100: #dcfce7;
    --primary-200: #bbf7d0;
    --primary-300: #86efac;
    --primary-400: #4ade80;
    --primary-500: #22c55e;
    --primary-600: #16a34a;
    --primary-700: #15803d;
    --primary-800: #166534;
    --primary-900: #14532d;

    --secondary: #064e3b;
    --accent: #f59e0b;
    --accent-light: #fbbf24;
    --accent-dark: #d97706;

    --danger: #ef4444;
    --danger-light: #fca5a5;
    --warning: #f59e0b;
    --info: #3b82f6;
    --success: #10b981;

    --bg: #f0fdf4;
    --bg-card: #ffffff;
    --bg-sidebar: #064e3b;
    --bg-hover: #f0fdf4;

    --text: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --text-light: #cbd5e1;
    --text-white: #ffffff;

    --border: #e2e8f0;
    --border-light: #f1f5f9;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.04);
    --shadow: 0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,.1);

    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --sidebar-width: 270px;
    --header-height: 64px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── RESET ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── LOGIN PAGE ── */
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary) 0%, #022c22 40%, var(--primary) 100%);
    position: relative;
    overflow: hidden;
}
.login-page::before {
    content: '';
    position: absolute;
    width: 600px; height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
    top: -200px; right: -100px;
}
.login-page::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(245,158,11,0.1) 0%, transparent 70%);
    bottom: -100px; left: -50px;
}

.login-card {
    background: rgba(255,255,255,0.97);
    backdrop-filter: blur(20px);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg), 0 0 80px rgba(22,163,74,0.15);
    position: relative;
    z-index: 1;
    animation: slideUp 0.6s ease-out;
}
.login-logo {
    text-align: center;
    margin-bottom: 32px;
}
.login-logo img { height: 56px; margin-bottom: 12px; }
.login-logo h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}
.login-logo p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Captcha */
.captcha-box {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #f0fdf4, #ecfdf5);
    border: 1.5px dashed var(--primary);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    user-select: none;
}
.captcha-question {
    font-size: 20px;
    font-weight: 800;
    color: var(--secondary);
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    flex: 1;
}
.captcha-refresh {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}
.captcha-refresh:hover {
    background: rgba(22,163,74,0.1);
    transform: rotate(180deg);
}

/* ── FORMS ── */
.form-group {
    margin-bottom: 20px;
}
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    letter-spacing: 0.3px;
}
.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    transition: var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    background: #fff;
}
.form-control::placeholder { color: var(--text-muted); }

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a6b57' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

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

/* ── BUTTONS ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    transition: var(--transition);
    white-space: nowrap;
    letter-spacing: 0.3px;
}
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(22,163,74,0.3);
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(22,163,74,0.4);
}
.btn i.bi { margin-right: 4px; }
.btn-secondary {
    background: var(--bg);
    color: var(--text-secondary);
    border: 2px solid var(--border);
}
.btn-secondary:hover { background: var(--primary-50); border-color: var(--primary-200); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #dc2626; }
.btn-accent {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
    color: white;
}
.btn-sm { padding: 8px 14px; font-size: 12px; }
.btn-lg { padding: 14px 32px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-icon {
    width: 40px; height: 40px; padding: 0;
    border-radius: var(--radius-sm);
}
.btn-ghost { background: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-hover); }

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

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(180deg, var(--bg-sidebar) 0%, #022c22 100%);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 1040;
    transition: transform 0.3s cubic-bezier(.4,0,.2,1);
    overflow: hidden;
}
.sidebar-header {
    padding: 0;
    border-bottom: none;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(255,255,255,.08);
    min-height: 72px;
}
.sidebar-brand img { height: 42px; width: 42px; border-radius: 10px; object-fit: cover; background: rgba(255,255,255,.15); flex-shrink: 0; }
.sidebar-brand .brand-icon {
    width: 42px; height: 42px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #22c55e);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff; flex-shrink: 0;
}
.sidebar-brand-text {
    color: #fff;
    font-weight: 800;
    font-size: 17px;
    letter-spacing: 0.5px;
    line-height: 1;
    font-family: 'DM Serif Display', serif;
}

.sidebar-nav {
    padding: 12px;
    flex: 1;
    overflow-y: auto;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 4px; }
.nav-section-title {
    font-size: 10px;
    font-weight: 700;
    color: rgba(255,255,255,0.3);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 16px 12px 8px;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: rgba(255,255,255,0.65);
    font-size: 13.5px;
    font-weight: 500;
    transition: var(--transition);
    margin-bottom: 2px;
    cursor: pointer;
    position: relative;
}
.nav-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.nav-item.active {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(22,163,74,.4);
}
.nav-item .icon { font-size: 18px; width: 22px; text-align: center; }
.nav-item i.bi { font-size: 18px; width: 22px; text-align: center; }
.nav-badge {
    position: absolute;
    right: 10px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid rgba(255,255,255,0.08);
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}
.sidebar-user:hover { }
.sidebar-avatar {
    width: 36px; height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary) 0%, #22c55e 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 14px;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-avatar img {
    width: 36px; height: 36px;
    border-radius: 10px;
    object-fit: cover;
}
.sidebar-user-info {
    flex: 1;
    min-width: 0;
}
.sidebar-user-info h4 {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin: 0;
}
.sidebar-user-info span {
    font-size: 11px;
    color: rgba(255,255,255,0.45);
}
.sidebar-user-actions {
    display: flex;
    gap: 4px;
}
.sidebar-user-actions button {
    width: 32px; height: 32px;
    border: none;
    background: rgba(255,255,255,.06);
    border-radius: 8px;
    color: rgba(255,255,255,.5);
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}
.sidebar-user-actions button:hover {
    background: rgba(255,255,255,.12);
    color: #fff;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

/* Header */
.app-header {
    height: var(--header-height);
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0,0,0,.05);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 1030;
}
.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}
.header-title h1 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
    font-family: 'DM Serif Display', serif;
}
.header-title p {
    font-size: 12px;
    color: var(--text-muted);
}
.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}
.header-btn {
    width: 40px; height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 19px;
    transition: var(--transition);
    position: relative;
}
.header-btn:hover { background: var(--primary-light); color: var(--primary); }
.header-btn .badge {
    position: absolute;
    top: 8px; right: 8px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--danger);
    border: 2px solid #fff;
    display: block;
    padding: 0;
    min-width: 0;
    font-size: 0;
}
.header-btn .badge-count {
    position: absolute;
    top: 4px; right: 4px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}
.menu-toggle { display: none; }

/* Page Content */
.page-content {
    padding: 24px 28px;
}

/* ── CARDS ── */
.card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: none;
    box-shadow: var(--shadow);
    transition: var(--transition);
    overflow: hidden;
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-weight: 600;
    font-size: 15px;
}
.card-header h3 {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
.card-body { padding: 20px 24px; }
.card-footer {
    padding: 12px 24px;
    border-top: 1px solid var(--border-light);
}

/* ── STAT CARDS ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card {
    background: var(--bg-card);
    border-radius: var(--radius);
    border: none;
    padding: 20px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.stat-card:hover {
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}
.stat-icon {
    width: 48px; height: 48px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}
.stat-icon.green { background: var(--primary-100); color: var(--primary); }
.stat-icon.amber { background: #fef3c7; color: var(--accent-dark); }
.stat-icon.red { background: #fee2e2; color: var(--danger); }
.stat-icon.blue { background: #dbeafe; color: var(--info); }
.stat-info h4 {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    line-height: 1;
    letter-spacing: -0.5px;
    font-family: 'DM Serif Display', serif;
}
.stat-info p {
    font-size: 12.5px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 500;
}

/* ── GRID LAYOUTS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; }
table {
    width: 100%;
    border-collapse: collapse;
}
table th, table td {
    text-align: left;
    padding: 12px 16px;
    font-size: 13px;
}
table th {
    font-weight: 700;
    color: #64748b;
    background: #f8fafc;
    border: none;
    white-space: nowrap;
    font-size: 11.5px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
table td {
    border-bottom: 1px solid #f1f5f9;
    color: var(--text);
    font-size: 13.5px;
    vertical-align: middle;
}
table tbody tr:hover { background: var(--bg-hover); }

/* ── BADGES ── */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.badge-status.submitted { background: #dbeafe; color: #1d4ed8; }
.badge-status.verified { background: var(--primary-100); color: var(--primary); }
.badge-status.rejected { background: #fee2e2; color: #dc2626; }
.badge-status.pending { background: #fef3c7; color: #b45309; }
.badge-status.approved { background: var(--primary-100); color: var(--primary); }
.badge-status.menunggu_verifikasi { background: #fef3c7; color: #b45309; }
.badge-status.disetujui { background: #dbeafe; color: #1d4ed8; }
.badge-status.ditindaklanjuti { background: #e0e7ff; color: #4338ca; }
.badge-status.selesai { background: var(--primary-100); color: var(--primary); }
.badge-status.rendah { background: #dbeafe; color: #1d4ed8; }
.badge-status.sedang { background: #fef3c7; color: #b45309; }
.badge-status.tinggi { background: #fed7aa; color: #c2410c; }
.badge-status.kritis { background: #fee2e2; color: #dc2626; }
.badge-freq {
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    background: var(--primary-50);
    color: var(--primary);
}

/* ── FORM PAGE (replaces modals) ── */
.form-page {
    max-width: 640px;
    margin: 0 auto;
}
.form-page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.form-page-header h3 {
    font-size: 18px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
    font-family: 'DM Serif Display', serif;
}
.btn-back {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
}
.btn-back:hover {
    color: var(--primary);
    background: var(--primary-50);
}
.form-page .card-body {
    padding: 24px;
}

/* ── DETAIL GRID ── */
.detail-grid {
    display: grid;
    gap: 14px;
    margin-bottom: 16px;
}
.detail-item {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    padding: 10px 14px;
    background: var(--bg);
    border-radius: var(--radius-sm);
}
.detail-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    width: 100%;
}
.detail-value {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    word-break: break-word;
}

@media (max-width: 480px) {
    .form-page .card-body { padding: 16px; }
    .form-page-header h3 { font-size: 16px; }
    .detail-item { padding: 8px 12px; }
}

/* ── MODAL (legacy) ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 0.2s ease;
}
.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 560px;
    margin: auto 0;
    flex-shrink: 0;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: white;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 2;
}
.modal-header h3 {
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    padding-right: 8px;
}
.modal-close {
    width: 32px; height: 32px;
    min-width: 32px;
    border: none;
    background: var(--bg);
    border-radius: 8px;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    flex-shrink: 0;
}
.modal-close:hover {
    background: var(--border-light);
    color: var(--text);
}
.modal-body {
    padding: 20px;
    overflow-wrap: break-word;
    word-break: break-word;
}
.modal-body img {
    max-width: 100%;
    height: auto;
}
.modal-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* ── PHOTO GRID ── */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.photo-grid img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}
.photo-grid img:hover {
    border-color: var(--primary);
    transform: scale(1.03);
}

/* ── CAMERA CAPTURE ── */
.camera-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: var(--primary-50);
}
.camera-zone:hover {
    border-color: var(--primary);
    background: var(--primary-100);
}
.camera-zone .icon { font-size: 32px; color: var(--primary); }
.camera-zone .icon i { font-size: 32px; }
.camera-zone p { font-size: 13px; color: var(--text-muted); margin-top: 8px; }

.photo-previews {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}
.photo-preview {
    position: relative;
    width: 80px; height: 80px;
}
.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}
.photo-preview .remove {
    position: absolute;
    top: -6px; right: -6px;
    width: 22px; height: 22px;
    border-radius: 50%;
    background: var(--danger);
    color: white;
    border: 2px solid white;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

/* ── CHAT ── */
.chat-layout { display: flex; height: calc(100vh - var(--header-height) - 48px); }
.chat-sidebar {
    width: 280px;
    border-right: 1px solid var(--border-light);
    background: white;
    overflow-y: auto;
}
.chat-user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 1px solid var(--border-light);
}
.chat-user-item:hover, .chat-user-item.active {
    background: var(--primary-50);
}
.chat-user-badge {
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    line-height: 20px;
    text-align: center;
    border-radius: 10px;
    padding: 0 6px;
    flex-shrink: 0;
}
.chat-main { flex: 1; display: flex; flex-direction: column; }
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.chat-bubble {
    max-width: 70%;
    padding: 10px 16px;
    border-radius: 16px;
    font-size: 14px;
    line-height: 1.5;
    animation: fadeIn 0.2s ease;
}
.chat-bubble.sent {
    align-self: flex-end;
    background: var(--primary);
    color: white;
    border-bottom-right-radius: 4px;
}
.chat-bubble.received {
    align-self: flex-start;
    background: var(--bg);
    border: 1px solid var(--border-light);
    border-bottom-left-radius: 4px;
}
.chat-bubble .time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    display: block;
}
.chat-input-area {
    padding: 10px 16px;
    border-top: 1px solid var(--border-light);
    background: white;
    position: relative;
}
.chat-input-area .chat-input-row input {
    flex: 1;
    padding: 10px 16px;
    border: 2px solid var(--border);
    border-radius: 24px;
    outline: none;
    font-size: 14px;
}
.chat-input-area .chat-input-row input:focus { border-color: var(--primary); }

/* ── NOTIFICATIONS DROPDOWN ── */
.notif-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-light);
    z-index: 300;
    animation: slideUp 0.2s ease;
}
.notif-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.notif-header h4 { font-size: 14px; font-weight: 700; }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: var(--transition);
}
.notif-item:hover { background: var(--bg-hover); }
.notif-item.unread { background: var(--primary-50); }
.notif-item h5 { font-size: 13px; font-weight: 600; color: var(--text); }
.notif-item p { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.notif-item .time { font-size: 11px; color: var(--text-light); margin-top: 4px; }

/* ── SETTINGS ── */
.settings-section {
    margin-bottom: 32px;
}
.settings-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--primary-100);
    color: var(--primary-dark);
}
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.color-input-wrap input[type="color"] {
    width: 44px; height: 44px;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 2px;
    cursor: pointer;
}
.logo-upload-zone {
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}
.logo-upload-zone:hover { border-color: var(--primary); background: var(--primary-50); }
.logo-preview { max-height: 80px; margin-top: 10px; }

/* ── PROGRESS BAR ── */
.progress-bar {
    height: 8px;
    background: var(--border-light);
    border-radius: 4px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #22c55e);
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(.4,0,.2,1);
}
.progress-fill.warning { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.progress-fill.danger { background: linear-gradient(90deg, var(--danger), #fca5a5); }

/* ── SCORE RING ── */
.score-ring {
    width: 80px; height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 800;
    position: relative;
}
.score-ring::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: white;
}
.score-ring span { position: relative; z-index: 1; }

/* ── EMPTY STATE ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state .icon i { font-size: 48px; }
.empty-state h4 { font-size: 16px; font-weight: 600; color: var(--text-secondary); }
.empty-state p { font-size: 13px; margin-top: 6px; }

/* ── TOAST ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 500;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toast {
    padding: 14px 20px;
    background: white;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 500;
    animation: slideRight 0.3s ease;
    border-left: 4px solid var(--primary);
}
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--accent); }

/* ── ANIMATIONS ── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideRight { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spinner-border { to { transform: rotate(360deg); } }

.fade-in { animation: fadeIn 0.4s ease; }
.slide-up { animation: slideUp 0.4s ease; }

/* ── SPINNER (Bootstrap-compatible) ── */
.spinner-border {
    display: inline-block;
    width: 2rem; height: 2rem;
    vertical-align: -.125em;
    border: .25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border .75s linear infinite;
}
.text-success { color: var(--primary) !important; }

/* ── RESPONSIVE ── */

/* Profile page layout */
.profile-layout {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 24px;
}

/* Responsive map containers */
.responsive-map { height: 450px; }
.responsive-map-sm { height: 350px; }

/* Mobile card view helpers (hidden by default, shown on mobile) */
.mobile-cards { display: none; }
.desktop-table { display: block; }

@media (max-width: 1024px) {
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .settings-grid { grid-template-columns: 1fr; }
    .profile-layout { grid-template-columns: 1fr; gap: 16px; }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        backdrop-filter: blur(4px);
        z-index: 1035;
        display: none;
    }
    .sidebar-overlay.show { display: block; }
    .main-content { margin-left: 0; }
    .menu-toggle { display: flex; }
    .page-content { padding: 12px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .stat-card { padding: 14px; gap: 10px; }
    .stat-icon { width: 40px; height: 40px; font-size: 18px; }
    .stat-info h4 { font-size: 20px; }
    .stat-info p { font-size: 11px; }
    .app-header { padding: 0 12px; left: 0; }
    .header-title h1 { font-size: 15px; }
    .header-title p { display: none; }

    /* Chat */
    .chat-layout { flex-direction: column; height: calc(100vh - var(--header-height) - var(--bottom-nav-height) - 16px); }
    .chat-sidebar { width: 100%; max-height: 160px; border-right: none; border-bottom: 1px solid var(--border-light); }
    .chat-messages { padding: 12px; }
    .chat-bubble { max-width: 85%; font-size: 13px; padding: 8px 12px; }
    .chat-input-area { padding: 8px 10px; }
    .chat-input-row { gap: 4px; }
    .chat-input-row input { padding: 8px 12px; font-size: 13px; }
    .chat-attach-btns { gap: 0; }
    .chat-attach-btns .btn { width: 30px; height: 30px; font-size: 14px; }
    .chat-media { max-width: 180px; }
    .emoji-picker { max-width: 260px; left: 0; }

    /* Notifications */
    .notif-dropdown { width: 300px; right: -60px; }

    /* Modals/forms */
    .modal-overlay { padding: 10px; }
    .modal-content { max-width: 100%; margin: 10px 0; }
    .modal-header { padding: 14px 16px; }
    .modal-header h3 { font-size: 15px; }
    .modal-body { padding: 16px; }
    .modal-body .mb-2 { font-size: 14px; }
    .modal-footer { padding: 14px 16px; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
    .photo-grid img { height: 80px; }
    .camera-zone { padding: 16px; }
    .form-group { margin-bottom: 12px; }
    .form-control { padding: 10px 12px; font-size: 14px; }
    textarea.form-control { min-height: 80px; }
    .form-page .card-body { padding: 16px; }

    /* Profile layout */
    .profile-layout { grid-template-columns: 1fr; gap: 12px; }

    /* Map responsive */
    .responsive-map { height: min(400px, 55vh); }
    .responsive-map-sm { height: min(300px, 45vh); }

    /* Card body compact */
    .card-body { padding: 14px 16px; }
    .card-header { padding: 12px 16px; }
    .card-header h3 { font-size: 14px; }

    /* Tables → mobile card view */
    .mobile-cards { display: block; }
    .desktop-table { display: none; }

    /* Table fallback (keep working if no mobile cards) */
    .table-wrap { margin: -6px -8px; }
    .table-wrap table th, .table-wrap table td { padding: 8px 10px; font-size: 12px; }
    .table-wrap table th { font-size: 10px; }

    /* Forms in grid */
    .settings-grid { gap: 10px; }
    .detail-grid { gap: 10px; }

    /* Late staff / dashboard compact */
    .late-staff-item { padding: 8px 0; gap: 8px; }

    /* Empty state compact */
    .empty-state { padding: 30px 16px; }
    .empty-state .icon, .empty-state .icon i { font-size: 36px; }
    .empty-state h4 { font-size: 14px; }

    /* Legend compact */
    .map-legend { gap: 4px; }
    .legend-item { padding: 3px 8px; font-size: 11px; }
}

@media (max-width: 480px) {
    .page-content { padding: 10px; }
    .modal-overlay { padding: 6px; }
    .modal-content { margin: 6px 0; border-radius: var(--radius); }
    .modal-header { padding: 12px 14px; }
    .modal-header h3 { font-size: 14px; }
    .modal-body { padding: 14px; }
    .modal-body .mb-2 { font-size: 13px; }
    .modal-footer { padding: 12px 14px; }
    .btn { padding: 10px 16px; font-size: 13px; }
    .btn-sm { padding: 6px 10px; font-size: 11px; }
    .photo-grid { grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
    .photo-grid img { height: 70px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .stat-card { padding: 12px; gap: 8px; }
    .stat-icon { width: 36px; height: 36px; font-size: 16px; border-radius: 8px; }
    .stat-info h4 { font-size: 18px; }
    .stat-info p { font-size: 10px; }
    .notif-dropdown { width: calc(100vw - 20px); right: -40px; }
    .responsive-map { height: min(300px, 50vh); }
    .responsive-map-sm { height: min(250px, 45vh); }
    .card-body { padding: 12px; }
    .card-header { padding: 10px 12px; }
    .form-page-header h3 { font-size: 15px; }

    /* Chat extra compact */
    .chat-sidebar { max-height: 140px; }
    .chat-user-item { padding: 10px 12px; gap: 8px; }
    .chat-messages { padding: 8px; gap: 8px; }
    .chat-bubble { max-width: 90%; padding: 8px 10px; font-size: 12.5px; border-radius: 12px; }

    /* Profile */
    .profile-avatar-wrap { width: 90px; height: 90px; }
    .profile-avatar-wrap img { width: 90px; height: 90px; }
    .profile-avatar-placeholder { width: 90px; height: 90px; font-size: 34px; }
    .profile-stat-box { padding: 8px 10px; }
    .profile-stat-box .num { font-size: 16px; }

    /* Score ring */
    .score-ring { width: 60px; height: 60px; font-size: 18px; }

    /* Header compact */
    .header-title h1 { font-size: 14px; }
    .header-btn { width: 36px; height: 36px; font-size: 16px; }
    .header-avatar { width: 32px; height: 32px; }
    .header-avatar img { width: 32px; height: 32px; }

    /* Performance cards */
    .grid-2[style*="minmax(200px"] { grid-template-columns: 1fr !important; }
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── UTILITIES ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--primary); }
.text-danger { color: var(--danger); }
.text-sm { font-size: 12px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.w-full { width: 100%; }

/* ── CHAT ENHANCEMENTS ── */
.chat-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
}
.chat-attach-btns {
    display: flex;
    gap: 2px;
}
.chat-attach-btns .btn {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 16px;
    color: var(--text-secondary);
}
.chat-attach-btns .btn:hover {
    background: var(--bg-hover);
    color: var(--primary);
}
.chat-media {
    max-width: 250px;
    max-height: 200px;
    border-radius: 8px;
    cursor: pointer;
    display: block;
    margin: 4px 0;
}
.chat-file-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    font-size: 13px;
    text-decoration: none;
    color: inherit;
    word-break: break-all;
}
.chat-file-link:hover { text-decoration: underline; }
.chat-caption {
    margin-top: 4px;
    font-size: 13px;
}
.chat-sender-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 2px;
}
.chat-bubble.received .chat-file-link {
    background: rgba(0,0,0,0.06);
}

/* ── EMOJI PICKER ── */
.emoji-picker {
    position: absolute;
    bottom: 100%;
    left: 10px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-md);
    padding: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 300px;
    z-index: 50;
}
.emoji-picker.hidden { display: none; }
.emoji-item {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.15s;
}
.emoji-item:hover { background: var(--bg-hover); transform: scale(1.2); }

/* ── LATE STAFF LIST ── */
.late-staff-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.late-staff-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    border-radius: 8px;
    background: #fff5f5;
    border-left: 3px solid var(--danger);
}

/* ── CARD WARNING ── */
.card-warning {
    border-left: 4px solid var(--danger);
}

/* ── ACTION CARDS (staff dashboard) ── */
.action-card {
    transition: transform 0.2s, box-shadow 0.2s;
}
.action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* ── GPS MAP ── */
#gps-map {
    border-radius: 0 0 12px 12px;
}
.leaflet-popup-content-wrapper {
    border-radius: 8px !important;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 13px;
}

/* ── CHAT RESPONSIVE FIX ── */
@media (max-width: 768px) {
    .chat-attach-btns { gap: 0; }
    .chat-attach-btns .btn { width: 30px; height: 30px; font-size: 14px; }
    .chat-media { max-width: 180px; }
    .emoji-picker { max-width: 260px; left: 0; }
}

/* ── PROFILE PAGE ── */
.profile-avatar-wrap {
    position: relative;
    width: 110px; height: 110px;
    margin: 0 auto 12px;
}
.profile-avatar-wrap img {
    width: 110px; height: 110px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
}
.profile-avatar-placeholder {
    width: 110px; height: 110px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 42px;
    color: #fff;
    font-weight: 700;
}
.profile-avatar-btn {
    position: absolute;
    bottom: 0; right: 0;
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--primary);
    border: 3px solid #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    transition: var(--transition);
}
.profile-avatar-btn:hover { background: var(--primary-hover); }

.profile-stat-box {
    text-align: center;
    padding: 12px 16px;
    border-radius: 10px;
}
.profile-stat-box .num {
    font-size: 20px;
    font-weight: 800;
}
.profile-stat-box .label {
    font-size: 10px;
    color: #64748b;
}

/* ── ENHANCED USERS TABLE ── */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { padding: 12px 10px; font-size: 13px; vertical-align: middle; border-bottom: 1px solid #f1f5f9; }
.users-table thead th { background: #f8fafc; color: #64748b; font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; white-space: nowrap; }
.users-table tbody tr:hover { background: rgba(22,163,74,.03); }
.users-table tbody tr:last-child td { border-bottom: none; }
.users-table .col-center { text-align: center; }
.users-table .col-actions { white-space: nowrap; text-align: right; }
.user-avatar-cell { display: flex; align-items: center; gap: 10px; }
.user-avatar-img { width: 32px; height: 32px; border-radius: 8px; object-fit: cover; flex-shrink: 0; }
.user-avatar-placeholder { width: 32px; height: 32px; border-radius: 8px; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.user-name { font-weight: 700; font-size: 13px; color: #1e293b; }
.user-email-sub { font-size: 11px; color: #94a3b8; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.badge-role { padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; background: var(--primary-light); color: var(--primary); }
.badge-active { padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; background: #dcfce7; color: #16a34a; }
.badge-inactive { padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 600; background: #f1f5f9; color: #64748b; }

.btn-sm-icon {
    width: 32px; height: 32px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 14px;
    transition: var(--transition);
    cursor: pointer;
}
.btn-sm-icon.edit { background: rgba(22,163,74,.1); color: var(--primary); }
.btn-sm-icon.edit:hover { background: rgba(22,163,74,.2); }
.btn-sm-icon.warn { background: rgba(245,158,11,.1); color: #d97706; }
.btn-sm-icon.warn:hover { background: rgba(245,158,11,.2); }
.btn-sm-icon.danger { background: rgba(239,68,68,.1); color: #dc2626; }
.btn-sm-icon.danger:hover { background: rgba(239,68,68,.2); }
.btn-sm-icon.success { background: rgba(16,185,129,.1); color: #10b981; }
.btn-sm-icon.success:hover { background: rgba(16,185,129,.2); }

/* Mobile user cards */
.user-card-mobile { display: none; }
@media (max-width: 899px) {
    .user-table-desktop { display: none !important; }
    .user-card-mobile { display: block; }
}
.user-mobile-item {
    display: flex; align-items: center; padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9; gap: 12px;
}
.user-mobile-item:hover { background: rgba(22,163,74,.03); }
.user-mobile-item:last-child { border-bottom: none; }
.user-mobile-avatar {
    width: 40px; height: 40px; border-radius: 10px;
    background: var(--primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px; font-weight: 700; flex-shrink: 0;
    overflow: hidden;
}
.user-mobile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-mobile-info { flex: 1; min-width: 0; }
.user-mobile-name { font-weight: 700; font-size: 13.5px; color: #1e293b; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mobile-email { font-size: 11.5px; color: #94a3b8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-mobile-meta { display: flex; gap: 6px; margin-top: 4px; align-items: center; flex-wrap: wrap; }
.user-mobile-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* ── HEADER PROFILE AVATAR ── */
.header-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    padding: 0;
}
.header-avatar img {
    width: 36px; height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

/* ── ANIMATIONS ── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp .4s ease both; }
.delay-1 { animation-delay: .05s; }
.delay-2 { animation-delay: .1s; }
.delay-3 { animation-delay: .15s; }
.delay-4 { animation-delay: .2s; }

/* Map Legend */
.map-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    background: var(--bg);
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid var(--border-light);
}
.legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    flex-shrink: 0;
}
.legend-label {
    font-weight: 600;
    color: var(--text-dark);
}
.legend-staff {
    color: var(--text-muted);
    font-size: 11px;
}

/* Color input wrapper */
.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}
.color-input-wrap input[type="color"] {
    width: 42px;
    height: 38px;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
    background: transparent;
}

/* Leaflet Draw overrides */
.leaflet-draw-toolbar a {
    background-color: #fff !important;
}
.leaflet-draw-actions a {
    font-size: 12px !important;
}

/* =============================================
   MOBILE CARD VIEW (replaces tables on small screens)
   ============================================= */
.mobile-card-item {
    background: var(--card-bg);
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
}
.mobile-card-item .mc-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
}
.mobile-card-item .mc-title {
    font-weight: 700;
    font-size: 14px;
    color: #1e293b;
    line-height: 1.3;
}
.mobile-card-item .mc-meta {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 2px;
}
.mobile-card-item .mc-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 13px;
}
.mobile-card-item .mc-label {
    color: #64748b;
    font-size: 12px;
    flex-shrink: 0;
}
.mobile-card-item .mc-value {
    text-align: right;
    font-weight: 500;
}
.mobile-card-item .mc-body {
    font-size: 13px;
    color: #475569;
    padding: 6px 0;
    line-height: 1.5;
}
.mobile-card-item .mc-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-light);
    flex-wrap: wrap;
}
.mobile-card-item .mc-actions .btn {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 12px;
    padding: 8px 10px;
}
.mobile-card-item .mc-badges {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

/* Table wrap - ensure horizontal scroll with indicator */
.table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

/* =============================================
   BOTTOM NAVIGATION BAR (Mobile App Style)
   ============================================= */
:root {
    --bottom-nav-height: 64px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: #fff;
    border-top: 1px solid var(--border);
    display: none; /* hidden on desktop */
    align-items: stretch;
    justify-content: space-around;
    z-index: 1050;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.06);
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 10px;
    font-weight: 600;
    transition: all 0.2s ease;
    position: relative;
    padding: 6px 0;
    cursor: pointer;
    background: none;
    border: none;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    user-select: none;
}
.bottom-nav-item i {
    font-size: 20px;
    transition: all 0.2s ease;
    line-height: 1;
}
.bottom-nav-item span {
    line-height: 1;
    letter-spacing: 0.2px;
}
.bottom-nav-item.active {
    color: var(--primary);
}
.bottom-nav-item.active i {
    transform: scale(1.1);
}
.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 4px 4px;
}
.bottom-nav-item .bnav-badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--danger);
    color: #fff;
    border-radius: 10px;
    border: 2px solid #fff;
    font-size: 9px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}
.bottom-nav-item .bnav-dot {
    position: absolute;
    top: 6px;
    right: calc(50% - 14px);
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid #fff;
}

/* ── MOBILE: Show bottom nav, adjust layout ── */
@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }
    body.app-loaded {
        padding-bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 4px);
    }
    /* Hide sidebar toggle button on mobile — use hamburger still for more menu */
    .sidebar-footer { padding-bottom: 12px; }
}

/* ── DESKTOP: Hide bottom nav ── */
@media (min-width: 769px) {
    .bottom-nav {
        display: none !important;
    }
}
