:root {
    --bg: #f4efe6;
    --panel: #fffdf8;
    --ink: #20303b;
    --muted: #61707c;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --accent: #f59e0b;
    --danger: #c2410c;
    --border: #dfd5c7;
    --shadow: 0 18px 40px rgba(32, 48, 59, 0.09);
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    background: radial-gradient(circle at top left, #fff5df 0, #f4efe6 50%, #e7eced 100%);
    color: var(--ink);
}
a { color: var(--primary-dark); text-decoration: none; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
    width: 270px;
    background: linear-gradient(180deg, #113b4a, #1f2937);
    color: #fff;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 20px;
}
.brand { font-size: 28px; font-weight: 700; }
.nav { display: grid; gap: 10px; }
.nav a {
    background: rgba(255,255,255,0.08);
    color: #fff;
    padding: 12px 14px;
    border-radius: 14px;
}
.content { flex: 1; padding: 28px; }
.content.full { max-width: 720px; margin: 0 auto; }
.page-header { margin-bottom: 24px; }
.page-header h1, .page-header p { margin: 0; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 20px; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid.one { grid-template-columns: 1fr; }
.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 22px;
    box-shadow: var(--shadow);
}
.stat { font-size: 34px; margin: 10px 0 0; color: var(--primary-dark); }
.btn, button, input[type="submit"] {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    cursor: pointer;
}
.btn.alt { background: var(--accent); color: #1f2937; }
.btn.danger { background: var(--danger); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
}
form.form-grid { display: grid; gap: 16px; }
label { display: grid; gap: 6px; font-weight: 600; }
input, select, textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font: inherit;
    background: #fff;
}
textarea { min-height: 120px; resize: vertical; }
.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.profile-box { display: flex; gap: 12px; align-items: center; }
.profile-box img, .profile-card img {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 18px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}
.profile-card {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 20px;
    align-items: center;
}
.profile-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}
.badge {
    display: inline-block;
    padding: 6px 10px;
    background: #d1fae5;
    color: #065f46;
    border-radius: 999px;
    font-size: 13px;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef3c7; color: #92400e; }
.alert { padding: 14px 16px; border-radius: 14px; margin-bottom: 18px; }
.alert.success { background: #dcfce7; color: #166534; }
.alert.error { background: #fee2e2; color: #991b1b; }
.search-bar { display: grid; grid-template-columns: 1fr auto; gap: 10px; margin-bottom: 18px; }
.login-card { margin-top: 50px; }
.demo-box { margin-top: 16px; padding: 16px; border-radius: 14px; background: #ecfeff; }
.class-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.class-card {
    display: grid;
    gap: 8px;
    background: #fffaf0;
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, border-color 0.2s ease;
}
.class-card:hover,
.class-card.active {
    transform: translateY(-2px);
    border-color: var(--primary);
}
.compact-grid {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}
.mini-stat {
    display: grid;
    gap: 6px;
    padding: 14px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
}
.mini-stat.success { background: #ecfdf5; }
.mini-stat.danger { background: #fef2f2; }
.mini-stat.warning { background: #fffbeb; }
.legend {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    color: var(--muted);
    font-size: 14px;
}
.legend-box {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 6px;
    border: 1px solid rgba(0,0,0,0.08);
}
.legend-box.present { background: #bbf7d0; }
.legend-box.absent { background: #fecaca; }
.legend-box.leave { background: #fde68a; }
.legend-box.empty { background: #e5e7eb; }
.student-calendar {
    margin-top: 22px;
    padding-top: 22px;
    border-top: 1px solid var(--border);
}
.student-calendar:first-of-type {
    margin-top: 16px;
    padding-top: 0;
    border-top: none;
}
.student-calendar-head {
    margin-bottom: 12px;
}
.attendance-calendar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
    gap: 10px;
}
.calendar-day {
    min-height: 82px;
    border-radius: 16px;
    padding: 10px;
    display: grid;
    align-content: space-between;
    border: 1px solid var(--border);
}
.calendar-day.present { background: #dcfce7; color: #166534; }
.calendar-day.absent { background: #fee2e2; color: #991b1b; }
.calendar-day.leave { background: #fef3c7; color: #92400e; }
.calendar-day.empty { background: #f8fafc; color: var(--muted); }
.day-number {
    font-weight: 700;
    font-size: 16px;
}
.day-status {
    font-size: 12px;
}
@media (max-width: 860px) {
    .shell { flex-direction: column; }
    .sidebar { width: 100%; }
    .profile-card { grid-template-columns: 1fr; }
    .attendance-calendar { grid-template-columns: repeat(auto-fit, minmax(72px, 1fr)); }
}
