:root {
  color-scheme: light;
  --white: #ffffff;
  --ink: #071a3d;
  --muted: #6d7789;
  --line: #dce1e9;
  --line-strong: #bdc6d4;
  --blue: #1468e8;
  --blue-dark: #0c55c6;
  --blue-pale: #eef5ff;
  --amber: #a75c00;
  --amber-pale: #fff5e5;
  --danger: #ad2e2e;
  --radius: 0.8rem;
  --font: "Avenir Next", Avenir, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 20rem;
  min-height: 100%;
  background: var(--white);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--white);
}

button,
input,
select {
  color: inherit;
  font: inherit;
}

button,
select,
label,
summary {
  -webkit-tap-highlight-color: transparent;
}

button,
select,
summary {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible + span,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(20 104 232 / 24%);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 20;
  top: 0.5rem;
  left: 0.5rem;
  padding: 0.6rem 0.8rem;
  border-radius: 0.55rem;
  background: var(--ink);
  color: white;
  font-size: 0.8rem;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.app-bar {
  display: flex;
  min-height: 4.75rem;
  padding: max(0.75rem, env(safe-area-inset-top)) max(1.25rem, env(safe-area-inset-right)) 0.75rem max(1.25rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  min-width: 0;
  color: var(--ink);
  font-size: clamp(1rem, 4.4vw, 1.25rem);
  font-weight: 680;
  letter-spacing: -0.025em;
  text-decoration: none;
  align-items: center;
  gap: 0.7rem;
}

.brand svg,
.term-line svg {
  width: 2rem;
  height: 2rem;
  flex: 0 0 auto;
  fill: none;
  stroke: var(--blue);
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
}

.brand span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.network-state {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 650;
}

main {
  min-height: calc(100dvh - 4.75rem);
}

.screen {
  width: min(100% - 2rem, 68rem);
  min-height: calc(100dvh - 4.75rem);
  margin: 0 auto;
  padding: clamp(2rem, 7vw, 4rem) 0 calc(7rem + env(safe-area-inset-bottom));
}

.term-line {
  display: flex;
  color: var(--blue-dark);
  font-size: 1rem;
  font-weight: 720;
  align-items: center;
  gap: 0.65rem;
}

.term-line svg {
  width: 1.55rem;
  height: 1.55rem;
}

h1 {
  margin: 2rem 0 2.5rem;
  font-size: clamp(2.55rem, 12vw, 4.5rem);
  font-weight: 720;
  line-height: 0.98;
  letter-spacing: -0.055em;
}

#profile-form {
  display: grid;
  gap: 1.75rem;
}

.field {
  display: grid;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
  gap: 0.65rem;
}

.field > span,
.field legend {
  padding: 0;
  font-size: 0.88rem;
  font-weight: 680;
}

.field select {
  width: 100%;
  height: 3.55rem;
  padding: 0 3rem 0 0.95rem;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--white);
  font-size: 0.98rem;
  font-weight: 580;
  text-overflow: ellipsis;
}

.segmented {
  display: grid;
  min-height: 3.55rem;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
}

.segmented label {
  min-width: 0;
  border-left: 1px solid var(--line-strong);
  cursor: pointer;
}

.segmented label:first-child {
  border-left: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented span {
  display: grid;
  height: 100%;
  min-height: 3.5rem;
  padding: 0.55rem;
  font-size: 0.98rem;
  font-weight: 720;
  place-items: center;
}

.segmented input:checked + span {
  background: var(--blue-pale);
  color: var(--blue-dark);
  box-shadow: inset 0 -2px var(--blue);
}

.primary-button,
.secondary-button {
  display: inline-flex;
  min-height: 3.55rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.96rem;
  font-weight: 760;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
}

.primary-button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: white;
}

.primary-button:hover:not(:disabled) {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}

.primary-button:disabled {
  border-color: #aeb8c8;
  background: #aeb8c8;
  cursor: not-allowed;
}

.secondary-button {
  border: 1px solid var(--line-strong);
  background: var(--white);
  color: var(--blue-dark);
}

.setup-submit {
  width: 100%;
  margin-top: clamp(1rem, 8vh, 5rem);
}

.profile-back {
  display: inline-flex;
  min-height: 2.75rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 760;
  align-items: center;
  gap: 0.55rem;
}

.profile-back svg,
.profile-button svg,
.electives summary svg,
.timetable-actions svg {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.9;
}

.choices-screen h1 {
  margin-bottom: 2.2rem;
}

.choice-groups {
  display: grid;
  gap: 2.2rem;
}

.choice-group {
  display: grid;
  gap: 0;
}

.choice-label {
  margin: 0;
  padding: 0 0 0.8rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
  font-weight: 680;
}

.choice-option {
  display: grid;
  min-height: 4.65rem;
  padding: 0.8rem 0.75rem;
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--white);
  cursor: pointer;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: center;
}

.choice-option:first-of-type {
  border-radius: 0.45rem 0.45rem 0 0;
}

.choice-option:last-child {
  border-radius: 0 0 0.45rem 0.45rem;
}

.choice-option:only-of-type {
  border-radius: 0.45rem;
}

.choice-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.choice-mark {
  display: grid;
  width: 1.35rem;
  height: 1.35rem;
  border: 1.5px solid #8d98aa;
  border-radius: 50%;
  place-items: center;
}

.choice-option input:checked + .choice-mark {
  border-color: var(--blue);
}

.choice-option input:checked + .choice-mark::after {
  width: 0.67rem;
  height: 0.67rem;
  border-radius: 50%;
  background: var(--blue);
  content: "";
}

.choice-option:has(input:checked) {
  border-color: #91b9f4;
  background: var(--blue-pale);
}

.choice-copy {
  display: grid;
  min-width: 0;
  gap: 0.25rem;
}

.choice-name {
  font-size: 0.92rem;
  font-weight: 560;
  line-height: 1.28;
}

.choice-meta,
.choice-clash {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 560;
}

.choice-clash {
  color: var(--amber);
  font-weight: 760;
}

.electives {
  margin-top: 2.4rem;
  border-block: 1px solid var(--line);
}

.electives summary {
  display: flex;
  min-height: 4rem;
  list-style: none;
  font-size: 0.95rem;
  font-weight: 760;
  align-items: center;
  justify-content: space-between;
}

.electives summary::-webkit-details-marker {
  display: none;
}

.electives[open] summary svg {
  transform: rotate(180deg);
}

#elective-list {
  padding-bottom: 0.75rem;
}

.sticky-action {
  position: fixed;
  z-index: 8;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 0.85rem max(1rem, env(safe-area-inset-right)) calc(0.85rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
}

.sticky-action .primary-button {
  width: min(100%, 66rem);
  margin: 0 auto;
}

.timetable-meta {
  display: flex;
  min-height: 3.25rem;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.timetable-meta > span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 650;
}

.profile-button {
  display: inline-flex;
  min-height: 2.8rem;
  max-width: 65%;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.7rem;
  background: var(--white);
  font-size: 0.82rem;
  font-weight: 720;
  align-items: center;
  gap: 0.5rem;
}

.profile-button span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-button svg {
  width: 1rem;
  height: 1rem;
  flex: 0 0 auto;
}

.timetable-screen h1 {
  margin: 1.7rem 0 1.4rem;
}

.day-tabs {
  display: grid;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  grid-template-columns: repeat(6, minmax(3.35rem, 1fr));
  scrollbar-width: none;
}

.day-tab {
  min-height: 3.55rem;
  padding: 0.6rem 0.45rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: var(--white);
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 690;
}

.day-tab[aria-selected="true"] {
  border-bottom-color: var(--blue);
  background: var(--blue-pale);
  color: var(--blue-dark);
}

.day-view {
  min-height: 20rem;
  padding-top: 1.1rem;
}

.timeline {
  position: relative;
}

.timeline::before {
  position: absolute;
  top: 1.45rem;
  bottom: 1.45rem;
  left: 7.55rem;
  width: 1px;
  background: var(--line);
  content: "";
}

.event-row {
  display: grid;
  min-height: 6.2rem;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--line);
  grid-template-columns: 6.85rem 1rem minmax(0, 1fr);
  gap: 0.35rem;
  align-items: start;
}

.event-row:last-child {
  border-bottom: 0;
}

.event-time {
  padding-top: 0.12rem;
  font-size: 0.79rem;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.event-dot {
  z-index: 1;
  width: 0.68rem;
  height: 0.68rem;
  margin-top: 0.3rem;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}

.event-copy {
  display: grid;
  gap: 0.35rem;
}

.event-copy strong {
  font-size: 0.94rem;
  font-weight: 720;
  line-height: 1.25;
}

.event-copy span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 580;
}

.event-row.is-conflict .event-dot {
  background: var(--amber);
  box-shadow: 0 0 0 1px var(--amber);
}

.event-row.is-conflict .event-copy span {
  color: var(--amber);
}

.empty-day {
  display: grid;
  min-height: 17rem;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 620;
  place-items: center;
}

.week-view {
  display: none;
}

.timetable-actions {
  position: fixed;
  z-index: 8;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  padding: 0.85rem max(1rem, env(safe-area-inset-right)) calc(0.85rem + env(safe-area-inset-bottom)) max(1rem, env(safe-area-inset-left));
  border-top: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  grid-template-columns: 1fr 1.25fr;
  gap: 0.75rem;
}

.timetable-actions svg {
  width: 1.15rem;
  height: 1.15rem;
}

.load-error {
  margin: 4rem 1rem;
  color: var(--danger);
  font-weight: 700;
  text-align: center;
}

@media (min-width: 48rem) {
  .app-bar {
    padding-inline: max(calc((100% - 68rem) / 2), 2rem);
  }

  .setup-screen {
    width: min(100% - 3rem, 46rem);
    padding-top: 2.25rem;
  }

  .setup-screen h1 {
    margin: 1.35rem 0 1.75rem;
    font-size: 3.75rem;
  }

  #profile-form {
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
  }

  .degree-field,
  .section-field,
  .setup-submit {
    grid-column: 1 / -1;
  }

  .setup-submit {
    margin-top: 0.75rem;
  }

  .sticky-action,
  .timetable-actions {
    position: static;
    padding: 1.5rem 0 0;
    border-top: 0;
    background: transparent;
  }

  .sticky-action .primary-button {
    width: 100%;
  }

  .day-tabs,
  .day-view {
    display: none;
  }

  .week-view {
    display: grid;
    border-top: 1px solid var(--line);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2rem;
  }

  .week-day {
    min-width: 0;
    padding: 1.2rem 0 1.4rem;
    border-bottom: 1px solid var(--line);
  }

  .week-day h2 {
    margin: 0 0 0.45rem;
    font-size: 1rem;
    font-weight: 780;
  }

  .week-day .timeline::before,
  .week-day .event-dot {
    display: none;
  }

  .week-day .event-row {
    min-height: 4.7rem;
    padding: 0.75rem 0;
    grid-template-columns: 6.4rem minmax(0, 1fr);
    gap: 0.75rem;
  }

  .week-day .event-copy strong {
    font-size: 0.87rem;
  }

  .week-day .empty-day {
    min-height: 7rem;
    place-items: start;
    align-content: center;
  }

  .timetable-actions {
    width: 22rem;
    margin-left: auto;
  }
}

@media (min-width: 70rem) {
  .week-view {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

/* Friendly timetable redesign */
:root {
  --white: #ffffff;
  --canvas: #f4f7fb;
  --ink: #10213e;
  --muted: #64748b;
  --line: #dbe3ee;
  --line-strong: #c8d3e2;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-pale: #eef5ff;
  --green: #20a765;
  --green-pale: #ecf9f2;
  --amber: #b96d00;
  --amber-pale: #fff7e8;
  --danger: #b42318;
  --radius: 1rem;
  --shadow: 0 0.8rem 2.2rem rgb(37 59 92 / 8%);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Helvetica, Arial, sans-serif;
}

html,
body {
  background: var(--canvas);
}

body {
  color: var(--ink);
  line-height: 1.45;
}

.app-bar {
  position: sticky;
  z-index: 12;
  top: 0;
  display: block;
  min-height: 4.5rem;
  padding: max(0.65rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.65rem max(1rem, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(12px);
}

.app-bar-inner {
  display: flex;
  width: 100%;
  min-height: 3.15rem;
  margin: 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.brand {
  font-size: clamp(0.92rem, 4.1vw, 1.12rem);
  font-weight: 730;
  letter-spacing: -0.025em;
  gap: 0.58rem;
}

.brand svg {
  width: 1.75rem;
  height: 1.75rem;
  stroke: var(--blue);
  stroke-width: 1.85;
}

.app-bar-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
}

.network-state {
  color: var(--amber);
  font-size: 0.73rem;
  font-weight: 700;
}

.save-status {
  display: inline-flex;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 620;
  align-items: center;
  gap: 0.48rem;
}

.save-status::before {
  width: 0.55rem;
  height: 0.55rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--green);
  content: "";
  box-shadow: 0 0 0 0.2rem rgb(32 167 101 / 10%);
}

.header-save-status {
  display: none;
}

.profile-button {
  min-height: 2.75rem;
  max-width: 10.5rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line-strong);
  border-radius: 0.85rem;
  background: var(--white);
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 720;
  box-shadow: 0 0.15rem 0.35rem rgb(37 59 92 / 4%);
}

.profile-button:hover {
  border-color: #9fb5d5;
  background: #fafdff;
}

main {
  min-height: calc(100dvh - 4.5rem);
}

.screen {
  width: min(100% - 2rem, 90rem);
  min-height: calc(100dvh - 4.5rem);
  padding: 1.85rem 0 calc(6.7rem + env(safe-area-inset-bottom));
}

h1 {
  margin: 1.4rem 0 2rem;
  font-size: clamp(2.35rem, 11vw, 3.25rem);
  font-weight: 760;
  line-height: 1.02;
  letter-spacing: -0.052em;
}

.term-line {
  color: var(--blue-dark);
  font-size: 0.9rem;
  font-weight: 700;
}

#profile-form {
  gap: 1.2rem;
}

.field > span,
.field legend {
  color: #34445e;
  font-size: 0.78rem;
  font-weight: 700;
}

.field select,
.segmented {
  min-height: 3.35rem;
  border-color: var(--line-strong);
  border-radius: 0.9rem;
  background: var(--white);
  box-shadow: 0 0.2rem 0.6rem rgb(37 59 92 / 4%);
}

.field select {
  height: 3.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.segmented span {
  min-height: 3.25rem;
  font-size: 0.9rem;
  font-weight: 700;
}

.segmented input:checked + span {
  background: var(--blue-pale);
  color: var(--blue-dark);
  box-shadow: inset 0 -2px var(--blue);
}

.primary-button,
.secondary-button {
  min-height: 3.35rem;
  border-radius: 0.9rem;
  font-size: 0.9rem;
  font-weight: 720;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.primary-button {
  border-color: var(--blue);
  background: var(--blue);
  box-shadow: 0 0.4rem 0.9rem rgb(37 99 235 / 14%);
}

.primary-button:hover:not(:disabled) {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.secondary-button {
  border-color: #9fb5d5;
  background: var(--white);
  color: var(--blue-dark);
}

.secondary-button:hover {
  border-color: var(--blue);
  background: var(--blue-pale);
}

.setup-screen,
.choices-screen {
  width: min(100% - 2rem, 42rem);
}

.setup-submit {
  margin-top: 1rem;
}

.profile-back {
  color: #263853;
  font-size: 0.9rem;
}

.choices-screen h1 {
  margin: 1.25rem 0 1.8rem;
}

.choice-groups {
  gap: 1.6rem;
}

.choice-label {
  padding-bottom: 0.7rem;
  border-color: var(--line);
  color: #34445e;
  font-size: 0.82rem;
}

.choice-option {
  min-height: 4.35rem;
  padding: 0.75rem 0.8rem;
  border-color: var(--line);
  background: var(--white);
  gap: 0.75rem;
}

.choice-option:first-of-type {
  border-radius: 0.8rem 0.8rem 0 0;
}

.choice-option:last-child {
  border-radius: 0 0 0.8rem 0.8rem;
}

.choice-option:only-of-type {
  border-radius: 0.8rem;
}

.choice-option:has(input:checked) {
  border-color: #9bc0fa;
  background: var(--blue-pale);
}

.choice-name {
  font-size: 0.88rem;
  font-weight: 630;
}

.choice-meta,
.choice-clash {
  font-size: 0.68rem;
}

.electives {
  border-color: var(--line);
}

.sticky-action,
.timetable-actions {
  border-color: var(--line);
  background: rgb(255 255 255 / 96%);
  backdrop-filter: blur(12px);
}

.timetable-heading {
  display: grid;
  margin-bottom: 1.65rem;
  gap: 0.55rem;
}

.title-line {
  display: flex;
  min-width: 0;
  align-items: baseline;
  gap: 0.9rem;
}

.title-line h1 {
  margin: 0;
  font-size: clamp(2.3rem, 10.5vw, 3.2rem);
}

.title-line > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 650;
}

.mobile-save-status {
  width: fit-content;
}

.day-tabs {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0.95rem;
  background: var(--white);
  box-shadow: 0 0.3rem 0.9rem rgb(37 59 92 / 5%);
  grid-template-columns: repeat(6, minmax(3.15rem, 1fr));
}

.day-tab {
  min-height: 3.25rem;
  padding: 0.55rem 0.3rem;
  border-right: 1px solid #edf1f6;
  border-bottom: 3px solid transparent;
  background: var(--white);
  color: var(--ink);
  font-size: 0.75rem;
  font-weight: 680;
}

.day-tab:last-child {
  border-right: 0;
}

.day-tab[aria-selected="true"] {
  border-bottom-color: var(--blue);
  background: var(--blue-pale);
  color: var(--blue);
}

.day-view {
  display: block;
  min-height: 22rem;
  padding-top: 1.65rem;
}

.mobile-day-title {
  margin: 0 0 0.95rem;
  font-size: 1.28rem;
  font-weight: 730;
  letter-spacing: -0.025em;
}

.timeline {
  display: grid;
  gap: 0.75rem;
}

.timeline::before {
  display: none;
}

.event-row {
  display: grid;
  min-height: 7.25rem;
  padding: 1rem 1rem 1rem 1.15rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-left: 4px solid var(--tone);
  border-radius: 0.95rem;
  background: var(--tone-bg);
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 0.55rem 0.75rem;
  box-shadow: 0 0.35rem 1rem rgb(37 59 92 / 5%);
}

.event-row:last-child {
  border-bottom: 1px solid var(--line);
}

.event-time {
  padding: 0;
  font-size: 1rem;
  font-weight: 760;
  grid-column: 1;
}

.event-copy {
  gap: 0.35rem;
  grid-column: 1;
}

.event-copy strong {
  max-width: 26rem;
  font-size: 0.94rem;
  font-weight: 690;
}

.event-copy span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 620;
}

.tone-blue {
  --tone: #2878f0;
  --tone-bg: #eef5ff;
}

.tone-purple {
  --tone: #8b5cf6;
  --tone-bg: #f5f1ff;
}

.tone-green {
  --tone: #20ad68;
  --tone-bg: #edf9f2;
}

.tone-amber {
  --tone: #f0a000;
  --tone-bg: #fff7e5;
}

.event-row.is-conflict,
.week-event.is-conflict {
  --tone: #dc5a4f;
  --tone-bg: #fff0ef;
}

.event-row.is-conflict .event-copy span,
.week-event.is-conflict span {
  color: var(--danger);
}

.empty-day {
  min-height: 15rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.week-view {
  display: none;
}

.timetable-actions {
  grid-template-columns: 1fr 1.25fr;
  gap: 0.7rem;
}

.timetable-actions svg {
  width: 1.15rem;
  height: 1.15rem;
  stroke-width: 1.9;
}

.offline-toast {
  position: fixed;
  z-index: 30;
  right: 1rem;
  bottom: calc(5.8rem + env(safe-area-inset-bottom));
  left: 1rem;
  display: flex;
  min-height: 3.2rem;
  padding: 0.75rem 1rem;
  border: 1px solid #a7dfc1;
  border-radius: 0.9rem;
  background: #f3fcf7;
  color: #17643e;
  font-size: 0.82rem;
  font-weight: 700;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  box-shadow: 0 0.8rem 2rem rgb(23 100 62 / 14%);
  opacity: 0;
  transform: translateY(0.75rem);
  transition: opacity 180ms ease, transform 180ms ease;
}

.offline-toast.is-visible {
  opacity: 1;
  transform: none;
}

.offline-toast svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

@media (min-width: 48rem) {
  .setup-screen {
    padding-top: 2.25rem;
  }

  .setup-screen h1 {
    margin: 1.2rem 0 1.7rem;
    font-size: 3.2rem;
  }

  #profile-form {
    gap: 1.15rem;
  }
}

@media (min-width: 64rem) {
  .app-bar {
    padding-inline: 2.6rem;
  }

  .app-bar-inner {
    width: min(100%, 90rem);
  }

  .brand {
    font-size: 1.08rem;
  }

  .brand svg {
    width: 1.85rem;
    height: 1.85rem;
  }

  .header-save-status {
    display: inline-flex;
  }

  .mobile-save-status {
    display: none;
  }

  .profile-button {
    min-height: 2.75rem;
    padding-inline: 0.9rem;
    font-size: 0.8rem;
  }

  .timetable-screen {
    width: min(100% - 5.2rem, 90rem);
    padding: 2.7rem 0 3rem;
  }

  .timetable-heading {
    margin-bottom: 1.8rem;
  }

  .title-line {
    gap: 1.2rem;
  }

  .title-line h1 {
    font-size: clamp(2.8rem, 4vw, 3.35rem);
  }

  .title-line > span {
    font-size: 0.98rem;
  }

  .day-tabs,
  .day-view {
    display: none;
  }

  .week-view {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 1.05rem;
    background: var(--white);
    box-shadow: var(--shadow);
    grid-template-columns: 8.6rem repeat(6, minmax(0, 1fr));
  }

  .week-row {
    display: contents;
  }

  .week-corner,
  .week-day-heading {
    display: grid;
    min-height: 4.65rem;
    padding: 0.85rem;
    border-bottom: 1px solid var(--line);
    background: #fbfdff;
    font-size: 0.88rem;
    font-weight: 700;
    place-items: center;
  }

  .week-day-heading {
    border-left: 1px solid var(--line);
  }

  .week-time {
    display: grid;
    min-height: 9.1rem;
    padding: 1rem 0.75rem;
    border-bottom: 1px solid var(--line);
    background: #fbfdff;
    font-size: 0.83rem;
    font-weight: 730;
    font-variant-numeric: tabular-nums;
    place-items: center;
  }

  .week-cell {
    display: grid;
    min-width: 0;
    min-height: 9.1rem;
    padding: 0.75rem;
    border-bottom: 1px solid var(--line);
    border-left: 1px solid var(--line);
    align-content: stretch;
    grid-auto-rows: minmax(0, 1fr);
    gap: 0.55rem;
  }

  .week-row:last-child .week-time,
  .week-row:last-child .week-cell {
    border-bottom: 0;
  }

  .week-event {
    display: grid;
    min-width: 0;
    min-height: 0;
    padding: 0.85rem 0.75rem;
    overflow: hidden;
    border: 1px solid rgb(16 33 62 / 5%);
    border-left: 3px solid var(--tone);
    border-radius: 0.7rem;
    background: var(--tone-bg);
    align-content: center;
    gap: 0.5rem;
  }

  .week-event strong {
    overflow-wrap: anywhere;
    font-size: 0.8rem;
    font-weight: 680;
    line-height: 1.38;
  }

  .week-event span {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 620;
  }

  .timetable-actions {
    position: static;
    display: flex;
    width: auto;
    margin: 1.65rem 0 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    backdrop-filter: none;
    justify-content: flex-end;
  }

  .timetable-actions .primary-button,
  .timetable-actions .secondary-button {
    min-width: 10.5rem;
  }

  .offline-toast {
    right: 1.5rem;
    bottom: 1.5rem;
    left: auto;
    width: 17rem;
  }
}

/* Step navigation and compact timetable header */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.app-bar {
  padding-bottom: 0;
}

.brand-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-title {
  display: inline-flex;
  min-width: 0;
  align-items: baseline;
  gap: 0.34rem;
}

.brand-title a {
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-title a:hover {
  color: var(--blue-dark);
}

.brand-home-link {
  flex: 0 0 auto;
  font-weight: 780;
}

.brand-app-link {
  min-width: 0;
}

.brand .brand-separator {
  display: inline-block;
  min-width: 0.45em;
  overflow: visible;
  flex: 0 0 auto;
  color: var(--muted);
  font-weight: 520;
  line-height: 1;
  text-align: center;
  text-overflow: clip;
}

.brand .brand-title {
  overflow: visible;
  text-overflow: clip;
}

.brand-term {
  flex: 0 0 auto;
  padding-left: 0.62rem;
  border-left: 1px solid var(--line-strong);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 680;
  letter-spacing: 0;
  white-space: nowrap;
}

.header-save-status {
  display: inline-flex;
  padding-left: 0.62rem;
  flex: 0 0 auto;
  border-left: 1px solid var(--line-strong);
  font-size: 0.68rem;
  gap: 0;
  white-space: nowrap;
}

.header-save-status::before {
  display: none;
}

.progress-nav {
  display: flex;
  width: 100%;
  min-height: 2.7rem;
  margin: 0 auto;
  align-items: center;
  gap: 0.25rem;
}

.app-bar-lower {
  display: flex;
  width: 100%;
  margin: 0 auto;
  align-items: center;
  gap: 0.55rem;
}

.app-bar-lower .progress-nav {
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
}

.contact-link {
  display: inline-flex;
  min-height: 2.15rem;
  padding: 0.4rem 0.65rem;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 0.68rem;
  background: var(--white);
  color: var(--blue-dark);
  font-size: 0.67rem;
  font-weight: 720;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  align-items: center;
  justify-content: center;
}

.contact-link:hover {
  border-color: #9fb5d5;
  background: var(--blue-pale);
}

.contact-link-top {
  display: none;
}

.contact-link-mobile {
  display: inline-flex;
}

.progress-nav button {
  min-height: 2.7rem;
  padding: 0.25rem 0.42rem;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 680;
}

.progress-nav button:hover,
.progress-nav button.is-active {
  color: var(--blue-dark);
}

.progress-nav button.is-active {
  border-bottom-color: var(--blue);
}

.progress-nav > span {
  color: #a9b4c3;
  font-size: 0.9rem;
}

main,
.screen {
  min-height: calc(100dvh - 7.2rem);
}

.setup-screen h1 {
  margin-top: 0.15rem;
}

.screen-profile {
  display: inline-flex;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
}

.choices-screen h1 {
  margin-top: 0.55rem;
}

.included {
  margin-top: 1.8rem;
}

.included h2 {
  margin: 0;
  padding: 0 0 0.7rem;
  border-bottom: 1px solid var(--line);
  color: #34445e;
  font-size: 0.82rem;
  font-weight: 700;
}

.included-item {
  display: grid;
  min-height: 3.9rem;
  padding: 0.72rem 0.8rem;
  border-bottom: 1px solid var(--line);
  background: rgb(255 255 255 / 58%);
  grid-template-columns: 1.35rem minmax(0, 1fr);
  align-items: center;
  gap: 0.75rem;
}

.included-mark {
  display: grid;
  width: 1.22rem;
  height: 1.22rem;
  border-radius: 50%;
  background: var(--green-pale);
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 800;
  place-items: center;
}

.included-copy {
  display: grid;
  min-width: 0;
  gap: 0.18rem;
}

.included-copy strong {
  font-size: 0.84rem;
  font-weight: 650;
  line-height: 1.3;
}

.included-copy span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 560;
}

.timetable-screen {
  padding-top: 1.25rem;
}

.timetable-actions {
  grid-template-columns: 1fr;
}

@media (max-width: 27rem) {
  .brand {
    gap: 0.34rem;
  }

  .brand-term {
    padding-left: 0.48rem;
    font-size: 0.64rem;
  }

  .brand-title {
    gap: 0.25rem;
  }

  .brand-home-link {
    font-size: 0.86rem;
  }

  .brand-app-link {
    font-size: 0.82rem;
  }

  .header-save-status {
    padding-left: 0.36rem;
    font-size: 0.53rem;
  }

  .app-bar-lower {
    gap: 0.22rem;
  }

  .progress-nav {
    gap: 0.08rem;
  }

  .progress-nav button {
    padding-inline: 0.24rem;
    font-size: 0.66rem;
  }

  .contact-link {
    max-width: 8.7rem;
    padding-inline: 0.42rem;
    font-size: 0.61rem;
  }

}

@media (max-width: 23.75rem) {
  .brand {
    display: grid;
    width: 100%;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 0.16rem 0;
  }

  .brand-title {
    grid-column: 1 / -1;
  }

  .brand-term {
    padding-left: 0;
    border-left: 0;
    grid-column: 1;
  }

  .header-save-status {
    grid-column: 2;
    justify-self: start;
  }
}

@media (min-width: 64rem) {
  .app-bar-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .brand {
    grid-column: 1;
    justify-self: start;
  }

  .contact-link-top {
    display: inline-flex;
    grid-column: 2;
    justify-self: center;
  }

  .contact-link-mobile {
    display: none;
  }

  .app-bar-lower {
    display: flex;
    width: min(100%, 90rem);
    justify-content: flex-start;
  }

  .app-bar-lower .progress-nav {
    width: auto;
    margin: 0;
    flex: 0 0 auto;
    justify-content: flex-start;
  }

  .progress-nav {
    width: min(100%, 90rem);
  }

  .progress-nav button {
    padding-inline: 0.55rem;
    font-size: 0.75rem;
  }

  .timetable-screen {
    padding-top: 1.7rem;
  }

  .timetable-actions .primary-button {
    min-width: 11.5rem;
  }
}
