/* ===== Design tokens (colors and sizes in one place) ===== */
:root {
    --sidebar-width: 250px;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;

    --expired: #dc2626;
    --critical: #ea580c;
    --warning: #ca8a04;
    --safe: #16a34a;
}

/* ===== Reset and base ===== */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial,
        sans-serif;
    background: var(--bg);
    color: var(--text);
}

/* ===== Layout: sidebar + main ===== */
.layout {
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    padding: 24px 16px;
    z-index: 100;
    transition: transform 0.25s ease;
}

.main {
    margin-left: var(--sidebar-width);
    padding: 28px 32px;
}

/* ===== Sidebar content ===== */
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 8px 24px;
    border-bottom: 1px solid #1e293b;
    margin-bottom: 20px;
}

.brand-icon {
    font-size: 1.6rem;
}

.brand-name {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 8px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-weight: 500;
    transition: background 0.15s ease;
}

.nav-link:hover {
    background: #1e293b;
}

.nav-link.active {
    background: var(--primary);
    color: #ffffff;
}

.sidebar-footer {
    font-size: 0.8rem;
    color: #64748b;
    padding: 0 8px;
}

.sidebar-footer p {
    margin: 2px 0;
}

/* ===== Top bar / page title ===== */
.topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.page-title {
    margin: 0;
    font-size: 1.75rem;
}

.page-subtitle {
    margin: 4px 0 0;
    color: var(--text-muted);
}

/* The menu button is hidden on desktop, shown on mobile */
.menu-btn {
    display: none;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 1.3rem;
    padding: 6px 12px;
    cursor: pointer;
}

.overlay {
    display: none;
}

/* ===== Stat cards ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-left: 5px solid var(--primary);
    border-radius: 10px;
    padding: 18px 20px;
}

.stat-card.stat-expired {
    border-left-color: var(--expired);
}

.stat-card.stat-critical {
    border-left-color: var(--critical);
}

.stat-card.stat-warning {
    border-left-color: var(--warning);
}

.stat-label {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.stat-value {
    margin: 8px 0 0;
    font-size: 2rem;
    font-weight: 700;
}

/* ===== Panels (white cards that hold content) ===== */
.panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px;
}

.panel-header h2 {
    margin: 0 0 12px;
    font-size: 1.2rem;
}

/* ===== Empty state ===== */
.empty-state {
    text-align: center;
    padding: 40px 16px;
}

.empty-icon {
    font-size: 2.5rem;
}

.empty-title {
    margin: 10px 0 4px;
    font-weight: 600;
    font-size: 1.05rem;
}

.empty-text {
    margin: 0 auto;
    max-width: 420px;
    color: var(--text-muted);
}

/* ===== Toolbar (search, filter, button) ===== */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
}

.input {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.95rem;
    background: #ffffff;
}

.toolbar .input[type="text"] {
    flex: 1;
    min-width: 180px;
}

.btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-dark);
}

.btn:disabled,
.input:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ===== Table ===== */
.table-wrapper {
    overflow-x: auto;
    /* lets the table scroll sideways on small screens */
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 640px;
}

.table th,
.table td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: #f8fafc;
}

/* ===== Mobile layout (screens 900px wide or less) ===== */
@media (max-width: 900px) {
    .sidebar {
        transform: translateX(-100%);
        /* hide sidebar off-screen */
    }

    .sidebar.open {
        transform: translateX(0);
        /* slide it in */
    }

    .main {
        margin-left: 0;
        padding: 20px 16px;
    }

    .menu-btn {
        display: block;
    }

    .overlay.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.5);
        z-index: 90;
    }

    .page-title {
        font-size: 1.4rem;
    }
}