:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-soft: #f8fafc;
  --surface-muted: #eef2f6;
  --line: #dde3ea;
  --line-strong: #c8d1dc;
  --text: #111827;
  --muted: #687385;
  --blue: #2563eb;
  --red: #dc2626;
  --green: #18794e;
  --rest-bg: #eef8f1;
  --rest-bg-muted: #f5fbf6;
  --amber: #b7791f;
  --shadow: 0 14px 34px rgba(17, 24, 39, 0.08);
  --button-shadow: 0 7px 16px rgba(17, 24, 39, 0.08);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.shell {
  width: min(1180px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 24px 0 34px;
}

.topbar,
.toolbar,
.legend,
.calendar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  font-size: 18px;
  letter-spacing: 0;
}

.subtle {
  color: var(--muted);
  font-size: 13px;
}

.session {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.toolbar {
  margin-top: 14px;
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  padding: 10px;
}

.month-title {
  text-align: center;
  display: grid;
  gap: 2px;
}

.month-title strong {
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0;
}

.icon-button,
.secondary,
.primary {
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  min-height: 36px;
}

.icon-button {
  width: 36px;
  font-size: 24px;
  line-height: 1;
}

.secondary {
  padding: 0 12px;
}

.primary {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
  padding: 0 14px;
  font-weight: 650;
}

.icon-button:hover:not(:disabled),
.secondary:hover,
.primary:hover {
  box-shadow: var(--button-shadow);
  transform: translateY(-1px);
}

.banner {
  margin-top: 14px;
  border: 1px solid #efd28a;
  background: #fff8df;
  color: #6f4f00;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.legend {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  padding: 11px 12px;
  color: var(--muted);
  font-size: 13px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rest-mark {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  font-style: normal;
  font-size: 12px;
  font-weight: 750;
}

.rest-mark {
  color: var(--green);
  background: #dff3e5;
}

.ticket {
  display: inline-block;
  width: 22px;
  height: 12px;
  border-radius: 4px;
}

.ticket.purchased {
  background: var(--blue);
}

.ticket.unpurchased {
  background: var(--red);
}

.ticket.waitlisted {
  background: var(--amber);
}

.calendar {
  margin-top: 14px;
  overflow: hidden;
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.06);
}

.weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.weekdays span {
  padding: 11px 6px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.day {
  min-height: 134px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 8px;
  transition: background-color 140ms ease, box-shadow 140ms ease;
}

.day:nth-child(7n) {
  border-right: 0;
}

.day.rest-day {
  background: var(--rest-bg);
}

.day.outside {
  background: #f9fafb;
  color: #8a95a5;
}

.day.outside.rest-day {
  background: var(--rest-bg-muted);
}

.day:hover {
  box-shadow: inset 0 0 0 1px var(--line-strong);
}

.day.today {
  box-shadow: inset 0 0 0 2px rgba(37, 99, 235, 0.5);
}

.day-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.day-number {
  font-size: 18px;
  font-weight: 750;
  line-height: 1;
}

.badges {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.holiday-name {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.tickets {
  display: grid;
  gap: 6px;
  align-self: end;
}

.ticket-button {
  width: 100%;
  min-height: 33px;
  border: 0;
  border-radius: 7px;
  color: #fff;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  text-align: left;
  font-size: 12px;
  box-shadow: 0 5px 12px rgba(17, 24, 39, 0.08);
}

.ticket-button.purchased {
  background: var(--blue);
}

.ticket-button.unpurchased {
  background: var(--red);
}

.ticket-button.waitlisted {
  background: var(--amber);
}

.ticket-button:hover {
  filter: brightness(0.96);
}

.ticket-button .route {
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ticket-button .status {
  font-weight: 750;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(17, 24, 39, 0.42);
  padding: 16px;
}

.dialog {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  display: grid;
  gap: 14px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
}

input:focus {
  outline: 2px solid rgba(37, 99, 235, 0.22);
  border-color: var(--blue);
}

.form-error {
  color: var(--red);
  font-size: 13px;
}

@media (max-width: 820px) {
  .shell {
    width: min(100vw - 16px, 680px);
    padding-top: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .session {
    width: 100%;
    justify-content: space-between;
  }

  .calendar {
    overflow-x: auto;
  }

  .weekdays,
  .grid {
    min-width: 760px;
  }

  .day {
    min-height: 128px;
  }
}
