:root {
  color-scheme: light;
  --canvas: #f7f6f3;
  --surface: #fff;
  --ink: #232122;
  --muted: #625e60;
  --line: #e4deda;
  --brand: #a71e37;
  --brand-dark: #82162b;
  --rose: #faeaf0;
  --focus: #623bb2;
  --radius: 16px;
  --gutter: clamp(16px, 4vw, 42px);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 100%;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; line-height: 1.5; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(1.95rem, 5vw, 3.2rem); line-height: 1.06; letter-spacing: -.04em; }
h2 { font-size: clamp(1.25rem, 2.5vw, 1.55rem); line-height: 1.15; letter-spacing: -.025em; }
h3 { font-size: 1.05rem; line-height: 1.3; }
a { color: var(--brand-dark); text-underline-offset: .2em; }
a:hover { color: var(--brand); }
button, input, textarea { font: inherit; }
button, summary { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }
.skip-link { position: absolute; top: -10rem; left: 1rem; z-index: 20; background: white; padding: 1rem; }
.skip-link:focus { top: 1rem; }

.site-header { border-top: 4px solid var(--brand); background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar {
  max-width: 1152px; margin: auto; padding: 11px var(--gutter);
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.brand { display: inline-flex; gap: 10px; align-items: center; color: var(--ink); text-decoration: none; font-weight: 750; line-height: 1.12; }
.brand img { border-radius: 10px; }
.brand small { display: block; color: var(--muted); font-size: .79rem; font-weight: 500; margin-top: 4px; }
.tabs { display: flex; gap: 4px; }
.tabs a, .account a, .account button {
  min-height: 44px; display: inline-flex; align-items: center; padding: 6px 10px;
  font-size: .875rem; border-radius: 8px; color: var(--ink); text-decoration: none; font-weight: 650;
}
.tabs a:hover, .account a:hover, .account button:hover { background: var(--canvas); }
.tabs a[aria-current] { background: var(--rose); color: var(--brand-dark); }
.account { margin-left: auto; display: flex; align-items: center; }
.text-button { border: 0; background: transparent; padding: 0; color: var(--brand-dark); text-decoration: underline; text-underline-offset: .25em; }
.shell { max-width: 1152px; margin: auto; padding: clamp(26px, 6vw, 65px) var(--gutter) 58px; }
.page-head { margin: 0 0 25px; }
.page-head p, .current-journey p, .detail-panel > p { color: var(--muted); margin-top: 8px; }
.breadcrumb { display: inline-block; margin-bottom: 13px; font-size: .9rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.current-journey {
  padding: clamp(20px, 4vw, 36px);
  display: flex; gap: 20px; align-items: center; justify-content: space-between;
  border-top: 3px solid var(--brand);
}
.status {
  display: inline-block; border-radius: 99px; padding: 3px 11px; margin-bottom: 9px;
  background: var(--rose); color: var(--brand-dark); font-size: .8rem; font-weight: 750;
}
.button {
  min-height: 48px; display: inline-flex; justify-content: center; align-items: center;
  border: 1px solid transparent; border-radius: 10px; padding: 10px 17px;
  font-weight: 720; text-align: center; text-decoration: none; line-height: 1.25;
}
.button-main { color: white; background: var(--brand); }
.button-main:hover { color: white; background: var(--brand-dark); }
.button-secondary { color: var(--ink); border-color: var(--line); background: var(--surface); }
.button-secondary:hover { color: var(--brand-dark); border-color: var(--brand); }
.button:disabled { opacity: .55; cursor: default; }
.recent, .corrections { margin-top: 35px; }
.section-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; margin-bottom: 12px; }
.section-head a { font-size: .9rem; }
.journey-list { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.journey-list li + li { border-top: 1px solid var(--line); }
.journey-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  color: var(--ink); text-decoration: none; padding: 14px 17px; min-height: 65px;
}
.journey-list a:focus-visible { outline-offset: -4px; }
.journey-list a:hover { background: #fcf8f8; }
.journey-list small { display: block; margin-top: 3px; font-size: .865rem; color: var(--muted); }
.journey-list strong, .summary dd, .changes li { overflow-wrap: anywhere; }
.distance { white-space: nowrap; color: var(--brand-dark); font-size: .9rem; font-weight: 720; }
.empty-state { color: var(--muted); border: 1px dashed #cfc5c6; padding: 20px; border-radius: var(--radius); }
.pagination { display: flex; justify-content: center; align-items: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }

.login-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(310px, 430px); gap: clamp(24px, 5vw, 76px); align-items: center; padding-top: clamp(10px, 7vw, 70px); }
.login-head p { color: var(--muted); margin-top: 14px; max-width: 34ch; }
.login-panel { padding: clamp(20px, 4vw, 33px); border-top: 3px solid var(--brand); }
.login-panel h2 { margin-bottom: 20px; }
.login-panel .field { margin-bottom: 14px; }
.login-panel .button { margin-top: 6px; width: 100%; }

.form-layout { max-width: 850px; margin-inline: auto; }
.form-panel, .detail-panel { padding: clamp(16px, 3vw, 25px); margin-bottom: 14px; }
.form-panel h2 { margin-bottom: 18px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px 20px; }
.field label { display: block; font-size: .94rem; font-weight: 690; margin-bottom: 5px; }
.field input, .field textarea {
  display: block; width: 100%; min-width: 0; min-height: 46px; padding: 9px 10px;
  color: var(--ink); background: white; border: 1px solid #bfb6b5; border-radius: 9px;
}
.field textarea { resize: vertical; }
.help { font-size: .85rem; color: var(--muted); margin-top: 6px; }
.choice-field { border: 0; margin: 0; padding: 0; min-inline-size: 0; }
.choice-field legend { font-weight: 650; font-size: .94rem; margin-bottom: 5px; padding: 0; }
.choice-options { display: flex; flex-wrap: wrap; gap: 6px; }
.choice {
  position: relative; display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
  min-height: 44px; border: 1px solid #d5cccb; border-radius: 9px; padding: 6px 12px; font-size: .88rem;
  background: white;
}
.choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.choice:has(input:checked) { background: var(--rose); color: var(--brand-dark); border-color: var(--brand); }
.choice:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice:hover { border-color: var(--brand); }
.check-group { border-top: 1px solid var(--line); padding: 16px 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.check-group h3 { grid-column: 1 / -1; }
.checklist > .field { border-top: 1px solid var(--line); padding-top: 15px; }
.refuel-fields { margin-top: 15px; }
.upload { margin-top: 16px; }
.upload input { min-height: 48px; }
.upload input::file-selector-button { font: inherit; padding: 4px 8px; border: 0; color: var(--brand-dark); background: var(--rose); border-radius: 5px; }
.upload a { display: inline-block; padding-block: 6px; }
.form-actions {
  position: sticky; bottom: 0; z-index: 2; background: var(--canvas); border-top: 1px solid var(--line);
  padding: 10px 0 max(10px, env(safe-area-inset-bottom)); display: flex; gap: 7px 12px; flex-wrap: wrap;
  justify-content: space-between; align-items: center;
}
.action-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.save-status { font-size: .85rem; color: var(--muted); }
.save-status:empty { display: none; }
.discard { margin-top: 9px; }
.phase-section > summary { font-size: 1.12rem; font-weight: 760; padding: 6px 0 10px; }

.detail-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 15px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.detail-panel { min-width: 0; }
.summary { margin-bottom: 0; }
.summary div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; border-top: 1px solid var(--line); padding: 7px 0; }
.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 570; white-space: pre-wrap; }
.correction { margin-top: 13px; }
.changes { list-style: none; padding: 0; margin-bottom: 0; }
.changes li { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; border-top: 1px solid var(--line); padding: 7px 0; }
.notice { padding: 12px 15px; margin: 0 0 15px; border: 1px solid #bcd8c8; background: #f1f8f3; color: #174e34; border-radius: 9px; }
.notice-error, .errorlist, .photo-error { color: var(--brand-dark); }
.notice-error { background: var(--rose); border-color: #e6abb8; }
.errorlist { margin: 5px 0 0; padding-left: 19px; font-size: .9rem; }
.photo-error { margin-top: 5px; font-size: .9rem; }
.field input[aria-invalid], .field textarea[aria-invalid] { border-color: var(--brand); }

@media (max-width: 680px) {
  .topbar { gap: 8px; }
  .tabs { order: 3; width: 100%; }
  .tabs a { flex: 1; justify-content: center; }
  .account a, .account button { font-size: .77rem; padding-inline: 5px; }
  .login-layout, .detail-grid { grid-template-columns: minmax(0, 1fr); }
  .current-journey { align-items: stretch; flex-direction: column; }
  .current-journey .button { width: 100%; }
}

@media (max-width: 510px) {
  .field-grid, .check-group { grid-template-columns: minmax(0, 1fr); }
  .action-buttons { flex-wrap: nowrap; width: 100%; }
  .action-buttons > * { flex: 1; padding-inline: 8px; font-size: .87rem; }
  .changes li { grid-template-columns: 1fr 1fr; }
  .changes strong { grid-column: 1 / -1; }
  .summary div { gap: 8px; }
}

@media print {
  .site-header, .breadcrumb, .button, .skip-link { display: none !important; }
  .shell { padding: 0; }
  .detail-grid { display: block; }
}
