@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #F6F3EC;
  --surface: #FFFFFF;
  --surface2: #F0ECE2;
  --line: #E4DFD2;
  --ink: #22302A;
  --muted: #7A8378;
  --accent: #2F5D50;
  --accent-dark: #1F4038;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: 'Inter', sans-serif; background: var(--bg); color: var(--ink); }
h1, h2, .brand, .serif { font-family: 'Fraunces', serif; }
a { color: inherit; text-decoration: none; }

/* ---------- App shell ---------- */
.shell { min-height: 100vh; display: flex; }
.sidebar {
  width: 250px; background: var(--surface); border-right: 1px solid var(--line);
  padding: 22px 16px; display: flex; flex-direction: column; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 9px; font-size: 19px; padding: 0 8px 22px; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; font-family: 'Fraunces', serif; font-size: 15px;
}
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-item {
  display: block; padding: 10px 12px; border-radius: 9px; font-size: 13.6px; font-weight: 500; color: var(--muted);
}
.nav-item:hover { background: var(--surface2); }
.nav-item.active { background: var(--surface2); color: var(--ink); font-weight: 700; }
.side-user { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 10px; }
.side-user-name { font-size: 13px; font-weight: 700; }
.side-user-role { font-size: 11.5px; color: var(--muted); }

.content { flex: 1; padding: 30px 36px; min-width: 0; }
.page-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.page-header h1 { font-size: 27px; margin: 0; }
.muted { color: var(--muted); font-size: 14px; margin: 6px 0 0; }

/* ---------- Cards / grid ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 20px; }
.card + .card { margin-top: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat-label { font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.stat-value { font-family: 'Fraunces', serif; font-size: 30px; }

/* ---------- Forms ---------- */
label.field { display: block; margin-bottom: 14px; }
.field-label { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; font-size: 14px; font-family: inherit; color: var(--ink); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
textarea { resize: vertical; min-height: 60px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center; font-weight: 600;
  border-radius: 9px; cursor: pointer; border: 1px solid transparent; font-family: inherit;
  font-size: 14px; padding: 9px 16px; background: var(--accent); color: #fff;
}
.btn:hover { filter: brightness(1.06); }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-danger { background: #B23A2E; color: #fff; }
.btn-subtle { background: var(--surface2); color: var(--ink); }
.btn-sm { font-size: 13px; padding: 6px 12px; }

/* ---------- Badges / alerts ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; }
.badge-neutral { background: var(--line); color: var(--ink); }
.badge-good { background: #DCEEE3; color: #1F6B45; }
.badge-warn { background: #FBEBD0; color: #8A5A15; }
.badge-bad { background: #F6DEDC; color: #A13327; }
.badge-info { background: #DDE7EA; color: #215966; }
.alert { padding: 10px 14px; border-radius: 9px; font-size: 13.5px; margin-bottom: 16px; }
.alert-bad { background: #F6DEDC; color: #A13327; }
.alert-good { background: #DCEEE3; color: #1F6B45; }

/* ---------- Tables ---------- */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.plain thead th { text-align: left; color: var(--muted); font-size: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
table.plain tbody td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sub { font-size: 11.5px; color: var(--muted); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* ---------- Progress bar ---------- */
.bar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.bar-label { width: 220px; font-size: 13px; flex-shrink: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 8px; border-radius: 999px; background: var(--surface2); overflow: hidden; }
.bar-fill { height: 100%; }
.bar-pct { width: 48px; text-align: right; font-size: 12.5px; font-weight: 700; }

/* ---------- Attendance grid ---------- */
.att-table { border-collapse: collapse; font-size: 12.5px; min-width: 700px; }
.att-table th, .att-table td { padding: 8px 4px; text-align: center; border-bottom: 1px solid var(--line); }
.att-table th:first-child, .att-table td:first-child {
  position: sticky; left: 0; background: var(--surface); text-align: left; padding: 8px 14px; min-width: 160px;
}
.att-pill {
  display: inline-block; width: 20px; height: 20px; line-height: 20px; border-radius: 5px; font-size: 10.5px; font-weight: 700;
}
.att-pill.h { background: #DCEEE3; color: #1F6B45; }
.att-pill.i { background: #FBEBD0; color: #8A5A15; }
.att-pill.a { background: #F6DEDC; color: #A13327; }
.att-pill.dash { color: var(--line); }
.att-legend { display: flex; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--muted); }

/* ---------- Login page ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-box { width: 100%; max-width: 900px; display: grid; grid-template-columns: 1.1fr 1fr; border-radius: 20px; overflow: hidden; box-shadow: 0 20px 60px rgba(24,42,36,0.12); }
.login-hero { background: linear-gradient(160deg, var(--accent) 0%, var(--accent-dark) 100%); color: #F4EFE2; padding: 44px 38px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero .brand { color: #F4EFE2; }
.login-hero .brand-mark { background: rgba(244,239,226,0.15); }
.login-hero h2 { font-size: 30px; line-height: 1.25; margin: 0 0 14px; max-width: 340px; }
.login-hero p { font-size: 14.5px; line-height: 1.7; color: rgba(244,239,226,0.82); max-width: 320px; }
.login-hero .func-list { display: flex; flex-direction: column; gap: 10px; }
.login-hero .func-list div { font-size: 12.5px; color: rgba(244,239,226,0.75); }
.login-hero .func-list strong { color: #F4EFE2; }
.login-form-side { background: var(--surface); padding: 44px 38px; }
.login-tabs { display: flex; gap: 6px; margin-bottom: 26px; background: var(--surface2); padding: 4px; border-radius: 10px; }
.login-tabs a { flex: 1; text-align: center; padding: 8px 0; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.login-tabs a.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
.login-note { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.6; }

@media (max-width: 820px) {
  .login-box { grid-template-columns: 1fr; }
  .login-hero { display: none; }
  .shell { flex-direction: column; }
  .sidebar { width: 100%; }
  .grid-3 { grid-template-columns: 1fr; }
}
