@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600&family=DM+Serif+Display&display=swap');

:root {
    --bg:        #F5F3EF;
    --surface:   #FFFFFF;
    --border:    #E2DED7;
    --text:      #1A1A18;
    --muted:     #7A7670;
    --accent:    #1D5C8A;
    --accent-lt: #EAF2FA;
    --green:     #1A6B4A;
    --green-lt:  #E6F5EE;
    --amber:     #9A5C00;
    --amber-lt:  #FEF3E2;
    --red:       #B52A2A;
    --red-lt:    #FCEAEA;
    --radius:    10px;
    --shadow:    0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
    --nav-w:     240px;
}

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

body {
    font-family: 'DM Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

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

.sidebar {
    width: var(--nav-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
}

.sidebar-logo {
    padding: 1.5rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}
.sidebar-logo span {
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    color: var(--accent);
    letter-spacing: -.5px;
}
.sidebar-logo small { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.nav-section { padding: 0 1.25rem; margin-bottom: .25rem; font-size: 10px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; color: var(--muted); }
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 1.25rem;
    font-size: 14px; font-weight: 400;
    color: var(--muted);
    border-left: 3px solid transparent;
    transition: all .15s;
}
.nav-link:hover { color: var(--text); background: var(--bg); text-decoration: none; }
.nav-link.active { color: var(--accent); background: var(--accent-lt); border-left-color: var(--accent); font-weight: 500; }
.nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border);
    font-size: 13px;
}
.sidebar-footer .user-name { font-weight: 500; }
.sidebar-footer .user-email { color: var(--muted); font-size: 12px; }

.main { margin-left: var(--nav-w); flex: 1; min-height: 100vh; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: .9rem 2rem;
    display: flex; align-items: center; justify-content: space-between;
    position: sticky; top: 0; z-index: 50;
}
.topbar h1 { font-family: 'DM Serif Display', serif; font-size: 20px; font-weight: 400; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.content { padding: 2rem; }

/* ── Cards ──────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.card-header {
    padding: 1.1rem 1.5rem .9rem;
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 15px; font-weight: 600; }
.card-body { padding: 1.5rem; }

/* ── Stat cards ─────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.1rem 1.25rem; }
.stat-label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat-value { font-size: 28px; font-weight: 600; line-height: 1; }
.stat-sub { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-card.green .stat-value { color: var(--green); }
.stat-card.amber .stat-value { color: var(--amber); }
.stat-card.red .stat-value   { color: var(--red); }
.stat-card.blue .stat-value  { color: var(--accent); }

/* ── Buttons ─────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; font-size: 13px; font-weight: 500;
    border-radius: 8px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text);
    cursor: pointer; transition: all .15s;
    font-family: 'DM Sans', sans-serif;
    text-decoration: none;
}
.btn:hover { background: var(--bg); text-decoration: none; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #174d77; }
.btn-danger  { background: var(--red); color: #fff; border-color: var(--red); }
.btn-danger:hover  { background: #9a2020; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn svg { width: 14px; height: 14px; }

/* ── Forms ───────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-grid.cols3 { grid-template-columns: 1fr 1fr 1fr; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.span2 { grid-column: span 2; }
.form-group.span3 { grid-column: span 3; }
label { font-size: 13px; font-weight: 500; color: var(--muted); }
input, select, textarea {
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color .15s;
    width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: #fff; }
textarea { resize: vertical; min-height: 80px; }

/* ── Table ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
    text-align: left; padding: 10px 14px;
    font-size: 11px; font-weight: 600; letter-spacing: .5px;
    text-transform: uppercase; color: var(--muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg); }

/* ── Badges ──────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.badge-normal    { background: var(--green-lt); color: var(--green); }
.badge-attention { background: var(--amber-lt); color: var(--amber); }
.badge-critical  { background: var(--red-lt);   color: var(--red); }

/* ── Alerts ──────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: 8px; font-size: 14px; margin-bottom: 1rem; }
.alert-success { background: var(--green-lt); color: var(--green); border: 1px solid #b5deca; }
.alert-error   { background: var(--red-lt);   color: var(--red);   border: 1px solid #f5c0c0; }
.alert-info    { background: var(--accent-lt); color: var(--accent); border: 1px solid #b5d4f4; }

/* ── Auth pages ──────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg);
}
.auth-card { width: 100%; max-width: 420px; }
.auth-card .card-body { padding: 2.5rem; }
.auth-logo {
    text-align: center; margin-bottom: 2rem;
    font-family: 'DM Serif Display', serif; font-size: 28px; color: var(--accent);
}
.auth-logo small { display: block; font-family: 'DM Sans', sans-serif; font-size: 13px; color: var(--muted); font-weight: 400; }
.auth-footer { text-align: center; margin-top: 1.25rem; font-size: 13px; color: var(--muted); }

/* ── Filters bar ─────────────────────────────────────── */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 1.25rem; align-items: center; }
.filters input, .filters select { width: auto; min-width: 140px; padding: 7px 10px; }

/* ── Chart container ─────────────────────────────────── */
.chart-box { position: relative; height: 280px; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .main { margin-left: 0; }
    .form-grid, .form-grid.cols3 { grid-template-columns: 1fr; }
    .form-group.span2, .form-group.span3 { grid-column: span 1; }
    .content { padding: 1rem; }
}

/* ── Print ───────────────────────────────────────────── */
@media print {
    .sidebar, .topbar, .topbar-actions, .btn, .filters, .no-print { display: none !important; }
    .main { margin-left: 0; }
    body { background: #fff; font-size: 12px; }
    .card { box-shadow: none; border: 1px solid #ccc; }
}
