:root {
    --bg: #f5f7fb;
    --panel: #ffffff;
    --ink: #18202f;
    --muted: #697386;
    --line: #dce3ee;
    --brand: #0f766e;
    --brand-dark: #115e59;
    --accent: #2563eb;
    --danger: #dc2626;
    --warning: #b45309;
    --success: #15803d;
    --half: #7c3aed;
    --shadow: 0 16px 36px rgba(24, 32, 47, .08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
}

a { color: inherit; text-decoration: none; }

.app-shell {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    width: 248px;
    height: 100vh;
    padding: 22px 16px;
    color: #eef7f6;
    background: #123a3a;
    display: flex;
    flex-direction: column;
    gap: 22px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    font-size: 18px;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: #e8f8f5;
    color: #123a3a;
    font-weight: 900;
}

.sidebar nav { display: grid; gap: 6px; }
.sidebar nav a {
    padding: 11px 12px;
    border-radius: 7px;
    color: #c7dbd9;
    font-weight: 650;
}
.sidebar nav a:hover,
.sidebar nav a.active {
    color: #fff;
    background: rgba(255, 255, 255, .12);
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,.16);
    display: grid;
    gap: 8px;
    color: #b8cfcc;
}
.sidebar-footer a { color: #fff; font-weight: 700; }

.content {
    flex: 1;
    padding: 28px;
    overflow-x: hidden;
}

.auth-content {
    width: 100%;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #edf8f6 0%, #f4f7fb 45%, #edf2ff 100%);
}

.page-head,
.toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
}

h1, h2, h3 { margin: 0; letter-spacing: 0; }
h1 { font-size: 30px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.card,
.auth-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.card { padding: 18px; }
.auth-card { width: min(440px, 100%); padding: 28px; }
.auth-card .brand { color: var(--ink); margin-bottom: 24px; }

.metric {
    display: grid;
    gap: 8px;
}
.metric span { color: var(--muted); font-weight: 650; }
.metric strong { font-size: 28px; }

.table-wrap {
    overflow-x: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}

th, td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    color: var(--muted);
    background: #f8fafc;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0;
}

tr:last-child td { border-bottom: 0; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .full { grid-column: 1 / -1; }

label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 700;
}

input, select, textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 7px;
    color: var(--ink);
    background: #fff;
    font: inherit;
}

textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid rgba(15,118,110,.18);
    border-color: var(--brand);
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    align-items: center;
}

.btn,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 9px 13px;
    border: 1px solid transparent;
    border-radius: 7px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
}

.btn:hover,
button:hover { background: var(--brand-dark); }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--line); }
.btn.secondary:hover { background: #f8fafc; }
.btn.danger, button.danger { background: var(--danger); }
.btn.danger:hover, button.danger:hover { background: #b91c1c; }
.btn.link { background: transparent; color: var(--accent); padding-inline: 0; border: 0; }

.badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 3px 9px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 12px;
}
.badge.present { color: var(--success); background: #dcfce7; }
.badge.late { color: var(--warning); background: #fef3c7; }
.badge.half { color: var(--half); background: #ede9fe; }
.badge.absent { color: var(--danger); background: #fee2e2; }
.badge.neutral { color: #334155; background: #e2e8f0; }

.alert {
    padding: 12px 14px;
    margin-bottom: 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    font-weight: 700;
}
.alert.success { border-color: #bbf7d0; background: #f0fdf4; color: var(--success); }
.alert.error { border-color: #fecaca; background: #fef2f2; color: var(--danger); }
.alert.info { border-color: #bfdbfe; background: #eff6ff; color: #1d4ed8; }

.inline-form { display: inline; }
.kpi-line { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }

.empty {
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 920px) {
    .app-shell { display: block; }
    .sidebar {
        position: static;
        width: 100%;
        height: auto;
        border-radius: 0;
    }
    .sidebar nav {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    .content { padding: 18px; }
    .grid,
    .grid.two,
    .grid.three,
    .form-grid,
    .form-grid.three { grid-template-columns: 1fr; }
    .page-head,
    .toolbar { display: grid; }
}

@media (max-width: 560px) {
    .sidebar nav { grid-template-columns: 1fr 1fr; }
    h1 { font-size: 24px; }
    .content { padding: 14px; }
    .card, .auth-card { padding: 16px; }
}