@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --ink: #0d1117;
  --panel: #151b23;
  --panel-raised: #1b232e;
  --line: #262f3b;
  --text: #eef1f5;
  --text-dim: #97a2b3;
  --text-faint: #5c6675;
  --brass: #d3a24a;
  --brass-dim: #8a6d38;
  --teal: #5aa8a0;
  --clay: #c17a5a;
  --sage: #7ea27a;
  --slate: #7a86a0;
  --danger: #c1655a;
  --tier-green: #7ea27a;
  --tier-yellow: #f5a623;
  --tier-red: #c1655a;
  --gv-lecture: #5b8def;
  --gv-lab: #ec5c93;
  --gv-tutorial: #34d399;
  --gv-break: #f5a623;
  --gv-active: #7c6cf6;
  --radius-s: 4px;
  --radius-m: 8px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: 'Inter', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  padding-bottom: 76px;
}

::selection { background: var(--brass); color: #14100a; }

button, select {
  font-family: inherit;
}

.crest {
  font-family: 'Space Grotesk', sans-serif;
}

.shell {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 18px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(13, 17, 23, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.topbar-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand-mark {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  color: var(--text);
}

.brand-mark span { color: var(--brass); }

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-weight: 500;
}

.college-select {
  appearance: none;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 30px 7px 12px;
  border-radius: var(--radius-s);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--text-dim) 50%), linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position: calc(100% - 15px) center, calc(100% - 10px) center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.college-select:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.install-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 780px;
  margin: 0 auto;
  padding: 10px 18px;
  background: linear-gradient(90deg, rgba(211,162,74,0.14), rgba(211,162,74,0.04));
  border-bottom: 1px solid var(--brass-dim);
  flex-wrap: wrap;
}

.install-banner-icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--brass);
  color: #14100a;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
}

.install-banner-text {
  flex: 1 1 200px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.install-banner-text strong {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 700;
}

.install-banner-text span {
  font-size: 0.72rem;
  color: var(--text-dim);
  line-height: 1.4;
  transition: color 0.2s ease;
}

.install-banner-sub-highlight { color: var(--brass) !important; font-weight: 600; }

.install-banner-btn {
  flex: 0 0 auto;
  background: var(--brass);
  color: #14100a;
  border: none;
  padding: 8px 14px;
  border-radius: var(--radius-s);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

main { padding-top: 20px; }

.site-notice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin: 12px 0 20px;
  padding: 13px 15px;
  background: rgba(211, 162, 74, 0.07);
  border: 1px solid rgba(211, 162, 74, 0.28);
  border-radius: var(--radius-m);
  color: var(--text-dim);
  font-size: 0.78rem;
  line-height: 1.55;
}

.site-notice-icon {
  flex: 0 0 auto;
  font-size: 0.95rem;
  line-height: 1.45;
}

.site-notice strong {
  color: var(--text);
  font-weight: 700;
}

.now-band {
  background: linear-gradient(160deg, var(--panel-raised) 0%, var(--panel) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}

.now-band::before {
  content: "";
  position: absolute;
  top: -60px;
  right: -60px;
  width: 180px;
  height: 180px;
  background: radial-gradient(circle, rgba(211,162,74,0.14) 0%, transparent 70%);
}

.now-eyebrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.now-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 500;
}

.now-clock {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.now-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 4px 0;
  color: var(--text);
}

.now-meta {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 14px;
}

.now-meta span + span::before {
  content: "·";
  margin: 0 6px;
  color: var(--text-faint);
}

.progress-track {
  height: 5px;
  background: var(--line);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: var(--brass);
  border-radius: 3px;
  transition: width 0.4s ease;
}

.progress-times {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-faint);
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}

.selector-block {
  margin-top: 22px;
}

.selector-label {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-weight: 600;
  margin-bottom: 8px;
  letter-spacing: 0.01em;
}

.chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 8px 14px;
  border-radius: var(--radius-s);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip:hover:not(:disabled) {
  border-color: var(--text-faint);
  color: var(--text);
}

.chip.active {
  background: var(--brass);
  border-color: var(--brass);
  color: #14100a;
}

.chip:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.day-strip {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.day-chip {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 10px 4px;
  border-radius: var(--radius-s);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  position: relative;
}

.day-chip.active {
  background: var(--panel-raised);
  border-color: var(--brass);
  color: var(--text);
}

.day-chip .dot {
  display: none;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--brass);
  margin: 4px auto 0;
}

.day-chip.is-today .dot { display: block; }

.strip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 26px;
  gap: 10px;
  flex-wrap: wrap;
}

.updated-tag {
  font-size: 0.74rem;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 6px;
}

.updated-tag::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--sage);
}

.view-toggle {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  overflow: hidden;
}

.view-toggle button {
  border: none;
  background: transparent;
  color: var(--text-dim);
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.view-toggle button.active {
  background: var(--panel-raised);
  color: var(--brass);
}

.section-picker {
  margin-left: auto;
}

.timeline {
  margin-top: 18px;
  position: relative;
}

.timeline-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.9rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-m);
}

.slot {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 14px;
  position: relative;
}

.slot:not(:last-child) .slot-rail::after {
  content: "";
  position: absolute;
  top: 30px;
  bottom: -14px;
  left: 50%;
  width: 1px;
  background: var(--line);
  transform: translateX(-50%);
}

.slot-rail {
  position: relative;
  padding-top: 2px;
  text-align: right;
}

.slot-time {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.72rem;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.slot.is-now .slot-time { color: var(--brass); font-weight: 600; }

.slot-card {
  border-left: 3px solid var(--line);
  background: var(--panel);
  border-radius: 0 var(--radius-s) var(--radius-s) 0;
  padding: 12px 14px;
  margin-bottom: 14px;
}

.slot-card.type-lecture { border-left-color: var(--teal); }
.slot-card.type-lab { border-left-color: var(--brass); }
.slot-card.type-tutorial { border-left-color: var(--sage); }
.slot-card.type-break { border-left-color: var(--text-faint); background: transparent; padding: 6px 14px; }

.slot.is-now .slot-card {
  background: var(--panel-raised);
  box-shadow: inset 0 0 0 1px rgba(211,162,74,0.35);
}

.slot-type {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 3px;
}

.type-lecture .slot-type { color: var(--teal); }
.type-lab .slot-type { color: var(--brass); }
.type-tutorial .slot-type { color: var(--sage); }
.type-break .slot-type { color: var(--text-faint); }

.slot-subject {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}

.type-break .slot-subject { font-size: 0.85rem; font-weight: 500; color: var(--text-dim); }

.slot-detail {
  font-size: 0.78rem;
  color: var(--text-dim);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.slot-detail span { white-space: nowrap; }

.grid-view {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.gv-empty {
  grid-column: 1 / -1;
  padding: 40px 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.9rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius-m);
}

.gv-card {
  --gv-accent: var(--gv-lecture);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gv-accent);
  border-radius: var(--radius-m);
  padding: 14px;
  display: flex;
  gap: 12px;
}

.gv-card.is-now {
  border-color: var(--gv-active);
  border-left-color: var(--gv-active);
  box-shadow: 0 0 0 1px var(--gv-active), 0 0 14px rgba(124,108,246,0.25);
}

.gv-card.type-lecture { --gv-accent: var(--gv-lecture); }
.gv-card.type-lab { --gv-accent: var(--gv-lab); }
.gv-card.type-tutorial { --gv-accent: var(--gv-tutorial); }
.gv-card.type-break { --gv-accent: var(--gv-break); }

.gv-time {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text);
  white-space: nowrap;
  padding-top: 1px;
}

.gv-time .gv-arrow {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 0.7rem;
  margin: 2px 0;
}

.gv-time .gv-end {
  color: var(--text-dim);
  font-weight: 600;
}

.gv-body { flex: 1; min-width: 0; }

.gv-type {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 4px;
  color: var(--gv-accent);
}

.gv-subject {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
  margin-bottom: 8px;
}

.type-break .gv-subject { font-weight: 600; }

.gv-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.gv-meta-row {
  font-size: 0.76rem;
  color: var(--text-dim);
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.gv-meta-icon {
  color: var(--text-faint);
  flex: 0 0 auto;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-primary {
  background: var(--brass);
  color: #14100a;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius-s);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-ghost {
  background: var(--panel);
  color: var(--text-dim);
  border: 1px solid var(--line);
  padding: 9px 16px;
  border-radius: var(--radius-s);
  font-weight: 600;
  font-size: 0.82rem;
  cursor: pointer;
  margin-right: 8px;
  margin-top: 10px;
}

.btn-wide { width: 100%; }

.link-btn {
  background: none;
  border: none;
  color: var(--brass);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
}

.account-login-btn { margin: 0; padding: 8px 14px; }

.account-menu-wrap { position: relative; }

.avatar-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brass);
  color: #14100a;
  border: none;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  font-family: 'Space Grotesk', sans-serif;
}

.account-menu {
  position: absolute;
  right: 0;
  top: 44px;
  background: var(--panel-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  min-width: 190px;
  overflow: hidden;
  z-index: 60;
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

.account-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--text);
  padding: 11px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}

.account-menu button:hover { background: var(--panel); }

.view-title {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.2rem;
  font-weight: 600;
  margin: 20px 0 16px;
}

.empty-panel {
  padding: 30px 20px;
  text-align: center;
  color: var(--text-dim);
  border: 1px dashed var(--line);
  border-radius: var(--radius-m);
  font-size: 0.9rem;
}

.empty-panel .btn-primary {
  display: block;
  margin: 14px auto 0;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-faint);
  padding: 10px 4px;
  margin-right: 22px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.active { color: var(--text); border-bottom-color: var(--brass); }

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 420px;
}

.form-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
}

.form-field input, .form-field select {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 10px 12px;
  border-radius: var(--radius-s);
  font-size: 0.9rem;
  font-family: inherit;
}

.form-field input:focus, .form-field select:focus {
  outline: none;
  border-color: var(--brass);
}

.form-actions { margin-top: 4px; }

.form-intro { color: var(--text-dim); font-size: 0.85rem; max-width: 420px; margin-bottom: 4px; }

.form-error { color: var(--danger); font-size: 0.8rem; min-height: 1em; }

.form-success { color: var(--sage); font-size: 0.85rem; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-m); max-width: 420px; }

.info-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 6px 16px;
  max-width: 420px;
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}

.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--text-faint); }

.att-header { margin-bottom: 18px; }
.att-date { font-family: 'Space Grotesk', sans-serif; font-size: 1.15rem; font-weight: 600; }
.att-context { font-size: 0.8rem; color: var(--text-faint); margin-top: 2px; }

.bulk-row { display: flex; margin-bottom: 4px; }

.att-list { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }

.att-row {
  display: flex;
  gap: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 14px;
}

.att-time {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.78rem;
  white-space: nowrap;
  padding-top: 2px;
}

.att-body { flex: 1; }
.att-type { font-size: 0.68rem; font-weight: 700; text-transform: uppercase; margin-bottom: 3px; }
.att-row.type-lecture .att-type { color: var(--gv-lecture); }
.att-row.type-lab .att-type { color: var(--gv-lab); }
.att-row.type-tutorial .att-type { color: var(--gv-tutorial); }
.att-subject { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; }
.att-meta { display: flex; gap: 10px; font-size: 0.76rem; color: var(--text-dim); margin-bottom: 10px; }

.seg { display: flex; gap: 5px; flex-wrap: wrap; }

.seg-btn {
  flex: 1;
  min-width: 64px;
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text-dim);
  padding: 8px 4px;
  border-radius: var(--radius-s);
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.seg-present.active { background: rgba(126,162,122,0.18); border-color: var(--sage); color: var(--sage); }
.seg-absent.active { background: rgba(193,101,90,0.18); border-color: var(--danger); color: var(--danger); }
.seg-unmarked.active { background: var(--panel-raised); border-color: var(--text-faint); color: var(--text); }
.seg-cancelled.active { background: rgba(122,134,160,0.18); border-color: var(--slate); color: var(--slate); }

.save-bar { margin-top: 20px; max-width: 420px; }

.att-top-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.btn-status-top {
  margin: 0;
  color: var(--brass);
  border-color: var(--brass-dim);
}

.backfill-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 10px 14px;
  margin-bottom: 14px;
}

.backfill-picker label {
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
}

.backfill-picker input[type="date"] {
  background: var(--ink);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius-s);
  font-size: 0.85rem;
  font-family: inherit;
}

.att-disclaimer {
  font-size: 0.78rem;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 10px 14px;
  margin: 14px 0 4px;
}

.status-disclaimer {
  font-size: 0.8rem;
  color: var(--text-dim);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brass-dim);
  border-radius: var(--radius-m);
  padding: 12px 16px;
  margin-bottom: 20px;
}

.meter-panel {
  display: flex;
  align-items: center;
  gap: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 18px;
  flex-wrap: wrap;
}

.meter-wrap {
  position: relative;
  width: 130px;
  height: 130px;
  flex: 0 0 auto;
}

.meter-svg { width: 130px; height: 130px; }

.meter-track {
  fill: none;
  stroke: var(--line);
  stroke-width: 10;
}

.meter-fill {
  fill: none;
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke-dasharray 0.5s ease;
}

.meter-fill.tier-green { stroke: var(--tier-green); }
.meter-fill.tier-yellow { stroke: var(--tier-yellow); }
.meter-fill.tier-red { stroke: var(--tier-red); }

.meter-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.meter-pct {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--text);
}

.meter-tag {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-top: 2px;
}

.tier-text-green { color: var(--tier-green); }
.tier-text-yellow { color: var(--tier-yellow); }
.tier-text-red { color: var(--tier-red); }

.meter-side {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.meter-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  color: var(--text-dim);
  flex-wrap: wrap;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 2px;
}

.legend-dot.tier-green { background: var(--tier-green); }
.legend-dot.tier-yellow { background: var(--tier-yellow); margin-left: 10px; }
.legend-dot.tier-red { background: var(--tier-red); margin-left: 10px; }

.projection-line {
  font-size: 0.86rem;
  color: var(--text);
  line-height: 1.4;
}

.projection-line strong { color: var(--brass); font-family: 'Space Grotesk', sans-serif; }

.criteria-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-dim);
  font-weight: 600;
  gap: 10px;
}

.criteria-input-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 5px 10px;
}

.criteria-input-wrap input {
  width: 42px;
  background: none;
  border: none;
  color: var(--text);
  font-size: 0.85rem;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  text-align: right;
}

.criteria-input-wrap input:focus { outline: none; }
.criteria-input-wrap span { color: var(--text-faint); font-size: 0.8rem; }

.pct-cell { font-weight: 700; }

.proj-cell {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
}

.proj-green { color: var(--tier-green); }
.proj-red { color: var(--tier-red); }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 16px 10px;
  text-align: center;
}

.stat-card span { display: block; font-size: 0.72rem; color: var(--text-faint); font-weight: 600; margin-bottom: 6px; }
.stat-card strong { font-family: 'Space Grotesk', sans-serif; font-size: 1.3rem; color: var(--brass); }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-m); }

table.subject-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
table.subject-table th { background: var(--panel-raised); text-align: left; padding: 9px 12px; color: var(--text-dim); font-weight: 600; }
table.subject-table td { padding: 9px 12px; border-top: 1px solid var(--line); }

.history-list { display: flex; flex-direction: column; gap: 8px; }

.history-item { border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; }

.history-summary {
  width: 100%;
  background: var(--panel);
  border: none;
  color: var(--text);
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  cursor: pointer;
  text-align: left;
}

.history-summary span:last-child { color: var(--text-faint); font-size: 0.78rem; }

.history-detail { background: var(--ink); padding: 4px 14px; }

.history-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.8rem;
}

.history-detail-row:last-child { border-bottom: none; }

.badge-present { color: var(--sage); font-weight: 700; text-transform: capitalize; }
.badge-absent { color: var(--danger); font-weight: 700; text-transform: capitalize; }

.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translate(-50%, 12px);
  background: var(--panel-raised);
  border: 1px solid var(--brass);
  color: var(--text);
  padding: 11px 18px;
  border-radius: var(--radius-s);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 80;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

.live-line {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 14px;
}

.room-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.room-chip {
  border-radius: var(--radius-s);
  padding: 12px 8px;
  text-align: center;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.82rem;
}

.room-chip-empty {
  background: rgba(126,162,122,0.12);
  border: 1px solid var(--sage);
  color: var(--sage);
}

.busy-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.busy-row {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 10px 14px;
}

.busy-room {
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--clay);
  flex: 0 0 auto;
  min-width: 64px;
}

.busy-detail { flex: 1; min-width: 0; }
.busy-subject { font-weight: 600; font-size: 0.86rem; }
.busy-subject.type-lecture { color: var(--gv-lecture); }
.busy-subject.type-lab { color: var(--gv-lab); }
.busy-subject.type-tutorial { color: var(--gv-tutorial); }
.busy-meta { font-size: 0.74rem; color: var(--text-faint); margin-top: 2px; }

.faculty-search {
  width: 100%;
  max-width: 420px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  padding: 11px 14px;
  border-radius: var(--radius-s);
  font-size: 0.9rem;
  font-family: inherit;
}

.faculty-search:focus { outline: none; border-color: var(--brass); }

.faculty-results {
  max-width: 420px;
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  overflow: hidden;
  display: none;
}

.faculty-result-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: none;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  padding: 10px 14px;
  font-size: 0.85rem;
  cursor: pointer;
}

.faculty-result-item:last-child { border-bottom: none; }
.faculty-result-item:hover { background: var(--panel-raised); }

.faculty-result-empty {
  padding: 10px 14px;
  color: var(--text-faint);
  font-size: 0.82rem;
  background: var(--panel);
}

.faculty-now-band { margin-top: 18px; padding: 16px 18px; }

.faculty-day-block { margin-top: 14px; }

.faculty-day-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}

.faculty-row {
  display: flex;
  gap: 14px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  margin-bottom: 8px;
}

.faculty-row.is-now { border-color: var(--brass); box-shadow: inset 0 0 0 1px rgba(211,162,74,0.35); }

.faculty-time {
  flex: 0 0 auto;
  font-family: 'Space Grotesk', sans-serif;
  font-weight: 700;
  font-size: 0.76rem;
  color: var(--text-dim);
  white-space: nowrap;
  padding-top: 1px;
}

.faculty-info { flex: 1; min-width: 0; }
.faculty-subject { font-weight: 600; font-size: 0.88rem; }
.faculty-subject.type-lecture { color: var(--gv-lecture); }
.faculty-subject.type-lab { color: var(--gv-lab); }
.faculty-subject.type-tutorial { color: var(--gv-tutorial); }
.faculty-meta { font-size: 0.74rem; color: var(--text-faint); margin-top: 2px; }

footer {
  margin-top: 34px;
  padding-bottom: 20px;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.72rem;
}

.credit {
  margin-top: 6px;
  color: var(--brass-dim);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.credit a {
  color: var(--brass);
  text-decoration: none;
}

.credit a:hover { text-decoration: underline; }

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  background: rgba(21, 27, 35, 0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
}

.bottom-nav-inner {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: stretch;
  width: 100%;
  max-width: 620px;
  margin: 0 auto;
  gap: 2px;
}

.bottom-nav-item {
  position: relative;
  min-width: 0;
  height: 54px;
  padding: 5px 1px 4px;
  margin: 0;
  background: transparent;
  border: 0;
  color: var(--text-faint);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-decoration: none;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
  font: inherit;
}

.bottom-nav-item:hover {
  background: rgba(255,255,255,0.025);
}

.bottom-nav-item.active {
  color: var(--brass);
}

.bottom-nav-item.active::after {
  content: "";
  position: absolute;
  left: 25%;
  right: 25%;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: currentColor;
}

.bottom-nav-item small {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  font-size: 0.62rem;
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: 0;
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  color: currentColor;
  opacity: 0.9;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

@media (max-width: 380px) {
  .bottom-nav { padding-left: 4px; padding-right: 4px; }
  .bottom-nav-inner { gap: 0; }
  .bottom-nav-item { height: 52px; }
  .bottom-nav-item small { font-size: 0.58rem; }
  .nav-icon, .nav-icon svg { width: 18px; height: 18px; }
}

/* Exams / datesheet */
.exam-countdown-band {
  margin: 18px 0 24px;
  padding: 18px 20px;
  background: linear-gradient(135deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.exam-countdown-band.has-exam {
  border-color: rgba(211,162,74,0.42);
}

.exam-countdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.exam-eyebrow {
  color: var(--brass);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 5px;
}

.exam-countdown-title {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 750;
  line-height: 1.25;
}

.exam-countdown-meta,
.exam-countdown-sub,
.exam-countdown-foot {
  color: var(--text-dim);
  font-size: 0.76rem;
  margin-top: 5px;
}

.exam-countdown-number {
  flex: 0 0 auto;
  text-align: right;
  font-family: 'Space Grotesk', sans-serif;
  font-variant-numeric: tabular-nums;
}

.exam-countdown-number strong {
  display: block;
  color: var(--brass);
  font-size: 1.55rem;
  line-height: 1;
}

.exam-countdown-number span {
  display: block;
  color: var(--text-dim);
  font-size: 0.76rem;
  margin-top: 5px;
}

.exam-timebar {
  height: 5px;
  margin-top: 15px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
}

.exam-timebar > div {
  height: 100%;
  border-radius: inherit;
  background: var(--brass);
  transition: width 0.5s linear;
}

.exam-countdown-foot {
  display: flex;
  justify-content: flex-end;
  font-size: 0.68rem;
}

.exam-action {
  white-space: nowrap;
}

.exam-personal-card,
.exam-guest-note {
  padding: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  margin-bottom: 14px;
}

.exam-personal-card h3,
.exam-guest-note h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.exam-personal-card p,
.exam-guest-note p {
  margin: 7px 0 0;
  color: var(--text-dim);
  font-size: 0.8rem;
  line-height: 1.55;
}

.exam-list {
  display: grid;
  gap: 9px;
}

.exam-item {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
}

.exam-item.next {
  border-color: rgba(211,162,74,0.5);
  background: var(--panel-raised);
}

.exam-date-block {
  flex: 0 0 52px;
  text-align: center;
  padding-right: 12px;
  border-right: 1px solid var(--line);
}

.exam-date-block strong {
  display: block;
  color: var(--text);
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.25rem;
  line-height: 1;
}

.exam-date-block span {
  color: var(--text-dim);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.exam-item-main {
  min-width: 0;
  flex: 1;
}

.exam-item-title {
  color: var(--text);
  font-weight: 700;
  font-size: 0.9rem;
}

.exam-item-meta {
  color: var(--text-dim);
  font-size: 0.74rem;
  margin-top: 4px;
}

.exam-next-pill {
  color: #14100a;
  background: var(--brass);
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 0.62rem;
  font-weight: 800;
}

.exam-source-note {
  margin: 12px 2px 18px;
  color: var(--text-faint);
  font-size: 0.7rem;
}

.full-datesheet {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.full-datesheet summary {
  cursor: pointer;
  color: var(--brass);
  font-size: 0.82rem;
  font-weight: 700;
}

.datesheet-wrap {
  margin-top: 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--panel);
}

.datesheet-table {
  width: 100%;
  min-width: 1050px;
  border-collapse: collapse;
  font-size: 0.72rem;
}

.datesheet-table th,
.datesheet-table td {
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 11px;
  vertical-align: top;
  text-align: left;
}

.datesheet-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-raised);
  color: var(--brass);
  font-weight: 800;
}

.datesheet-table tbody th {
  width: 105px;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}

.datesheet-table tbody th span {
  color: var(--text-dim);
  font-weight: 500;
}

.datesheet-block + .datesheet-block {
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px dashed var(--line);
}

.datesheet-block div {
  line-height: 1.4;
}

.muted-cell {
  color: var(--text-faint);
}

.datesheet-instructions {
  margin-top: 14px;
  padding: 15px 17px;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  color: var(--text-dim);
  font-size: 0.74rem;
  line-height: 1.55;
}

.datesheet-instructions strong {
  color: var(--text);
}

.datesheet-instructions ul {
  margin: 7px 0 0;
  padding-left: 18px;
}

@media (max-width: 640px) {
  .exam-countdown-head {
    align-items: flex-start;
  }

  .exam-countdown-number strong {
    font-size: 1.2rem;
  }

  .exam-countdown-meta {
    line-height: 1.45;
  }

  .exam-countdown-foot {
    justify-content: flex-start;
  }

  .exam-action {
    padding: 7px 10px;
  }

  .exam-item {
    gap: 10px;
  }

  .exam-next-pill {
    display: none;
  }
}
