:root {
  color-scheme: dark;
  --bg: #07101d;
  --surface: #0d1a2a;
  --surface-raised: #132338;
  --border: #29415c;
  --border-strong: #42678d;
  --text: #f2f7fb;
  --muted: #a8b8c8;
  --accent: #4da3ff;
  --accent-hover: #78b9ff;
  --teal: #4fd1b5;
  --warning: #f2c14e;
  --danger: #ff6b7a;
  --focus: #ffe08a;
  --radius: 6px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
  line-height: 1.5;
}

a {
  color: var(--accent-hover);
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
a {
  touch-action: manipulation;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.app-bar {
  min-height: 60px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: #091523;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.app-bar nav,
.app-bar nav form {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
}

.page {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.auth-page {
  width: min(480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.auth-shell {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 20px 50px rgb(0 0 0 / 25%);
}

.login-section {
  padding: 28px;
}

.login-section h1,
.login-section h2 {
  margin: 0 0 22px;
  font-size: 1.35rem;
}

.auth-shell hr {
  margin: 0 28px;
  border: 0;
  border-top: 1px solid var(--border-strong);
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: 2rem;
  line-height: 1.15;
}

h2 {
  margin: 0;
  font-size: 1.2rem;
}

.page-heading,
.section-heading,
.section-band.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.page-heading {
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
}

.muted {
  display: block;
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.field {
  margin-bottom: 17px;
}

.field label {
  display: block;
  margin-bottom: 6px;
  color: #dce8f2;
  font-size: 0.9rem;
  font-weight: 650;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 46px;
  padding: 9px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: #081522;
  color: var(--text);
}

.field input[type="color"] {
  padding: 5px;
}

.field-invalid input,
.field-invalid select,
.field-invalid textarea {
  border-color: var(--danger);
}

.field-error,
.form-status.is-error {
  margin: 5px 0 0;
  color: #ff9daa;
  font-size: 0.86rem;
}

.field-help,
.form-status {
  min-height: 1.25rem;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.check-field {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 44px;
  padding: 9px 0;
  color: var(--text);
  cursor: pointer;
}

.check-field input {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 1px 0 0;
}

.choice-group {
  margin: 20px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.choice-group legend {
  padding: 0 6px;
  font-weight: 700;
}

.button-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  min-height: 44px;
  padding: 10px 15px;
  border: 1px solid transparent;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  cursor: pointer;
}

.button-primary {
  background: #1675d1;
  border-color: #2e94ef;
}

.button-primary:hover {
  background: #2386e3;
}

.button-secondary {
  background: var(--surface-raised);
  border-color: var(--border-strong);
}

.button-quiet,
.button-danger-quiet {
  min-height: 40px;
  padding: 7px 10px;
  background: transparent;
  border-color: var(--border);
}

.button-danger,
.button-danger-quiet {
  border-color: #8f3f4a;
  color: #ffc5cc;
}

.button-danger {
  background: #7e2735;
}

.messages {
  margin-bottom: 18px;
}

.message {
  margin: 0 0 14px;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: 4px;
  background: var(--surface-raised);
}

.message-error {
  border-left-color: var(--danger);
}

.message-warning {
  border-left-color: var(--warning);
}

.message-success {
  border-left-color: var(--teal);
}

.schedule-refresh-banner {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.schedule-refresh-banner[hidden] {
  display: none;
}

.schedule-refresh-banner .button {
  flex: 0 0 auto;
}

.conflict-comparison {
  margin: 12px 0;
  overflow-x: auto;
}

.conflict-comparison table {
  width: 100%;
  min-width: 560px;
  border-collapse: collapse;
}

.conflict-comparison th,
.conflict-comparison td {
  padding: 8px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.conflict-comparison thead th {
  background: var(--surface);
}

.section-band {
  margin-top: 22px;
  padding: 22px 0;
  border-top: 1px solid var(--border);
}

.section-band.compact {
  padding: 20px 0;
}

.item-list {
  margin: 17px 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.item-list li {
  min-height: 64px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.inline-form {
  margin-top: 20px;
  display: grid;
  grid-template-columns: minmax(180px, 320px) auto;
  align-items: end;
  gap: 12px;
}

.inline-form .field {
  margin: 0;
}

.colour-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.colour-form input[type="color"] {
  width: 52px;
  height: 44px;
  padding: 4px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--surface-raised);
}

.user-colour,
.small-swatch {
  flex: 0 0 auto;
  background: var(--user-colour);
  border: 2px solid #fff;
}

.user-colour {
  width: 42px;
  height: 42px;
  border-radius: 50%;
}

.small-swatch {
  width: 18px;
  height: 18px;
  border-radius: 3px;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.8fr);
  gap: 40px;
}

.form-page {
  width: min(560px, 100%);
}

.form-page.wide {
  width: min(760px, 100%);
}

.stacked-form {
  margin-top: 20px;
}

.status-cluster {
  display: flex;
  gap: 8px;
}

.status,
.count {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 750;
}

.status-good {
  border-color: #287c6c;
  color: #8ce9d4;
}

.status-danger {
  border-color: #8f3f4a;
  color: #ffc5cc;
}

.empty-state {
  color: var(--muted);
}

.enrollment-layout {
  margin-top: 25px;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  align-items: start;
  gap: 30px;
}

.totp-qr {
  width: 230px;
  height: 230px;
  padding: 8px;
  border-radius: 4px;
  background: #fff;
}

.secret-value {
  margin: 20px 0;
}

.secret-value span {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.secret-value code {
  display: block;
  margin-top: 5px;
  font-size: 1rem;
  word-break: break-all;
}

.recovery-codes {
  margin: 24px 0;
  padding: 18px 18px 18px 50px;
  columns: 2;
  border: 1px solid var(--border-strong);
  background: #081522;
}

.recovery-codes li {
  padding: 5px;
  break-inside: avoid;
}

.check-field {
  margin: 20px 0;
  display: grid;
  grid-template-columns: 24px 1fr;
  align-items: start;
  gap: 8px;
}

.check-field input {
  width: 20px;
  height: 20px;
}

.advanced-options {
  margin: 20px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.advanced-options summary {
  min-height: 44px;
  padding: 11px 2px;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

.advanced-options-body {
  padding: 2px 0 4px;
}

.entry-modal {
  appearance: none;
  margin: auto;
  width: min(720px, calc(100% - 24px));
  max-height: min(860px, calc(100dvh - 24px));
  padding: 0;
  border: 1px solid var(--border-strong);
  outline: 0;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 70px rgb(0 0 0 / 55%);
  overflow: hidden;
}

.entry-modal::backdrop {
  background: rgb(2 8 15 / 78%);
}

.entry-modal-panel {
  max-height: calc(100dvh - 26px);
  padding: 20px;
  overflow-y: auto;
}

.entry-form-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
}

.entry-form-heading h1,
.entry-form-heading h2 {
  margin-bottom: 0;
}

.modal-close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: var(--surface-raised);
}

.modal-loading {
  margin: 0;
  padding: 28px;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.schedule-page {
  width: 100%;
  padding: 24px 0 56px;
}

.schedule-heading,
.schedule-page > .message,
.schedule-navigation,
.timetable {
  width: min(1440px, calc(100% - 32px));
  margin-right: auto;
  margin-left: auto;
}

.schedule-heading {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.schedule-list,
.member-order {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.schedule-list {
  border-top: 1px solid var(--border);
}

.schedule-list li {
  border-bottom: 1px solid var(--border);
}

.schedule-list a {
  min-height: 72px;
  padding: 12px 10px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, auto) minmax(120px, auto);
  align-items: center;
  gap: 16px;
  color: var(--text);
  text-decoration: none;
}

.schedule-list a:hover {
  background: var(--surface);
}

.schedule-list a > span:not(.status) {
  color: var(--muted);
  font-size: 0.9rem;
}

.schedule-list-archived {
  opacity: 0.82;
}

.schedule-list-admin .status {
  justify-self: end;
}

.status-active {
  border-color: #287c6c;
  color: #8ce9d4;
}

.status-archived {
  border-color: var(--border-strong);
  color: var(--muted);
}

.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.member-order {
  border-top: 1px solid var(--border);
}

.member-order > li {
  min-height: 68px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
}

.order-number {
  width: 24px;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.icon-actions,
.icon-actions form {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
}

.icon-button {
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text);
  font-size: 1.2rem;
  cursor: pointer;
}

.icon-button:disabled {
  opacity: 0.3;
  cursor: default;
}

.schedule-navigation {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.day-tabs {
  min-width: 0;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-color: var(--border-strong) var(--surface);
}

.day-tabs a {
  min-width: max-content;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid transparent;
  border-bottom-color: var(--border);
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.day-tabs a.selected {
  border-color: var(--border-strong);
  border-bottom-color: var(--accent);
  background: var(--surface-raised);
  color: var(--text);
}

.timetable-toolbar {
  padding-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.view-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.segmented-control {
  min-height: 52px;
  padding: 3px;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  display: flex;
  background: var(--surface);
}

.segmented-control button {
  min-width: 68px;
  min-height: 44px;
  padding: 5px 9px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.segmented-control button[aria-pressed="true"] {
  background: #1b5483;
  color: var(--text);
}

.timetable {
  --day-height: var(--day-height-hour);
  --lane-width: 220px;
  --time-axis-width: 62px;
  --lane-header-height: 56px;
  margin-top: 4px;
}

.timetable[data-density="half-hour"] {
  --day-height: var(--day-height-half);
}

.timetable-scroll {
  max-height: max(480px, calc(100dvh - 230px));
  border: 1px solid var(--border);
  background: #081522;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: var(--border-strong) var(--surface);
}

.timetable-canvas {
  position: relative;
  width: max(100%, var(--canvas-width));
  min-height: calc(var(--lane-header-height) + var(--day-height));
  display: grid;
  grid-template-columns: var(--time-axis-width) 0 minmax(0, 1fr);
  align-items: start;
}

.timetable[data-view-mode="focused"] .timetable-canvas,
.timetable[data-view-mode="combined"] .timetable-canvas {
  width: 100%;
}

.time-axis {
  position: sticky;
  left: 0;
  z-index: 8;
  grid-column: 1;
  width: var(--time-axis-width);
  background: #091523;
}

.axis-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--lane-header-height);
  border-bottom: 1px solid var(--border-strong);
  background: #091523;
}

.time-axis-body,
.lane-body,
.overview-body {
  position: relative;
  height: var(--day-height);
}

.time-axis-body {
  border-right: 1px solid var(--border-strong);
}

.time-tick {
  position: absolute;
  top: var(--tick-top);
  right: 0;
  left: 0;
  height: 1px;
  border-top: 1px solid var(--border);
}

.time-tick span {
  position: absolute;
  top: -0.72em;
  right: 7px;
  padding: 0 3px;
  background: #091523;
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.time-tick:first-child span {
  top: 3px;
}

.time-tick:last-child span {
  top: auto;
  bottom: 3px;
}

.time-tick.minor span {
  display: none;
}

.timetable[data-density="half-hour"] .time-tick.minor span {
  display: block;
  color: #7f94a8;
}

.user-lanes {
  grid-column: 3;
  display: grid;
  grid-template-columns: repeat(var(--lane-count), minmax(var(--lane-width), 1fr));
}

.timetable[data-view-mode="focused"] .user-lanes {
  grid-template-columns: minmax(var(--lane-width), 1fr);
}

.timetable[data-view-mode="focused"] .user-lane:not(.is-focused),
.timetable[data-view-mode="combined"] .user-lanes {
  display: none;
}

.user-lane {
  min-width: 0;
  border-right: 1px solid var(--border);
  background: #0a1928;
  background: color-mix(in srgb, var(--user-colour) 6%, #081522);
}

.user-lane:first-child {
  border-left: 1px solid var(--border);
}

.lane-header {
  position: sticky;
  top: 0;
  z-index: 6;
  height: var(--lane-header-height);
  padding: 0;
  border-bottom: 1px solid var(--border-strong);
  background: #142b42;
  background: color-mix(in srgb, var(--user-colour) 38%, #07101d);
  display: flex;
  align-items: center;
  overflow: hidden;
}

.lane-focus {
  width: 100%;
  height: 100%;
  padding: 9px 10px;
  border: 0;
  background: transparent;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  text-align: left;
  cursor: pointer;
}

.lane-focus:hover {
  background: rgb(255 255 255 / 8%);
}

.lane-focus:focus-visible {
  outline-offset: -3px;
}

.lane-focus strong,
.combined-lane-header strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lane-body {
  background: #0a1928;
  background: color-mix(in srgb, var(--user-colour) 6%, #081522);
}

.combined-lane {
  min-width: 0;
  grid-column: 3;
  border-right: 1px solid var(--border);
  border-left: 1px solid var(--border);
}

.combined-lane[hidden] {
  display: none;
}

.combined-lane-header {
  padding: 9px 12px;
  background: #17324a;
}

.combined-lane .lane-body {
  background: #081522;
}

.lane-grid-line {
  position: absolute;
  z-index: 0;
  top: var(--tick-top);
  right: 0;
  left: 0;
  border-top: 1px solid rgb(66 103 141 / 18%);
  pointer-events: none;
}

.lane-grid-line.major {
  border-top-color: rgb(66 103 141 / 42%);
}

.lane-body[data-own-lane] {
  cursor: crosshair;
}

.lane-body[data-own-lane]:focus-visible {
  outline-offset: -4px;
}

.entry-block {
  position: absolute;
  z-index: 2;
  top: var(--entry-top);
  left: calc(var(--entry-left) + 3px);
  width: calc(var(--entry-width) - 6px);
  height: max(var(--entry-height), 18px);
  min-width: 0;
  padding: 5px 6px;
  border: 2px solid var(--entry-colour);
  border-radius: 4px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: min-content min-content;
  gap: 1px 4px;
  background: color-mix(in srgb, var(--entry-colour) 78%, #0d1a2a);
  color: var(--entry-text);
  text-decoration: none;
  overflow: hidden;
}

a.entry-block:hover,
a.entry-block:focus-visible {
  z-index: 5;
  filter: brightness(1.12);
}

.entry-prep {
  border-style: dashed;
}

.entry-important {
  box-shadow: inset 0 0 0 1px currentColor;
}

.entry-joined::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: currentColor;
  content: "";
  opacity: 0.7;
}

.entry-title,
.entry-time {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.entry-title {
  font-size: 0.82rem;
  font-weight: 800;
}

.entry-time {
  grid-column: 1;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.entry-icons {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: flex;
  align-items: start;
  gap: 3px;
  font-size: 0.7rem;
  font-weight: 900;
}

.entry-icons span {
  min-width: 16px;
  height: 16px;
  border: 1px solid currentColor;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
}

.entry-private:not(.entry-masked) {
  background-image: linear-gradient(
    135deg,
    transparent 0 45%,
    rgb(255 255 255 / 10%) 45% 55%,
    transparent 55% 100%
  );
  background-size: 9px 9px;
}

.entry-masked {
  border-style: solid;
}

.entry-short {
  padding-top: 1px;
  padding-bottom: 1px;
  grid-template-rows: 1fr;
}

.entry-short .entry-time,
.entry-short .entry-icons {
  display: none;
}

.continuation {
  position: absolute;
  left: 50%;
  z-index: 2;
  font-size: 0.55rem;
  line-height: 1;
  transform: translateX(-50%);
}

.continuation-top {
  top: 1px;
}

.continuation-bottom {
  bottom: 1px;
}

.current-time-line {
  position: absolute;
  z-index: 7;
  right: 0;
  left: var(--time-axis-width);
  height: 2px;
  background: #ff6b7a;
  box-shadow: 0 0 0 1px rgb(7 16 29 / 55%);
  pointer-events: none;
}

.current-time-line span {
  position: absolute;
  top: -10px;
  left: 3px;
  padding: 1px 5px;
  border-radius: 3px;
  background: #a82f42;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
}

.personal-overview {
  position: sticky;
  left: var(--time-axis-width);
  z-index: 9;
  grid-column: 2;
  width: 18px;
  height: calc(var(--lane-header-height) + var(--day-height));
  padding: 0;
  border: 0;
  border-right: 1px solid #80bfff;
  border-left: 1px solid #80bfff;
  background: #0b2033;
  color: var(--text);
  overflow: visible;
}

.personal-overview[hidden] {
  display: none;
}

.overview-return {
  position: sticky;
  top: 5px;
  z-index: 2;
  width: 16px;
  min-width: 16px;
  height: 44px;
  padding: 0;
  border: 0;
  display: grid;
  place-items: center;
  background: #164c78;
  color: var(--text);
  cursor: pointer;
  font-size: 0.9rem;
}

.overview-body {
  position: absolute;
  top: var(--lane-header-height);
  right: 1px;
  left: 1px;
  overflow: hidden;
}

.overview-entry {
  position: absolute;
  top: var(--entry-top);
  left: var(--entry-left);
  width: var(--entry-width);
  height: max(var(--entry-height), 3px);
  border: 1px solid var(--entry-colour);
  background: var(--entry-colour);
}

.overview-entry-prep {
  background: transparent;
  border-style: dashed;
}

.overview-entry-important::after {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    transparent 0 3px,
    #fff 3px 4px
  );
  content: "";
}

.entry-detail {
  width: min(760px, 100%);
}

.entry-colour-swatch {
  width: 42px;
  height: 42px;
  border: 3px solid var(--entry-colour);
  border-radius: 4px;
  background: color-mix(in srgb, var(--entry-colour) 35%, var(--surface));
}

.detail-list {
  margin: 24px 0;
  border-top: 1px solid var(--border);
}

.detail-list > div {
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(100px, 150px) minmax(0, 1fr);
  gap: 12px;
}

.detail-list dt {
  color: var(--muted);
  font-weight: 700;
}

.detail-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.preserve-lines {
  white-space: pre-wrap;
}

.history-list {
  margin: 22px 0;
  padding: 0;
  border-top: 1px solid var(--border);
  list-style: none;
}

.history-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: minmax(140px, 1fr) auto;
  gap: 2px 16px;
}

.history-list li span {
  color: var(--muted);
  font-size: 0.88rem;
}

.privacy-confirmation {
  margin: 22px 0;
  padding: 16px;
  border: 1px solid var(--warning);
  border-radius: var(--radius);
  background: #1c2130;
}

.privacy-confirmation h2 {
  font-size: 1rem;
}

@media (max-width: 760px) {
  .app-bar {
    padding: 0 14px;
  }

  .brand {
    max-width: 170px;
    line-height: 1.2;
  }

  .page {
    width: min(100% - 24px, 1180px);
    padding-top: 24px;
  }

  .schedule-heading,
  .schedule-page > .message,
  .schedule-navigation,
  .timetable {
    width: calc(100% - 24px);
  }

  .schedule-navigation {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
  }

  .timetable-toolbar {
    padding-bottom: 0;
    justify-content: space-between;
  }

  .timetable {
    --lane-width: 190px;
    --time-axis-width: 58px;
    --canvas-width: var(--canvas-width-tablet);
  }

  .timetable-scroll {
    max-height: max(440px, calc(100dvh - 245px));
  }

  .admin-layout,
  .enrollment-layout {
    grid-template-columns: 1fr;
    gap: 18px;
  }

  .totp-qr {
    width: min(230px, 100%);
    height: auto;
  }

  .schedule-list a {
    grid-template-columns: 1fr auto;
  }

  .schedule-list a > span:nth-child(2) {
    grid-column: 1;
  }

  .schedule-list a > span:last-child {
    grid-column: 2;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 520px) {
  .auth-page {
    width: 100%;
    padding: 0;
  }

  .auth-shell {
    min-height: calc(100vh - 60px);
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .login-section {
    padding: 24px 18px;
  }

  .page-heading,
  .section-band.compact,
  .schedule-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .field-pair {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .member-order > li {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .member-order .icon-actions {
    width: 100%;
    padding-left: 36px;
  }

  .button-row .button,
  .inline-form .button {
    width: 100%;
  }

  .schedule-actions {
    width: 100%;
  }

  .schedule-actions .button {
    width: 100%;
  }

  .timetable {
    --lane-width: 170px;
    --time-axis-width: 54px;
    --canvas-width: var(--canvas-width-mobile);
  }

  .segmented-control {
    flex: 1;
  }

  .segmented-control button {
    min-width: 0;
    flex: 1;
  }

  .time-tick span {
    right: 4px;
    font-size: 0.66rem;
  }

  .inline-form {
    grid-template-columns: 1fr;
  }

  .item-list li {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .item-list .button {
    margin-left: auto;
  }

  .recovery-codes {
    columns: 1;
  }
}

@media (max-height: 520px) and (orientation: landscape) {
  .schedule-page {
    padding-top: 12px;
  }

  .schedule-heading {
    margin-bottom: 8px;
  }

  .schedule-heading h1 {
    font-size: 1.5rem;
  }

  .schedule-heading .muted {
    font-size: 0.8rem;
  }

  .timetable-toolbar {
    padding-bottom: 0;
  }

  .timetable-scroll {
    max-height: calc(100dvh - 190px);
  }
}

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

@media print {
  :root {
    color-scheme: light;
  }

  body {
    background: #fff;
    color: #000;
  }

  .app-bar,
  .print-hidden,
  .message {
    display: none !important;
  }

  .recovery-codes {
    border-color: #000;
    background: #fff;
  }
}
