/* ============================================================
   SCHOOL HEAD — design tokens
   Concept: the registrar's office. A ledger book crossed with a
   record-card index. Ink-navy sidebar, warm paper canvas, brass
   accents, and a rubber "record stamp" as the signature motif for
   every status (present, paid, active…).
   ============================================================ */

:root {
  --ink: #161B22;
  --ink-2: #212A38;
  --paper: #FAF7F0;
  --paper-raised: #FFFFFF;
  --paper-line: #E4DCC7;
  --text: #1C2027;
  --text-soft: #5B6472;
  --brass: #B8863B;
  --brass-dark: #8C6626;
  --forest: #2E5C4C;
  --rust: #9A4331;

  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", "SFMono-Regular", monospace;

  --radius: 10px;
  --shadow: 0 8px 24px rgba(22, 27, 34, 0.08);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--text);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
a { color: var(--brass-dark); }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0 0 4px; letter-spacing: -0.01em; }
button { font-family: var(--font-body); cursor: pointer; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin: 0 0 2px;
}

/* ---------- brand mark ---------- */
.brand-mark { display: flex; align-items: center; gap: 12px; }
.brand-mark.small { padding: 22px 20px 18px; }
.brand-seal {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--brass);
  color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  border: 2px solid var(--ink);
  flex-shrink: 0;
}
.brand-mark h1 { font-size: 21px; color: var(--ink); }
.brand-mark.small h1 { color: #F4EFE3; font-size: 19px; }

/* ---------- auth screen ---------- */
.auth-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 15% 20%, rgba(184,134,59,0.08), transparent 40%),
    var(--paper);
  padding: 24px;
}
.auth-card {
  width: 100%; max-width: 400px;
  background: var(--paper-raised);
  border: 1px solid var(--paper-line);
  border-radius: 14px;
  padding: 28px 28px 22px;
  box-shadow: var(--shadow);
}
.auth-card .brand-mark { margin-bottom: 22px; }
.auth-panel h2 { font-size: 20px; margin-bottom: 14px; }
.switch-line { font-size: 13px; color: var(--text-soft); margin-top: 14px; text-align: center; }
.hint { font-size: 12.5px; color: var(--text-soft); line-height: 1.5; margin: 10px 0 0; }

/* ---------- form controls ---------- */
.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 500; color: var(--text-soft); margin-bottom: 12px; }
.input {
  font-family: var(--font-body);
  padding: 10px 12px;
  border: 1px solid var(--paper-line);
  border-radius: 7px;
  font-size: 14px;
  background: var(--paper-raised);
  color: var(--text);
}
.input:focus { border-color: var(--brass); }
.form-grid { display: grid; gap: 4px; }

.btn-brass, .btn-ghost {
  font-size: 14px; font-weight: 600; padding: 10px 16px;
  border-radius: 7px; border: 1px solid transparent;
}
.btn-brass { background: var(--brass); color: #1B1500; border-color: var(--brass-dark); }
.btn-brass:hover { background: var(--brass-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--paper-line); }
.btn-ghost:hover { border-color: var(--brass); }
.full { width: 100%; }
.link-btn { background: none; border: none; color: var(--brass-dark); font-weight: 600; font-size: 13px; padding: 4px 0; }

/* ---------- app shell ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex-shrink: 0;
  background: var(--ink); color: #DDE2EA;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-nav { flex: 1; padding: 6px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav-link {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 7px;
  color: #B7BFCC; text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav-link:hover { background: var(--ink-2); color: #fff; }
.nav-link.active { background: var(--brass); color: #1B1500; font-weight: 600; }
.nav-icon { font-size: 13px; width: 16px; text-align: center; }
.sidebar-foot { padding: 16px 20px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-badge { font-size: 12px; color: #9AA3B2; margin: 0 0 10px; text-transform: capitalize; }

.view { flex: 1; padding: 32px 40px; max-width: 1100px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 22px; gap: 12px; flex-wrap: wrap; }
.page-actions { display: flex; gap: 10px; }
.section-title { font-size: 15px; margin: 26px 0 10px; color: var(--text-soft); font-weight: 600; }

/* ---------- stat grid ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 26px; }
.record-card {
  background: var(--paper-raised); border: 1px solid var(--paper-line); border-radius: var(--radius);
  padding: 16px 18px;
}
.stat-label { font-size: 12px; color: var(--text-soft); margin: 0 0 6px; }
.stat-value { font-family: var(--font-mono); font-size: 24px; font-weight: 600; margin: 0; }

/* index card (student self-view) with a card-catalog perforated edge */
.index-card { position: relative; padding-left: 26px; max-width: 320px; }
.index-card::before {
  content: ""; position: absolute; left: 10px; top: 12px; bottom: 12px; width: 0;
  border-left: 2px dashed var(--paper-line);
}
.index-card::after {
  content: ""; position: absolute; left: 5px; top: 50%; width: 9px; height: 9px;
  border-radius: 50%; border: 1.5px solid var(--paper-line); background: var(--paper);
  transform: translateY(-50%);
}

/* ---------- ledger stamp (signature element) ---------- */
.stamp {
  display: inline-block; font-family: var(--font-display); font-weight: 700;
  font-size: 11px; letter-spacing: 0.08em;
  padding: 3px 10px; border-radius: 20px;
  border: 1.5px solid currentColor;
  transform: rotate(-2deg);
}
.stamp-green { color: var(--forest); background: rgba(46,92,76,0.08); }
.stamp-rust { color: var(--rust); background: rgba(154,67,49,0.08); }
.stamp-brass { color: var(--brass-dark); background: rgba(184,134,59,0.1); }
.stamp-neutral { color: var(--text-soft); background: rgba(91,100,114,0.08); }

/* ---------- tables ---------- */
.data-table { width: 100%; border-collapse: collapse; background: var(--paper-raised); border: 1px solid var(--paper-line); border-radius: var(--radius); overflow: hidden; }
.data-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-soft); padding: 10px 14px; border-bottom: 1px solid var(--paper-line); background: #F4F0E6;
}
.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--paper-line); font-size: 13.5px; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #FBF9F3; }

.empty-state { color: var(--text-soft); font-size: 13.5px; padding: 18px; text-align: center; border: 1px dashed var(--paper-line); border-radius: var(--radius); }
.empty-state.small { padding: 8px; font-size: 12px; }
.loading { color: var(--text-soft); padding: 20px; font-size: 13px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; }
.muted { color: var(--text-soft); font-size: 12px; }

/* ---------- timetable ---------- */
.timetable-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.timetable-day { background: var(--paper-raised); border: 1px solid var(--paper-line); border-radius: var(--radius); padding: 10px; min-height: 120px; }
.timetable-day h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-soft); margin-bottom: 8px; }
.timetable-slot { background: #F4F0E6; border-radius: 6px; padding: 6px 8px; margin-bottom: 6px; display: flex; flex-direction: column; font-size: 12px; }
.timetable-slot strong { font-family: var(--font-mono); font-size: 11.5px; }

/* ---------- score sheet ---------- */
.score-sheet { max-height: 340px; overflow-y: auto; }
.score-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--paper-line); }
.score-row .input { width: 90px; }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(22,27,34,0.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal-card { background: var(--paper-raised); border-radius: 12px; width: 100%; max-width: 460px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--paper-line); }
.modal-head h3 { font-size: 17px; }
.icon-btn { background: none; border: none; font-size: 20px; color: var(--text-soft); line-height: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--paper-line); }

/* ---------- toast ---------- */
.toast-host { position: fixed; top: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 8px; font-size: 13px;
  opacity: 0; transform: translateY(-6px); transition: all 0.2s ease; box-shadow: var(--shadow);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast-error { background: var(--rust); }
.toast-success { background: var(--forest); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; flex-direction: row; align-items: center; padding: 8px 12px; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; flex: 1; }
  .nav-link span.text { display: none; }
  .sidebar-foot { display: none; }
  .brand-mark.small { padding: 8px; }
  .brand-mark.small h1 { display: none; }
  .view { padding: 18px; }
  .timetable-grid { grid-template-columns: repeat(2, 1fr); }
}
