/* Sazolu student app. Phone first. Change the colours in :root (and the dark block) and everything follows. */
:root {
  --bg: #f3f2f7;
  --surface: #ffffff;
  --surface-2: #ece9f3;
  --line: #d9d5e4;
  --fg: #1e1b29;
  --muted: #666277;
  --accent: #5a3ea5;
  --accent-fg: #ffffff;
  --accent-soft: #e8e2f6;
  --ok: #1b7448; --ok-soft: #dcf0e4;
  --warn: #8f5600; --warn-soft: #faebcb;
  --bad: #ae2a22; --bad-soft: #fadfdc;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15131c; --surface: #1e1b29; --surface-2: #292537; --line: #383348;
    --fg: #ece9f5; --muted: #a39eb5; --accent: #a58bf0; --accent-fg: #17111f; --accent-soft: #2f2751;
    --ok: #5fcb92; --ok-soft: #163227; --warn: #e9b24c; --warn-soft: #382c14; --bad: #f28b82; --bad-soft: #3b1c1a;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 16px; line-height: 1.45; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: .94em; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.grow { flex: 1 1 auto; }
.center { text-align: center; }

/* ---- the phone-width column ---- */
.shell { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); }
@media (min-width: 520px) { .shell { box-shadow: 0 0 0 1px var(--line); } }
.topbar { display: flex; align-items: center; gap: 10px; padding: calc(12px + env(safe-area-inset-top, 0px)) 18px 12px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.logo { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; flex: none; }
.brand { font-weight: 700; font-size: 17px; }
.main { flex: 1; padding: 18px; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.tabbar { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; background: var(--surface); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom, 0px); z-index: 6; }
.tabbar a { flex: 1; text-align: center; padding: 10px 4px 12px; text-decoration: none; color: var(--muted); font-size: 12.5px; font-weight: 600; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.tabbar a.active { color: var(--accent); }
.tabbar svg { width: 24px; height: 24px; }
.offline-bar { background: var(--warn-soft); color: var(--warn); font-size: 13.5px; font-weight: 600; padding: 8px 18px; text-align: center; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); text-decoration: none; font-weight: 600; margin-bottom: 12px; }

/* ---- cards and lists ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.card.link { display: block; color: inherit; text-decoration: none; }
.card.link:active { background: var(--surface-2); }
.course-code { font-size: 12px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--accent); }
.course-title { font-size: 17px; font-weight: 650; margin: 2px 0 10px; }
.section-title { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 6px 2px -4px; }
.empty { text-align: center; color: var(--muted); padding: 30px 16px; border: 1px dashed var(--line); border-radius: 14px; }
.note { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; }
.note.warn { background: var(--warn-soft); color: var(--warn); }
.note.bad { background: var(--bad-soft); color: var(--bad); }
.note.ok { background: var(--ok-soft); color: var(--ok); }
.badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.bad { background: var(--bad-soft); color: var(--bad); }
.badge.grey { background: var(--surface-2); color: var(--muted); }
.bar { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }
.bar.below > i { background: var(--bad); }
.pct { font-size: 34px; font-weight: 750; line-height: 1; font-variant-numeric: tabular-nums; }
.class-row { display: flex; justify-content: space-between; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); gap: 10px; }
.class-row:last-child { border-bottom: 0; }

/* ---- the open-now card ---- */
.open-card { border: 2px solid var(--ok); background: var(--surface); border-radius: 16px; padding: 16px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); display: inline-block; margin-right: 7px; animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(31,122,77,.5); } 70% { box-shadow: 0 0 0 9px rgba(31,122,77,0); } 100% { box-shadow: 0 0 0 0 rgba(31,122,77,0); } }

/* ---- buttons and forms ---- */
.btn { font: inherit; font-weight: 650; border-radius: 12px; padding: 13px 18px; border: 1px solid transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; min-height: 48px; }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.secondary { background: var(--surface); color: var(--accent); border-color: var(--line); }
.btn.danger { background: var(--bad); color: #fff; }
.btn.ghost { background: transparent; color: var(--accent); }
.btn.block { width: 100%; }
.btn.sm { min-height: 38px; padding: 8px 14px; font-size: 14px; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.busy { cursor: progress; }
.mark-btn { width: 100%; min-height: 64px; font-size: 19px; border-radius: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label { font-weight: 650; font-size: 14px; }
.hint { font-size: 13px; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=tel] { font: inherit; font-size: 16px; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; width: 100%; min-height: 48px; }
input:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
.code-input { font-size: 28px !important; letter-spacing: 10px; text-align: center; font-variant-numeric: tabular-nums; font-family: var(--mono) !important; }
.error-text { color: var(--bad); font-size: 14px; margin-bottom: 12px; font-weight: 600; }
.link { background: none; border: 0; color: var(--accent); font: inherit; font-weight: 650; cursor: pointer; padding: 6px 2px; text-decoration: underline; }

/* ---- sign-in screens ---- */
.auth { padding: calc(28px + env(safe-area-inset-top, 0px)) 22px 30px; display: flex; flex-direction: column; gap: 6px; }
.auth .logo { width: 44px; height: 44px; border-radius: 13px; margin-bottom: 14px; }
.auth-foot { margin-top: 14px; text-align: center; font-size: 15px; }

/* ---- status screens ---- */
.status-screen { text-align: center; padding: 30px 8px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.circle { width: 96px; height: 96px; border-radius: 50%; display: grid; place-items: center; }
.circle.ok { background: var(--ok-soft); color: var(--ok); }
.circle.bad { background: var(--bad-soft); color: var(--bad); }
.circle.wait { background: var(--accent-soft); color: var(--accent); animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { transform: scale(1.08); } }
.circle svg { width: 52px; height: 52px; }

/* ---- PIN lock ---- */
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 18px 0; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--accent); }
.pin-dots i.on { background: var(--accent); }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 0 auto; }
.keypad button { font: inherit; font-size: 24px; font-weight: 600; min-height: 62px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.keypad button:active { background: var(--surface-2); }

#toasts { position: fixed; bottom: calc(86px + env(safe-area-inset-bottom, 0px)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; align-items: center; width: calc(100% - 32px); max-width: 440px; pointer-events: none; }
.toast { background: var(--fg); color: var(--bg); padding: 12px 16px; border-radius: 12px; font-size: 15px; font-weight: 600; text-align: center; }
.toast.bad { background: var(--bad); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
