:root {
    color-scheme: light;
    --bg: #eef4ff;
    --surface: #ffffff;
    --surface-soft: #f7f9ff;
    --surface-strong: #edf2ff;
    --text: #0f172a;
    --text-muted: #5b6676;
    --border: #d8e2f1;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --success: #16a34a;
    --danger: #be123c;
    --warning: #f59e0b;
    --radius: 26px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: radial-gradient(circle at top left, rgba(79,70,229,0.14), transparent 34%),
                linear-gradient(180deg, #eef4ff 0%, #f8fbff 100%);
    color: var(--text);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button,
input,
select,
textarea {
    font: inherit;
}

button {
    cursor: pointer;
}

img,
svg {
    display: block;
    max-width: 100%;
}

.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 24px;
    background: linear-gradient(180deg, rgba(15,23,42,0.04) 0%, rgba(255,255,255,0.65) 100%);
}

.container .card {
    width: 100%;
    max-width: 520px;
    background: var(--surface);
    border-radius: 28px;
    box-shadow: 0 30px 80px rgba(15,23,42,0.12);
    padding: 36px;
}

.logo {
    text-align: center;
    margin-bottom: 32px;
}

.logo .logo-icon {
    width: 64px;
    height: 64px;
    border-radius: 18px;
    background: linear-gradient(135deg, var(--primary-dark), #2563eb);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: white;
    margin-bottom: 16px;
}

.logo h2 {
    font-size: 28px;
    color: var(--text);
    margin-bottom: 8px;
}

.logo p {
    color: var(--text-muted);
    font-size: 15px;
}

.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    color: #334155;
    font-weight: 600;
    font-size: 14px;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    min-height: 48px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: #f8fafc;
    color: var(--text);
    transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.form-group textarea {
    min-height: 120px;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(79,70,229,0.12);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 600;
    transition: transform 0.25s ease, background 0.25s ease;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.text-center {
    text-align: center;
    margin-top: 20px;
}

.text-center a {
    color: var(--primary-dark);
    text-decoration: none;
}

/* ============ ADMIN PANEL LAYOUT ============ */
.admin-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--bg);
}

.sidebar {
    width: 280px;
    background: #0b142f;
    color: #f8fafc;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    padding-bottom: 24px;
    border-right: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header {
    padding: 34px 26px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-header h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.sidebar-header p {
    font-size: 13px;
    color: rgba(248,250,252,0.72);
}

.sidebar-menu {
    list-style: none;
    padding: 0;
    margin-top: 24px;
    flex: 1;
}

.sidebar-menu li {
    margin-bottom: 8px;
}

.sidebar-menu li a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 22px;
    color: rgba(226,232,240,0.95);
    border-radius: 16px;
    transition: background 0.25s ease, color 0.25s ease;
    font-size: 15px;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
    background: rgba(99,102,241,0.18);
    color: #ffffff;
}

.main-content {
    flex: 1;
    margin-left: 280px;
    padding: 32px 36px;
    min-width: 0;
    width: calc(100% - 280px);
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
    padding: 24px 28px;
    background: var(--surface);
    border-radius: 28px;
    box-shadow: 0 28px 80px rgba(15,23,42,0.08);
}

.top-bar h1 {
    font-size: 32px;
    color: var(--text);
}

.admin-info {
    display: flex;
    align-items: center;
}

.admin-name {
    display: inline-flex;
    align-items: center;
    padding: 12px 18px;
    border-radius: 999px;
    background: rgba(99,102,241,0.12);
    color: var(--primary-dark);
    font-weight: 700;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 24px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--surface);
    border-radius: 28px;
    padding: 26px;
    box-shadow: 0 24px 60px rgba(15,23,42,0.08);
    display: flex;
    align-items: center;
    gap: 18px;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 30px 72px rgba(15,23,42,0.12);
}

.stat-icon {
    font-size: 40px;
}

.stat-info h3 {
    margin-bottom: 8px;
    font-size: 14px;
    color: #64748b;
}

.stat-info p {
    font-size: 34px;
    font-weight: 700;
    color: var(--text);
}

.stat-card.safe .stat-info p { color: var(--success); }
.stat-card.missing .stat-info p { color: var(--danger); }
.stat-card.unaccounted .stat-info p { color: var(--warning); }

.card {
    background: var(--surface);
    border-radius: 28px;
    box-shadow: 0 24px 60px rgba(15,23,42,0.08);
    overflow: hidden;
    margin-bottom: 32px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 26px 30px;
    border-bottom: 1px solid #eef2f7;
    flex-wrap: wrap;
}

.card-header h2 {
    font-size: 22px;
    color: var(--text);
}

.btn-refresh {
    padding: 12px 20px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 16px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.25s ease, transform 0.25s ease;
}

.btn-refresh:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.table-responsive {
    overflow-x: auto;
    padding: 20px;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 600px;
}

th,
td {
    padding: 18px 16px;
    text-align: left;
    border-bottom: 1px solid #e7edf7;
}

th {
    background: #f8fbff;
    font-weight: 700;
    font-size: 12px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #475569;
}

td {
    color: #334155;
    font-size: 14px;
}

tr:hover td {
    background: rgba(79,70,229,0.06);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.status-safe { background: #ecfdf5; color: var(--success); }
.status-missing { background: #fce7f3; color: var(--danger); }
.status-unaccounted { background: #fff7ed; color: var(--warning); }

.last-updated {
    text-align: center;
    padding: 16px 20px;
    font-size: 13px;
    color: #6b7280;
    background: #f8fbff;
    border-radius: 22px;
    margin-top: 16px;
}

/* Media Queries */
@media (max-width: 1280px) {
    .main-content {
        padding: 24px 28px;
    }
    
    .stats-grid {
        gap: 20px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-info p {
        font-size: 28px;
    }
}

@media (max-width: 1024px) {
    .sidebar {
        width: 72px;
    }

    .main-content {
        margin-left: 72px;
        padding: 20px;
        width: calc(100% - 72px);
    }

    .sidebar-header h2,
    .sidebar-header p,
    .sidebar-menu li a span {
        display: none;
    }
    
    .sidebar-menu li a {
        justify-content: center;
        padding: 16px;
    }

    .top-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        padding: 20px;
    }
    
    .top-bar h1 {
        font-size: 28px;
    }

    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stat-card {
        padding: 18px;
    }
    
    .stat-icon {
        font-size: 32px;
    }
    
    .stat-info p {
        font-size: 24px;
    }
    
    .table-responsive {
        padding: 12px;
    }
    
    th,
    td {
        padding: 12px 10px;
    }
    
    th {
        font-size: 11px;
    }
    
    td {
        font-size: 13px;
    }
    
    .card-header h2 {
        font-size: 18px;
    }
    
    .btn-refresh {
        width: 100%;
    }
}

@media (max-width: 640px) {
    body {
        font-size: 14px;
    }
    
    .top-bar {
        padding: 16px;
    }
    
    .top-bar h1 {
        font-size: 24px;
    }
    
    .admin-name {
        font-size: 13px;
        padding: 8px 14px;
    }
    
    .card {
        border-radius: 20px;
    }
    
    .card-header {
        padding: 16px;
    }
    
    .card-header h2 {
        font-size: 16px;
    }
    
    .table-responsive {
        padding: 8px;
    }
    
    th, td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .status-badge {
        padding: 4px 10px;
        font-size: 11px;
    }
    
    .last-updated {
        font-size: 11px;
        padding: 12px;
    }
}