:root {
  --bg: #0b0e14;
  --card: #151a24;
  --fg: #e6ebf2;
  --muted: #8b98a9;
  --accent: #0A84FF;
  --danger: #ff453a;
  --ok: #30d158;
  --warn: #ffd60a;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, sans-serif; }
body { padding-bottom: env(safe-area-inset-bottom); }

#topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: #0e131c; position: sticky; top: 0; z-index: 10;
  border-bottom: 1px solid #1e2635;
}
.brand { display: flex; gap: 8px; align-items: baseline; }
.logo { font-weight: 700; color: var(--accent); letter-spacing: 1px; }
.tenant { color: var(--muted); font-size: 13px; }

main { padding: 16px; max-width: 560px; margin: 0 auto; padding-bottom: 96px; }
.view h1, .view h2 { margin-top: 8px; }
.view h3 { margin-top: 24px; color: var(--muted); font-weight: 500; }

form label { display: block; margin: 12px 0; font-size: 14px; color: var(--muted); }
form input, form select, form textarea {
  display: block; width: 100%; margin-top: 6px; padding: 12px;
  background: var(--card); color: var(--fg); border: 1px solid #232a3a; border-radius: 10px; font-size: 16px;
}
button {
  background: var(--accent); color: white; border: 0; padding: 12px 16px;
  border-radius: 10px; font-size: 15px; cursor: pointer; font-weight: 600;
}
button.ghost { background: transparent; color: var(--fg); border: 1px solid #2a3446; }
button:disabled { opacity: 0.6; }
.big-btn { width: 100%; padding: 18px; font-size: 18px; margin: 16px 0; }
.icon { margin-right: 6px; }

.user-card, .coords {
  background: var(--card); padding: 14px 16px; border-radius: 12px;
  display: flex; justify-content: space-between; align-items: center; margin-top: 12px;
}
.coords { flex-direction: column; align-items: flex-start; gap: 6px; }
.big { font-size: 20px; font-weight: 700; }
.muted { color: var(--muted); font-size: 12px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.pill { background: #223; padding: 4px 10px; border-radius: 999px; font-size: 12px; }

.result {
  padding: 12px 14px; border-radius: 10px; margin-top: 8px; font-size: 14px;
}
.result.ok   { background: rgba(48,209,88,0.15);  color: var(--ok);    border: 1px solid rgba(48,209,88,0.4); }
.result.warn { background: rgba(255,214,10,0.15); color: var(--warn);  border: 1px solid rgba(255,214,10,0.4); }
.result.err  { background: rgba(255,69,58,0.15);  color: var(--danger);border: 1px solid rgba(255,69,58,0.4); }

.quick { display: flex; gap: 8px; margin-top: 8px; }
.quick button { flex: 1; }

.recent { list-style: none; padding: 0; margin: 12px 0; }
.recent li {
  padding: 12px 14px; background: var(--card); border-radius: 10px; margin-bottom: 8px;
  font-size: 14px; display: flex; justify-content: space-between; gap: 12px;
}
.recent small { color: var(--muted); }

#tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; background: #0e131c; border-top: 1px solid #1e2635;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  z-index: 20;
}
.tab {
  flex: 1; background: transparent; color: var(--muted); font-weight: 600;
  position: relative;
}
.tab.active { color: var(--accent); }

.hint { color: var(--muted); font-size: 13px; margin-top: 16px; }
code { background: #1a2130; padding: 2px 6px; border-radius: 6px; font-size: 12px; }

/* ---- Today / Roll call ---- */
.lecture-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 14px 16px; background: var(--card); border-radius: 12px;
  margin-bottom: 10px; cursor: pointer; border: 1px solid #1e2635;
  list-style: none;
}
.lecture-card:hover { border-color: var(--accent); }
.lecture-card .title { font-weight: 700; font-size: 16px; }
.lecture-card .meta  { color: var(--muted); font-size: 13px; display: flex; gap: 12px; }
.lecture-card .status-pill {
  align-self: flex-start; padding: 2px 8px; border-radius: 999px;
  font-size: 11px; text-transform: uppercase; font-weight: 700;
}
.status-scheduled { background: #223;                color: #9ab; }
.status-ongoing   { background: rgba(255,214,10,0.15); color: var(--warn); }
.status-completed { background: rgba(48,209,88,0.15);  color: var(--ok); }

.roster ul { list-style: none; padding: 0; margin: 0; }
.roster li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--card); border-radius: 10px;
  margin-bottom: 8px; gap: 12px;
}
.roster .student-name { font-weight: 600; }
.roster .student-id   { color: var(--muted); font-size: 12px; }

.toggle-group { display: flex; gap: 4px; }
.toggle-group button {
  padding: 6px 10px; font-size: 12px; font-weight: 700;
  background: #1a2130; color: var(--muted); border-radius: 8px;
  border: 1px solid transparent;
}
.toggle-group button.active[data-status="present"] { background: var(--ok);     color: #000; }
.toggle-group button.active[data-status="absent"]  { background: var(--danger); color: #fff; }
.toggle-group button.active[data-status="late"]    { background: var(--warn);   color: #000; }

.roll-actions {
  display: flex; gap: 8px; margin-top: 16px;
  position: sticky; bottom: 60px; background: var(--bg);
  padding: 12px 0; z-index: 15;
}
.roll-actions button { flex: 1; }
.roll-actions .primary { padding: 14px; font-size: 16px; }

/* ---- Alerts / notifications ---- */
.alerts-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.alerts-head .small { padding: 6px 10px; font-size: 13px; }

#alertsList li {
  padding: 12px 14px;
  background: var(--card);
  border-radius: 10px;
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  border-left: 3px solid transparent;
  align-items: stretch;
}
#alertsList li.unread {
  border-left-color: var(--accent);
  background: #1a2130;
}
#alertsList li .alert-title { font-weight: 700; font-size: 14px; }
#alertsList li .alert-body  { color: var(--fg); font-size: 13px; opacity: 0.9; }
#alertsList li .alert-meta  { color: var(--muted); font-size: 11px; margin-top: 2px; }
#alertsList li .unread-dot {
  display: inline-block; width: 6px; height: 6px; background: var(--accent);
  border-radius: 50%; margin-right: 6px; vertical-align: middle;
}

/* Tab badge */
.tab .badge {
  position: absolute;
  top: 0; right: 8px;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 16px;
  text-align: center;
  line-height: 1;
}