/* INNOS Portal — the school's working rooms, in the same voice as the website. */

:root {
  --ink: #0e090b;
  --ink-2: #1a1114;
  --ink-3: #2a1d21;
  --burgundy: #6e1830;
  --burgundy-deep: #3f0d1b;
  --gold: #c9a35c;
  --gold-soft: rgba(201, 163, 92, 0.14);
  --champagne: #f1d9a6;
  --ivory: #f6f2ea;
  --paper: #fbf9f5;
  --white: #ffffff;
  --muted: #6b625e;
  --line: rgba(14, 9, 11, 0.1);
  --line-strong: rgba(14, 9, 11, 0.18);
  --line-dark: rgba(255, 255, 255, 0.1);
  --ok: #2f6b4f;
  --ok-soft: #e4efe8;
  --warn: #9a6a12;
  --warn-soft: #f6ecd6;
  --bad: #9b2335;
  --bad-soft: #f5e1e3;
  --info: #3c5a7a;
  --info-soft: #e3e9f0;
  --serif: "Instrument Serif", "Iowan Old Style", "Times New Roman", serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 4px;
  --side: 268px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--champagne); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.m0 { margin: 0 !important; }
.mt-s { margin-top: 0.4rem; }
.mt { margin-top: 1.2rem; }
.mt-l { margin-top: 1.6rem; }
.pad-y { padding: 1.4rem 0; }
.grow { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Type ---------- */
.kicker { display: flex; align-items: center; gap: 0.8rem; margin: 0 0 0.6rem; font-size: 0.66rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--gold); }
.kicker::before { content: ""; width: 1.8rem; height: 1px; background: currentColor; opacity: 0.7; }
.serif { font-family: var(--serif); font-weight: 400; letter-spacing: -0.015em; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; letter-spacing: -0.02em; margin: 0; line-height: 1; }
h1 { font-size: clamp(2.2rem, 3.6vw, 3.2rem); }
h1 em, h2 em { font-style: italic; color: var(--burgundy); }
h2 { font-size: 1.7rem; }
h3 { font-size: 1.3rem; }
.muted { color: var(--muted); }
.small { font-size: 0.84rem; }
.caps { font-size: 0.66rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); }

/* ---------- Buttons + fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 40px; padding: 0.55rem 1.1rem; border-radius: 999px; border: 1px solid var(--ink);
  background: var(--ink); color: var(--white); cursor: pointer; text-decoration: none;
  font-size: 0.7rem; font-weight: 500; letter-spacing: 0.2em; text-transform: uppercase; white-space: nowrap;
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, opacity 0.2s ease;
}
.btn:hover { background: var(--burgundy); border-color: var(--burgundy); }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.ghost:hover { border-color: var(--ink); background: transparent; }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.gold:hover { background: var(--champagne); border-color: var(--champagne); }
.btn.danger { background: transparent; color: var(--bad); border-color: rgba(155, 35, 53, 0.35); }
.btn.danger:hover { background: var(--bad); color: white; border-color: var(--bad); }
.btn.small { min-height: 32px; padding: 0.35rem 0.8rem; font-size: 0.62rem; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.link { background: none; border: 0; padding: 0; color: var(--burgundy); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(110, 24, 48, 0.35); }

.field { display: grid; gap: 0.35rem; }
.field > span { font-size: 0.64rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 42px; padding: 0.55rem 0.75rem; border: 1px solid var(--line-strong);
  border-radius: var(--radius); background: var(--white); font-size: 15px; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea.input { min-height: 96px; resize: vertical; line-height: 1.5; }
.input:focus { outline: 0; border-color: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
select.input { appearance: none; padding-right: 2rem; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.input.score { width: 84px; text-align: center; font-variant-numeric: tabular-nums; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem 1rem; align-items: end; }
.grid-form .full { grid-column: 1 / -1; }

/* ---------- Auth ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: 1.1fr 0.9fr; background: var(--paper); }
.auth-art { position: relative; overflow: hidden; color: var(--ivory); background: var(--ink); display: flex; flex-direction: column; justify-content: space-between; padding: clamp(1.5rem, 4vw, 3.5rem); }
.auth-art img.bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 40%; filter: saturate(0.95) contrast(1.03); animation: auth-push 28s ease-in-out alternate infinite; }
.auth-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(10, 4, 7, 0.92) 0%, rgba(10, 4, 7, 0.72) 28%, rgba(10, 4, 7, 0.18) 55%, rgba(10, 4, 7, 0) 75%, rgba(10, 4, 7, 0.35) 100%), linear-gradient(100deg, rgba(40, 8, 18, 0.5) 0%, rgba(40, 8, 18, 0.1) 50%, rgba(40, 8, 18, 0) 75%); }
.auth-art > * { position: relative; z-index: 2; }
.auth-art img.bg { z-index: 0; }
.auth-art::after { z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 0.85rem; text-decoration: none; }
.auth-brand img { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25); }
.auth-brand strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.45rem; letter-spacing: 0.22em; line-height: 1; }
.auth-brand span { display: block; margin-top: 0.3rem; font-size: 0.6rem; letter-spacing: 0.36em; text-transform: uppercase; color: var(--champagne); }
.auth-art a, .auth-art h1, .auth-art p { text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55), 0 1px 3px rgba(0, 0, 0, 0.45); }
.auth-art h1 { font-size: clamp(3rem, 6vw, 6rem); line-height: 0.88; letter-spacing: -0.035em; max-width: 9ch; }
.auth-art h1 em { color: var(--champagne); }
.auth-art p { max-width: 30rem; color: rgba(255, 255, 255, 0.92); margin: 1.2rem 0 0; font-size: 1.02rem; }
.auth-art .kicker { color: var(--champagne); font-weight: 500; }
@keyframes auth-push { from { transform: scale(1.06); } to { transform: scale(1.16) translate(-1%, -1%); } }
.auth-panel { display: grid; place-items: center; padding: clamp(1.5rem, 5vw, 4rem); }
.auth-card { width: min(420px, 100%); display: grid; gap: 1.2rem; }
.auth-card h2 { font-size: clamp(2.4rem, 4vw, 3.2rem); }
.auth-card h2 em { font-style: italic; color: var(--burgundy); }
.auth-card form { display: grid; gap: 1rem; margin-top: 0.4rem; }
.auth-card .btn { min-height: 50px; margin-top: 0.4rem; }
.auth-foot { padding-top: 1.2rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.86rem; }
.auth-foot a { color: var(--burgundy); }
.who { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0.9rem 0 0; padding: 0; list-style: none; }
.who li { padding: 0.3rem 0.75rem; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); }
.form-error { min-height: 1.2rem; margin: 0; color: var(--bad); font-size: 0.88rem; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 4.2rem; }
.pw-wrap button { position: absolute; right: 0.4rem; top: 50%; translate: 0 -50%; background: none; border: 0; padding: 0.3rem 0.5rem; font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase; color: var(--muted); cursor: pointer; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: var(--side) 1fr; min-height: 100vh; min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; display: flex; flex-direction: column;
  background: var(--ink); color: var(--ivory); padding: 1.4rem 1rem 1rem; scrollbar-width: thin; scrollbar-color: var(--ink-3) transparent;
}
.side-brand { display: flex; align-items: center; gap: 0.75rem; padding: 0 0.5rem 1.3rem; border-bottom: 1px solid var(--line-dark); text-decoration: none; }
.side-brand img { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
.side-brand strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.25rem; letter-spacing: 0.2em; line-height: 1; }
.side-brand span { display: block; margin-top: 0.25rem; font-size: 0.56rem; letter-spacing: 0.34em; text-transform: uppercase; color: var(--gold); }
.side-user { margin: 1.2rem 0.5rem 0.4rem; }
.side-user strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.25rem; line-height: 1.1; }
.role-pill { display: inline-block; margin-top: 0.45rem; padding: 0.15rem 0.55rem; border: 1px solid rgba(201, 163, 92, 0.45); border-radius: 999px; font-size: 0.56rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--champagne); }
.side-child { margin: 0.9rem 0.5rem 0.2rem; }
.side-child label { display: block; margin-bottom: 0.35rem; font-size: 0.56rem; letter-spacing: 0.28em; text-transform: uppercase; color: rgba(246, 242, 234, 0.55); }
.side-child select { width: 100%; min-height: 40px; padding: 0.45rem 2rem 0.45rem 0.7rem; border: 1px solid var(--line-dark); border-radius: var(--radius); background: var(--ink-2); color: var(--ivory); appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size: 5px 5px; background-repeat: no-repeat; }
.nav-group { margin-top: 1.3rem; }
.nav-group > p { margin: 0 0 0.4rem 0.6rem; font-size: 0.55rem; letter-spacing: 0.32em; text-transform: uppercase; color: rgba(246, 242, 234, 0.45); }
.nav-item { position: relative; display: flex; align-items: center; gap: 0.75rem; min-height: 40px; padding: 0.45rem 0.7rem; border-radius: var(--radius); color: rgba(246, 242, 234, 0.78); text-decoration: none; font-size: 0.92rem; transition: background 0.25s ease, color 0.25s ease; }
.nav-item svg { width: 17px; height: 17px; flex: none; opacity: 0.75; }
.nav-item:hover { background: var(--ink-2); color: var(--ivory); }
.nav-item.on { background: var(--ink-2); color: var(--white); }
.nav-item.on::before { content: ""; position: absolute; left: -1rem; top: 8px; bottom: 8px; width: 2px; background: var(--gold); }
.nav-item.on svg { opacity: 1; color: var(--gold); }
.side-foot { margin-top: auto; padding-top: 1.2rem; display: grid; gap: 0.3rem; border-top: 1px solid var(--line-dark); }
.side-foot .nav-item { font-size: 0.85rem; }
.side-foot button.nav-item { width: 100%; background: none; border: 0; cursor: pointer; text-align: left; }

.topbar { display: none; }
.main { min-width: 0; padding: clamp(1.4rem, 3.4vw, 3rem) clamp(1.2rem, 3.4vw, 3.4rem) 4rem; }
.page-head { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; flex-wrap: wrap; padding-bottom: 1.6rem; margin-bottom: 1.8rem; border-bottom: 1px solid var(--line); }
.page-head p.sub { margin: 0.7rem 0 0; color: var(--muted); max-width: 46rem; }
.page-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: end; }
.view { animation: view-in 0.6s var(--ease) both; }
@keyframes view-in { from { opacity: 0; translate: 0 10px; } to { opacity: 1; translate: 0; } }

/* ---------- Cards + stats ---------- */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.4rem; }
.card + .card { margin-top: 1.2rem; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.card-head h2 { font-size: 1.55rem; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 1.2rem; align-items: start; }
.cols-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; align-items: start; }
.stack > * + * { margin-top: 1.2rem; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 1.4rem; }
.stat { background: var(--white); padding: 1.3rem 1.3rem 1.2rem; display: grid; gap: 0.35rem; align-content: start; }
.stat .caps { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }
.stat strong { font-family: var(--serif); font-weight: 400; font-size: 2.6rem; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat strong small { font-family: var(--sans); font-size: 0.9rem; color: var(--muted); letter-spacing: 0; margin-left: 0.2rem; }
.stat .meter { height: 3px; background: var(--ivory); border-radius: 2px; overflow: hidden; margin-top: 0.4rem; }
.stat .meter i { display: block; height: 100%; background: linear-gradient(90deg, var(--burgundy), var(--gold)); transform-origin: left; animation: meter 1.2s var(--ease) both; }
@keyframes meter { from { transform: scaleX(0); } }

.hero-card { position: relative; overflow: hidden; border-radius: var(--radius); background: var(--ink); color: var(--ivory); padding: clamp(1.5rem, 3vw, 2.4rem); margin-bottom: 1.4rem; display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; flex-wrap: wrap; }
.hero-card::before { content: ""; position: absolute; inset: 0; background: radial-gradient(80% 140% at 100% 0%, rgba(110, 24, 48, 0.75), rgba(110, 24, 48, 0) 60%), radial-gradient(60% 100% at 0% 100%, rgba(201, 163, 92, 0.18), rgba(201, 163, 92, 0) 70%); }
.hero-card > * { position: relative; }
.hero-card h2 { font-size: clamp(2.4rem, 4.4vw, 3.8rem); line-height: 0.95; }
.hero-card h2 em { color: var(--champagne); font-style: italic; }
.hero-card .kicker { color: var(--champagne); }
.hero-card p { margin: 0.6rem 0 0; color: rgba(246, 242, 234, 0.72); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; padding: 0.75rem 1rem; font-size: 0.6rem; font-weight: 500; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); background: var(--paper); border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.2s ease; }
tbody tr:hover { background: #fdfcf9; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td .name { font-weight: 500; }
td .sub { display: block; color: var(--muted); font-size: 0.8rem; }
.row-actions { display: flex; gap: 0.4rem; justify-content: flex-end; flex-wrap: wrap; }

.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.18rem 0.6rem; border-radius: 999px; font-size: 0.62rem; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 500; white-space: nowrap; background: var(--ivory); color: var(--muted); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.gold { background: var(--gold-soft); color: #7d5d22; }

.empty { padding: 2.6rem 1.4rem; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); background: rgba(255, 255, 255, 0.5); }
.empty h3 { color: var(--ink); margin-bottom: 0.4rem; }
.empty .btn { margin-top: 1rem; }

/* ---------- Toolbar (pickers above a sheet) ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 0.8rem 1rem; align-items: end; margin-bottom: 1.2rem; }
.toolbar .field { min-width: 170px; }
.tabs { display: inline-flex; gap: 0.2rem; padding: 0.25rem; border: 1px solid var(--line); border-radius: 999px; background: var(--white); }
.tabs button { border: 0; background: none; padding: 0.4rem 0.95rem; border-radius: 999px; cursor: pointer; font-size: 0.66rem; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.tabs button.on { background: var(--ink); color: var(--white); }

/* ---------- Register ---------- */
.register-row { display: grid; grid-template-columns: minmax(160px, 1fr) auto minmax(140px, 0.8fr); gap: 1rem; align-items: center; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 999px; overflow: hidden; background: var(--white); }
.seg button { border: 0; background: none; min-width: 44px; min-height: 36px; padding: 0 0.75rem; cursor: pointer; font-size: 0.68rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); border-right: 1px solid var(--line); transition: background 0.2s ease, color 0.2s ease; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"][data-v="present"] { background: var(--ok); color: white; }
.seg button[aria-pressed="true"][data-v="late"] { background: var(--warn); color: white; }
.seg button[aria-pressed="true"][data-v="absent"] { background: var(--bad); color: white; }
.seg button[aria-pressed="true"][data-v="excused"] { background: var(--info); color: white; }
.savebar { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; padding: 0.9rem 1.1rem; background: rgba(14, 9, 11, 0.94); backdrop-filter: blur(10px); color: var(--ivory); border-radius: var(--radius); }
.savebar .tally { display: flex; gap: 1.1rem; flex-wrap: wrap; font-size: 0.8rem; color: rgba(246, 242, 234, 0.8); }
.savebar .tally b { font-family: var(--serif); font-weight: 400; font-size: 1.3rem; color: var(--white); margin-right: 0.25rem; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.35rem; vertical-align: 1px; }
.dot.present { background: var(--ok); } .dot.late { background: var(--warn); } .dot.absent { background: var(--bad); } .dot.excused { background: var(--info); } .dot.none { background: var(--line-strong); }

/* ---------- Calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.cal .dow { font-size: 0.6rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--muted); padding: 0 0 0.3rem 0.2rem; }
.cal .day { min-height: 74px; padding: 0.5rem 0.6rem; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); display: flex; flex-direction: column; justify-content: space-between; font-variant-numeric: tabular-nums; }
.cal .day.blank { background: transparent; border-color: transparent; }
.cal .day.today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.cal .day b { font-weight: 500; font-size: 0.9rem; }
.cal .day span { font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; }
.cal .day.present { background: var(--ok-soft); border-color: transparent; } .cal .day.present span { color: var(--ok); }
.cal .day.late { background: var(--warn-soft); border-color: transparent; } .cal .day.late span { color: var(--warn); }
.cal .day.absent { background: var(--bad-soft); border-color: transparent; } .cal .day.absent span { color: var(--bad); }
.cal .day.excused { background: var(--info-soft); border-color: transparent; } .cal .day.excused span { color: var(--info); }
.legend { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: 0.8rem; color: var(--muted); margin-top: 1rem; }

/* ---------- Lists ---------- */
.feed { display: grid; gap: 0; }
.feed article { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.feed article:first-child { border-top: 0; padding-top: 0; }
.feed h3 { font-size: 1.35rem; margin-bottom: 0.35rem; }
.feed p { margin: 0.3rem 0 0; white-space: pre-line; }
.feed .meta { display: flex; gap: 0.8rem; align-items: center; flex-wrap: wrap; font-size: 0.78rem; color: var(--muted); }

.hw { display: grid; grid-template-columns: 84px 1fr auto; gap: 1.1rem; align-items: start; padding: 1.1rem 0; border-top: 1px solid var(--line); }
.hw:first-child { border-top: 0; padding-top: 0; }
.hw .due { text-align: center; padding: 0.5rem 0.4rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); }
.hw .due b { display: block; font-family: var(--serif); font-weight: 400; font-size: 1.9rem; line-height: 1; }
.hw .due span { font-size: 0.58rem; letter-spacing: 0.22em; text-transform: uppercase; color: var(--muted); }
.hw.soon .due { border-color: var(--gold); background: var(--gold-soft); }
.hw h3 { font-size: 1.35rem; }
.hw p { margin: 0.35rem 0 0; color: var(--muted); white-space: pre-line; }

.week { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 0.8rem; overflow-x: auto; }
.week .daycol h3 { font-size: 1.2rem; padding-bottom: 0.6rem; margin-bottom: 0.6rem; border-bottom: 1px solid var(--line); }
.slot { position: relative; padding: 0.7rem 0.8rem; margin-bottom: 0.5rem; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); border-left: 3px solid var(--gold); }
.slot b { display: block; font-weight: 500; }
.slot span { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.slot .x { position: absolute; top: 0.35rem; right: 0.35rem; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0.2rem 0.35rem; border-radius: 4px; }
.slot .x:hover { background: var(--bad-soft); color: var(--bad); }
.slot.now { border-left-color: var(--burgundy); box-shadow: 0 0 0 1px var(--burgundy); }

.class-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.2rem; }
.class-card { position: relative; overflow: hidden; display: grid; gap: 0.9rem; padding: 1.4rem; border-radius: var(--radius); background: var(--white); border: 1px solid var(--line); transition: border-color 0.3s ease, translate 0.4s var(--ease); }
.class-card:hover { border-color: var(--gold); translate: 0 -2px; }
.class-card h3 { font-size: 2rem; }
.class-card .row { display: flex; justify-content: space-between; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.class-card .acts { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.bar { height: 6px; border-radius: 3px; background: var(--ivory); overflow: hidden; min-width: 80px; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--ok), #4f9a74); }

.checklist { display: grid; gap: 0.6rem; margin: 0; padding: 0; list-style: none; counter-reset: step; }
.checklist li { counter-increment: step; display: grid; grid-template-columns: 2rem 1fr auto; gap: 0.8rem; align-items: center; padding: 0.8rem 0; border-top: 1px solid var(--line); }
.checklist li::before { content: counter(step, decimal-leading-zero); font-size: 0.7rem; letter-spacing: 0.14em; color: var(--gold); }
.checklist li.done { color: var(--muted); }
.checklist li.done strong { text-decoration: line-through; text-decoration-color: var(--gold); }

/* ---------- Report card ---------- */
.report { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.4rem, 4vw, 3rem); max-width: 900px; }
.report-head { display: flex; justify-content: space-between; align-items: center; gap: 1.5rem; flex-wrap: wrap; padding-bottom: 1.4rem; border-bottom: 2px solid var(--ink); }
.report-head .crest { display: flex; gap: 1rem; align-items: center; }
.report-head img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
.report-head h2 { font-size: 1.5rem; line-height: 1.1; }
.report-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; padding: 1.3rem 0; border-bottom: 1px solid var(--line); }
.report-meta div span { display: block; font-size: 0.58rem; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted); }
.report-meta div b { font-family: var(--serif); font-weight: 400; font-size: 1.4rem; }
.report table { margin: 1.2rem 0; }
.report .score { font-family: var(--serif); font-size: 1.3rem; }
.report-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); margin-top: 0.4rem; }
.report-summary div { background: var(--paper); padding: 1rem 1.1rem; }
.report-summary span { display: block; font-size: 0.58rem; letter-spacing: 0.26em; text-transform: uppercase; color: var(--muted); }
.report-summary b { font-family: var(--serif); font-weight: 400; font-size: 2rem; }
.report-remark { margin-top: 1.4rem; padding: 1.2rem 1.3rem; border-left: 2px solid var(--gold); background: var(--paper); font-family: var(--serif); font-size: 1.3rem; line-height: 1.35; }

/* ---------- Dialog ---------- */
dialog.modal { width: min(560px, calc(100vw - 2rem)); max-height: calc(100dvh - 2rem); padding: 0; border: 0; border-radius: 6px; background: var(--paper); color: var(--ink); box-shadow: 0 40px 80px rgba(14, 9, 11, 0.35); }
dialog.modal.wide { width: min(820px, calc(100vw - 2rem)); }
dialog.modal::backdrop { background: rgba(14, 9, 11, 0.6); backdrop-filter: blur(4px); }
dialog.modal[open] { animation: modal-in 0.45s var(--ease) both; }
@keyframes modal-in { from { opacity: 0; translate: 0 16px; scale: 0.98; } }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; padding: 1.4rem 1.5rem 1rem; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 1.9rem; }
.modal-head button { border: 0; background: none; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); padding: 0.2rem 0.4rem; }
.modal-body { padding: 1.3rem 1.5rem; overflow-y: auto; max-height: calc(100dvh - 12rem); }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.6rem; padding: 1rem 1.5rem 1.3rem; border-top: 1px solid var(--line); }
.secret { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0; padding: 1rem 1.2rem; border: 1px dashed var(--gold); border-radius: var(--radius); background: var(--gold-soft); }
.secret code { font-family: "IBM Plex Mono", ui-monospace, Menlo, monospace; font-size: 1.35rem; letter-spacing: 0.06em; }
.checks { display: grid; gap: 0.5rem; }
.checks label { display: flex; align-items: center; gap: 0.6rem; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--white); cursor: pointer; }
.checks input { width: 18px; height: 18px; accent-color: var(--burgundy); }

/* ---------- Toasts + loading ---------- */
.toasts { position: fixed; right: 1.2rem; bottom: 1.2rem; z-index: 100; display: grid; gap: 0.5rem; }
.toast { min-width: 240px; max-width: 380px; padding: 0.85rem 1.1rem; border-radius: var(--radius); background: var(--ink); color: var(--ivory); box-shadow: 0 16px 40px rgba(14, 9, 11, 0.3); border-left: 3px solid var(--gold); font-size: 0.9rem; animation: toast-in 0.5s var(--ease) both; }
.toast.bad { border-left-color: #e0566b; }
.toast.ok { border-left-color: #5fbf8f; }
@keyframes toast-in { from { opacity: 0; translate: 0 12px; } }
.loading { display: grid; place-items: center; min-height: 40vh; }
.loading i { width: 40px; height: 1px; background: var(--line-strong); overflow: hidden; position: relative; }
.loading i::after { content: ""; position: absolute; inset: 0; background: var(--gold); animation: load 1.1s ease-in-out infinite; }
@keyframes load { from { translate: -100% 0; } to { translate: 100% 0; } }
.boot { min-height: 100vh; display: grid; place-items: center; background: var(--ink); }
.boot img { width: 56px; height: 56px; border-radius: 50%; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.5; scale: 0.94; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .cols-2 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 38vh; }
  .auth-art h1 { font-size: clamp(2.6rem, 11vw, 4rem); }
  .auth-art p { display: none; }
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; z-index: 50; width: min(300px, 86vw); translate: -100% 0; transition: translate 0.45s var(--ease); }
  body.nav-open .side { translate: 0 0; box-shadow: 30px 0 60px rgba(0, 0, 0, 0.3); }
  body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(14, 9, 11, 0.5); }
  .topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.7rem 1rem; padding-top: max(0.7rem, env(safe-area-inset-top)); background: var(--ink); color: var(--ivory); }
  .topbar .side-brand { padding: 0; border: 0; }
  .topbar .side-brand img { width: 34px; height: 34px; }
  .topbar button { min-height: 40px; padding: 0.4rem 0.95rem; border: 1px solid var(--line-dark); border-radius: 999px; background: none; color: var(--ivory); font-size: 0.62rem; letter-spacing: 0.24em; text-transform: uppercase; cursor: pointer; }
  .main { padding: 1.4rem 1rem 6rem; }
  .register-row { grid-template-columns: 1fr; gap: 0.5rem; }
  .seg { width: 100%; }
  .seg button { flex: 1; }
  .hw { grid-template-columns: 64px 1fr; }
  .hw > :last-child:not(:nth-child(2)) { grid-column: 2; }
  .week { grid-template-columns: repeat(5, minmax(200px, 1fr)); }
  td, th { padding: 0.65rem 0.75rem; }
  .toasts { left: 1rem; right: 1rem; }
  .toast { max-width: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- Print: report card only ---------- */
@media print {
  @page { margin: 14mm; }
  body { background: white; font-size: 12px; }
  .side, .topbar, .page-head, .toolbar, .toasts, .no-print { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; }
  .report { border: 0; padding: 0; max-width: none; }
  .view { animation: none; }
}

/* ---------- Demo ---------- */
.demo-box { padding: 1.1rem 1.2rem 1rem; border: 1px solid rgba(201, 163, 92, 0.5); border-radius: 8px; background: linear-gradient(160deg, #fffaf0, #fbf3e3); }
.demo-box p { margin: 0 0 0.5rem; }
.demo-box code { white-space: nowrap; padding: 0.1rem 0.4rem; border-radius: 4px; background: var(--white); border: 1px solid var(--line); font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 0.85rem; color: var(--burgundy); }
.demo-roles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.5rem; margin: 0.8rem 0 0.7rem; }
.demo-role { display: grid; gap: 0.15rem; text-align: left; padding: 0.75rem 0.85rem; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--white); cursor: pointer; transition: border-color 0.25s ease, translate 0.35s var(--ease), box-shadow 0.35s ease; }
.demo-role:hover { border-color: var(--gold); translate: 0 -2px; box-shadow: 0 10px 24px rgba(14, 9, 11, 0.08); }
.demo-role b { font-family: var(--serif); font-weight: 400; font-size: 1.15rem; line-height: 1.1; }
.demo-role span { font-size: 0.75rem; color: var(--muted); }
.demo-banner { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 0 0 1.4rem; padding: 0.7rem 1rem; border-radius: 6px; background: var(--gold-soft); border: 1px solid rgba(201, 163, 92, 0.4); font-size: 0.86rem; }
.demo-banner b { margin-right: 0.5rem; padding: 0.1rem 0.5rem; border-radius: 999px; background: var(--gold); color: var(--ink); font-size: 0.6rem; letter-spacing: 0.2em; text-transform: uppercase; font-weight: 500; vertical-align: 1px; }

/* ---------- Skeleton ---------- */
.skeleton { display: grid; gap: 1rem; padding-top: 0.2rem; }
.skeleton i { display: block; border-radius: 6px; background: linear-gradient(90deg, #f1ece4 25%, #f8f4ee 50%, #f1ece4 75%); background-size: 200% 100%; animation: sk 1.3s ease-in-out infinite; }
.skeleton .sk-k { width: 120px; height: 10px; }
.skeleton .sk-h { width: min(420px, 70%); height: 46px; margin-bottom: 1rem; }
.skeleton .sk-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.skeleton .sk-row i { height: 110px; }
.skeleton .sk-b { height: 180px; }
.skeleton .sk-b.short { height: 90px; width: 70%; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- Performance bars ---------- */
.perf-h { width: 28%; }
.perf-bar { height: 8px; border-radius: 4px; background: var(--ivory); overflow: hidden; min-width: 90px; }
.perf-bar i { display: block; height: 100%; border-radius: 4px; transform-origin: left; animation: meter 1.1s var(--ease) both; }
.perf-bar.hi i { background: linear-gradient(90deg, #2f6b4f, #4f9a74); }
.perf-bar.mid i { background: linear-gradient(90deg, #8a6a2a, var(--gold)); }
.perf-bar.ok i { background: linear-gradient(90deg, #a9874a, #d6b97f); }
.perf-bar.low i { background: linear-gradient(90deg, var(--burgundy), #b34a63); }
.subj { display: grid; gap: 0.75rem; }
.subj-row { display: grid; grid-template-columns: minmax(110px, 0.9fr) 1.4fr 2.6rem; gap: 0.9rem; align-items: center; font-size: 0.9rem; }
.subj-row b { font-family: var(--serif); font-weight: 400; font-size: 1.25rem; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Attendance strip ---------- */
.strip { display: grid; grid-template-columns: repeat(15, 1fr); gap: 5px; }
.pip { display: grid; justify-items: center; gap: 0.3rem; }
.pip i { width: 100%; aspect-ratio: 1 / 1.6; max-height: 38px; border-radius: 4px; background: var(--line); transition: transform 0.3s var(--ease); }
.pip:hover i { transform: scaleY(1.08); }
.pip small { font-size: 0.62rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.pip.present i { background: var(--ok); } .pip.late i { background: var(--warn); } .pip.absent i { background: var(--bad); } .pip.excused i { background: var(--info); }

/* ---------- Password strength ---------- */
.pw-meter { display: flex; align-items: center; gap: 0.7rem; min-height: 1.1rem; }
.pw-bars { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; width: 140px; }
.pw-bars i { height: 4px; border-radius: 2px; background: var(--line); transition: background 0.3s ease; }
.pw-meter span { font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.pw-meter[data-score="0"] i:nth-child(-n+1), .pw-meter[data-score="1"] i:nth-child(-n+1) { background: var(--bad); }
.pw-meter[data-score="2"] i:nth-child(-n+2) { background: var(--warn); }
.pw-meter[data-score="3"] i:nth-child(-n+3) { background: #6a8f3c; }
.pw-meter[data-score="4"] i { background: var(--ok); }

/* ---------- Devices ---------- */
.devices { display: grid; gap: 0; }
.device { display: grid; grid-template-columns: 22px 1fr auto; gap: 0.9rem; align-items: center; padding: 0.8rem 0; border-top: 1px solid var(--line); }
.device:first-child { border-top: 0; }
.device svg { width: 20px; height: 20px; color: var(--gold); }
.device b { display: block; font-weight: 500; }

/* ---------- Polish ---------- */
.card { transition: border-color 0.3s ease, box-shadow 0.4s ease; }
.card:hover { box-shadow: 0 18px 40px -28px rgba(14, 9, 11, 0.35); }
.stat { position: relative; transition: background 0.3s ease; }
.stat:hover { background: #fffdf9; }
.nav-item svg { transition: transform 0.3s var(--ease); }
.nav-item:hover svg { transform: translateX(2px); }
.btn:active { scale: 0.98; }
@media (max-width: 900px) {
  .demo-roles { grid-template-columns: 1fr; }
  .strip { grid-template-columns: repeat(15, minmax(14px, 1fr)); overflow-x: auto; }
  .perf-h, .perf { display: none; }
}
@media print { .perf-bar i { animation: none; } .demo-banner { display: none; } }
