/* ==========================================================================
   Doodle Academy · Dream...Doodle...Do!
   ========================================================================== */
:root {
    color-scheme: light;
    --brand-900: #252853;
    --brand-800: #2c3064;
    --brand-700: #353976;
    --brand-600: #474c92;
    --brand-500: #6268b4;
    --brand-100: #e9eafa;
    --brand-50: #f3f3fc;
    --doodle-purple: #353976;
    --doodle-pink: #eb268f;
    --doodle-cyan: #00aff0;
    --doodle-lime: #a9cf46;
    --doodle-yellow: #fff112;
    --doodle-orange: #f58634;
    --doodle-red: #ec3237;
    --pink-soft: #fff0f8;
    --cyan-soft: #e8f8ff;
    --lime-soft: #f0f7dc;
    --gold-600: #94500e;
    --gold-500: #f58634;
    --gold-100: #fff5d6;
    --page: #f7f7fc;
    --surface: #ffffff;
    --surface-2: #fafaff;
    --ink: #292b4b;
    --ink-2: #484b68;
    --muted: #6d7089;
    --line: #e7e7f1;
    --line-strong: #d6d7e7;
    --success: #4b6816; --success-bg: #f0f7dc;
    --warning: #8c490d; --warning-bg: #fff1df;
    --danger: #b62632;  --danger-bg: #fff0f2;
    --info: #00698e;    --info-bg: #e8f8ff;
    --radius: 20px;
    --radius-sm: 10px;
    --shadow-sm: 0 5px 24px rgba(53, 57, 118, .045);
    --shadow: 0 10px 32px rgba(53, 57, 118, .075);
    --sidebar: 258px;
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    font-size: 15px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--page);
    -webkit-font-smoothing: antialiased;
}
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
img { max-width: 100%; }
a { color: var(--brand-600); text-decoration: none; }
a:hover { color: var(--brand-800); text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4, p { margin-top: 0; }
h1 { font-size: 1.75rem; line-height: 1.2; letter-spacing: -.035em; margin-bottom: .25rem; font-weight: 780; color: var(--brand-700); }
h2 { font-size: 1.08rem; letter-spacing: -.01em; margin-bottom: .75rem; font-weight: 680; }
h3 { font-size: .98rem; margin-bottom: .5rem; font-weight: 650; }
p { margin-bottom: .85rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }
small { font-size: .82rem; }
code { font-size: .85em; background: var(--surface-2); padding: .1em .35em; border-radius: 4px; border: 1px solid var(--line); }
.icon { flex: none; vertical-align: middle; }

/* ---------- Forms ---------- */
input, select, textarea, button { font: inherit; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), select, textarea {
    display: block; width: 100%; min-width: 0; padding: .6rem .75rem;
    color: var(--ink); background: var(--surface);
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    transition: border-color .15s, box-shadow .15s;
}
input[type=file] { padding: .45rem .6rem !important; background: var(--surface-2) !important; }
input:hover, select:hover, textarea:hover { border-color: #a9acd1; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 3px rgba(53, 57, 118, .12); }
select { appearance: none; padding-right: 2.2rem !important; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2366746d' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .8rem center; }
input[type=checkbox], input[type=radio] { width: 1.05rem; height: 1.05rem; accent-color: var(--brand-600); margin: 0; }
textarea { min-height: 6rem; resize: vertical; }
label { display: grid; gap: .38rem; color: var(--ink-2); font-size: .86rem; font-weight: 600; }
label.checkbox, .checkbox { display: flex; gap: .55rem; align-items: center; font-weight: 550; }
.hint { color: var(--muted); font-size: .8rem; font-weight: 450; }
:where(button, input, select, textarea, a, summary):focus-visible { outline: 3px solid #007ba8; outline-offset: 3px; }
.sidebar :focus-visible { outline-color: var(--brand-700); }
fieldset { border: 0; border-radius: var(--radius); background: var(--surface-2); padding: 1.2rem; margin: 0; }
legend { padding: 0 .4rem; font-weight: 650; font-size: .88rem; }

/* ---------- Buttons ---------- */
button, .button {
    display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
    font-weight: 620; font-size: .9rem; line-height: 1.2; padding: .62rem 1rem; white-space: nowrap;
    border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--ink-2); cursor: pointer; text-decoration: none;
    box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, color .15s, transform .05s;
}
button:hover, .button:hover { background: var(--surface-2); border-color: #acafd1; color: var(--ink); text-decoration: none; }
button:active, .button:active { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: not-allowed; }
.primary, button.primary, .button.primary { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.primary:hover, button.primary:hover, .button.primary:hover { background: var(--brand-800); border-color: var(--brand-800); color: #fff; }
.button.gold, button.gold { background: var(--doodle-yellow); border-color: var(--doodle-yellow); color: var(--brand-900); }
.button.danger, button.danger { color: var(--danger); border-color: #efc2be; }
.button.danger:hover, button.danger:hover { background: var(--danger-bg); }
.button.ghost, button.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--brand-700); }
.button.ghost:hover, button.ghost:hover { background: var(--brand-50); }
.compact, .button.compact, button.compact { padding: .38rem .7rem; font-size: .8rem; }
.link-button { background: none; border: 0; box-shadow: none; padding: 0; color: var(--brand-600); font-weight: 600; }
.link-button:hover { background: none; text-decoration: underline; }

/* ---------- App shell ---------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; background: linear-gradient(90deg, #eeedf8 var(--sidebar), transparent var(--sidebar)); }
.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: .9rem; padding: 1.1rem .9rem 1rem;
    color: var(--brand-700); background: #eeedf8;
    border: 0;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }
.school-brand { display: grid; gap: .75rem; padding: 0 .15rem .5rem; color: var(--brand-700); text-decoration: none; }
.school-brand:hover { color: var(--brand-700); text-decoration: none; }
.school-wordmark { display: grid; place-items: center; padding: .5rem .75rem; background: transparent; }
.school-brand img { display: block; width: 100%; height: auto; object-fit: contain; }
.school-brand-caption { padding: 0 .5rem; }
.school-brand strong { display: block; font-size: .78rem; line-height: 1.2; font-weight: 650; }
.school-brand small { display: block; color: #6d7089; font-size: .72rem; margin-top: .25rem; }
.nav-group { display: grid; gap: 2px; }
.nav-group-title { padding: .65rem .65rem .3rem; color: #777a96; font-size: .65rem; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.nav-link {
    display: flex; align-items: center; gap: .7rem; padding: .52rem .65rem; border-radius: 8px;
    color: #515576; font-size: .85rem; font-weight: 520; text-decoration: none; position: relative;
}
.nav-link .icon { color: #75799d; }
.nav-link:hover { background: #e3e2f2; color: var(--brand-700); text-decoration: none; }
.nav-link:hover .icon { color: var(--brand-700); }
.nav-link.selected { background: var(--brand-700); color: #fff; font-weight: 720; box-shadow: 0 5px 12px rgba(53,57,118,.12); }
.nav-link.selected .icon { color: #fff; }
.nav-link.selected::before { display: none; }
.sidebar-footer { margin-top: auto; padding: .85rem .5rem 0; display: grid; gap: .6rem; }
.powered { display: flex; align-items: center; gap: .5rem; color: #777a96; font-size: .72rem; padding: 0 .2rem; }
.powered b { color: var(--brand-700); font-weight: 650; }
.app-main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .7rem clamp(1rem, 2.6vw, 2.25rem); background: rgba(255,255,255,.92); backdrop-filter: saturate(1.4) blur(8px);
    border: 0; min-height: 66px;
}
.topbar-left { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.crumbs { display: flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumbs strong { color: var(--ink); font-weight: 620; }
.term-chip { display: inline-flex; align-items: center; gap: .4rem; padding: .35rem .7rem; border-radius: 999px; background: var(--lime-soft); color: #52671f; font-size: .75rem; font-weight: 650; white-space: nowrap; }
.account { display: flex; align-items: center; gap: .75rem; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--brand-100); color: var(--brand-800); font-weight: 720; font-size: .8rem; flex: none; }
.account-name { line-height: 1.2; font-size: .86rem; font-weight: 620; }
.account-name small { display: block; color: var(--muted); font-weight: 500; font-size: .74rem; }
.menu-toggle { display: none; }
.sidebar-close, .nav-backdrop { display: none; }
.content { width: 100%; max-width: 1360px; margin: 0 auto; padding: 1.75rem clamp(1rem, 2.6vw, 2.25rem) 3rem; }
.app-footer { margin-top: auto; padding: 1rem clamp(1rem, 2.6vw, 2.25rem); color: var(--muted); font-size: .78rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* ---------- Page structure ---------- */
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.page-heading > div:first-child { min-width: 0; }
.page-heading p { color: var(--muted); margin: .25rem 0 0; max-width: 60ch; }
.eyebrow { display: inline-flex; align-items: center; gap: .35rem; color: #b4186c; font-size: .74rem; font-weight: 720; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .35rem; }
.eyebrow a { color: inherit; }
.back-link { display: inline-flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .84rem; font-weight: 550; margin-bottom: .6rem; }
.actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .9rem; }
.section-heading h2 { margin: 0; }
.section-heading p { margin: .15rem 0 0; color: var(--muted); font-size: .86rem; }
.stack, .form-grid { display: grid; gap: 1rem; }
.stack-lg { display: grid; gap: 1.5rem; }
.form-grid { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
.form-grid .full, .form-actions { grid-column: 1 / -1; }
.form-actions { display: flex; gap: .6rem; justify-content: flex-start; padding-top: .5rem; border-top: 1px solid var(--line); margin-top: .25rem; padding-top: 1rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 1.25rem; align-items: start; }
.mt { margin-top: 1.25rem; }
.muted { color: var(--muted); }
.subtle { color: var(--muted); font-size: .86rem; }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.preserve-whitespace { white-space: pre-wrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Cards ---------- */
.panel, .card {
    background: var(--surface); border: 0; border-radius: var(--radius);
    box-shadow: var(--shadow-sm); padding: 1.5rem; min-width: 0;
}
:where(.content, .stack-flow) > :where(.panel, .card, .toolbar, .grid-2, .grid-3, .split, .card-grid, .metric-grid, section, form, .tabs) + :where(.panel, .card, .grid-2, .grid-3, .split, .card-grid, section, form) { margin-top: 1.25rem; }
.panel.flush, .card.flush { padding: 0; overflow: hidden; }
.panel.flush > .section-heading, .card.flush > .section-heading { padding: 1.1rem 1.35rem 0; }
.panel-footer { padding: .9rem 1.35rem; background: var(--surface-2); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 1rem; }
.tile {
    display: flex; flex-direction: column; gap: .65rem; padding: 1.4rem; border: 0; border-radius: var(--radius);
    background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm); transition: box-shadow .15s, transform .15s;
}
a.tile:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; color: var(--ink); }
.tile-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.tile h3 { margin: 0; font-size: 1rem; }
.tile p { margin: 0; color: var(--muted); font-size: .86rem; }
.tile-icon { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--brand-50); color: var(--brand-700); }
.tile .go { color: var(--muted); }

/* ---------- Metrics ---------- */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.metric { display: flex; gap: .9rem; align-items: flex-start; padding: 1.1rem 1.2rem; }
.metric .tile-icon { width: 42px; height: 42px; }
.metric-label { color: var(--muted); font-size: .8rem; font-weight: 600; }
.metric-value { display: block; font-size: 1.6rem; font-weight: 740; letter-spacing: -.02em; line-height: 1.15; margin-top: .1rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.metric-note { display: block; font-size: .76rem; color: var(--muted); margin-top: .15rem; }
.metric.accent-gold .tile-icon { background: var(--pink-soft); color: #b4186c; }
.metric.accent-info .tile-icon { background: var(--info-bg); color: var(--info); }
.metric.accent-danger .tile-icon { background: var(--danger-bg); color: var(--danger); }
.progress { height: 8px; border-radius: 99px; background: var(--brand-50); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-600), var(--brand-500)); }
.progress.gold > span { background: linear-gradient(90deg, var(--doodle-orange), var(--doodle-yellow)); }

/* ---------- Hero ---------- */
.hero {
    position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
    padding: .4rem 0 1rem; color: var(--brand-700); margin-bottom: 1.5rem;
    background: transparent; border: 0;
    box-shadow: none;
}
.hero::after { display: none; }
.hero-identity { display: flex; align-items: center; gap: 1.1rem; position: relative; z-index: 1; }
.hero-identity img { width: 140px; height: auto; object-fit: contain; }
.hero h1 { color: var(--brand-700); font-size: clamp(1.75rem, 2.7vw, 2.3rem); margin: .15rem 0 .35rem; }
.hero p { color: var(--muted); margin: .2rem 0 0; }
.hero .greeting { color: #b4186c; font-weight: 700; font-size: .76rem; letter-spacing: .04em; text-transform: uppercase; margin: 0 0 .2rem; }
.hero-meta { position: relative; z-index: 1; display: flex; gap: .6rem; flex-wrap: wrap; }
.hero-meta { max-width: 330px; justify-content: flex-end; }
.hero-meta span { display: inline-flex; align-items: center; gap: .4rem; padding: .45rem .8rem; background: #ecebf7; border: 0; border-radius: 999px; font-size: .76rem; color: var(--brand-700); }
.hero-meta .hero-motto { width: 100%; justify-content: flex-end; background: transparent; border: 0; padding: 0 .2rem .35rem; font-size: 1.05rem; font-weight: 750; color: var(--brand-700); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .55rem; border-radius: 999px; font-size: .74rem; font-weight: 650; line-height: 1.4; white-space: nowrap; background: #eeeef7; color: #555873; }
.badge.success, .badge.green { background: var(--success-bg); color: var(--success); }
.badge.warning, .badge.amber { background: var(--warning-bg); color: var(--warning); }
.badge.danger, .badge.red { background: var(--danger-bg); color: var(--danger); }
.badge.info, .badge.blue { background: var(--info-bg); color: var(--info); }
.badge.brand { background: var(--brand-100); color: var(--brand-800); }
.badge.gold { background: var(--gold-100); color: #6f531a; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.plain::before { display: none; }

/* ---------- Notices ---------- */
.notice { display: flex; gap: .65rem; align-items: flex-start; padding: .9rem 1.1rem; border: 0; border-radius: var(--radius-sm); background: var(--success-bg); color: var(--success); margin-bottom: 1.25rem; font-size: .9rem; }
.notice.error { background: var(--danger-bg); border-color: #f1c4c0; color: #8e1f19; }
.notice.warning { background: var(--warning-bg); border-color: #f0d9a6; color: #74490a; }
.notice.info { background: var(--info-bg); border-color: #c4d9ee; color: #194d7c; }
.notice ul { padding-left: 1.1rem; margin: 0; }
.notice p { margin: 0; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.panel > .table-scroll:first-child, .card > .table-scroll:first-child { margin: -1.5rem -1.5rem 0; }
.panel.flush .table-scroll { margin: 0; }
table { border-collapse: separate; border-spacing: 0; width: 100%; text-align: left; font-size: .88rem; }
th, td { padding: .72rem .9rem; border: 0; vertical-align: middle; }
thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
tbody tr:hover td, tbody tr:hover th { background: #f7f7fe; }
tbody tr:nth-child(even) td { background: #fafaff; }
tbody tr:last-child td, tbody tr:last-child th { border-bottom: 0; }
tbody th { font-weight: 620; }
td.actions-cell { white-space: nowrap; text-align: right; }
td form { margin: 0; }
td input:not([type=checkbox]):not([type=radio]), td select { padding: .4rem .55rem; font-size: .86rem; }
.table-title { font-weight: 620; color: var(--ink); }
.table-sub { display: block; color: var(--muted); font-size: .78rem; }
.empty-row td { text-align: center; color: var(--muted); padding: 2.25rem 1rem; }

/* ---------- Lists ---------- */
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list > li { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .8rem 0; border: 0; }
.list > li:last-child { border-bottom: 0; }
.list > li > a.row-link { flex: 1; display: flex; align-items: center; justify-content: space-between; gap: .75rem; color: var(--ink); text-decoration: none; font-weight: 600; }
.list > li > a.row-link:hover { color: var(--brand-700); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: .45rem 1.25rem; margin: 0; font-size: .9rem; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 580; }

/* ---------- Toolbar & tabs ---------- */
.toolbar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: .75rem; padding: 1.2rem 1.35rem; margin-bottom: 1.25rem; background: var(--surface); border: 0; border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.toolbar label { min-width: 170px; }
.toolbar .grow { flex: 1; }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs a { padding: .65rem .9rem; color: var(--muted); font-weight: 600; font-size: .9rem; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none; }
.tabs a:hover { color: var(--ink); }
.tabs a.selected { color: var(--brand-700); border-bottom-color: var(--brand-600); }

/* ---------- Setup area ---------- */
.setup-grid { display: grid; align-items: start; grid-template-columns: 236px minmax(0, 1fr); gap: 1.25rem; }
.setup-nav { position: sticky; top: 76px; display: grid; gap: 1px; padding: .75rem; }
.setup-nav strong { display: block; margin: .75rem .5rem .3rem; font-size: .68rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.setup-nav strong:first-child { margin-top: .2rem; }
.setup-nav a { display: block; padding: .42rem .55rem; border-radius: 6px; font-size: .87rem; color: var(--ink-2); text-decoration: none; }
.setup-nav a:hover { background: var(--surface-2); color: var(--ink); }
.setup-nav a.selected { background: var(--brand-50); color: var(--brand-800); font-weight: 650; }

/* ---------- Details / disclosure ---------- */
details.disclosure { position: relative; display: inline-block; }
details.disclosure > summary { list-style: none; cursor: pointer; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure[open] > summary::before { content: ""; position: fixed; inset: 0; z-index: 60; background: rgba(37, 40, 83, .38); cursor: default; }
details.disclosure[open] > .popover { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 61; max-height: 90vh; overflow: auto; width: min(420px, 92vw); padding: 1.35rem; background: var(--surface); border: 0; border-radius: var(--radius); box-shadow: 0 12px 32px rgba(53,57,118,.16); text-align: left; white-space: normal; }
details.block { border: 0; border-radius: var(--radius-sm); background: var(--surface-2); }
details.block > summary { cursor: pointer; padding: .8rem 1rem; font-weight: 620; }
details.block[open] > summary { border-bottom: 1px solid var(--line); }
details.block > .details-body { padding: 1rem; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.empty .tile-icon { margin: 0 auto .75rem; width: 48px; height: 48px; }
.empty h3 { color: var(--ink); margin-bottom: .3rem; }
.empty p { margin: 0 auto; max-width: 42ch; }

/* ---------- Pagination ---------- */
.pagination { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .9rem 1.35rem; border-top: 1px solid var(--line); font-size: .85rem; color: var(--muted); }

/* ---------- Attendance codes ---------- */
.code-group { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 8px; overflow: hidden; }
.code-group label { position: relative; display: inline-flex; flex-direction: row; align-items: center; gap: 0; font-size: .78rem; font-weight: 650; cursor: pointer; }
.code-group input { position: absolute; opacity: 0; pointer-events: none; }
.code-group span { padding: .38rem .62rem; border-right: 1px solid var(--line); color: var(--muted); }
.code-group label:last-child span { border-right: 0; }
.code-group input:checked + span.present { background: var(--success-bg); color: var(--success); }
.code-group input:checked + span.late { background: var(--warning-bg); color: var(--warning); }
.code-group input:checked + span.absent { background: var(--danger-bg); color: var(--danger); }
.code-group input:checked + span.excused { background: var(--info-bg); color: var(--info); }
.code-group input:focus-visible + span { outline: 2px solid var(--brand-500); outline-offset: -2px; }

/* ---------- Timetable ---------- */
.timetable { table-layout: fixed; }
.timetable th:first-child, .timetable td:first-child { width: 110px; }
.slot { display: block; padding: .65rem .75rem; border-radius: 10px; background: var(--brand-100); border: 0; font-size: .8rem; line-height: 1.35; }
.slot strong { display: block; color: var(--ink); font-size: .84rem; }
.slot span { color: var(--muted); }

/* ---------- Charts ---------- */
.bar-chart { display: grid; gap: .65rem; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 70px; align-items: center; gap: .75rem; font-size: .85rem; }
.bar-row .progress { height: 10px; }

/* ---------- Login ---------- */
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); background: var(--surface); }
.login-identity {
    position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
    padding: clamp(2rem, 4vw, 4.5rem); color: var(--brand-700);
    background: #f4f3fc;
}
.login-identity::before, .login-identity::after { display: none; }
.login-identity > * { position: relative; z-index: 1; }
.login-brand { display: flex; align-items: center; gap: .8rem; color: var(--brand-700); font-weight: 700; }
.login-brand img { display: block; width: 235px; height: auto; object-fit: contain; }
.login-brand small { display: block; color: var(--muted); font-weight: 500; }
.login-identity > .login-brand { align-self: flex-start; background: transparent; padding: 0; border: 0; box-shadow: none; }
.login-heading { max-width: 560px; }
.login-heading h1 { color: var(--brand-700); font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; font-size: clamp(2.3rem, 3.7vw, 3.65rem); line-height: 1.12; letter-spacing: -.045em; font-weight: 800; margin-bottom: 1.1rem; }
.login-heading h1 > span { color: #c71a79; }
.login-heading p { color: #646680; max-width: 40ch; font-size: .98rem; line-height: 1.7; }
.login-heading .login-kicker { color: var(--brand-700); font-size: .69rem; line-height: 1.3; font-weight: 750; letter-spacing: .12em; text-transform: uppercase; margin-bottom: .85rem; }
.login-points { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem 1.2rem; margin: 1.8rem 0 0; padding: 0; list-style: none; }
.login-points li { display: flex; gap: .6rem; align-items: center; color: var(--brand-700); font-size: .84rem; }
.login-points strong { display: block; font-size: .78rem; font-weight: 750; line-height: 1.4; }
.login-points small { display: block; color: #6d6e88; font-size: .7rem; line-height: 1.5; margin-top: .15rem; }
.feature-icon { display: grid; place-items: center; flex: none; width: 39px; height: 42px; border-radius: 13px; color: #a81765; background: #fce1ef; }
.login-points li:nth-child(2) .feature-icon { color: #00698e; background: #d8f3ff; }
.login-points li:nth-child(3) .feature-icon { color: #5b6d1a; background: #e8f0cb; }
.login-points li:nth-child(4) .feature-icon { color: #8c490d; background: #ffe9cf; }
.login-foot { display: flex; align-items: center; gap: .8rem; color: #636687; font-size: .8rem; font-weight: 650; padding-top: .5rem; }
.brand-dots { display: inline-flex; align-items: center; gap: 5px; }
.brand-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--doodle-pink); }
.brand-dots i:nth-child(2) { background: var(--doodle-cyan); }
.brand-dots i:nth-child(3) { background: var(--doodle-lime); }
.brand-dots i:nth-child(4) { background: var(--doodle-yellow); }
.brand-dots i:nth-child(5) { background: var(--doodle-orange); }
.brand-dots i:nth-child(6) { background: var(--doodle-red); }
.login-main { display: grid; place-items: center; padding: 3rem 2rem; background: var(--surface); }
.login-main section { width: min(100%, 395px); }
.portal-label { display: inline-flex; align-items: center; gap: .5rem; margin-bottom: 1.1rem; padding: .45rem .7rem; border-radius: 8px; color: var(--brand-700); background: var(--brand-50); font-size: .68rem; font-weight: 750; letter-spacing: .075em; text-transform: uppercase; }
.login-main h2 { color: var(--brand-700); font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif; font-size: clamp(2rem, 2.8vw, 2.7rem); margin-bottom: .45rem; letter-spacing: -.045em; font-weight: 800; }
.welcome-dot { color: var(--doodle-pink); }
.login-main h2 + p { font-size: .88rem; margin-bottom: 1.85rem; }
.login-main .stack { gap: 1.2rem; }
.login-main input:not([type=checkbox]) { padding: .85rem .9rem; background: #fdfdff; }
.login-main label { font-size: .79rem; }
.login-main label.checkbox { font-weight: 450; color: var(--muted); font-size: .76rem; margin: -.1rem 0 .3rem; }
.login-main .primary { width: 100%; padding: .95rem 1.1rem; justify-content: space-between; font-size: .88rem; box-shadow: 0 6px 14px rgba(53,57,118,.12); border-radius: 11px; }
.family-entry { display: flex; align-items: center; gap: .75rem; margin-top: 1.65rem; padding: 1.1rem; color: var(--brand-700); border: 0; border-radius: 16px; background: var(--brand-50); }
.family-entry:hover { color: var(--brand-700); text-decoration: none; background: var(--pink-soft); }
.family-entry > span:nth-child(2) { flex: 1; }
.family-entry strong { display: block; font-size: .8rem; }
.family-entry small { display: block; font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.family-entry-icon { display: grid; place-items: center; width: 36px; height: 38px; border-radius: 10px; background: #fce4f0; color: #b4186b; }
.login-note { margin: 1.8rem 0 0; text-align: center; color: var(--muted); font-size: .67rem; }
.login-note span { padding: 0 .35rem; color: #b2b4c7; }
.evaluation-panel { margin: 0 0 1.15rem; }
.evaluation-heading { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .75rem; font-size: .68rem; color: var(--muted); }
.evaluation-tag { display: inline-flex; align-items: center; gap: .4rem; color: var(--brand-700); font-weight: 750; }
.evaluation-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--doodle-lime); }
.evaluation-roles { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.evaluation-role { display: flex; gap: .5rem; justify-content: flex-start; min-width: 0; padding: .75rem .7rem; font-size: .74rem; line-height: 1.25; white-space: normal; text-align: left; color: var(--brand-700); background: #efedf9; border: 0; border-radius: 12px; box-shadow: none; }
.evaluation-role span { flex: 1; }
.evaluation-role > .icon:last-child { opacity: .55; }
.evaluation-role:nth-child(4n+2) { background: #fcebf4; }
.evaluation-role:nth-child(4n+3) { background: #e5f5fc; }
.evaluation-role:nth-child(4n+4) { background: #f0f5df; }
.evaluation-role:hover { background: #e4e0f4; border: 0; color: var(--brand-700); box-shadow: 0 4px 12px rgba(53,57,118,.055); }
.evaluation-role[aria-busy=true] { opacity: .6; }
.evaluation-caption { margin: .85rem 0 0; color: var(--muted); font-size: .7rem; }
.has-evaluation { padding-top: 2rem; padding-bottom: 2rem; }
.has-evaluation .portal-label { margin-bottom: .65rem; }
.has-evaluation h2 { font-size: 2.05rem; }
.has-evaluation h2 + p { margin-bottom: 1.1rem; font-size: .8rem; }
.has-evaluation .stack { gap: .85rem; }
.has-evaluation input:not([type=checkbox]) { padding: .7rem .8rem; }
.has-evaluation .family-entry { margin-top: 1.1rem; padding: .8rem 1rem; }
.has-evaluation .login-note { margin-top: 1.25rem; }
.demo-accounts { margin-top: 1.5rem; padding: 1rem; background: var(--surface-2); border: 0; border-radius: var(--radius-sm); font-size: .82rem; }
.demo-accounts table { font-size: .8rem; }
.demo-accounts th, .demo-accounts td { padding: .35rem .4rem; }
.demo-accounts button { padding: .2rem .5rem; font-size: .74rem; box-shadow: none; }

/* ---------- Portal (parents) ---------- */
.portal { min-height: 100vh; background: var(--page); }
.portal-header { background: #eeedf8; color: var(--brand-700); border: 0; }
.portal-header-inner { max-width: 980px; margin: 0 auto; padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.portal-header .login-brand { color: var(--brand-700); }
.portal-header .login-brand small { color: var(--muted); }
.portal-header .login-brand > img, .portal-header .portal-brand-logo { width: 150px; height: auto; background: transparent; padding: 0; }
.portal-header button { background: var(--brand-100); color: var(--brand-700); border: 0; box-shadow: none; }
.portal-main { max-width: 980px; margin: 0 auto; padding: 2rem 1.25rem 3rem; }
.portal-card { max-width: 440px; margin: 2rem auto; }
.footer-motto { color: var(--brand-700); font-weight: 650; }
.tile:nth-child(4n+2) .tile-icon { color: #b4186b; background: var(--pink-soft); }
.tile:nth-child(4n+3) .tile-icon { color: var(--info); background: var(--cyan-soft); }
.tile:nth-child(4n+4) .tile-icon { color: var(--success); background: var(--lime-soft); }
.metric-grid .metric { position: relative; display: block; min-height: 168px; padding: 1.4rem; border: 0; background: #eeecfa; box-shadow: none; }
.metric-grid .metric:nth-child(4n+2) { background: #fcebf4; }
.metric-grid .metric:nth-child(4n+3) { background: #e5f5fc; }
.metric-grid .metric:nth-child(4n+4) { background: #fff2de; }
.metric-grid .metric > .tile-icon { position: absolute; right: 1.15rem; top: 1.2rem; width: 30px; height: 30px; background: transparent; }
.metric-grid .metric-label { display: block; padding-right: 28px; color: var(--brand-700); font-size: .78rem; }
.metric-grid .metric-value { font-size: 2.25rem; letter-spacing: -.045em; margin-top: .9rem; color: var(--brand-700); }
.metric-grid .metric-note { margin-top: .35rem; font-size: .73rem; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
    .split { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; background: none; }
    .sidebar { position: fixed; z-index: 50; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; }
    .nav-open .sidebar { transform: none; box-shadow: 0 0 0 100vmax rgba(0,0,0,.35); }
    .menu-toggle { display: inline-flex; padding: .45rem; }
    .sidebar-close { display: flex; align-self: flex-end; border: 0; background: var(--brand-100); color: var(--brand-700); padding: .4rem .65rem; font-size: .75rem; }
    .nav-open .nav-backdrop { display: block; position: fixed; inset: 0; z-index: 45; background: rgba(37,40,83,.5); border: 0; border-radius: 0; box-shadow: none; }
    .setup-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .setup-nav { position: static; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .setup-nav strong { grid-column: 1 / -1; }
    .login-shell { grid-template-columns: 1fr; }
    .login-identity { gap: 1.7rem; padding: 2rem; }
    .login-identity > .login-brand { padding: 0; }
    .login-brand img { width: 200px; }
    .login-heading h1 { font-size: 2.6rem; }
    .login-points { max-width: 560px; }
    .hero-meta { justify-content: flex-start; }
    .hero-meta .hero-motto { justify-content: flex-start; }
    .account-name, .term-chip { display: none; }
}
@media (max-width: 900px) {
    .login-identity { align-items: center; padding: 1.25rem 1rem 1.5rem; gap: 0; background: #f4f3fc; }
    .login-identity > .login-brand { align-self: center; border: 0; background: transparent; box-shadow: none; padding: 0; }
    .login-brand img { width: 190px; }
    .login-heading, .login-foot, .login-identity::before { display: none; }
    .login-main { padding: 2rem 1.5rem; }
    .login-main h2 { font-size: 2rem; }
    .login-main h2 + p { margin-bottom: 1.45rem; }
    .portal-label { margin-bottom: .75rem; }
    .family-entry { margin-top: 1.2rem; }
    .hero-meta { max-width: 100%; }
}
@media (max-width: 560px) {
    .content { padding-top: 1.1rem; }
    .hero { padding: .4rem 0 .75rem; }
    h1 { font-size: 1.45rem; }
    .bar-row { grid-template-columns: 90px 1fr 54px; }
}
@media print {
    .sidebar, .topbar, .app-footer, .actions, .toolbar, .no-print { display: none !important; }
    .app-shell { display: block; }
    body, .page { background: #fff; }
    .panel, .card { box-shadow: none; border: 0; }
}

.evaluation-roles form .evaluation-role { width: 100%; height: 100%; }

.login-identity { justify-content: flex-start; }
.login-identity .login-slides { position: absolute; inset: 31% 0 0; z-index: 0; pointer-events: none; }
.login-slides::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, #f4f3fc 0%, rgba(244,243,252,.94) 9%, rgba(244,243,252,.55) 29%, transparent 53%); }
.login-slides img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; animation: school-photo 24s linear infinite; }
.login-slides img:first-child { animation-delay: -2s; }
.login-slides img:nth-child(2) { animation-delay: -18s; }
.login-slides img:nth-child(3) { animation-delay: -10s; }
@keyframes school-photo { 0% { opacity: 0; } 8%, 33.333% { opacity: 1; } 41.333%, 100% { opacity: 0; } }
.login-slides { background: center / cover url("images/login/academy-chess.jpg"); }
.login-slides.paused img { animation-play-state: paused; }
.login-identity .slides-control { position: absolute; inset: auto auto 1.35rem 1.35rem; border: 0; border-radius: 2rem; background: #353976; color: white; padding: .5rem .9rem; font-size: .76rem; }
@media (prefers-reduced-motion: reduce) {
    .login-slides img { animation: none; }
    .login-slides img:first-child { opacity: 1; }
    .login-identity .slides-control { display: none; }
}
@media (max-width: 900px) {
    .login-identity .login-slides, .login-identity .slides-control { display: none; }
}
