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

:root {
    --primary: #0f5132;
    --primary-rgb: 15, 81, 50;
    --secondary: #198754;
    --accent: #d1e7dd;
    --bg-light: #f0f4f2;
    --bg-white: #ffffff;
    --sidebar-w: 260px;
    --topbar-h: 60px;
    --text-dark: #1a1a2e;
    --text-muted: #64748b;
    --border-color: rgba(15, 81, 50, 0.1);
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 30px rgba(0,0,0,0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg-light);
    color: var(--text-dark);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15,81,50,0.2); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(15,81,50,0.4); }

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

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, #0a3d25 0%, var(--primary) 40%, #0d4a2e 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform 0.3s ease;
    overflow-y: auto;
    overflow-x: hidden;
}
.sidebar-brand {
    padding: 20px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-brand-icon {
    width: 40px; height: 40px;
    background: #fff;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--primary);
    font-size: 22px;
    flex-shrink: 0;
}
.sidebar-brand h1 { font-size: 16px; font-weight: 800; letter-spacing: -0.3px; line-height: 1.2; }
.sidebar-brand p { font-size: 10px; opacity: 0.5; font-weight: 500; letter-spacing: 0.5px; text-transform: uppercase; margin-top: 2px; }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-label {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; color: rgba(255,255,255,0.3);
    padding: 16px 14px 8px; margin-top: 4px;
}
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: var(--radius-sm);
    color: rgba(255,255,255,0.65); cursor: pointer;
    transition: var(--transition); font-size: 13px; font-weight: 500;
    text-decoration: none; position: relative;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,0.08); color: #fff; }
.nav-item.active {
    background: rgba(255,255,255,0.12);
    color: #fff; font-weight: 600;
    border-left-color: #fff;
}
.nav-item .material-symbols-outlined { font-size: 20px; width: 20px; }
.nav-item .nav-badge {
    margin-left: auto; background: #dc3545; color: #fff;
    font-size: 10px; font-weight: 700; padding: 2px 7px;
    border-radius: 10px; min-width: 18px; 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;
    padding: 10px; border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.06);
}
.sidebar-user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: rgba(255,255,255,0.15);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-info .name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-info .role { font-size: 10px; opacity: 0.5; }

/* ===== TOP BAR ===== */
.main-wrapper { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
    height: var(--topbar-h);
    background: var(--primary);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 28px;
    position: sticky; top: 0; z-index: 50;
    box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-search {
    position: relative; width: 320px;
}
.topbar-search input {
    width: 100%; padding: 9px 14px 9px 40px;
    background: rgba(255,255,255,0.1);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: var(--radius-sm); color: #fff;
    font-size: 13px; outline: none;
    transition: var(--transition);
}
.topbar-search input::placeholder { color: rgba(255,255,255,0.4); }
.topbar-search input:focus { background: rgba(255,255,255,0.18); border-color: rgba(255,255,255,0.2); }
.topbar-search .material-symbols-outlined {
    position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
    font-size: 18px; color: rgba(255,255,255,0.4);
}
.topbar-right { display: flex; align-items: center; gap: 8px; }
.topbar-btn {
    width: 38px; height: 38px; border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.08); border: none;
    color: rgba(255,255,255,0.8); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition); position: relative;
}
.topbar-btn:hover { background: rgba(255,255,255,0.18); color: #fff; }
.topbar-btn .badge-dot {
    position: absolute; top: 7px; right: 7px;
    width: 8px; height: 8px; background: #dc3545;
    border-radius: 50%; border: 2px solid var(--primary);
}
.topbar-divider { width: 1px; height: 28px; background: rgba(255,255,255,0.15); margin: 0 8px; }
.topbar-user {
    display: flex; align-items: center; gap: 10px; cursor: pointer;
    padding: 4px 8px; border-radius: var(--radius-sm);
    transition: var(--transition);
}
.topbar-user:hover { background: rgba(255,255,255,0.1); }
.topbar-user-info { text-align: right; }
.topbar-user-info .name { font-size: 13px; font-weight: 600; color: #fff; }
.topbar-user-info .role { font-size: 10px; color: rgba(255,255,255,0.5); }
.topbar-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(255,255,255,0.1);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: 700; font-size: 14px;
}
.mobile-toggle { display: none; background: none; border: none; color: #fff; cursor: pointer; }

/* ===== CONTENT ===== */
.content { flex: 1; padding: 28px; }
.page { display: none; animation: fadeIn 0.35s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* ===== CARDS ===== */
.stat-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
    background: #fff; border-radius: var(--radius); padding: 22px;
    border: 1px solid var(--border-color); position: relative;
    transition: var(--transition); overflow: hidden;
    box-shadow: var(--shadow-sm);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: 16px; font-size: 22px;
}
.stat-card-icon.green { background: #d1e7dd; color: #0f5132; }
.stat-card-icon.yellow { background: #fff3cd; color: #856404; }
.stat-card-icon.red { background: #f8d7da; color: #842029; }
.stat-card-icon.blue { background: #cfe2ff; color: #084298; }
.stat-card-icon.slate { background: #e2e8f0; color: #475569; }
.stat-card-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted); }
.stat-card-value { font-size: 32px; font-weight: 800; margin-top: 4px; color: var(--text-dark); }
.stat-card-badge {
    position: absolute; top: 16px; right: 16px;
    font-size: 10px; font-weight: 700; padding: 3px 10px;
    border-radius: 20px;
}
.badge-green { background: #d1e7dd; color: #0f5132; }
.badge-yellow { background: #fff3cd; color: #856404; }
.badge-red { background: #f8d7da; color: #842029; }

/* ===== PANEL / TABLE CARD ===== */
.panel {
    background: #fff; border-radius: var(--radius);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm); overflow: hidden;
    margin-bottom: 24px;
}
.panel-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px;
}
.panel-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.panel-title .material-symbols-outlined { color: var(--primary); font-size: 22px; }
.panel-body { padding: 0; }
.panel-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
    background: rgba(15,81,50,0.02);
}

/* ===== TABLES ===== */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
    padding: 14px 16px;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--primary);
    background: rgba(15,81,50,0.04);
    text-align: left; white-space: nowrap;
    border-bottom: 2px solid var(--border-color);
    position: sticky; top: 0;
}
.data-table tbody td {
    padding: 14px 16px;
    border-bottom: 1px solid rgba(15,81,50,0.04);
    vertical-align: middle;
}
.data-table tbody tr { transition: var(--transition); }
.data-table tbody tr:hover { background: rgba(15,81,50,0.03); }

/* ===== STATUS BADGES ===== */
.status-badge {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 12px; border-radius: 20px;
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-badge .dot { width: 6px; height: 6px; border-radius: 50%; }
.status-active { background: #d1e7dd; color: #0f5132; }
.status-active .dot { background: #0f5132; }
.status-repair { background: #fff3cd; color: #856404; }
.status-repair .dot { background: #856404; }
.status-disposal { background: #f8d7da; color: #842029; }
.status-disposal .dot { background: #842029; }
.status-decommissioned { background: #e2e8f0; color: #475569; }
.status-decommissioned .dot { background: #475569; }
.status-calibration { background: #dbeafe; color: #1e40af; }
.status-calibration .dot { background: #2563eb; }
.status-condemned { background: #fce7f3; color: #9d174d; }
.status-condemned .dot { background: #db2777; }
.status-disposed { background: #f1f5f9; color: #64748b; }
.status-disposed .dot { background: #94a3b8; }
.status-overdue { background: #f8d7da; color: #842029; }
.status-overdue .dot { background: #dc3545; }
.status-due-soon { background: #fff3cd; color: #856404; }
.status-due-soon .dot { background: #ffc107; }
.status-ok { background: #d1e7dd; color: #0f5132; }
.status-ok .dot { background: #198754; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 20px; border-radius: var(--radius-sm);
    font-size: 13px; font-weight: 600; cursor: pointer;
    border: none; transition: var(--transition);
    text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 4px 14px rgba(15,81,50,0.25); }
.btn-primary:hover { background: #0d4a2e; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(15,81,50,0.3); }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid rgba(15,81,50,0.2); }
.btn-outline:hover { background: rgba(15,81,50,0.05); border-color: var(--primary); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-icon { width: 34px; height: 34px; padding: 0; justify-content: center; border-radius: var(--radius-xs); }
.btn-icon .material-symbols-outlined { font-size: 18px; }

.action-btns { display: flex; gap: 4px; }
.action-btn {
    width: 32px; height: 32px; border: none; border-radius: var(--radius-xs);
    background: transparent; color: var(--text-muted); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.action-btn:hover { background: rgba(15,81,50,0.08); color: var(--primary); }
.action-btn.delete:hover { background: #f8d7da; color: #842029; }
.action-btn .material-symbols-outlined { font-size: 18px; }

/* ===== FILTERS ===== */
.filters-bar {
    background: #fff; border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 16px 20px; margin-bottom: 20px;
    display: flex; align-items: center; flex-wrap: wrap; gap: 12px;
    box-shadow: var(--shadow-sm);
}
.filter-label { font-size: 12px; font-weight: 700; color: var(--primary); display: flex; align-items: center; gap: 6px; }
.filter-select {
    padding: 8px 36px 8px 14px; border-radius: var(--radius-xs);
    border: 1px solid var(--border-color); font-size: 12px; font-weight: 500;
    background: rgba(15,81,50,0.03); color: var(--text-dark);
    appearance: none; cursor: pointer; outline: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24'%3E%3Cpath fill='%230f5132' d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    transition: var(--transition);
}
.filter-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,81,50,0.1); }

/* ===== FORM ===== */
.form-section {
    background: #fff; border-radius: var(--radius);
    border: 1px solid var(--border-color);
    padding: 28px; margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}
.form-section-title {
    display: flex; align-items: center; gap: 10px;
    font-size: 16px; font-weight: 700; margin-bottom: 24px;
    padding-bottom: 16px; border-bottom: 1px solid var(--border-color);
}
.form-section-title .material-symbols-outlined { color: var(--primary); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-dark); }
.form-control {
    padding: 10px 14px; border-radius: var(--radius-xs);
    border: 1.5px solid var(--border-color);
    font-size: 13px; font-family: inherit;
    background: rgba(15,81,50,0.02);
    transition: var(--transition); outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(15,81,50,0.08); background: #fff; }
textarea.form-control { resize: vertical; min-height: 100px; }
.toggle-switch {
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; font-size: 13px; font-weight: 500;
}
.toggle-switch input { display: none; }
.toggle-slider {
    width: 42px; height: 22px; background: #ccc;
    border-radius: 22px; position: relative; transition: var(--transition);
}
.toggle-slider::after {
    content: ''; position: absolute; top: 2px; left: 2px;
    width: 18px; height: 18px; background: #fff;
    border-radius: 50%; transition: var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.toggle-switch input:checked + .toggle-slider { background: var(--primary); }
.toggle-switch input:checked + .toggle-slider::after { transform: translateX(20px); }

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px); z-index: 200;
    display: none; align-items: center; justify-content: center;
    padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff; border-radius: 16px;
    width: 100%; max-width: 800px; max-height: 90vh;
    overflow-y: auto; box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.modal-header {
    padding: 24px 28px; border-bottom: 1px solid var(--border-color);
    display: flex; align-items: center; justify-content: space-between;
}
.modal-header h2 { font-size: 18px; font-weight: 700; }
.modal-close {
    width: 36px; height: 36px; border-radius: 50%;
    border: none; background: rgba(15,81,50,0.05);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.modal-close:hover { background: #f8d7da; color: #842029; }
.modal-body { padding: 28px; }
.modal-footer {
    padding: 20px 28px; border-top: 1px solid var(--border-color);
    display: flex; justify-content: flex-end; gap: 12px;
}

/* ===== LIFECYCLE TRACKER ===== */
.lifecycle-tracker {
    display: flex; align-items: center; justify-content: space-between;
    padding: 32px 16px; position: relative;
}
.lifecycle-tracker::before {
    content: ''; position: absolute; top: 50%;
    left: 40px; right: 40px; height: 3px;
    background: #e2e8f0; transform: translateY(-14px);
}
.lifecycle-track-fill {
    position: absolute; top: 50%;
    left: 40px; height: 3px;
    background: var(--primary); transform: translateY(-14px);
    transition: width 0.5s ease;
}
.lifecycle-stage {
    display: flex; flex-direction: column; align-items: center; gap: 10px;
    position: relative; z-index: 1;
}
.lifecycle-node {
    width: 44px; height: 44px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
}
.lifecycle-node.completed { background: var(--primary); color: #fff; box-shadow: 0 0 0 4px rgba(15,81,50,0.15); }
.lifecycle-node.current { background: var(--primary); color: #fff; box-shadow: 0 0 0 6px rgba(15,81,50,0.2), 0 0 20px rgba(15,81,50,0.3); transform: scale(1.15); }
.lifecycle-node.pending { background: #e2e8f0; color: #94a3b8; }
.lifecycle-label { font-size: 11px; font-weight: 600; text-align: center; }
.lifecycle-label.active-label { color: var(--primary); font-weight: 700; }
.lifecycle-label.pending-label { color: #94a3b8; }

/* ===== TIMELINE ===== */
.timeline { position: relative; padding-left: 40px; }
.timeline::before {
    content: ''; position: absolute; left: 18px; top: 0; bottom: 0;
    width: 2px; background: rgba(15,81,50,0.1);
}
.timeline-item { position: relative; padding-bottom: 32px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-dot {
    position: absolute; left: -28px; top: 4px;
    width: 14px; height: 14px; border-radius: 50%;
    background: var(--primary); z-index: 1;
    box-shadow: 0 0 0 4px rgba(15,81,50,0.12);
}
.timeline-dot.secondary { background: rgba(15,81,50,0.3); }
.timeline-card {
    background: rgba(15,81,50,0.03); border: 1px solid var(--border-color);
    border-radius: var(--radius); padding: 20px;
    transition: var(--transition);
}
.timeline-card:hover { border-color: rgba(15,81,50,0.2); box-shadow: var(--shadow-sm); }
.timeline-card h4 { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.timeline-card .event-type { font-size: 10px; font-weight: 700; color: var(--primary); text-transform: uppercase; letter-spacing: 0.5px; }
.timeline-card .event-date {
    font-size: 11px; font-weight: 700; color: var(--primary);
    background: #fff; border: 1px solid var(--border-color);
    padding: 3px 10px; border-radius: 4px;
}
.timeline-card p { font-size: 13px; color: var(--text-muted); line-height: 1.6; margin: 10px 0; }
.timeline-meta { display: flex; gap: 16px; font-size: 11px; color: var(--text-muted); border-top: 1px solid var(--border-color); padding-top: 10px; margin-top: 10px; }
.timeline-meta span { display: flex; align-items: center; gap: 4px; }

/* ===== TABS ===== */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border-color); margin-bottom: 24px; overflow-x: auto; }
.tab-btn {
    padding: 12px 20px; font-size: 13px; font-weight: 600;
    color: var(--text-muted); border: none; background: none;
    cursor: pointer; border-bottom: 2px solid transparent;
    margin-bottom: -2px; white-space: nowrap;
    transition: var(--transition);
    display: flex; align-items: center; gap: 6px;
}
.tab-btn:hover { color: var(--primary); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-content { display: none; animation: fadeIn 0.3s ease; }
.tab-content.active { display: block; }

/* ===== CALENDAR MINI ===== */
.mini-calendar { background: #fff; border-radius: var(--radius); border: 1px solid var(--border-color); padding: 20px; }
.cal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.cal-header h4 { font-size: 14px; font-weight: 700; }
.cal-nav { display: flex; gap: 4px; }
.cal-nav button {
    width: 28px; height: 28px; border-radius: 6px;
    border: none; background: rgba(15,81,50,0.05);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition); color: var(--text-muted);
}
.cal-nav button:hover { background: rgba(15,81,50,0.1); color: var(--primary); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal-day-name { font-size: 10px; font-weight: 700; color: var(--text-muted); padding: 6px 0; }
.cal-day {
    font-size: 12px; padding: 8px 0; border-radius: 6px;
    cursor: pointer; transition: var(--transition); position: relative;
}
.cal-day:hover { background: rgba(15,81,50,0.05); }
.cal-day.today { background: var(--primary); color: #fff; font-weight: 700; }
.cal-day.muted { color: #cbd5e1; }
.cal-day.has-event::after { content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 4px; height: 4px; border-radius: 50%; }
.cal-day.has-overdue::after { background: #dc3545; }
.cal-day.has-due-soon::after { background: #ffc107; }

/* ===== PAGINATION ===== */
.pagination { display: flex; align-items: center; gap: 4px; }
.pagination-info { font-size: 13px; color: var(--text-muted); }
.pagination-info strong { color: var(--text-dark); }
.page-btn {
    min-width: 36px; height: 36px; border: none;
    border-radius: var(--radius-xs); font-size: 13px; font-weight: 600;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: var(--transition);
    background: transparent; color: var(--text-muted);
}
.page-btn:hover { background: rgba(15,81,50,0.08); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; }

/* ===== QR SCANNER ===== */
.qr-scanner-area {
    width: 320px; height: 320px; margin: 0 auto;
    border-radius: 16px; border: 3px dashed rgba(15,81,50,0.3);
    display: flex; align-items: center; justify-content: center;
    flex-direction: column; gap: 16px;
    background: rgba(15,81,50,0.02); position: relative; overflow: hidden;
}
.qr-scanner-area .scan-line {
    position: absolute; top: 0; left: 10%; right: 10%;
    height: 3px; background: linear-gradient(90deg, transparent, var(--primary), transparent);
    animation: scanMove 2s ease-in-out infinite;
}
@keyframes scanMove { 0%,100% { top: 10%; } 50% { top: 85%; } }

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .sidebar { 
        position: fixed;
        z-index: 1000;
        height: 100vh;
        transform: translateX(-100%); 
        box-shadow: 20px 0 50px rgba(0,0,0,0.1);
    }
    .sidebar.open { transform: translateX(0); }
    .main-wrapper { margin-left: 0; width: 100%; }
    .mobile-toggle { display: flex; }
    .topbar-search { width: 180px; }
    
    /* Overlay for mobile sidebar */
    body.sidebar-open::after {
        content: '';
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        z-index: 999;
    }
}

@media (max-width: 768px) {
    .content { padding: 16px; margin-top: 60px; }
    .topbar { padding: 0 16px; height: 60px; }
    .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .form-grid { grid-template-columns: 1fr; gap: 12px; }
    .topbar-search { display: none; }
    .topbar-user-info { display: none; }
    .lifecycle-tracker { 
        overflow-x: auto; 
        justify-content: flex-start; 
        gap: 16px; 
        padding: 24px 8px; 
    }
    .page-header { flex-direction: column; align-items: flex-start; }
    .page-header .btn { width: 100%; }
    
    /* Better table scrolling on mobile */
    .table-responsive {
        border-radius: 8px;
        border: 1px solid var(--border-color);
        margin: 0 -8px;
    }
    
    .panel { border-radius: 0; margin-left: -16px; margin-right: -16px; border-left: none; border-right: none; }
}

@media (max-width: 480px) {
    .stat-cards { grid-template-columns: 1fr; }
    .topbar-user .name { display: none; }
    .login-card { width: 95%; padding: 24px; }
    .stat-card-value { font-size: 20px; }
}

/* ===== GRID LAYOUT UTILS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
@media (max-width: 1024px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ===== PAGE HEADER ===== */
.page-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 24px; flex-wrap: wrap; gap: 16px; }
.page-header h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; color: var(--text-dark); }
.page-header p { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.breadcrumb a { color: var(--primary); text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }

/* ===== UPCOMING EVENTS ===== */
.event-item {
    display: flex; gap: 12px; padding: 12px;
    border-radius: var(--radius-sm); transition: var(--transition);
}
.event-item:hover { background: rgba(15,81,50,0.03); }
.event-date-box {
    width: 44px; flex-shrink: 0; text-align: center;
    background: #fff; border: 1px solid var(--border-color);
    border-radius: var(--radius-xs); padding: 4px;
}
.event-date-box .month { font-size: 8px; font-weight: 700; text-transform: uppercase; }
.event-date-box .day { font-size: 16px; font-weight: 800; }
.event-info h5 { font-size: 12px; font-weight: 600; }
.event-info p { font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.event-item.overdue { background: #fef2f2; border-left: 3px solid #dc3545; }
.event-item.overdue .event-date-box { border-color: #fca5a5; }
.event-item.overdue .event-date-box .month { color: #dc3545; }
.event-item.overdue .event-date-box .day { color: #dc3545; }
.event-item.due-soon { background: #fffbeb; border-left: 3px solid #f59e0b; }
.event-item.due-soon .event-date-box { border-color: #fcd34d; }
.event-item.due-soon .event-date-box .month { color: #d97706; }
.event-item.due-soon .event-date-box .day { color: #d97706; }

/* ===== REPORT CARDS ===== */
.report-card {
    background: #fff; border: 1px solid var(--border-color);
    border-radius: var(--radius); padding: 24px;
    display: flex; flex-direction: column; gap: 16px;
    transition: var(--transition);
}
.report-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.report-card-icon {
    width: 52px; height: 52px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(15,81,50,0.08); color: var(--primary); font-size: 26px;
}
.report-card h4 { font-size: 15px; font-weight: 700; }
.report-card p { font-size: 12px; color: var(--text-muted); line-height: 1.5; }
.report-actions { display: flex; gap: 8px; margin-top: auto; }

/* ===== SYSTEM STATUS CARD ===== */
.system-card {
    background: linear-gradient(135deg, var(--primary) 0%, #0d4a2e 100%);
    border-radius: var(--radius); padding: 24px; color: #fff;
}
.system-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 6px; }
.system-card p { font-size: 12px; opacity: 0.7; margin-bottom: 16px; }
.progress-bar { height: 6px; background: rgba(255,255,255,0.2); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: #fff; border-radius: 10px; transition: width 1s ease; }
.progress-label { font-size: 9px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; opacity: 0.6; margin-top: 8px; }

/* ===== TABLE RESPONSIVE WRAPPER ===== */
.table-responsive { overflow-x: auto; }
.table-responsive::-webkit-scrollbar { height: 4px; }

/* ===== FONT MONO ===== */
.font-mono { font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace; }
/* ===== LOGIN OVERLAY ===== */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle at center, #0d4a2e 0%, #051a10 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}
.login-card {
    background: #fff;
    width: 100%;
    max-width: 420px;
    padding: 48px 40px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.login-header {
    text-align: center;
    margin-bottom: 40px;
}
.login-logo-icon {
    font-size: 64px;
    color: var(--primary);
    margin-bottom: 24px;
    display: inline-flex;
    align-items: center; justify-content: center;
    background: var(--accent);
    width: 90px;
    height: 90px;
    border-radius: 20px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
}
.login-header h2 {
    font-size: 24px;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}
.login-header p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 6px;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.admin-only {
    display: none !important;
}
.admin-mode .admin-only {
    display: flex !important;
}
.admin-mode a.admin-only.nav-item {
    display: flex !important;
}

/* System Logo in Sidebar */
.sidebar-logo-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
