:root {
    --bg: #f3f6fb;
    --ink: #0c1b2a;
    --muted: #5f6d7b;
    --line: #d8e0ea;
    --card: #ffffff;
    --brand: #0f8b8d;
    --brand-2: #125b76;
    --accent: #f4a261;
    --danger: #d64545;
    --success: #1f9d55;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: 'Manrope', sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at top right, #e7f7fa 0%, var(--bg) 40%, #eef2f8 100%);
}

a { color: inherit; text-decoration: none; }
small { color: var(--muted); }

.app-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }
.sidebar {
    background: linear-gradient(190deg, #0f172a 0%, #14253c 100%);
    color: #dfe8f5;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: linear-gradient(140deg, var(--brand), var(--brand-2));
    font-weight: 800;
}
.brand h1 { margin: 0; font-size: 1rem; }
.brand p { margin: 2px 0 0; color: #9fb2cc; font-size: 0.82rem; }

.menu { display: grid; gap: 8px; }
.menu a {
    padding: 11px 12px;
    border-radius: 10px;
    color: #c9d7ea;
    font-weight: 600;
}
.menu a.active,
.menu a:hover {
    background: rgba(255, 255, 255, 0.09);
    color: #fff;
}

.content { padding: 26px; }
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}
.topbar h2 { margin: 0; font-size: 1.6rem; }
.topbar p { margin: 3px 0 0; color: var(--muted); }
.user-chip {
    background: #fff;
    border: 1px solid var(--line);
    padding: 10px 14px;
    border-radius: 999px;
    font-weight: 600;
}

.alert {
    border-radius: 12px;
    padding: 12px 14px;
    margin: 0 0 14px;
}
.alert.success { background: #e6f8ee; color: #1b6f41; border: 1px solid #b9e7cc; }
.alert.error { background: #ffecec; color: #8b2e2e; border: 1px solid #f7b7b7; }
.alert ul { margin: 0; padding-left: 18px; }

.grid { display: grid; gap: 16px; }
.cards-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { grid-template-columns: minmax(320px, 0.95fr) minmax(540px, 1.3fr); }

.stat-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
}
.stat-card p { margin: 0; color: var(--muted); font-weight: 600; }
.stat-card h3 { margin: 8px 0 0; font-size: 2rem; }
.stat-card.warn h3 { color: #b65f20; }

.panel {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px;
}
.panel h3 { margin: 0 0 12px; }
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
thead th {
    text-align: left;
    color: var(--muted);
    font-size: 0.82rem;
    letter-spacing: .02em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
    padding: 10px 8px;
}
tbody td {
    border-bottom: 1px solid #edf1f5;
    padding: 11px 8px;
    vertical-align: top;
}

.pill {
    display: inline-block;
    border-radius: 999px;
    background: #ecf4ff;
    color: #305f93;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 4px 10px;
}

.form-grid { display: grid; gap: 10px; }
.form-grid.compact { gap: 8px; }
label { display: grid; gap: 5px; font-weight: 600; font-size: 0.9rem; color: #304152; }
input, select, textarea {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.14);
}

.btn {
    border: none;
    border-radius: 10px;
    padding: 10px 14px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.btn-primary {
    color: #fff;
    background: linear-gradient(140deg, var(--brand), var(--brand-2));
}
.btn-ghost {
    background: #f2f6fb;
    border: 1px solid var(--line);
    color: #314255;
}
.full { width: 100%; }

.inline-actions,
.inline-grade {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.inline-grade input[type="number"] { width: 90px; }
.inline-grade input[type="text"] { min-width: 180px; }

.pager { margin-top: 14px; }
.pager nav { display: flex; justify-content: center; }

.calendar-filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 10px;
}

.day-card {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
    min-height: 108px;
}

.day-card header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
}

.day-card .rate {
    font-size: 1.15rem;
    font-weight: 800;
}

.day-card.status-good {
    border-color: #b6e5c6;
    background: #f2fbf5;
}

.day-card.status-medium {
    border-color: #f5dfb7;
    background: #fffaf0;
}

.day-card.status-low {
    border-color: #f0c1c1;
    background: #fff4f4;
}

.day-card.today {
    box-shadow: 0 0 0 2px rgba(15, 139, 141, 0.18);
}

.muted { color: var(--muted); }

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}
.login-wrap {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 50px rgba(21, 36, 61, 0.13);
}
.login-side {
    padding: 44px;
    color: #fff;
    background: linear-gradient(160deg, #0f8b8d 0%, #125b76 55%, #12253e 100%);
}
.login-side h1 { margin: 0; font-size: 2rem; }
.login-side p { margin: 10px 0 0; max-width: 34ch; color: #dcf4f7; }
.login-badges { margin-top: 20px; display: flex; gap: 8px; flex-wrap: wrap; }
.login-badges span {
    border: 1px solid rgba(255,255,255,.34);
    border-radius: 999px;
    font-size: .82rem;
    padding: 6px 10px;
}
.login-card { padding: 34px; }
.login-card h2 { margin: 0; }
.login-card p { margin: 6px 0 16px; color: var(--muted); }
.checkline { display: flex; align-items: center; gap: 8px; }

@media (max-width: 1100px) {
    .calendar-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar { position: sticky; top: 0; z-index: 10; }
    .cards-4, .split, .login-wrap { grid-template-columns: 1fr; }
    .calendar-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .calendar-grid { grid-template-columns: 1fr; }
    .calendar-filters { flex-direction: column; align-items: stretch; }
}
