/* ===========================================================================
   Digital HSS Web — styles
   Material 3 system ported from the Android app (seed #1565C0).
   =========================================================================== */
:root {
  --primary: #1565C0;
  --primary-variant: #0D47A1;
  --on-primary: #FFFFFF;
  --primary-container: #D3E4FF;
  --on-primary-container: #001C3D;
  --secondary: #0288D1;
  --tertiary: #006874;
  --error: #BA1A1A;
  --on-error: #FFFFFF;
  --error-container: #FFDAD6;
  --on-error-container: #410002;
  --success: #2E7D32;
  --warning: #F57F17;

  --background: #F8F9FF;
  --surface: #F8F9FF;
  --on-surface: #181C22;
  --on-surface-variant: #44474F;
  --surface-container-lowest: #FFFFFF;
  --surface-container-low: #F2F3FD;
  --surface-container: #ECEDFA;
  --surface-container-high: #E6E8F4;
  --outline: #74777F;
  --outline-variant: #C4C6D0;

  --card: var(--surface-container-lowest);
  --radius: 16px;
  --shadow: 0 2px 10px rgba(21, 101, 192, 0.06);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.08);
  --font: "Roboto", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --nav-h: 64px;
}

[data-theme="dark"] {
  --primary: #A4C8FF;
  --primary-variant: #00458D;
  --on-primary: #003063;
  --primary-container: #00458D;
  --on-primary-container: #D3E4FF;
  --secondary: #8ECFF6;
  --tertiary: #4FD8EB;
  --error: #FFB4AB;
  --on-error: #690005;
  --error-container: #93000A;
  --on-error-container: #FFDAD6;

  --background: #101318;
  --surface: #101318;
  --on-surface: #E1E2EE;
  --on-surface-variant: #C4C6D0;
  --surface-container-lowest: #0B0E13;
  --surface-container-low: #181C20;
  --surface-container: #1D2024;
  --surface-container-high: #272A2F;
  --outline: #8E9099;
  --outline-variant: #44474F;
  --shadow: none;
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.4);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--on-surface);
  background: var(--surface);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }
.container { width: min(640px, 100%); margin: 0 auto; }

/* ---- buttons (M3) ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; border-radius: 100px; border: none; cursor: pointer;
  font-size: 15px; font-weight: 600; font-family: var(--font);
  background: var(--primary); color: var(--on-primary); transition: .15s; width: auto;
}
.btn:hover { filter: brightness(0.95); }
.btn.block { width: 100%; }
.btn.tonal { background: var(--primary-container); color: var(--on-primary-container); }
.btn.outlined { background: transparent; color: var(--primary); border: 1px solid var(--outline-variant); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ============================ LOGIN ============================ */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 28px 18px; position: relative; overflow: hidden auto;
  background:
    radial-gradient(1100px 560px at 12% -12%, #3b78e6 0%, transparent 55%),
    radial-gradient(900px 560px at 112% 8%, #0a59c7 0%, transparent 52%),
    linear-gradient(160deg, #1565C0 0%, #0D47A1 58%, #0a3576 100%);
  background-attachment: fixed;
}
.auth-wrap::before, .auth-wrap::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(10px);
  opacity: .22; pointer-events: none;
}
.auth-wrap::before { width: 300px; height: 300px; background: #9cc2ff; top: -90px; right: -70px; }
.auth-wrap::after  { width: 240px; height: 240px; background: #25a4e6; bottom: -80px; left: -60px; }

.auth-shell { width: min(420px, 100%); margin: auto; position: relative; z-index: 1; animation: authRise .45s cubic-bezier(.2,.7,.3,1) both; }
@keyframes authRise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

.auth-hero { text-align: center; margin-bottom: 18px; }
.logo-badge {
  width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 22px;
  background: linear-gradient(145deg, #ffffff, #e6efff); display: grid; place-items: center;
  font-size: 38px; line-height: 1;
  box-shadow: 0 14px 32px rgba(0,0,0,.30), inset 0 1px 0 rgba(255,255,255,.7);
}
.brandline { color: #fff; font-size: 26px; font-weight: 800; letter-spacing: -.3px; }
.brandsub { color: rgba(255,255,255,.82); font-size: 13.5px; margin-top: 3px; }

.auth-card {
  background: var(--surface-container-lowest); border-radius: 22px; padding: 26px 22px;
  box-shadow: 0 26px 64px rgba(7, 30, 70, .38); border: 1px solid rgba(255,255,255,.55);
}
[data-theme="dark"] .auth-card { border-color: var(--outline-variant); }
.auth-card h1 { font-size: 22px; font-weight: 800; margin: 0 0 3px; text-align: center; color: var(--on-surface); }
.auth-tagline { color: var(--on-surface-variant); font-size: 13.5px; text-align: center; margin: 0 0 20px; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--on-surface-variant); margin-bottom: 6px; }
.input-icon { position: relative; display: flex; align-items: center; }
.input-icon .lead { position: absolute; left: 13px; color: var(--on-surface-variant); display: grid; place-items: center; pointer-events: none; }
.input-icon .lead svg { width: 18px; height: 18px; }
.field input, .field textarea {
  width: 100%; padding: 14px; border: 1px solid var(--outline-variant); border-radius: 12px;
  font-size: 15px; font-family: var(--font); background: var(--surface-container-low); color: var(--on-surface);
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.input-icon input { padding-left: 42px; }
.input-icon input.has-eye { padding-right: 46px; }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--primary); background: var(--surface-container-lowest);
  box-shadow: 0 0 0 3px var(--primary-container);
}
.eye { position: absolute; right: 7px; width: 34px; height: 34px; border: none; background: none;
  cursor: pointer; color: var(--on-surface-variant); display: grid; place-items: center; border-radius: 9px; }
.eye:hover { background: var(--surface-container); color: var(--primary); }
.eye svg { width: 19px; height: 19px; }

.link { color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer; }
.link:hover { text-decoration: underline; }
.forgot { text-align: right; margin: 2px 0 14px; }
.btn-lg { padding: 15px 22px; font-size: 15.5px; box-shadow: 0 8px 22px rgba(21,101,192,.30); }
.btn-lg:hover { box-shadow: 0 10px 26px rgba(21,101,192,.38); }
.divider {
  display: flex; align-items: center; gap: 12px; color: var(--on-surface-variant);
  font-size: 11px; font-weight: 700; margin: 18px 0; text-transform: uppercase; letter-spacing: .05em;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--outline-variant); }
.gbtn {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%;
  padding: 13px; border: 1px solid var(--outline-variant); border-radius: 12px;
  background: var(--surface); color: var(--on-surface); font-weight: 600; cursor: pointer; font-size: 14px; transition: .15s;
}
.gbtn:hover { background: var(--surface-container); border-color: var(--outline); }
.btn.outlined svg { width: 18px; height: 18px; }
.signup-row { text-align: center; margin-top: 16px; font-size: 13.5px; color: var(--on-surface-variant); }
.msg { font-size: 13px; padding: 11px 13px; border-radius: 10px; margin-bottom: 14px; display: none; }
.msg.err { background: var(--error-container); color: var(--on-error-container); display: block; }
.msg.ok { background: #C9E6CC; color: #0A3818; display: block; }
.auth-footer { text-align: center; color: rgba(255,255,255,.72); font-size: 12px; padding: 16px 0 0; }

/* ============================ APP SHELL ============================ */
.app-screen { min-height: 100vh; padding-bottom: var(--nav-h); background: var(--surface); }

/* Home blue header */
.app-bar {
  background: var(--primary); color: var(--on-primary);
  padding: 16px 18px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 30;
}
.app-bar .avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; overflow: hidden;
  background: var(--on-primary); color: var(--primary); display: grid; place-items: center;
  font-weight: 800; border: 2px solid rgba(255,255,255,.35);
}
.app-bar .avatar img { width: 100%; height: 100%; object-fit: cover; }
.app-bar .meta { flex: 1; min-width: 0; }
.app-bar .greeting { font-size: 13px; opacity: .8; }
.app-bar .name { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-bar .school { font-size: 11px; opacity: .65; }
.app-bar .icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: none; background: transparent;
  color: var(--on-primary); cursor: pointer; display: grid; place-items: center; position: relative;
}
.app-bar .icon-btn:hover { background: rgba(255,255,255,.12); }
.app-bar .icon-btn svg { width: 24px; height: 24px; }
.badge {
  position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: var(--error); color: #fff; font-size: 9px; font-weight: 700;
  display: none; align-items: center; justify-content: center;
}

/* simple title bar (Result / Notes panels) */
.title-bar {
  background: var(--primary); color: var(--on-primary); padding: 18px;
  position: sticky; top: 0; z-index: 30;
}
.title-bar h1 { margin: 0; font-size: 20px; font-weight: 600; }
.title-bar p { margin: 2px 0 0; font-size: 12.5px; opacity: .8; }

.content { padding: 14px 14px 24px; max-width: 780px; margin-left: auto; margin-right: auto; }

/* feed posts */
.post {
  background: var(--card); border: 1px solid var(--outline-variant); border-radius: var(--radius);
  margin-bottom: 14px; overflow: hidden; box-shadow: var(--shadow-card);
}
.post .head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 0; }
.post .head .pp { width: 40px; height: 40px; border-radius: 50%; background: var(--primary-container); overflow: hidden; flex: none; }
.post .head .pp img { width: 100%; height: 100%; object-fit: cover; }
.post .head .pn { font-weight: 700; font-size: 14.5px; }
.post .head .pd { font-size: 12px; color: var(--on-surface-variant); }
.post .body { padding: 12px 14px; white-space: pre-wrap; font-size: 14.5px; }
.post .imgs { display: grid; gap: 2px; }
.post .imgs.n1 { grid-template-columns: 1fr; }
.post .imgs.n2, .post .imgs.n3, .post .imgs.n4 { grid-template-columns: 1fr 1fr; }
.post .imgs img { width: 100%; height: 200px; object-fit: cover; }
.post .imgs.n1 img { height: auto; max-height: 420px; }
.post .foot { padding: 10px 14px; border-top: 1px solid var(--outline-variant); }
.post .foot a { font-size: 13px; font-weight: 600; }

/* generic cards */
.card {
  background: var(--card); border: 1px solid var(--outline-variant); border-radius: var(--radius);
  box-shadow: var(--shadow-card); padding: 18px; margin-bottom: 14px;
}
.card h2 { margin: 0 0 8px; font-size: 19px; }
.card h3 { margin: 0 0 8px; font-size: 16px; }

.notice-card { display: flex; gap: 14px; }
.notice-card img { width: 96px; height: 84px; object-fit: cover; border-radius: 10px; flex: none; }
.notice-card h3 { margin: 0 0 5px; font-size: 16px; }
.notice-card p { margin: 0; color: var(--on-surface-variant); font-size: 14px; white-space: pre-wrap; }

/* form controls */
.row-controls { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.select-field { display: flex; flex-direction: column; gap: 6px; flex: 1; min-width: 150px; }
.select-field label { font-size: 12.5px; font-weight: 600; color: var(--on-surface-variant); }
.select-field select {
  padding: 13px 14px; border: 1px solid var(--outline-variant); border-radius: 12px; font-size: 15px;
  background: var(--surface-container-low); color: var(--on-surface); font-family: var(--font);
}

/* result table */
table.result { width: 100%; border-collapse: collapse; font-size: 14px; }
table.result th, table.result td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--outline-variant); }
table.result th { background: var(--primary-container); color: var(--on-primary-container); font-weight: 700; }
table.result td.num, table.result th.num { text-align: center; }
.grade { font-weight: 800; }
.grade.A\+, .grade.A { color: var(--success); }
.grade.B\+, .grade.B { color: var(--primary); }
.grade.C\+, .grade.C, .grade.D { color: var(--warning); }
.grade.NG { color: var(--error); }
.result-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.gpa-badge { background: var(--primary); color: var(--on-primary); padding: 10px 18px; border-radius: 14px; text-align: center; }
.gpa-badge .v { font-size: 24px; font-weight: 800; line-height: 1; }
.gpa-badge .l { font-size: 12px; opacity: .85; }

.empty { text-align: center; color: var(--on-surface-variant); padding: 48px 20px; }
.loading { text-align: center; color: var(--on-surface-variant); padding: 30px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--outline-variant); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 12px; }
@keyframes spin { to { transform: rotate(360deg); } }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { background: var(--primary-container); color: var(--on-primary-container); padding: 6px 12px; border-radius: 100px; font-size: 13px; font-weight: 600; }
.info-grid { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; }
.info-grid dt { color: var(--on-surface-variant); font-weight: 600; }
.info-grid dd { margin: 0; }

/* Notes / library grid */
.notes-stat { background: var(--primary-container); color: var(--on-primary-container); border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px; }
.book-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.book-card { background: var(--card); border: 1px solid var(--outline-variant); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-card); display: flex; flex-direction: column; }
.book-cover { aspect-ratio: 3 / 4; background: linear-gradient(140deg, var(--primary-container), var(--surface-container)); display: grid; place-items: center; }
.book-cover svg { width: 54px; height: 54px; color: var(--primary); opacity: .85; }
.book-body { padding: 10px 12px 10px; flex: 1; }
.book-title { font-size: 13.5px; font-weight: 700; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-badge { display: inline-block; margin-top: 8px; color: #fff; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 100px; }
.book-actions { display: flex; border-top: 1px solid var(--outline-variant); }
.book-actions a { flex: 1; text-align: center; padding: 10px 4px; font-size: 13px; font-weight: 600; color: var(--primary); cursor: pointer; }
.book-actions a:hover { background: var(--primary-container); text-decoration: none; }
.book-actions a + a { border-left: 1px solid var(--outline-variant); }
@media (min-width: 560px) { .book-grid { grid-template-columns: repeat(3, 1fr); } }

/* ============================ MORE (settings list) ============================ */
.more-profile {
  background: var(--primary); color: var(--on-primary); display: flex; align-items: center; gap: 16px;
  padding: 24px 20px;
}
.more-profile .avatar {
  width: 64px; height: 64px; border-radius: 50%; overflow: hidden; flex: none;
  background: var(--on-primary); color: var(--primary); display: grid; place-items: center;
  font-size: 26px; font-weight: 800; border: 2px solid rgba(255,255,255,.35);
}
.more-profile .avatar img { width: 100%; height: 100%; object-fit: cover; }
.more-profile .pname { font-size: 20px; font-weight: 600; }
.more-profile .pmail { font-size: 13px; opacity: .85; }
.more-profile .pschool { font-size: 12px; opacity: .7; }
.section-label { color: var(--primary); font-size: 12px; font-weight: 700; letter-spacing: .08em; margin: 22px 6px 8px; }
.settings-card {
  background: var(--surface-container); border: 1px solid var(--outline-variant); border-radius: 16px; overflow: hidden;
}
.srow {
  display: flex; align-items: center; gap: 16px; padding: 0 16px; height: 58px; cursor: pointer;
  background: none; border: none; width: 100%; text-align: left; font-family: var(--font); color: var(--on-surface);
}
.srow:hover { background: rgba(21,101,192,.06); }
.srow + .srow { border-top: 1px solid var(--outline-variant); margin-left: 64px; padding-left: 0; }
.srow + .srow .sicon { margin-left: -48px; }
.sicon { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.sicon svg { width: 20px; height: 20px; }
.srow .stext { flex: 1; }
.srow .stitle { font-size: 15px; }
.srow .ssub { font-size: 12px; color: var(--on-surface-variant); }
.srow .chev { color: var(--on-surface-variant); }
.srow .chev svg { width: 20px; height: 20px; }
.switch { width: 44px; height: 26px; border-radius: 100px; background: var(--outline-variant); position: relative; transition: .15s; flex: none; }
.switch.on { background: var(--primary); }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .15s; }
.switch.on::after { left: 21px; }
.logout-card {
  background: var(--error-container); color: var(--on-error-container); border-radius: 16px; margin-top: 22px;
  display: flex; align-items: center; justify-content: center; gap: 10px; height: 56px; cursor: pointer; font-weight: 600; font-size: 15px;
}
.logout-card:hover { filter: brightness(0.97); }
.logout-card svg { width: 20px; height: 20px; }
.version-footer { text-align: center; color: var(--on-surface-variant); font-size: 12px; opacity: .6; margin: 20px 0 8px; }

/* sub-page (opened from a settings row) */
.subpage-bar { display: flex; align-items: center; gap: 12px; }
.back-btn { background: none; border: none; color: var(--on-primary); cursor: pointer; padding: 4px; display: grid; place-items: center; }
.back-btn svg { width: 24px; height: 24px; }

/* ============================ QUIZ ============================ */
.quiz-q { font-size: 19px; font-weight: 700; margin: 0 0 18px; }
.quiz-opt {
  display: block; width: 100%; text-align: left; padding: 15px 16px; margin-bottom: 10px;
  border: 1px solid var(--outline-variant); border-radius: 14px; background: var(--card); color: var(--on-surface);
  font-size: 15px; cursor: pointer; font-family: var(--font);
}
.quiz-opt:hover { border-color: var(--primary); background: var(--primary-container); }
.quiz-opt.correct { border-color: var(--success); background: #C9E6CC; color: #0A3818; font-weight: 700; }
.quiz-opt.wrong { border-color: var(--error); background: var(--error-container); color: var(--on-error-container); font-weight: 700; }
.quiz-opt[disabled] { cursor: default; }
.quiz-meta { display: flex; justify-content: space-between; color: var(--on-surface-variant); font-size: 14px; margin-bottom: 14px; }

/* ============================ CALENDAR ============================ */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.cal-head button { border: 1px solid var(--outline-variant); background: var(--card); color: var(--on-surface); border-radius: 8px; width: 36px; height: 36px; cursor: pointer; font-size: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-grid .dow { text-align: center; font-size: 12px; font-weight: 700; color: var(--on-surface-variant); padding: 6px 0; }
.cal-grid .day { aspect-ratio: 1; display: grid; place-items: center; border-radius: 9px; font-size: 14px; background: var(--surface-container); }
.cal-grid .day.today { background: var(--primary); color: var(--on-primary); font-weight: 800; }
.cal-grid .day.empty { background: transparent; }

/* ============================ BOTTOM NAV ============================ */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h); z-index: 40;
  background: var(--surface-container); border-top: 1px solid var(--outline-variant);
  display: flex; box-shadow: 0 -2px 10px rgba(0,0,0,.06);
}
.bottom-nav .nav-item {
  flex: 1; border: none; background: none; cursor: pointer; font-family: var(--font);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--on-surface-variant); font-size: 11px; font-weight: 600; padding-top: 6px;
}
.bottom-nav .nav-item svg { width: 24px; height: 24px; }
.bottom-nav .nav-item .pill {
  display: flex; align-items: center; justify-content: center; width: 56px; height: 30px;
  border-radius: 100px; transition: .15s;
}
.bottom-nav .nav-item.active { color: var(--primary); }
.bottom-nav .nav-item.active .pill { background: var(--primary-container); color: var(--on-primary-container); }

.panel { display: none; }
.panel.active { display: block; }

/* teacher portal header + tabs */
.thead { background: var(--primary); color: var(--on-primary); padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; }
.thead .tt { font-size: 19px; font-weight: 600; }
.thead .who { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.thead .who .avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--on-primary); color: var(--primary); display: grid; place-items: center; font-weight: 800; }
.thead .logout-btn { background: rgba(255,255,255,.15); border: none; color: #fff; padding: 8px 14px; border-radius: 100px; cursor: pointer; font-weight: 600; font-family: var(--font); }
.thead .logout-btn:hover { background: rgba(255,255,255,.28); }
.tabs { display: flex; gap: 4px; overflow-x: auto; background: var(--surface-container); border-bottom: 1px solid var(--outline-variant); position: sticky; top: 0; z-index: 20; padding: 0 8px; }
.tab { flex: none; border: none; background: none; padding: 14px 14px; font-family: var(--font); font-size: 14px; font-weight: 600; color: var(--on-surface-variant); border-bottom: 3px solid transparent; cursor: pointer; white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* teacher dashboard (LMainActivity-style) */
.t-wrap { width: min(760px, 100%); margin: 0 auto; padding: 0 0 30px; }
.t-header { background: var(--card); border: 1px solid var(--outline-variant); border-radius: 22px; margin: 16px; padding: 18px; box-shadow: var(--shadow-card); }
.t-header .row { display: flex; align-items: center; gap: 12px; }
.t-header .avatar { width: 52px; height: 52px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 22px; background: linear-gradient(135deg, #00897B, #1565C0); }
.t-header .wname { font-size: 19px; font-weight: 800; }
.t-header .wmail { font-size: 12px; color: var(--on-surface-variant); }
.t-header hr { border: none; border-top: 1px solid var(--outline-variant); margin: 16px 0 14px; }
.t-header .school { font-size: 15px; font-weight: 800; }
.t-header .worktag { font-size: 13px; color: var(--on-surface-variant); margin-top: 2px; }
.t-chips { display: flex; gap: 8px; margin-top: 14px; }
.t-chip { font-size: 12px; font-weight: 700; padding: 7px 12px; border-radius: 16px; }
.t-chip.active { color: #00897B; background: #E6F7F3; border: 1px solid #A7E5D8; }
.t-chip.role { color: #1565C0; background: #EAF4FF; border: 1px solid #B8D8FF; }
.t-access { margin-top: 12px; padding: 10px 12px; border-radius: 12px; font-size: 13px; background: var(--surface-container-low); border: 1px solid var(--outline-variant); }
.t-section { display: flex; align-items: center; gap: 10px; margin: 22px 18px 10px; }
.t-section .line { width: 3px; height: 14px; border-radius: 4px; background: var(--primary); }
.t-section .lbl { font-size: 18px; font-weight: 800; }
.t-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 0 14px; }
.ttile { position: relative; background: var(--card); border: 1px solid var(--outline-variant); border-radius: 18px; padding: 16px 12px 12px; cursor: pointer; min-height: 116px; text-align: left; font-family: var(--font); color: var(--on-surface); overflow: hidden; transition: .12s; }
.ttile:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.ttile .accent { position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.ttile .ibox { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 10px; }
.ttile .ibox svg { width: 22px; height: 22px; }
.ttile .ttitle { font-weight: 800; font-size: 14px; }
.ttile .tsub { font-size: 11px; color: var(--on-surface-variant); margin-top: 3px; }
.ttile .tbadge { position: absolute; top: 8px; right: 8px; background: #DC2626; color: #fff; border-radius: 14px; min-width: 24px; height: 24px; display: none; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; padding: 0 6px; }
.t-logout { display: flex; justify-content: center; margin: 22px 16px; }
.t-logout button { background: #FFF7F7; color: #EF4444; border: 1px solid #FFD0D0; border-radius: 14px; padding: 15px 32px; font-weight: 800; font-size: 14px; cursor: pointer; width: 100%; font-family: var(--font); }
[data-theme="dark"] .t-chip.active, [data-theme="dark"] .t-chip.role { background: var(--surface-container-high); }
@media (min-width: 620px) { .t-grid { grid-template-columns: repeat(3, 1fr); } }

/* tool sub-page: themed header subtitle */
#subBar p { margin: 2px 0 0; font-size: 12.5px; opacity: .85; }

/* selector card (Enter Marks / Reports) */
.sel-card { background: var(--card); border: 1px solid var(--outline-variant); border-radius: 18px; box-shadow: var(--shadow-card); padding: 16px; margin-bottom: 14px; }
.sel-row { display: flex; gap: 16px; }
.sel-row .select-field { flex: 1; }
.sel-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--primary); margin-bottom: 6px; display: block; }
.sel-status { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--outline-variant); margin-top: 14px; padding-top: 12px; }
.sel-status .done { flex: 1; font-weight: 700; font-size: 14px; }
.count-chip { background: var(--primary-container); color: var(--on-primary-container); font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 100px; }

/* mark entry card (list_item_marks) */
.mk-card { background: var(--card); border: 1px solid var(--outline-variant); border-radius: 16px; box-shadow: var(--shadow-card); padding: 14px; margin-bottom: 12px; display: flex; gap: 12px; }
.mk-avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 16px; }
.mk-main { flex: 1; min-width: 0; }
.mk-top { display: flex; align-items: center; gap: 8px; }
.mk-name { flex: 1; font-weight: 700; font-size: 16px; }
.mk-status { width: 22px; height: 22px; flex: none; }
.mk-roll { background: var(--secondary); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 100px; }
.mk-bar { height: 4px; border-radius: 2px; background: var(--outline-variant); margin: 10px 0; overflow: hidden; }
.mk-bar i { display: block; height: 100%; width: 0; background: var(--warning); transition: .2s; }
.mk-bar.full i { background: var(--success); }
.mk-inputs { display: flex; gap: 12px; align-items: flex-end; }
.mk-field { flex: 1; }
.mk-field .lab { display: flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; margin-bottom: 5px; }
.mk-field .lab.theory { color: var(--primary); }
.mk-field .lab.prac { color: var(--tertiary); }
.mk-field input { width: 100%; height: 46px; text-align: center; border: 1px solid var(--outline-variant); border-radius: 8px; background: var(--surface-container-low); color: var(--on-surface); font-size: 15px; font-family: var(--font); }
.mk-field input:focus { outline: none; border-color: var(--primary); }
.mk-divider { width: 1px; align-self: stretch; background: var(--outline-variant); }

/* save FAB */
.fab-save { position: fixed; bottom: 20px; right: 20px; z-index: 35; border: none; cursor: pointer;
  background: var(--primary); color: var(--on-primary); font-family: var(--font); font-weight: 700; font-size: 15px;
  padding: 16px 24px; border-radius: 100px; box-shadow: 0 6px 18px rgba(0,0,0,.25); }
.fab-save:hover { filter: brightness(0.95); }
.fab-save[disabled] { opacity: .6; }
@media (min-width: 680px) { .fab-save { right: calc(50% - 320px + 20px); } }

/* new-student panel */
.panel-box { background: var(--card); border: 1px solid var(--outline-variant); border-radius: 16px; padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow-card); }
.panel-box h3 { margin: 0 0 12px; font-size: 16px; }
.inline-row { display: flex; gap: 10px; }
.inline-row .btn { white-space: nowrap; }

/* student list row */
.stu-row { display: flex; align-items: center; gap: 12px; background: var(--card); border: 1px solid var(--outline-variant); border-radius: 12px; padding: 10px 14px; margin-bottom: 8px; }
.stu-row .av { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 800; }
.stu-row .nm { flex: 1; font-weight: 600; }
.stu-row .rl { color: var(--on-surface-variant); font-size: 13px; }
.stu-row .del { background: none; border: none; color: var(--error); cursor: pointer; font-weight: 600; font-family: var(--font); }

/* ledger table */
.ledger-wrap { overflow-x: auto; border: 1px solid var(--outline-variant); border-radius: 14px; }
table.ledger { border-collapse: collapse; font-size: 13px; white-space: nowrap; width: 100%; }
table.ledger th, table.ledger td { padding: 9px 10px; border-bottom: 1px solid var(--outline-variant); border-right: 1px solid var(--outline-variant); text-align: center; }
table.ledger th { background: var(--primary-container); color: var(--on-primary-container); font-weight: 700; position: sticky; top: 0; }
table.ledger td.name, table.ledger th.name { text-align: left; position: sticky; left: 0; background: var(--card); font-weight: 600; }
table.ledger th.name { background: var(--primary-container); }
table.ledger td.fail { background: #F6B8C4; color: #5a1020; font-weight: 700; }
table.ledger td.passs { background: #C6F6D5; color: #0a3818; font-weight: 700; }
table.ledger td .lg { font-size: 10px; opacity: .8; }
table.ledger th.grp { background: var(--primary); color: var(--on-primary); }
.export-row { display: flex; gap: 12px; margin-top: 14px; }
.export-row .btn { flex: 1; }
.btn.danger { background: var(--error); color: var(--on-error); }
.btn.ok { background: var(--success); color: #fff; }

/* Wide ledger tools (View Reports / Record View) break out of the centered column */
#panel-sub.tool-wide .content { max-width: none; }
#panel-sub.tool-wide .t-wrap { width: min(1280px, 100%); }
.ledger-wrap { -webkit-overflow-scrolling: touch; max-height: 72vh; overflow: auto; position: relative; }
table.ledger tbody tr:nth-child(even) td { background: var(--surface-container-low); }
table.ledger tbody tr:nth-child(even) td.name { background: var(--surface-container-low); }
table.ledger tbody tr:hover td { background: var(--primary-container); }
table.ledger tbody tr:hover td.name { background: var(--primary-container); }

@media (min-width: 680px) {
  .bottom-nav { width: 640px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
}

/* ===== Desktop layout: bottom nav becomes a left sidebar (student app only) ===== */
@media (min-width: 980px) {
  .bottom-nav {
    flex-direction: column; align-items: stretch; justify-content: flex-start;
    left: 0; top: 0; bottom: 0; width: 240px; height: 100vh; transform: none;
    border-top: none; border-right: 1px solid var(--outline-variant); border-radius: 0;
    padding: 14px 12px; gap: 4px; box-shadow: none; background: var(--surface-container);
  }
  .bottom-nav::before {
    content: "🎓 Digital HSS"; display: block; font-size: 18px; font-weight: 800;
    color: var(--primary); padding: 12px 12px 18px;
  }
  .bottom-nav .nav-item {
    flex: none; flex-direction: row; justify-content: flex-start; gap: 14px;
    height: 48px; padding: 0 12px; border-radius: 12px; font-size: 15px; font-weight: 600;
  }
  .bottom-nav .nav-item .pill { width: auto; height: auto; padding: 0; background: none !important; color: inherit; }
  .bottom-nav .nav-item.active { background: var(--primary-container); color: var(--on-primary-container); }
  .bottom-nav .nav-item:hover { background: var(--primary-container); }

  /* push the app content right of the sidebar — only when a sidebar exists */
  .app-screen:has(.bottom-nav) { padding-left: 240px; padding-bottom: 0; }

  /* full-bleed header bars, centered content column */
  .app-bar, .title-bar { padding-left: max(18px, calc((100% - 780px) / 2)); padding-right: max(18px, calc((100% - 780px) / 2)); }

  /* teacher portal centers its own column already (.t-wrap) — give it breathing room */
  .t-wrap { width: min(900px, 100%); }
  .t-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ============================ POLISH ============================ */
* { -webkit-tap-highlight-color: transparent; }
html { scroll-behavior: smooth; }
img { -webkit-user-drag: none; user-select: none; }

/* accessible focus rings (keyboard only) */
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 6px; }
button:focus:not(:focus-visible), a:focus:not(:focus-visible),
input:focus:not(:focus-visible), select:focus:not(:focus-visible) { outline: none; }

/* smooth panel/tab transition (opacity only — keeps sticky headers intact) */
@keyframes panelFade { from { opacity: 0; } to { opacity: 1; } }
.panel.active { animation: panelFade .22s ease; }

/* tactile press feedback */
.btn, .gbtn { transition: filter .15s, transform .08s, box-shadow .18s, background .15s; }
.btn:active, .gbtn:active, .nav-item:active, .more-tile:active, .ttile:active,
.srow:active, .book-card:active, .quiz-opt:active, .logout-card:active, .tab:active { transform: scale(.985); }
.nav-item, .tab, .srow, .stu-row, .quiz-opt, .gbtn, .ttile, .more-tile { transition: background .15s, color .15s, transform .1s, border-color .15s; }

/* desktop hover affordances */
@media (hover: hover) and (min-width: 900px) {
  .post, .card { transition: box-shadow .18s ease, transform .18s ease; }
  .post:hover { box-shadow: 0 8px 26px rgba(7, 30, 70, .10); }
  .stu-row:hover { border-color: var(--primary); }
}

/* media fade-in */
.post .imgs img, .notice-card img, .school-hero img, .book-cover { animation: imgIn .4s ease both; }
@keyframes imgIn { from { opacity: 0; } to { opacity: 1; } }

/* loading skeletons */
.skel { background: linear-gradient(90deg, var(--surface-container) 25%, var(--surface-container-high) 37%, var(--surface-container) 63%);
  background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 8px; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.skel-card { background: var(--card); border: 1px solid var(--outline-variant); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; box-shadow: var(--shadow-card); }
.skel-row { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.skel-dot { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.skel-line { height: 12px; border-radius: 6px; }
.skel-img { height: 200px; border-radius: 10px; }

/* refined scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--outline-variant) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-thumb { background: var(--outline-variant); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: var(--outline); }
*::-webkit-scrollbar-track { background: transparent; }

/* selection */
::selection { background: var(--primary-container); color: var(--on-primary-container); }

/* respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ============================ ADMISSIONS ============================ */
.adm-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .adm-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1040px) { .adm-grid { grid-template-columns: 1fr 1fr 1fr; } }
.adm-card { background: var(--card); border: 1px solid var(--outline-variant); border-radius: 16px; padding: 14px; box-shadow: var(--shadow-card); display: flex; flex-direction: column; gap: 11px; min-width: 0; transition: box-shadow .18s, transform .18s; }
@media (hover: hover) and (min-width: 900px) { .adm-card:hover { transform: translateY(-3px); box-shadow: 0 10px 26px rgba(7, 30, 70, .12); } }
.adm-top { display: flex; align-items: center; gap: 12px; }
.adm-name { font-weight: 800; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-sub { font-size: 12px; color: var(--on-surface-variant); }
.adm-badge { color: #fff; font-size: 11px; font-weight: 800; padding: 4px 10px; border-radius: 100px; flex: none; }
.adm-meta { font-size: 12.5px; color: var(--on-surface-variant); }
.adm-calls { display: flex; flex-direction: column; gap: 8px; }
.call-btn { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 12px; background: var(--success); color: #fff; font-weight: 700; font-size: 14px; text-decoration: none; min-width: 0; transition: filter .15s, transform .08s; }
.call-btn svg { width: 18px; height: 18px; flex: none; }
.call-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.call-btn small { margin-left: auto; font-weight: 600; opacity: .92; white-space: nowrap; }
.call-btn:hover { filter: brightness(.96); text-decoration: none; }
.call-btn:active { transform: scale(.98); }
.call-btn.guardian { background: var(--secondary); }
.adm-actions { display: flex; align-items: center; gap: 16px; border-top: 1px solid var(--outline-variant); padding-top: 10px; }
.adm-actions .link { background: none; border: none; cursor: pointer; font-weight: 700; font-family: var(--font); font-size: 13px; padding: 0; }
.adm-actions .link:hover { text-decoration: underline; }
.adm-form-grid { display: grid; grid-template-columns: 1fr; gap: 0 16px; }
@media (min-width: 560px) { .adm-form-grid { grid-template-columns: 1fr 1fr; } }
@media (min-width: 920px) { .adm-form-grid { grid-template-columns: 1fr 1fr 1fr; } }
.adm-form-grid select { width: 100%; padding: 14px; border: 1px solid var(--outline-variant); border-radius: 12px; font-size: 15px; font-family: var(--font); background: var(--surface-container-low); color: var(--on-surface); }
.adm-form-grid select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-container); }

/* type-YES confirmation modal */
.confirm-overlay { position: fixed; inset: 0; background: rgba(7, 16, 38, .55); backdrop-filter: blur(3px); display: grid; place-items: center; z-index: 200; padding: 20px; animation: panelFade .15s ease; }
.confirm-box { background: var(--card); border-radius: 18px; padding: 24px; width: min(400px, 100%); box-shadow: 0 24px 60px rgba(0, 0, 0, .4); text-align: center; animation: authRise .22s cubic-bezier(.2,.7,.3,1) both; }
.confirm-ic { font-size: 40px; line-height: 1; }
.confirm-box h3 { margin: 8px 0 6px; font-size: 19px; color: var(--on-surface); }
.confirm-box p { margin: 0 0 16px; color: var(--on-surface-variant); font-size: 14px; line-height: 1.5; }
.confirm-lbl { display: block; text-align: left; font-size: 12.5px; font-weight: 600; color: var(--on-surface-variant); margin-bottom: 6px; }
.confirm-box input { width: 100%; padding: 13px 14px; border: 1px solid var(--outline-variant); border-radius: 12px; font-size: 15px; font-family: var(--font); background: var(--surface-container-low); color: var(--on-surface); margin-bottom: 16px; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; }
.confirm-box input:focus { outline: none; border-color: var(--error); box-shadow: 0 0 0 3px var(--error-container); }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }
