/* ============================================
   Track360 Admin Panel — Production Design System
   ============================================ */

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

:root {
    --sidebar-width: 256px;
    --header-height: 62px;

    /* Brand — Olive Green */
    --primary: #5f6e28;
    --primary-dark: #4c5820;
    --primary-light: #7d9237;
    --primary-faint: #eff4e0;

    /* Semantic */
    --success: #16a34a;
    --success-bg: #f0fdf4;
    --warning: #d97706;
    --warning-bg: #fffbeb;
    --danger: #dc2626;
    --danger-bg: #fef2f2;
    --info: #0284c7;
    --info-bg: #f0f9ff;

    /* Sidebar — Deep olive-forest dark */
    --sidebar-bg: #0d1608;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: rgba(107, 130, 40, 0.2);
    --sidebar-text: #8fa89c;
    --sidebar-text-hover: #c4d5c0;
    --sidebar-text-active: #ffffff;

    /* Surface — Warm parchment */
    --body-bg: #f1f3eb;
    --card-bg: #ffffff;
    --surface-2: #f6f8f1;

    /* Text */
    --text-primary: #111a08;
    --text-secondary: #526048;
    --text-muted: #8ea08a;

    /* Borders */
    --border-color: #dde4d4;
    --border-strong: #c8d5bc;

    /* Shadows */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.07), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.06), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.09), 0 8px 10px -6px rgba(0, 0, 0, 0.04);

    /* Radius */
    --radius-sm: 5px;
    --radius: 9px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    /* Transitions */
    --transition: all 0.18s ease;
    --focus-ring: 0 0 0 3px rgba(95, 110, 40, 0.2);

    /* Chip */
    --chip-bg: #eaf0d4;
    --chip-text: #3d5010;
}

* { box-sizing: border-box; }

html { font-size: 15px; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--body-bg);
    color: var(--text-primary);
    overflow-x: hidden;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    letter-spacing: -0.01em;
}

/* Utility */
.fw-600 { font-weight: 600; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
    border-radius: var(--radius-sm);
}

/* ============================================
   Sidebar
   ============================================ */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #0f1c09 0%, #0d1608 60%, #0a1205 100%);
    z-index: 1040;
    display: flex;
    flex-direction: column;
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    transition: width 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    gap: 0.625rem;
    text-decoration: none;
    flex-shrink: 0;
}

.sidebar-brand .brand-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.sidebar-brand .brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.sidebar-brand .brand-text {
    color: #e8f0d8;
    font-size: 1.0625rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    white-space: nowrap;
}

.sidebar-brand .brand-text span {
    color: var(--primary-light);
}

.sidebar-nav {
    flex: 1;
    padding: 0.875rem 0.625rem;
    overflow-y: auto;
    overflow-x: hidden;
}

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

.nav-section-title {
    font-size: 0.625rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: rgba(143, 168, 156, 0.55);
    padding: 1.25rem 0.625rem 0.4rem;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar .nav-item { margin-bottom: 1px; list-style: none; }

.sidebar .nav-link {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.5rem 0.625rem;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.15s ease, background 0.15s ease;
    position: relative;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar .nav-link i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    opacity: 0.85;
}

.sidebar .nav-link:hover {
    color: var(--sidebar-text-hover);
    background: var(--sidebar-hover);
}

.sidebar .nav-link.active {
    color: var(--sidebar-text-active);
    background: var(--sidebar-active-bg);
    font-weight: 600;
}

.sidebar .nav-link.active i { opacity: 1; }

.sidebar .nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: linear-gradient(180deg, #9ab845, #6b8a2a);
    border-radius: 0 3px 3px 0;
}

.nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    padding: 0.1rem 0.45rem;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: 0.875rem 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    flex-shrink: 0;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.sidebar-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6b8a2a, #9ab845);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.75rem;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

.sidebar-user-info { flex: 1; min-width: 0; }

.sidebar-user-name {
    color: #ddeacd;
    font-weight: 600;
    font-size: 0.8125rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.sidebar-user-role {
    color: var(--sidebar-text);
    font-size: 0.6875rem;
    line-height: 1.3;
}

/* ============================================
   Sidebar — Desktop Collapsed
   ============================================ */

@media (min-width: 992px) {
    .sidebar.collapsed {
        width: 60px;
        overflow: visible;
    }

    .sidebar.collapsed .brand-text,
    .sidebar.collapsed .nav-section-title,
    .sidebar.collapsed .nav-text,
    .sidebar.collapsed .sidebar-user-info,
    .sidebar.collapsed .sidebar-user a[title="Sign out"] {
        opacity: 0;
        visibility: hidden;
        width: 0;
        overflow: hidden;
    }

    .sidebar.collapsed .sidebar-brand {
        justify-content: center;
        padding: 0;
    }

    .sidebar.collapsed .sidebar-nav {
        overflow: visible;
        padding: 0.875rem 0.5rem;
    }

    .sidebar.collapsed .sidebar-nav .nav-link {
        justify-content: center;
        padding: 0.55rem;
        gap: 0;
        overflow: visible;
    }

    /* Tooltip on collapsed */
    .sidebar.collapsed .sidebar-nav .nav-link::after {
        content: attr(data-tooltip);
        position: absolute;
        left: calc(100% + 10px);
        top: 50%;
        transform: translateY(-50%);
        background: #1a2710;
        color: #d4e8be;
        padding: 0.35rem 0.75rem;
        border-radius: 7px;
        font-size: 0.8125rem;
        font-weight: 500;
        white-space: nowrap;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.12s ease, visibility 0.12s ease;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
        z-index: 1060;
    }

    .sidebar.collapsed .sidebar-nav .nav-link:hover::after {
        opacity: 1;
        visibility: visible;
    }

    .sidebar.collapsed .sidebar-nav .nav-link i {
        margin: 0;
        font-size: 1.1rem;
        width: 20px;
    }

    .sidebar.collapsed .sidebar-nav .nav-link.active::before {
        left: 0;
    }

    .sidebar.collapsed .sidebar-footer {
        padding: 0.75rem 0.5rem;
    }

    .sidebar.collapsed .sidebar-user {
        justify-content: center;
    }

    .sidebar.collapsed .nav-badge { display: none; }

    .main-content {
        transition: margin-left 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .main-content.sidebar-collapsed {
        margin-left: 60px;
    }
}

/* ============================================
   Main Content Area
   ============================================ */

.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}

.main-header {
    height: var(--header-height);
    background: var(--card-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
    position: sticky;
    top: 0;
    z-index: 1020;
    box-shadow: var(--shadow-xs);
}

.main-header .header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.main-header .header-right {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-shrink: 0;
}

.btn-sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    font-size: 1.1rem;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-sidebar-toggle:hover {
    background: var(--surface-2);
    color: var(--text-primary);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-back:hover {
    background: var(--surface-2);
    color: var(--primary);
    border-color: var(--primary-light);
}

.btn-back i { font-size: 0.9rem; }

.page-title-header {
    min-width: 0;
}

.page-title-header h1 {
    font-size: 1.0625rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: -0.02em;
}

.page-title-header p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.3;
}

.header-icon-btn {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    text-decoration: none;
    font-size: 0.9375rem;
}

.header-icon-btn:hover {
    background: var(--surface-2);
    color: var(--text-secondary);
    border-color: var(--border-strong);
}

.header-icon-btn .badge-dot {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 7px;
    height: 7px;
    background: var(--danger);
    border-radius: 50%;
    border: 1.5px solid var(--card-bg);
}

.main-body {
    padding: 1.5rem;
    max-width: 1440px;
}

/* ============================================
   Alerts / Flash Messages
   ============================================ */

.alert {
    border-radius: var(--radius);
    font-size: 0.875rem;
    border: 1px solid transparent;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
}

.alert-success {
    background: var(--success-bg);
    color: #166534;
    border-color: #bbf7d0;
}

.alert-danger {
    background: var(--danger-bg);
    color: #991b1b;
    border-color: #fecaca;
}

.alert-warning {
    background: var(--warning-bg);
    color: #92400e;
    border-color: #fde68a;
}

.alert-info {
    background: var(--info-bg);
    color: #075985;
    border-color: #bae6fd;
}

.alert .btn-close {
    margin-left: auto;
    flex-shrink: 0;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.5;
}

.alert .btn-close:hover { opacity: 0.9; }

/* ============================================
   Cards
   ============================================ */

.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.card-header h5 {
    margin: 0;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.015em;
}

.card-header h6 {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.card-body { padding: 1.25rem; }

/* ============================================
   Stat Cards (Dashboard)
   ============================================ */

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    transition: box-shadow 0.15s ease, transform 0.15s ease;
    position: relative;
    overflow: hidden;
}

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

.stat-card .stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.0625rem;
    margin-bottom: 0.875rem;
    flex-shrink: 0;
}

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    letter-spacing: -0.03em;
}

.stat-card .stat-label {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 500;
    letter-spacing: 0.01em;
}

/* Flat icon colors — no gradient card backgrounds */
.stat-card.stat-primary .stat-icon { background: #eaf0d4; color: #5f6e28; }
.stat-card.stat-success .stat-icon { background: #f0fdf4; color: #16a34a; }
.stat-card.stat-warning .stat-icon { background: #fffbeb; color: #d97706; }
.stat-card.stat-danger  .stat-icon { background: #fef2f2; color: #dc2626; }
.stat-card.stat-info    .stat-icon { background: #f0f9ff; color: #0284c7; }

/* ============================================
   Tables
   ============================================ */

.table-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-container .table-toolbar {
    padding: 0.875rem 1.25rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--card-bg);
}

.table-container .table-toolbar h5 {
    margin: 0;
    font-weight: 700;
    font-size: 0.9375rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    letter-spacing: -0.015em;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.toolbar-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

.toolbar-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.toolbar-clear {
    color: var(--text-muted);
    font-size: 0.8125rem;
    text-decoration: none;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.3rem 0.55rem;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    transition: var(--transition);
}

.toolbar-clear:hover {
    color: var(--text-secondary);
    border-color: var(--primary-light);
    background: var(--primary-faint);
}

.filter-chip-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.5rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-2);
}

.filter-chip-label {
    color: var(--text-muted);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--chip-bg);
    color: var(--chip-text);
    padding: 0.175rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.table-meta {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.quick-presets {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    padding: 0.5rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-2);
}

.quick-presets .preset-link {
    text-decoration: none;
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 500;
    transition: var(--transition);
}

.quick-presets .preset-link:hover {
    color: var(--primary);
    border-color: var(--primary-light);
    background: var(--primary-faint);
}

.table {
    margin: 0;
    font-size: 0.875rem;
}

.table thead th {
    background: var(--surface-2);
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.06em;
    padding: 0.6875rem 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    border-top: none;
}

.table tbody td {
    padding: 0.6875rem 1rem;
    vertical-align: middle;
    border-bottom: 1px solid #eaecdf;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.table tbody tr:last-child td { border-bottom: none; }

.table tbody tr:hover { background: #f5f7ef; }

.table tbody tr.table-row-link { cursor: pointer; }
.table tbody tr.table-row-link:hover { background: #eef3de; }

.table td.sticky-actions,
.table th.sticky-actions {
    position: sticky;
    right: 0;
    background: var(--card-bg);
    z-index: 1;
}

.table thead th.sticky-actions {
    z-index: 2;
    background: var(--surface-2);
}

.table tbody tr:hover td.sticky-actions {
    background: #f5f7ef;
}

.row-click-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================
   Badges / Status Chips
   ============================================ */

.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.6rem;
    border-radius: 5px;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.badge-status::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.badge-active   { background: #f0fdf4; color: #166534; }
.badge-active::before { background: #22c55e; }

.badge-inactive { background: #fef2f2; color: #991b1b; }
.badge-inactive::before { background: #ef4444; }

.badge-pending  { background: #fffbeb; color: #92400e; }
.badge-pending::before { background: #f59e0b; }

.badge-info     { background: #f0f9ff; color: #075985; }
.badge-info::before { background: #38bdf8; }

.badge-danger   { background: #fef2f2; color: #991b1b; }
.badge-danger::before { background: #ef4444; }

.badge-default  { background: #f1f5f9; color: #475569; }
.badge-default::before { background: #94a3b8; }

/* ============================================
   Buttons
   ============================================ */

.btn {
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 6px;
    padding: 0.4375rem 0.875rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    line-height: 1.4;
    cursor: pointer;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    box-shadow: 0 1px 2px rgba(95, 110, 40, 0.28);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    box-shadow: 0 2px 6px rgba(95, 110, 40, 0.35);
}

.btn-outline-primary {
    color: var(--primary);
    border-color: var(--primary);
    background: transparent;
}

.btn-outline-primary:hover {
    background: var(--primary);
    color: white;
}

.btn-outline-success {
    color: var(--success);
    border-color: #86efac;
    background: transparent;
}

.btn-outline-success:hover {
    background: var(--success-bg);
    color: #15803d;
    border-color: #86efac;
}

.btn-outline-danger {
    color: var(--danger);
    border-color: #fca5a5;
    background: transparent;
}

.btn-outline-danger:hover {
    background: var(--danger-bg);
    color: #991b1b;
}

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--surface-2);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.btn-sm {
    padding: 0.3125rem 0.6875rem;
    font-size: 0.8125rem;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

/* ============================================
   Forms
   ============================================ */

.form-control, .form-select {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.4375rem 0.75rem;
    font-size: 0.875rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    color: var(--text-primary);
    background: var(--card-bg);
    line-height: 1.5;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(95, 110, 40, 0.12);
    outline: none;
}

.form-control:hover:not(:focus),
.form-select:hover:not(:focus) {
    border-color: var(--border-strong);
}

.form-control::placeholder { color: var(--text-muted); }

.form-label {
    font-weight: 500;
    font-size: 0.8125rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
    display: block;
}

.form-helper {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.search-input { position: relative; }

.search-input i {
    position: absolute;
    left: 0.65rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    z-index: 1;
    font-size: 0.875rem;
}

.search-input input { padding-left: 2rem; }

/* Checkbox */
.form-check-input {
    border-color: var(--border-strong);
    cursor: pointer;
}

.form-check-input:checked {
    background-color: var(--primary);
    border-color: var(--primary);
}

.form-check-input:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(95, 110, 40, 0.12);
}

/* Input group */
.input-group-text {
    background: var(--surface-2);
    border-color: var(--border-color);
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ============================================
   Login Page
   ============================================ */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(145deg, #060d02 0%, #111d08 55%, #0d1908 100%);
    position: relative;
    overflow: hidden;
}

.login-page::before {
    content: '';
    position: absolute;
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, rgba(107, 138, 42, 0.16) 0%, transparent 65%);
    top: -250px;
    right: -200px;
    pointer-events: none;
}

.login-page::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, rgba(154, 184, 69, 0.09) 0%, transparent 65%);
    bottom: -150px;
    left: -150px;
    pointer-events: none;
}

.login-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg);
    border-radius: 18px;
    box-shadow: 0 28px 56px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
    padding: 2.5rem 2.25rem;
    position: relative;
    z-index: 1;
}

.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.625rem;
    margin-bottom: 1.75rem;
}

.login-logo .brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.login-logo .brand-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.login-logo h2 {
    font-weight: 800;
    font-size: 1.5rem;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.035em;
}

.login-logo h2 span { color: var(--primary); }

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

.login-card .form-control {
    padding: 0.5625rem 0.875rem;
    font-size: 0.9375rem;
}

.login-card .input-group-text {
    padding: 0.5625rem 0.75rem;
}

.login-card .btn-primary {
    padding: 0.625rem;
    font-size: 0.9375rem;
    font-weight: 600;
    width: 100%;
    justify-content: center;
}

.login-footer-note {
    text-align: center;
    margin-top: 1.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================
   Pagination
   ============================================ */

.pagination-container {
    padding: 0.75rem 1.25rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-2);
}

.pagination-info {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.pagination .page-link {
    border-radius: 5px;
    margin: 0 1px;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    border-color: var(--border-color);
    padding: 0.3rem 0.6rem;
    transition: var(--transition);
}

.pagination .page-link:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.pagination .page-item.active .page-link {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.pagination .page-item.disabled .page-link {
    color: var(--text-muted);
    background: transparent;
}

/* ============================================
   Modals
   ============================================ */

.modal-content {
    border: none;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    padding: 1.125rem 1.5rem;
}

.modal-header .modal-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-body { padding: 1.5rem; }

.modal-footer {
    border-top: 1px solid var(--border-color);
    padding: 0.875rem 1.5rem;
    background: var(--surface-2);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
    text-align: center;
    padding: 3rem 1.5rem;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 2.5rem;
    margin-bottom: 0.875rem;
    display: block;
    opacity: 0.4;
}

.empty-state h5 {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9375rem;
    margin-bottom: 0.375rem;
}

.empty-state p {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-bottom: 0;
}

.empty-state .empty-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    justify-content: center;
}

/* ============================================
   Detail View
   ============================================ */

.detail-row {
    display: flex;
    padding: 0.5625rem 0;
    border-bottom: 1px solid #eaecdf;
    gap: 1rem;
}

.detail-row:last-child { border-bottom: none; }

.detail-label {
    width: 160px;
    flex-shrink: 0;
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.8125rem;
    padding-top: 1px;
}

.detail-value {
    color: var(--text-primary);
    font-size: 0.875rem;
    flex: 1;
    min-width: 0;
    word-break: break-word;
}

/* ============================================
   Dashboard — Metric Cards (Operational Focus)
   ============================================ */

.dashboard-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
    margin-bottom: 1rem;
}

.urgent-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 1px;
    background: var(--border-color);
    border-radius: var(--radius);
    overflow: hidden;
}

.urgent-card {
    background: var(--card-bg);
    padding: 1rem 1.125rem;
    transition: background 0.12s ease;
}

.urgent-card:hover { background: var(--surface-2); }

.urgent-card .label {
    color: var(--text-muted);
    font-size: 0.6875rem;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
    margin-bottom: 0.375rem;
}

.urgent-card .value {
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.035em;
    line-height: 1.1;
    margin-bottom: 0.375rem;
}

.urgent-card .action {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    text-decoration: none;
    color: var(--primary);
    font-weight: 500;
    transition: color 0.12s ease;
}

.urgent-card .action:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ============================================
   Audit / Activity Log
   ============================================ */

.audit-json-block {
    margin: 0;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--surface-2);
    color: var(--text-secondary);
    font-size: 0.75rem;
    max-height: 360px;
    overflow: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    line-height: 1.6;
}

.audit-change-table th,
.audit-change-table td {
    vertical-align: top;
    font-size: 0.8125rem;
}

.audit-change-row { background: #fffbeb; }

.audit-value {
    display: inline-block;
    max-width: 360px;
    white-space: pre-wrap;
    word-break: break-word;
}

/* ============================================
   Role / Permission Helpers
   ============================================ */

.role-description {
    margin-top: 0.5rem;
    padding: 0.5rem 0.65rem;
    background: var(--surface-2);
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.permission-list {
    margin: 0.5rem 0 0;
    padding-left: 1rem;
    color: var(--text-secondary);
    font-size: 0.8125rem;
}

.permission-list li { margin-bottom: 0.2rem; }

/* ============================================
   Jurisdiction Picker
   ============================================ */

.jurisdiction-picker {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--surface-2);
    padding: 0.65rem;
}

.jurisdiction-picker-toolbar {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.jurisdiction-picker-summary {
    margin-top: 0.375rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.jurisdiction-picker-list {
    max-height: 230px;
    overflow-y: auto;
    margin-top: 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.375rem;
}

.jurisdiction-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.4rem;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-primary);
    transition: background 0.1s ease;
}

.jurisdiction-option:hover { background: var(--primary-faint); color: var(--primary); }

.jurisdiction-option input { margin-top: 0; cursor: pointer; }

.jurisdiction-empty {
    padding: 0.5rem;
    color: var(--text-muted);
    font-size: 0.8125rem;
}

.jurisdiction-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.5rem;
}

/* ============================================
   Reports — Tabs, Sidebar, Filter Panel
   ============================================ */

.report-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border-color);
}

.report-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.625rem 1.125rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s ease;
    white-space: nowrap;
}

.report-tab:hover { color: var(--primary); }

.report-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.report-tab i { font-size: 0.9375rem; }

.report-layout {
    display: flex;
    gap: 1.125rem;
    align-items: flex-start;
}

.report-sidebar {
    width: 252px;
    flex-shrink: 0;
    position: sticky;
    top: calc(var(--header-height) + 1rem);
}

.report-content {
    flex: 1;
    min-width: 0;
}

.report-filter-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.filter-panel-header {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-2);
}

.filter-panel-header h6 {
    margin: 0;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.filter-panel-body {
    padding: 0.75rem 1rem;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
}

.filter-panel-footer {
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--surface-2);
}

.filter-group { margin-bottom: 0.75rem; }

.filter-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.3rem;
}

@media (min-width: 992px) {
    .report-sidebar { display: block !important; }
}

/* ============================================
   Analytics Charts
   ============================================ */

.chart-container {
    position: relative;
    height: 380px;
    margin-bottom: 0.5rem;
}

.custom-map-marker { background: none; border: none; }

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background-color: rgba(95, 110, 40, 0.55);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background-color: rgba(95, 110, 40, 0.85);
    color: white;
    font-weight: 600;
}

@media (max-width: 768px) {
    .chart-container { height: 280px; }
    #verificationMap { height: 380px !important; }
}

.card-header h6 {
    font-weight: 600;
    color: var(--text-primary);
}

/* ============================================
   Asset QR Composer
   ============================================ */

.asset-qr-value {
    display: inline-block;
    width: 100%;
    max-width: 100%;
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--surface-2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-size: 0.6875rem;
    line-height: 1.4;
    padding: 0.3rem 0.45rem;
    font-family: 'SFMono-Regular', Consolas, monospace;
}

.qr-composer-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.qr-options-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    background: var(--surface-2);
}

.qr-options-grid .form-check { margin: 0; }

.qr-options-grid .form-check-label { font-size: 0.875rem; }

.qr-preview-wrap {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    min-width: 260px;
    min-height: 260px;
    padding: 0.75rem;
    border-radius: var(--radius);
    border: 1px dashed var(--border-strong);
    background: var(--surface-2);
}

.qr-preview {
    width: 256px;
    height: 256px;
    max-width: 100%;
    object-fit: contain;
}

.qr-error { font-size: 0.8125rem; }

.qr-download-btn {
    min-width: 150px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   Responsive — Mobile Sidebar
   ============================================ */

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: var(--sidebar-width);
        transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .sidebar.show { transform: translateX(0); }

    .main-content { margin-left: 0 !important; }

    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 1035;
        backdrop-filter: blur(2px);
    }

    .sidebar-overlay.show { display: block; }

    .report-sidebar { display: none; }
    .report-sidebar.show {
        display: block;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1050;
        background: var(--card-bg);
        overflow-y: auto;
        padding: 1rem;
    }

    .report-layout { flex-direction: column; }
    .report-content { min-width: 0; }

    .qr-options-grid { grid-template-columns: 1fr; }

    .qr-preview-wrap { width: 100%; min-width: 0; }
}

/* ============================================
   Misc Utilities
   ============================================ */

.text-muted { color: var(--text-muted) !important; }
.text-secondary { color: var(--text-secondary) !important; }

code {
    font-size: 0.8125rem;
    color: #be185d;
    background: #fdf2f8;
    padding: 0.1em 0.3em;
    border-radius: 3px;
}

.font-monospace {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* Badge (Bootstrap override) */
.badge.bg-secondary {
    background: var(--surface-2) !important;
    color: var(--text-secondary) !important;
    border: 1px solid var(--border-color);
    font-weight: 500;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 5px;
}

/* img-thumbnail override */
.img-thumbnail {
    border-radius: var(--radius);
    border-color: var(--border-color);
    background: var(--surface-2);
    padding: 0.375rem;
}
