/* Kelas — single stylesheet. Dark, low-contrast fatigue, no framework. */

:root {
  --bg:        #0f1115;
  --bg-2:      #161a21;
  --bg-3:      #1d222b;
  --line:      #272d38;
  --line-2:    #333a47;
  --fg:        #e6e9ef;
  --fg-dim:    #9aa3b2;
  --fg-faint:  #6b7484;
  --accent:    #4f8cff;
  --accent-2:  #2f6fe0;
  --ok:        #2ea36b;
  --warn:      #d99a2b;
  --err:       #e05555;
  --radius:    10px;
  --radius-sm: 7px;
  --shadow:    0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

/* ------------------------------------------------------------- light theme
 *
 * The dark palette above is the default. Setting data-theme="light" on <html>
 * swaps the tokens; every component reads tokens, so nothing else changes.
 * "auto" follows the OS via the media query at the bottom of this block.
 */
[data-theme="light"] {
  --bg:        #f6f7f9;
  --bg-2:      #ffffff;
  --bg-3:      #eceef2;
  --line:      #d9dde4;
  --line-2:    #c3c9d3;
  --fg:        #14171c;
  --fg-dim:    #5a6473;
  --fg-faint:  #8b94a3;
  --accent:    #2f6fe0;
  --accent-2:  #1f57bd;
  --ok:        #1f8a55;
  --warn:      #b8791a;
  --err:       #cc3b3b;
  --shadow:    0 1px 2px rgba(16,20,28,.06), 0 8px 24px rgba(16,20,28,.08);
}

/* OS preference applies only when the user has not chosen explicitly. */
@media (prefers-color-scheme: light) {
  html[data-theme="auto"] {
    --bg:        #f6f7f9;
    --bg-2:      #ffffff;
    --bg-3:      #eceef2;
    --line:      #d9dde4;
    --line-2:    #c3c9d3;
    --fg:        #14171c;
    --fg-dim:    #5a6473;
    --fg-faint:  #8b94a3;
    --accent:    #2f6fe0;
    --accent-2:  #1f57bd;
    --ok:        #1f8a55;
    --warn:      #b8791a;
    --err:       #cc3b3b;
    --shadow:    0 1px 2px rgba(16,20,28,.06), 0 8px 24px rgba(16,20,28,.08);
  }
}

/* ------------------------------------------------------- pager + searchbar */

.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap;
  margin-top: 1rem; padding-top: .85rem;
  border-top: 1px solid var(--line);
}
.pager-info { color: var(--fg-dim); font-size: .82rem; }
.pager-links { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.pager-btn {
  display: inline-grid; place-items: center;
  min-width: 30px; height: 30px; padding: 0 .45rem;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-2); color: var(--fg);
  font-size: .82rem; text-decoration: none; line-height: 1;
}
.pager-btn:hover { border-color: var(--line-2); background: var(--bg-3); }
.pager-btn.is-on {
  background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}
.pager-btn.is-off { opacity: .35; }
.pager-gap { color: var(--fg-faint); padding: 0 .15rem; }

.searchbar { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.searchbar input[type="search"] {
  flex: 1 1 200px; min-width: 140px;
  padding: .45rem .6rem;
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); color: var(--fg);
  font-size: .88rem;
}
.searchbar input[type="search"]:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* --------------------------------------------------------- theme toggle */

.theme-toggle {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; padding: 0;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--bg-2); color: var(--fg-dim);
  cursor: pointer; line-height: 1;
}
.theme-toggle:hover { color: var(--fg); border-color: var(--line-2); }
.theme-toggle svg { width: 16px; height: 16px; display: block; }
/* show the icon for the theme you would switch TO */
.theme-toggle .i-sun  { display: none; }
.theme-toggle .i-moon { display: block; }
[data-theme="light"] .theme-toggle .i-sun  { display: block; }
[data-theme="light"] .theme-toggle .i-moon { display: none; }

/* floating variant for the bare layout (login / install / error) */
.theme-toggle-float {
  position: fixed; top: 1rem; right: 1rem; z-index: 50;
}
/* on the login page the art panel is dark, so keep the button legible */
body.bare:has(.login-page) .theme-toggle-float {
  background: rgba(20,22,26,.72);
  border-color: rgba(255,255,255,.22);
  color: #e6e9ef;
  backdrop-filter: blur(6px);
}
body.bare:has(.login-page) .theme-toggle-float:hover {
  background: rgba(20,22,26,.9);
  border-color: rgba(255,255,255,.4);
  color: #fff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 .6rem; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p  { margin: 0 0 .8rem; }

small { color: var(--fg-dim); }
code, pre { font-family: var(--mono); font-size: .9em; }
pre {
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: .7rem .9rem; overflow: auto;
}

/* ---------------------------------------------------------------- topbar */

.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(15,17,21,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  display: flex; align-items: center; gap: 1.2rem;
  padding: .6rem 1rem;
}
.brand { display: flex; align-items: center; gap: .6rem; color: var(--fg); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 32px; height: 32px; flex: 0 0 32px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), #7b5cff);
  border-radius: 9px; font-weight: 700; color: #fff;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text small { font-size: .72rem; color: var(--fg-faint); }

.mainnav { display: flex; gap: .15rem; flex: 1; flex-wrap: wrap; }
.mainnav a {
  padding: .4rem .7rem; border-radius: var(--radius-sm);
  color: var(--fg-dim); font-size: .92rem;
}
.mainnav a:hover { background: var(--bg-3); color: var(--fg); text-decoration: none; }
.mainnav a.active { background: var(--bg-3); color: var(--fg); font-weight: 600; }

.userbox { display: flex; align-items: center; gap: .5rem; }
.userchip {
  display: flex; align-items: center; gap: .5rem;
  padding: .25rem .55rem .25rem .25rem;
  border-radius: 999px; border: 1px solid var(--line);
  color: var(--fg); font-size: .88rem;
}
.userchip:hover { background: var(--bg-3); text-decoration: none; }
.userchip img { border-radius: 50%; display: block; }
.userchip span { display: flex; flex-direction: column; line-height: 1.1; }
.userchip small { font-size: .68rem; color: var(--fg-faint); text-transform: capitalize; }

/* ---------------------------------------------------------------- page */

.page { max-width: 1180px; margin: 0 auto; padding: 1.4rem 1rem 3rem; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem;
}
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--fg-dim); font-size: .9rem; }

.footer {
  max-width: 1180px; margin: 0 auto; padding: 1rem;
  border-top: 1px solid var(--line);
  color: var(--fg-faint); font-size: .8rem;
}

/* ---------------------------------------------------------------- cards */

.card {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1rem 1.1rem; margin-bottom: 1rem;
}
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; margin-bottom: .7rem;
}

.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); }

.stat {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: .85rem 1rem;
}
.stat .n { font-size: 1.7rem; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--fg-dim); font-size: .82rem; margin-top: .2rem; }
.stat.warn .n { color: var(--warn); }
.stat.err  .n { color: var(--err); }
.stat.ok   .n { color: var(--ok); }

/* ---------------------------------------------------------------- forms */

label { display: block; font-size: .86rem; color: var(--fg-dim); margin: 0 0 .25rem; }

input[type=text], input[type=password], input[type=email], input[type=number],
input[type=date], input[type=datetime-local], input[type=search], input[type=file],
select, textarea {
  width: 100%; padding: .5rem .65rem;
  background: var(--bg-3); color: var(--fg);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
  font: inherit; font-size: .93rem;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,140,255,.18);
}
textarea { min-height: 90px; resize: vertical; }
input[type=file] { padding: .35rem; }

.field { margin-bottom: .85rem; }
.field-row { display: flex; gap: .7rem; flex-wrap: wrap; }
.field-row > * { flex: 1 1 160px; }

.check { display: flex; align-items: center; gap: .45rem; }
.check input { width: auto; }
.check label { margin: 0; color: var(--fg); font-size: .9rem; }

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  padding: .48rem .85rem; border-radius: var(--radius-sm);
  background: var(--accent); color: #fff; border: 1px solid transparent;
  font: inherit; font-size: .9rem; font-weight: 550; cursor: pointer;
  white-space: nowrap;
}
.btn:hover { background: var(--accent-2); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

.btn-ghost { background: transparent; border-color: var(--line-2); color: var(--fg); }
.btn-ghost:hover { background: var(--bg-3); }
.btn-danger { background: var(--err); }
.btn-danger:hover { background: #c94848; }
.btn-ok { background: var(--ok); }
.btn-ok:hover { background: #278a5a; }
.btn-sm { padding: .3rem .55rem; font-size: .82rem; }
.btn-block { width: 100%; }

.inline { display: inline; }
.actions { display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--line); }
th { background: var(--bg-3); color: var(--fg-dim); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.02); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono { font-family: var(--mono); font-size: .85rem; }

/* ---------------------------------------------------------------- misc */

.badge {
  display: inline-block; padding: .12rem .45rem; border-radius: 999px;
  font-size: .74rem; font-weight: 600; border: 1px solid var(--line-2);
  color: var(--fg-dim); background: var(--bg-3);
}
.badge-ok   { color: #7ee0a8; border-color: #235c3c; background: #14301f; }
.badge-warn { color: #f0c674; border-color: #6b5320; background: #33280f; }
.badge-err  { color: #ff9a9a; border-color: #6b2626; background: #331414; }
.badge-info { color: #9dc0ff; border-color: #2a4a80; background: #16233d; }

.flash {
  padding: .6rem .85rem; border-radius: var(--radius-sm);
  margin-bottom: .9rem; border: 1px solid var(--line-2); font-size: .9rem;
}
.flash-ok   { background: #14301f; border-color: #235c3c; color: #b9f0cf; }
.flash-err  { background: #331414; border-color: #6b2626; color: #ffc4c4; }
.flash-warn { background: #33280f; border-color: #6b5320; color: #f5dda6; }

.empty {
  padding: 1.6rem 1rem; text-align: center;
  color: var(--fg-faint); font-size: .9rem;
  border: 1px dashed var(--line-2); border-radius: var(--radius);
}

.muted { color: var(--fg-dim); }
.faint { color: var(--fg-faint); }
.right { text-align: right; }
.center { text-align: center; }
.mt0 { margin-top: 0; } .mb0 { margin-bottom: 0; }
.mt1 { margin-top: .6rem; } .mb1 { margin-bottom: .6rem; }
.mt2 { margin-top: 1.2rem; } .mb2 { margin-bottom: 1.2rem; }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.between { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; }
.stack > * + * { margin-top: .6rem; }

.classpick { display: flex; gap: .35rem; flex-wrap: wrap; margin-bottom: 1rem; }
.classpick a {
  padding: .3rem .65rem; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); color: var(--fg-dim); font-size: .86rem;
}
.classpick a:hover { background: var(--bg-3); text-decoration: none; }
.classpick a.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* ---------------------------------------------------------------- bare (login/install/error) */

body.bare { display: grid; place-items: center; min-height: 100vh; padding: 1.2rem; }
.bare-wrap { width: 100%; max-width: 420px; }
.bare-wrap.wide { max-width: 620px; }

.authcard {
  background: var(--bg-2); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.6rem 1.5rem; box-shadow: var(--shadow);
}
.authcard h1 { margin-bottom: .25rem; }
.authcard .lead { color: var(--fg-dim); font-size: .9rem; margin-bottom: 1.2rem; }
.authbrand { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.2rem; }
.authbrand .brand-mark { width: 38px; height: 38px; flex-basis: 38px; font-size: 1.1rem; }

/* ---------------------------------------------------------------- login page
 *
 * Split-screen monochrome composition. The reference illustration occupies the
 * left half (full-bleed, cropped to the character), the form sits on the right
 * over a light field framed by dark bands. Below 900px the illustration is
 * dropped and the banded single-column layout takes over.
 */

.login-page {
  position: relative;
  min-height: 100vh;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr;
  overflow: hidden;
  background: #0a0b0d;
}

/* ---- left: the illustration ---- */
.login-art {
  position: relative;
  display: none;               /* enabled at >= 900px */
  min-height: 100vh;           /* give the absolutely-positioned img a box */
  overflow: hidden;
  background: #0a0b0d;
}
.login-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* the character is centred in the source; bias the crop so her face and the
   * ring motif stay in frame on wide viewports */
  object-position: 50% 42%;
  filter: grayscale(.15) contrast(1.04);
}
/* a soft dark scrim on the inner edge so the two halves meet cleanly */
.login-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(10,11,13,.55) 0%, rgba(10,11,13,0) 38%, rgba(10,11,13,.35) 100%);
}

/* ---- right: the form side ---- */
.login-side {
  position: relative;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
  overflow: hidden;
  background: #0a0b0d;
}
/* the light field, letterboxed by dark bands */
.login-side::before {
  content: "";
  position: absolute;
  inset: 12vh 0;
  background: linear-gradient(180deg, #e9eaea 0%, #dfe2e4 55%, #cfd4d8 100%);
}

.login-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
}

@media (min-width: 900px) {
  .login-page { grid-template-columns: 1fr 1fr; }
  .login-art  { display: block; }
}
@media (min-width: 1400px) {
  .login-page { grid-template-columns: 1.15fr 1fr; }
}

/* ---- circular mark sitting on a broken ring ----
 * The halo is a ring drawn with a conic-gradient mask so it reads as broken
 * (two arcs with gaps) rather than a plain border. Two layers, rotated, give
 * the offset double-arc look of the reference illustration. */
.login-mark {
  position: relative;
  width: 92px; height: 92px;
  margin: 0 auto 1.1rem;
  display: grid; place-items: center;
}
.login-mark .ring,
.login-mark .ring-2 {
  position: absolute;
  inset: -16px;
  border-radius: 50%;
  /* a ring 2px thick, masked into two arcs with gaps at ~1 and ~7 o'clock */
  background: conic-gradient(
    from 0deg,
    #1a1a1a 0deg 118deg,
    transparent 118deg 152deg,
    #1a1a1a 152deg 298deg,
    transparent 298deg 332deg,
    #1a1a1a 332deg 360deg
  );
  -webkit-mask: radial-gradient(circle, transparent 0 calc(50% - 2px), #000 calc(50% - 2px));
          mask: radial-gradient(circle, transparent 0 calc(50% - 2px), #000 calc(50% - 2px));
  opacity: .9;
}
.login-mark .ring-2 {
  inset: -24px;
  transform: rotate(96deg);
  opacity: .45;
}
.login-mark .glyph {
  position: relative;
  z-index: 1;
  width: 92px; height: 92px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: #0a0b0d;
  color: #f2f4f6;
  font-size: 2.1rem; font-weight: 700;
  letter-spacing: -.02em;
  box-shadow: 0 0 0 1px #1a1a1a, 0 14px 34px rgba(10,11,13,.4);
}

/* ---- the card: light panel on the light field ---- */
.login-card {
  background: rgba(255,255,255,.86);
  border: 1px solid #c9ccd0;
  border-radius: 12px;
  padding: 1.7rem 1.5rem 1.5rem;
  backdrop-filter: blur(6px);
  box-shadow: 0 18px 50px rgba(10,11,13,.22);
}

.login-title {
  text-align: center;
  margin: 0 0 .2rem;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -.01em;
  color: #111315;
}
.login-sub {
  text-align: center;
  font-size: .84rem;
  color: #5a6b7c;
  margin: 0 0 1.35rem;
  letter-spacing: .01em;
}

/* labels: small, wide-tracked, restrained */
.login-card .field label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #5a6b7c;
  font-weight: 600;
}
.login-card .field input {
  background: #fff;
  border: 1px solid #c9ccd0;
  color: #111315;
  border-radius: 8px;
  padding: .62rem .7rem;
}
.login-card .field input:focus {
  outline: none;
  border-color: #5a6b7c;
  box-shadow: 0 0 0 3px rgba(90,107,124,.18);
}

/* primary action: solid near-black, sharp-ish */
.login-card .btn {
  background: #111315;
  border-color: #111315;
  color: #fff;
  border-radius: 8px;
  padding: .68rem 1rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.login-card .btn:hover { background: #23272c; border-color: #23272c; }

.login-foot {
  text-align: center;
  font-size: .78rem;
  color: #5a6b7c;
  margin: 1.1rem 0 0;
}

/* dark-mode preference: invert the field, keep the banding */
@media (prefers-color-scheme: dark) {
  .login-page { background: #0a0b0d; }
  .login-page::before { background: linear-gradient(180deg, #16181c 0%, #1b1e23 55%, #22262c 100%); }
  .login-card {
    background: rgba(22,26,33,.9);
    border-color: #333a47;
  }
  .login-title { color: #e6e9ef; }
  .login-sub, .login-foot { color: #9aa3b2; }
  .login-card .field label { color: #9aa3b2; }
  .login-card .field input { background: #0f1115; border-color: #333a47; color: #e6e9ef; }
  .login-mark .glyph { background: #0a0b0d; }
  .login-mark .ring, .login-mark .ring-2 { border-color: #3a414d; }
}

/* The login page keeps its own monochrome identity in light mode: the art
 * panel is always dark, and the form side stays a light field. Only the card
 * needs a touch of adjustment so it does not fight the light background. */
[data-theme="light"] .login-side { background: #0a0b0d; }
[data-theme="light"] .login-card {
  background: rgba(255,255,255,.94);
  border-color: #c9ccd0;
}
[data-theme="light"] .login-title { color: #111315; }
[data-theme="light"] .login-sub,
[data-theme="light"] .login-foot { color: #5a6b7c; }
[data-theme="light"] .login-card .field label { color: #5a6b7c; }
[data-theme="light"] .login-card .field input {
  background: #fff; border-color: #c9ccd0; color: #111315;
}
[data-theme="light"] .login-mark .glyph { background: #0a0b0d; color: #f2f4f6; }
[data-theme="light"] .login-mark .ring,
[data-theme="light"] .login-mark .ring-2 { background: conic-gradient(
    from 0deg,
    #1a1a1a 0deg 118deg, transparent 118deg 152deg,
    #1a1a1a 152deg 298deg, transparent 298deg 332deg,
    #1a1a1a 332deg 360deg); }

/* When a login page is present, drop the centred-wrap constraints so the
 * banded composition can own the whole viewport. Same for the public
 * landing page — without this the 420px wrap pins it to a phone layout
 * on desktop. */
body.bare:has(.login-page),
body.bare:has(.land) {
  display: block;
  padding: 0;
}
body.bare:has(.login-page) .bare-wrap,
body.bare:has(.land) .bare-wrap {
  max-width: none;
}
/* the landing nav has its own toggle; the floating one would collide with
 * the Daftar button */
body.bare:has(.land) .theme-toggle-float {
  display: none;
}

@media (max-width: 420px) {
  .login-card { padding: 1.4rem 1.1rem; }
  .login-mark { width: 76px; height: 76px; }
  .login-mark .glyph { width: 76px; height: 76px; font-size: 1.7rem; }
}

.errpage { text-align: center; }
.errpage .code { font-size: 3.4rem; font-weight: 800; color: var(--fg-faint); line-height: 1; }

/* ---------------------------------------------------------------- hall chat */

.hall {
  display: flex; flex-direction: column; height: min(62vh, 560px);
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--bg-2);
}
.hall-log { flex: 1; overflow-y: auto; padding: .9rem; display: flex; flex-direction: column; gap: .7rem; }
.hall-msg { display: flex; gap: .6rem; align-items: flex-start; }
.hall-msg img { border-radius: 50%; flex: 0 0 30px; }
.hall-msg .bubble {
  background: var(--bg-3); border: 1px solid var(--line);
  border-radius: 10px; padding: .45rem .7rem; max-width: 78%;
}
.hall-msg.mine { flex-direction: row-reverse; }
.hall-msg.mine .bubble { background: #1b2c4d; border-color: #2a4a80; }
.hall-msg .who { font-size: .74rem; color: var(--fg-faint); margin-bottom: .15rem; }
.hall-msg .txt { font-size: .92rem; white-space: pre-wrap; word-break: break-word; }
.hall-msg .at { font-size: .68rem; color: var(--fg-faint); margin-top: .2rem; }
.hall-form { display: flex; gap: .5rem; padding: .6rem; border-top: 1px solid var(--line); background: var(--bg-3); }
.hall-form input { flex: 1; }

/* ---------------------------------------------------------------- exam (phase 4 hooks) */

.exam-shell { max-width: 760px; margin: 0 auto; }
.exam-timer {
  font-family: var(--mono); font-size: 1.3rem; font-weight: 700;
  padding: .2rem .6rem; border-radius: var(--radius-sm);
  background: var(--bg-3); border: 1px solid var(--line-2);
}
.exam-timer.low { color: #ff9a9a; border-color: #6b2626; }
.q-card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; }
.opt { display: flex; gap: .55rem; align-items: flex-start; padding: .5rem .6rem; border: 1px solid var(--line-2); border-radius: var(--radius-sm); margin-bottom: .4rem; cursor: pointer; }
.opt:hover { background: var(--bg-3); }
.opt input { margin-top: .25rem; }
.opt.sel { border-color: var(--accent); background: #16233d; }

/* ---------------------------------------------------------------- exam runner (student) */

.exam-body { background: var(--bg); }

.exam-bar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 1rem;
  padding: .6rem 1rem; background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.exam-bar > div:first-child { flex: 1; display: flex; flex-direction: column; }
.exam-bar .faint { font-size: .78rem; }

.exam-warn {
  padding: .55rem 1rem; background: #331414; color: #ff9a9a;
  border-bottom: 1px solid #6b2626; font-size: .88rem;
}

.exam-main { max-width: 820px; margin: 0 auto; padding: 1rem; }
.exam-q { margin-bottom: 1rem; }
.exam-q-head { display: flex; align-items: center; gap: .5rem; margin-bottom: .6rem; }
.exam-q-body { margin-bottom: .8rem; white-space: pre-wrap; }
.exam-img { max-width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line); margin-bottom: .8rem; }

.exam-opts { display: flex; flex-direction: column; gap: .4rem; }
.exam-opt {
  display: flex; gap: .55rem; align-items: flex-start;
  padding: .55rem .7rem; border: 1px solid var(--line-2);
  border-radius: var(--radius-sm); cursor: pointer;
}
.exam-opt:hover { background: var(--bg-3); }
.exam-opt input { margin-top: .25rem; }
.exam-opt:has(input:checked) { border-color: var(--accent); background: #16233d; }

.exam-short {
  width: 100%; padding: .55rem .7rem; font: inherit;
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--line-2); border-radius: var(--radius-sm);
}
.exam-short:focus { outline: none; border-color: var(--accent); }

.exam-foot {
  position: sticky; bottom: 0;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .7rem 1rem; background: var(--bg-2); border-top: 1px solid var(--line);
}
.exam-timer.warn { color: #f0c674; border-color: #6b5320; }
.exam-timer.danger { color: #ff9a9a; border-color: #6b2626; }

/* hall (student view markup) */
.hall-body { white-space: pre-wrap; word-break: break-word; }
.hall-meta { display: flex; gap: .5rem; align-items: baseline; font-size: .76rem; }
.hall-meta .faint { font-size: .72rem; }

.alert { padding: .6rem .8rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .9rem; }
.alert-ok { background: #14301f; border: 1px solid #235c3c; color: #7ee0a8; }

.mb0 { margin-bottom: 0; }
.mb1 { margin-bottom: .6rem; }
.mb2 { margin-bottom: 1rem; }
.mt1 { margin-top: .6rem; }
.mt2 { margin-top: 1rem; }
.mono { font-family: var(--mono); }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-dim); }
.faint { color: var(--fg-faint); }
.row { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; flex-wrap: wrap; }
.page-head .sub { color: var(--fg-dim); font-size: .88rem; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-bottom: .8rem; flex-wrap: wrap; }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; }
  .mainnav { order: 3; width: 100%; flex-basis: 100%; }
  .userchip span { display: none; }
}

/* ============================================================ student skin
 *
 * Students get a warmer, rounder, larger interface: bigger touch targets, a
 * friendly coral accent instead of the cold corporate blue, pill buttons and
 * playful badges. Teachers and admins keep the compact professional look.
 * The exam page carries body.exam-body (no role class), so it is included.
 */

body.role-student,
body.exam-body {
  --accent:    #ff7a59;
  --accent-2:  #e2603f;
  --ok:        #1f9d63;
  --warn:      #d98a12;
  --err:       #e05252;
  --radius:    16px;
  --radius-sm: 12px;
}

body.role-student {
  font-size: 17px;
  line-height: 1.55;
}

/* Softer, bouncier cards. */
body.role-student .card {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}
body.role-student .card:hover {
  transform: translateY(-1px);
}

/* Pill buttons with a satisfying press. */
body.role-student .btn {
  border-radius: 999px;
  padding: .55rem 1.15rem;
  font-weight: 600;
  transition: transform .1s ease, filter .1s ease;
}
body.role-student .btn:active { transform: scale(.97); }
body.role-student .btn-sm { padding: .4rem .8rem; }

/* Friendlier badges. */
body.role-student .badge {
  border-radius: 999px;
  padding: .18rem .6rem;
  font-size: .78rem;
  font-weight: 600;
}

/* Bigger, easier-to-hit form controls. */
body.role-student input[type="text"],
body.role-student input[type="number"],
body.role-student input[type="datetime-local"],
body.role-student select,
body.role-student textarea {
  border-radius: var(--radius-sm);
  padding: .55rem .7rem;
  font-size: 1rem;
}
body.role-student input[type="radio"],
body.role-student input[type="checkbox"] {
  width: 1.15em;
  height: 1.15em;
  accent-color: var(--accent);
  vertical-align: middle;
}

/* Roomy tables — small dense type is hostile on a phone. */
body.role-student table td,
body.role-student table th {
  padding: .7rem .6rem;
  font-size: .95rem;
}

/* Exam options: large tap targets, clear selected state. */
body.exam-body .exam-opt,
body.role-student .exam-opt {
  padding: .8rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 1.02rem;
}
body.exam-body .exam-opt:has(input:checked),
body.role-student .exam-opt:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
}
body.exam-body .exam-q,
body.role-student .exam-q {
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
}

/* Greeting + summary chips on the student dashboard. */
.hello {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 0;
}
.hello .wave { display: inline-block; animation: wave 2.2s ease-in-out infinite; transform-origin: 70% 70%; }
@keyframes wave {
  0%, 60%, 100% { transform: rotate(0deg); }
  10% { transform: rotate(14deg); }
  20% { transform: rotate(-8deg); }
  30% { transform: rotate(12deg); }
  40% { transform: rotate(0deg); }
}
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.chip {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .35rem .8rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-2);
  font-size: .85rem; font-weight: 600; color: var(--fg-dim);
}
.chip b { color: var(--fg); }
.chip.chip-warn { border-color: var(--warn); color: var(--warn); }
.chip.chip-ok   { border-color: var(--ok);   color: var(--ok); }

/* Score bar: a number means little to a nine-year-old; a full bar does. */
.bar {
  position: relative; height: 10px; min-width: 90px;
  border-radius: 999px; background: var(--bg-3); overflow: hidden;
}
.bar-fill {
  position: absolute; inset: 0 auto 0 0;
  border-radius: 999px; background: var(--ok);
}
.bar-fill.is-mid  { background: var(--warn); }
.bar-fill.is-low  { background: var(--err); }

/* Friendly empty states. */
body.role-student .empty { padding: 1.6rem 1rem; font-size: 1rem; }
body.role-student .empty .empty-emoji { font-size: 1.6rem; display: block; margin-bottom: .4rem; }

/* Due-date countdown pills on the student task list. */
.due { font-size: .78rem; font-weight: 600; }
.due.due-today { color: var(--err); }
.due.due-soon  { color: var(--warn); }

@media (prefers-reduced-motion: reduce) {
  body.role-student .card,
  body.role-student .btn,
  .hello .wave { transition: none; animation: none; }
}
