:root {
  color-scheme: light;
  --bg: #f4f7f6;
  --panel: #ffffff;
  --ink: #17211f;
  --muted: #61716d;
  --line: #dce5e1;
  --teal: #0f766e;
  --teal-dark: #115e59;
  --gold: #b7791f;
  --red: #b42318;
  --blue: #2563eb;
  --shadow: 0 12px 32px rgba(18, 38, 35, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(15, 118, 110, 0.12), rgba(244, 247, 246, 0) 280px),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

.app {
  width: min(100%, 680px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px 14px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: -14px -14px 14px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: rgba(244, 247, 246, 0.92);
  border-bottom: 1px solid rgba(220, 229, 225, 0.9);
  backdrop-filter: blur(14px);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.event-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--teal-dark);
  text-transform: uppercase;
}

.updated {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.82rem;
}

.sync-pill,
.role-pill,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  white-space: nowrap;
}

.sync-pill.is-fresh {
  border-color: rgba(15, 118, 110, 0.28);
  color: var(--teal-dark);
}

.hero {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding: 20px;
  border-radius: 8px;
  background:
    radial-gradient(circle at right top, rgba(183, 121, 31, 0.16), transparent 230px),
    var(--panel);
  box-shadow: var(--shadow);
}

.person-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.person-name {
  margin: 0;
  font-size: clamp(1.9rem, 9vw, 3.15rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.role-pill {
  border-color: rgba(37, 99, 235, 0.25);
  color: #1e40af;
}

.role-pill.instructor {
  border-color: rgba(183, 121, 31, 0.36);
  color: #87530f;
}

.role-pill.staff {
  border-color: rgba(15, 118, 110, 0.32);
  color: var(--teal-dark);
}

.next-panel {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(15, 118, 110, 0.18);
  border-radius: 8px;
  background: #eef8f6;
}

.section-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.next-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 850;
}

.next-meta,
.meta-row {
  color: var(--muted);
  font-size: 0.92rem;
}

.tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 12px 0 16px;
}

.tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
}

.tab.is-active {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.panel {
  display: grid;
  gap: 12px;
}

.schedule-card {
  display: grid;
  grid-template-columns: 6px 1fr;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 6px 18px rgba(18, 38, 35, 0.07);
}

.schedule-card .accent {
  background: var(--teal);
}

.schedule-card.changed .accent {
  background: var(--gold);
}

.schedule-card.canceled .accent {
  background: var(--red);
}

.card-body {
  display: grid;
  gap: 8px;
  padding: 15px;
}

.time-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.time {
  color: var(--teal-dark);
  font-size: 0.92rem;
  font-weight: 850;
}

.course-title {
  margin: 0;
  font-size: 1.16rem;
  line-height: 1.18;
}

.meta-grid {
  display: grid;
  gap: 7px;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.meta-icon {
  display: inline-grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 999px;
  background: #eef2f1;
  color: var(--teal-dark);
  font-size: 0.75rem;
  font-weight: 900;
  flex: 0 0 auto;
}

.status-pill {
  color: var(--teal-dark);
  font-size: 0.72rem;
  text-transform: capitalize;
}

.status-pill.room_changed {
  border-color: rgba(183, 121, 31, 0.3);
  color: #87530f;
  background: #fff8eb;
}

.status-pill.canceled {
  border-color: rgba(180, 35, 24, 0.24);
  color: var(--red);
  background: #fff1f0;
}

.notice {
  border: 1px solid rgba(183, 121, 31, 0.32);
  border-radius: 8px;
  padding: 12px;
  background: #fff8eb;
  color: #69410a;
  font-weight: 700;
}

.directory {
  display: grid;
  gap: 10px;
}

.directory-item {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: inherit;
  text-align: left;
  text-decoration: none;
}

.directory-item strong {
  font-size: 1rem;
}

.directory-item span {
  color: var(--muted);
  font-size: 0.9rem;
}

.lookup-panel,
.error-panel,
.loading-panel {
  display: grid;
  gap: 14px;
  min-height: calc(100vh - 28px);
  align-content: center;
  padding: 22px;
  border-radius: 8px;
}

.lookup-card,
.error-card,
.loading-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.lookup-card,
.error-card {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.lookup-card h1,
.error-card h1,
.loading-panel h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1;
}

.lookup-card p,
.error-card p,
.loading-panel p {
  margin: 0;
  color: var(--muted);
}

.lookup-form {
  display: flex;
  gap: 8px;
}

.lookup-form input {
  min-width: 0;
  flex: 1;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  text-transform: uppercase;
}

.primary-button {
  height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--teal);
  color: white;
  font-weight: 850;
}

.primary-button:disabled {
  background: #9fb9b4;
}

.checkin-card.checked-in .accent {
  background: var(--blue);
}

.checkin-button {
  width: 100%;
}

.checkin-stamp {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  border: 1px solid rgba(37, 99, 235, 0.18);
  border-radius: 8px;
  padding: 12px;
  background: #eff6ff;
  color: #1e40af;
  font-weight: 850;
}

.error-notice {
  border-color: rgba(180, 35, 24, 0.24);
  background: #fff1f0;
  color: var(--red);
}

.brand-mark {
  display: inline-grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: white;
  font-weight: 900;
}

.footer-note {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
}

.is-hidden {
  display: none;
}

@media (min-width: 640px) {
  .app {
    padding-top: 22px;
  }

  .topbar {
    margin-top: -22px;
  }
}
