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

:root {
    --navy:      #1F3864;
    --navy-dark: #162d52;
    --navy-light:#2a4a80;
    --orange:    #E65100;
    --green:     #2E7D32;
    --red:       #C62828;
    --yellow:    #F9A825;
    --gray-50:   #f8f9fc;
    --gray-100:  #f0f2f7;
    --gray-200:  #e0e4ed;
    --gray-400:  #9aa0b0;
    --gray-600:  #555e78;
    --gray-900:  #1a1e2e;
    --white:     #ffffff;
    --sidebar-w: 220px;
    --radius:    8px;
    --shadow:    0 1px 4px rgba(0,0,0,0.08);
}

body {
    font-family: Arial, sans-serif;
    font-size: 14px;
    color: var(--gray-900);
    background: var(--gray-100);
    min-height: 100vh;
}

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

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding: 28px;
    min-width: 0;
}

/* ── SIDEBAR ────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-w);
    background: var(--navy);
    color: white;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
}

.sidebar-logo {
    padding: 22px 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}
.logo-ws { font-size: 17px; font-weight: 700; color: white; }
.logo-g  { font-size: 17px; font-weight: 700; color: #f97316; }
.logo-sub { font-size: 10px; color: rgba(255,255,255,0.5); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.8px; }

.nav-links { list-style: none; padding: 10px 0; flex: 1; }
.nav-links li a {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 20px;
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.15s, color 0.15s;
}
.nav-links li a svg { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; }
.nav-links li a:hover { background: rgba(255,255,255,0.08); color: white; }
.nav-links li.active a { background: rgba(255,255,255,0.12); color: white; border-left: 3px solid #f97316; }

.sidebar-footer {
    padding: 14px 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 12px;
    color: rgba(255,255,255,0.6);
    display: flex; justify-content: space-between; align-items: center;
}
.logout-link { color: rgba(255,255,255,0.5); text-decoration: none; font-size: 11px; }
.logout-link:hover { color: white; }

/* ── PAGE HEADER ────────────────────────────────────── */
.page-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 24px;
}
.page-title { font-size: 20px; font-weight: 700; color: var(--navy); }
.page-sub   { font-size: 12px; color: var(--gray-400); margin-top: 2px; }

/* ── STAT CARDS ─────────────────────────────────────── */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--navy);
}
.stat-card.green  { border-top-color: var(--green); }
.stat-card.orange { border-top-color: var(--orange); }
.stat-card.red    { border-top-color: var(--red); }
.stat-card.yellow { border-top-color: var(--yellow); }
.stat-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--gray-400); margin-bottom: 6px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-sub   { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.stat-delta { font-size: 11px; font-weight: 600; margin-top: 4px; }
.stat-delta.up   { color: var(--green); }
.stat-delta.down { color: var(--red); }

/* ── TABLES ─────────────────────────────────────────── */
.card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 24px;
}
.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex; justify-content: space-between; align-items: center;
}
.card-title { font-size: 14px; font-weight: 700; color: var(--navy); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    background: var(--navy);
    color: white;
    padding: 10px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    white-space: nowrap;
}
tbody tr { border-bottom: 1px solid var(--gray-100); }
tbody tr:hover { background: var(--gray-50); }
tbody td { padding: 10px 14px; color: var(--gray-900); }

/* ── BADGES ─────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}
.badge-retire    { background: #FFDDDD; color: #8B0000; }
.badge-remediate { background: #FFE8CC; color: #7A3000; }
.badge-monitor   { background: #FFFACC; color: #665000; }
.badge-watch     { background: #EFEFEF; color: #444; }
.badge-clean     { background: #DDFFDD; color: #1B5E20; }
.badge-submitted { background: #E3F2FD; color: #0D47A1; }
.badge-atr       { background: #DDFFDD; color: #1B5E20; }

/* ── FILTERS ────────────────────────────────────────── */
.filter-bar {
    display: flex; gap: 10px; align-items: center;
    flex-wrap: wrap; margin-bottom: 16px;
}
.filter-bar input, .filter-bar select {
    padding: 7px 11px;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px;
    font-size: 13px;
    background: white;
}
.filter-bar input:focus, .filter-bar select:focus {
    outline: none; border-color: var(--navy);
}
.btn {
    padding: 7px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    text-decoration: none;
    display: inline-block;
}
.btn-primary { background: var(--navy); color: white; }
.btn-primary:hover { background: var(--navy-dark); }
.btn-danger  { background: var(--red); color: white; }

/* ── LOGIN PAGE ─────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: var(--gray-100);
}
.login-card {
    background: white;
    border-radius: 10px;
    padding: 40px;
    width: 380px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}
.login-logo { text-align: center; margin-bottom: 28px; }
.login-logo .logo-ws { font-size: 22px; }
.login-logo .logo-g  { font-size: 22px; }
.login-logo .logo-sub { font-size: 11px; color: var(--gray-400); margin-top: 4px; }
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; color: var(--gray-600); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
.form-group input {
    width: 100%; padding: 10px 12px;
    border: 1.5px solid var(--gray-200);
    border-radius: 6px; font-size: 14px;
}
.form-group input:focus { outline: none; border-color: var(--navy); }
.btn-login { width: 100%; padding: 12px; font-size: 15px; font-weight: 700; background: var(--navy); color: white; border: none; border-radius: 6px; cursor: pointer; }
.btn-login:hover { background: var(--navy-dark); }
.login-error { background: #FFDDDD; color: var(--red); padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }

/* ── DATE RANGE PICKER ──────────────────────────────── */
.date-range { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--gray-400); }

/* ── CHART CONTAINER ────────────────────────────────── */
.chart-wrap { padding: 20px; height: 280px; position: relative; }

/* ── CIDR SECTION ───────────────────────────────────── */
.cidr-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}
.cidr-card {
    background: white;
    border-radius: var(--radius);
    padding: 12px 14px;
    border-left: 4px solid #ccc;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: transform 0.1s;
}
.cidr-card:hover { transform: translateY(-1px); }
.cidr-card.active { box-shadow: 0 0 0 2px var(--navy); }
.cidr-card .label { font-size: 10px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; color: var(--gray-400); margin-bottom: 4px; }
.cidr-card .count { font-size: 24px; font-weight: 700; line-height: 1; }
.cidr-card .sub   { font-size: 10px; color: var(--gray-400); margin-top: 3px; }
.c-retire    { border-left-color: #D32F2F; } .c-retire .count    { color: #D32F2F; }
.c-remediate { border-left-color: #E65100; } .c-remediate .count { color: #E65100; }
.c-monitor   { border-left-color: #F9A825; } .c-monitor .count   { color: #F9A825; }
.c-watch     { border-left-color: #888; }    .c-watch .count     { color: #555; }
.c-clean     { border-left-color: #2E7D32; } .c-clean .count     { color: #2E7D32; }
.c-all       { border-left-color: var(--navy); } .c-all .count   { color: var(--navy); }
.c-submitted { border-left-color: #0D47A1; } .c-submitted .count { color: #0D47A1; }
.c-atr       { border-left-color: #2E7D32; } .c-atr .count       { color: #2E7D32; }

/* ── OVERLAY / MODAL ────────────────────────────────── */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 200; align-items: center; justify-content: center; }
.overlay.open { display: flex; }
.modal { background: white; border-radius: 10px; padding: 24px; width: 560px; max-width: 96vw; max-height: 88vh; overflow-y: auto; position: relative; }
.modal-close { position: absolute; top: 12px; right: 14px; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--gray-400); }
.modal-title { font-size: 18px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.modal-sub   { font-size: 13px; color: var(--gray-400); margin-bottom: 16px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.detail-field { background: var(--gray-50); border-radius: 6px; padding: 8px 10px; }
.detail-field .lbl { font-size: 10px; color: var(--gray-400); font-weight: 700; text-transform: uppercase; margin-bottom: 2px; }
.detail-field .val { font-size: 13px; font-weight: 600; }
.flag-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--gray-100); font-size: 12px; }
.flag-row:last-child { border-bottom: none; }
.flag-Y { color: #D32F2F; font-weight: 700; }
.flag-N { color: var(--gray-400); }
.log-entry { display: flex; gap: 8px; font-size: 11px; padding: 5px 0; border-bottom: 1px solid var(--gray-100); }
.log-date  { color: var(--gray-400); min-width: 120px; }

/* ── PAGINATION ─────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--gray-100); font-size: 12px; color: var(--gray-400); }
.page-btns { display: flex; gap: 5px; }
.page-btn { padding: 4px 10px; border: 1px solid var(--gray-200); border-radius: 4px; background: white; cursor: pointer; font-size: 11px; }
.page-btn.active { background: var(--navy); color: white; border-color: var(--navy); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

@media (max-width: 900px) {
    .cidr-grid { grid-template-columns: repeat(4,1fr); }
    .stat-grid { grid-template-columns: repeat(2,1fr); }
}
