:root {
  color-scheme: light;
  font-family: system-ui, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  font-size: 16px;
  --ink: #17243b;
  --muted: #445570;
  --navy: #153a69;
  --action: #185ba8;
  --canvas: #f2f5fa;
  --surface: #fff;
  --line: #dce3ed;
  --space-field: 16px;
  --space-group: 32px;
  --space-section: 40px;
  color: #17243b;
  background: #f2f5fa;
}
* { box-sizing: border-box; }
body { margin: 0; line-height: 1.6; }
header {
  background: #153a69; color: #fff;
  padding: 20px max(20px, calc((100vw - 1200px) / 2));
  display: flex; gap: 16px; align-items: center; flex-wrap: wrap;
}
h1 { font-size: 1.75rem; line-height: 1.25; margin: 0; }
main { max-width: 1240px; margin: auto; padding: 24px 20px 40px; }
section {
  background: #fff; border: 1px solid #dce3ed;
  border-radius: 12px; padding: 24px; margin: 24px 0;
}
h2 { font-size: 1.375rem; line-height: 1.35; margin: 0 0 16px; }
p { line-height: 1.7; word-break: keep-all; overflow-wrap: anywhere; margin: 12px 0; }
#register-form button { color: #153a69; background: #fff; border: 1px solid #aab8ca; }
#register-form button:hover:not(:disabled) { background: #f2f5fa; }
section > p { max-width: 72ch; }
label { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; font-weight: 600; }
input, select, button {
  font: inherit; min-height: 44px; min-width: 44px;
  border-radius: 6px; padding: 10px 12px; border: 1px solid #aab8ca;
}
button { cursor: pointer; background: #185ba8; color: #fff; border: 0; margin: 6px 8px 6px 0; }
input, select { width: 100%; max-width: 100%; background: #fff; color: #17243b; font-weight: 400; }
#credentials-form, #ntfy-form { max-width: 640px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px 20px; align-items: end; }
.grid > * { min-width: 0; }
.grid button { margin-bottom: 12px; }
.check { flex-direction: row; align-items: center; min-height: 44px; font-weight: 400; }
.check input { width: 44px; flex: 0 0 44px; margin: 0; }
article { padding: 20px; margin: 16px 0; border: 1px solid #dce3ed; border-radius: 8px; }
article h3 { font-size: 1.125rem; line-height: 1.5; margin: 0 0 12px; overflow-wrap: anywhere; }
article p { max-width: 72ch; }
.notice { border: 1px solid #d2ad69; padding: 16px; background: #fff4dc; }
.reservation-details {
  white-space: pre-wrap; line-height: 1.8;
  padding: 16px; max-width: 760px;
  background: #f2f5fa; border: 1px solid #dce3ed; border-radius: 6px;
  font-variant-numeric: tabular-nums;
}
#message { white-space: pre-wrap; color: #753a00; }
#message:empty { display: none; }
a { display: block; overflow-wrap: anywhere; margin: 12px 0; color: #185ba8; text-underline-offset: 3px; }
.official-ticket { min-height: 44px; padding: 10px 0; font-weight: 600; }
#topic { display: inline-flex; justify-content: center; align-items: center; min-height: 44px; min-width: 44px; padding: 10px 12px; margin: 6px 8px 6px 0; border-radius: 6px; background: #185ba8; color: #fff; text-decoration: none; cursor: pointer; }
#topic:hover { background: #153a69; }
#topic:active { background: #17243b; }
#setup-link { user-select: all; }
#auth { max-width: 640px; margin: 28px auto; padding: 32px; }
#auth h2 { margin-bottom: 24px; }
#auth label { margin: 0 0 16px; }
#auth form button { width: 100%; margin: 8px 0 0; }
#registration { margin-top: 40px; padding-top: 40px; border-top: 1px solid #dce3ed; }
#registration > p { color: #445570; margin: 16px 0 0; }
@media (min-width: 900px) {
  #auth { max-width: 960px; display: grid; grid-template-columns: 1fr 1fr; gap: 64px; padding: 40px; }
  #auth { position: relative; }
  #registration { margin: 0; padding: 0; border: 0; }
  #registration::before { content: ''; position: absolute; top: 40px; bottom: 40px; left: 50%; border-left: 1px solid #dce3ed; }
  #auth:has(#registration[hidden]) { display: block; max-width: 480px; }
}
@media (max-width: 520px) { #auth { padding: 28px 20px; } }
#roster p { padding: 12px 0; margin: 0; border-bottom: 1px solid #dce3ed; font-variant-numeric: tabular-nums; }
#roster p:last-child { border: 0; }
[hidden] { display: none !important; }
input:focus, select:focus, button:focus, a:focus {
  outline: 3px solid #185ba8; outline-offset: 3px;
}
header button:focus { outline-color: #fff; }
button:hover:not(:disabled) { background: #153a69; }
button:active:not(:disabled) { background: #17243b; }
a:hover { color: #153a69; }
button:disabled { background: #dce3ed; color: #445570; opacity: 1; cursor: not-allowed; }
input:disabled, select:disabled { background: #f2f5fa; color: #445570; opacity: 1; cursor: not-allowed; }
input::placeholder { color: #56657a; opacity: 1; }
input { caret-color: #185ba8; }
::selection { color: #fff; background: #153a69; }
.ios-guide { margin-top: 24px; border-top: 1px solid #dce3ed; padding-top: 16px; }
.ios-guide summary { min-height: 44px; padding: 10px 0; cursor: pointer; font-weight: 700; color: #185ba8; }
.ios-guide summary:focus-visible { outline: 3px solid #185ba8; outline-offset: 3px; }
.ios-guide-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-left: 24px; }
.ios-guide-steps li { min-width: 0; padding-left: 4px; }
.ios-guide h3 { font-size: 1.125rem; margin: 16px 0 8px; }
.ios-guide img { display: block; width: 100%; max-width: 290px; height: auto; margin: 16px auto; border: 1px solid #dce3ed; border-radius: 10px; }
.ios-guide p { word-break: keep-all; overflow-wrap: anywhere; }
.guide-caption { color: var(--muted); font-size: 1rem; }
.ios-guide code { overflow-wrap: anywhere; }
@media (max-width: 800px) { .ios-guide-steps { grid-template-columns: 1fr; } }
@media (max-width: 520px) {
  main { padding: 16px 12px 32px; }
  section { padding: 20px 16px; }
  article { padding: 16px; }
  .grid { grid-template-columns: 1fr; }
  button, #topic { width: 100%; margin-right: 0; }
  header button { width: auto; }
  header { padding: 20px 18px; gap: 12px 16px; }
}

/* Operate layout: frequent work first, account and notification setup second. */
#who { margin-left: auto; overflow-wrap: anywhere; }
.booking-layout, .booking-main, .booking-settings { display: grid; gap: var(--space-section); min-width: 0; align-content: start; }
.booking-layout { margin-top: var(--space-group); }
.booking-layout section { margin: 0; min-width: 0; }
.booking-layout section > p { color: var(--muted); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: var(--space-field); margin-bottom: 24px; }
.section-heading h2 { margin: 0; }
#refresh { width: auto; flex: 0 0 auto; margin: 0; }
#refresh, #logout, #test-notify, #credentials-form button, #ntfy-form button {
  color: var(--navy); background: var(--surface); border: 1px solid #aab8ca;
}
#refresh:hover, #logout:hover, #test-notify:hover, #credentials-form button:hover, #ntfy-form button:hover { background: var(--canvas); }
#jobs > p { margin: 0; padding: 16px 0; color: var(--muted); }
#jobs article { margin: 24px 0 0; padding: 24px 0 0; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
#jobs article:first-child { margin-top: 0; }
#jobs article button { background: var(--surface); color: var(--navy); border: 1px solid #aab8ca; }
#jobs article button:hover { background: var(--canvas); }
.booking-form { margin-top: 24px; }
.booking-form fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.booking-form fieldset + fieldset { margin-top: var(--space-group); }
.booking-form legend { padding: 0; margin-bottom: 12px; color: var(--navy); font-size: 1.125rem; font-weight: 700; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-field); }
.field-row > * { min-width: 0; }
.field-row label { margin: 0; }
.date-field { grid-column: 1 / -1; }
.passenger-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.booking-form > .check { margin: 24px 0 16px; }
.booking-form > button { width: 100%; margin: 0; }
.booking-settings form button { width: 100%; margin: 8px 0; }
.booking-settings #topic, .booking-settings #test-notify { width: 100%; margin: 8px 0; }
.booking-settings .ios-guide-steps { grid-template-columns: 1fr; }
.reservation-details { max-width: 100%; }
/* Secondary actions retain their disabled/loading affordance. */
#register-form button:disabled, #refresh:disabled, #logout:disabled,
#test-notify:disabled, #credentials-form button:disabled,
#ntfy-form button:disabled, #jobs article button:disabled {
  background: var(--line); color: var(--muted); cursor: not-allowed;
}
@media (min-width: 1100px) {
  .booking-layout { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: var(--space-group); align-items: start; }
}
@media (max-width: 520px) {
  .booking-layout, .booking-main, .booking-settings { gap: var(--space-group); }
  .field-row { grid-template-columns: 1fr; }
  .passenger-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .passenger-row input { padding-left: 8px; padding-right: 8px; }
}
