:root {
  color-scheme: light;
  --bg: oklch(96.7% 0.018 7);
  --surface: oklch(99% 0.006 7);
  --surface-strong: oklch(98.4% 0.012 7);
  --field: oklch(98.5% 0.004 7);
  --ink: oklch(25% 0.035 350);
  --muted: oklch(48% 0.035 350);
  --subtle: oklch(62% 0.032 350);
  --line: oklch(88% 0.025 7);
  --accent: oklch(48% 0.095 350);
  --accent-strong: oklch(38% 0.085 350);
  --accent-soft: oklch(91.5% 0.035 7);
  --accent-wash: oklch(94% 0.026 7);
  --warning: oklch(50% 0.095 45);
  --warning-soft: oklch(94.5% 0.038 45);
  --success: oklch(46% 0.075 150);
  --success-soft: oklch(93% 0.035 150);
  --shadow: 0 18px 42px oklch(35% 0.055 350 / 0.12);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, "PingFang SC",
    "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

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

button {
  touch-action: manipulation;
}

h1,
h2,
p {
  margin: 0;
}

.shell {
  width: min(100%, 760px);
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 14px 34px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.brand-block {
  min-width: 0;
}

.brand-logo {
  display: block;
  width: min(160px, 48vw);
  height: auto;
  object-fit: contain;
  object-position: left center;
}

.eyebrow {
  margin: 4px 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

h1 {
  font-size: 22px;
  line-height: 1.15;
}

h2 {
  font-size: 19px;
  line-height: 1.2;
}

.status-pill,
.section-head span,
.source-badge {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: oklch(99% 0.006 7 / 0.82);
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 750;
}

.entry-tabs {
  position: sticky;
  top: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0 12px;
  padding: 6px 0;
  background: oklch(96.7% 0.018 7 / 0.88);
  backdrop-filter: blur(14px);
}

.entry-tab,
.primary-action,
.secondary-action,
.date-chip,
.mini-action,
.time-shortcuts button {
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  font-weight: 820;
  cursor: pointer;
}

.entry-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 6px;
}

.entry-tab span {
  color: var(--accent);
  font-size: 20px;
  line-height: 1;
}

.entry-tab.is-active,
.date-chip.is-active,
.primary-action {
  border-color: var(--accent);
  background: var(--accent);
  color: oklch(98.7% 0.008 7);
}

.entry-tab.is-active span {
  color: oklch(98.7% 0.008 7);
}

.panel {
  display: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: oklch(99% 0.006 7 / 0.94);
  box-shadow: var(--shadow);
  padding: 16px;
}

.panel.is-active {
  display: block;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.today-hero {
  display: grid;
  grid-template-columns: minmax(0, 0.7fr) minmax(0, 1.3fr);
  gap: 12px;
  align-items: stretch;
}

.today-id,
.today-shift,
.status-card,
.source-note,
.empty-state,
.planned-shift,
.draft-output,
.form-message,
.sync-card,
.bonus-banner,
.mismatch-warning {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  color: var(--muted);
  padding: 13px;
}

.today-id,
.today-shift {
  display: grid;
  gap: 7px;
}

.today-id span,
.today-shift span,
.status-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.today-id strong {
  color: var(--ink);
  font-size: 27px;
  line-height: 1;
}

.today-shift strong {
  color: var(--accent-strong);
  font-size: 18px;
  line-height: 1.25;
}

.today-id small,
.today-shift small {
  color: var(--subtle);
}

.today-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 0.68fr;
  gap: 10px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.status-card {
  display: grid;
  gap: 8px;
}

.status-card strong {
  color: var(--ink);
  font-size: 15px;
}

.source-note {
  margin-top: 12px;
  background: var(--accent-wash);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.45;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

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

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px oklch(48% 0.095 350 / 0.18);
  outline: none;
}

input[type="time"] {
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 850;
  text-align: center;
  background: var(--accent-wash);
}

input[type="time"]::-webkit-calendar-picker-indicator {
  opacity: 0.62;
}

.checkin-form {
  display: grid;
  gap: 14px;
}

.planned-shift {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 820;
}

.form-message {
  border-color: var(--warning);
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.form-message[hidden] {
  display: none;
}

fieldset {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: oklch(98.7% 0.006 7 / 0.66);
}

legend {
  padding: 0 4px;
  color: var(--ink);
  font-weight: 850;
}

.time-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.time-summary {
  display: grid;
  gap: 8px;
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--muted);
  padding: 12px;
  text-align: left;
}

.time-summary span {
  font-size: 13px;
  font-weight: 800;
}

.time-summary strong {
  justify-self: center;
  color: var(--accent-strong);
  font-size: 28px;
  line-height: 1;
}

.toggle-row {
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 48px;
  color: var(--ink);
}

.toggle-row input {
  width: 24px;
  min-height: 24px;
  accent-color: var(--accent);
}

.conditional {
  display: none;
}

.conditional.is-open {
  display: block;
}

.sync-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  background: var(--surface);
}

.sync-card.is-warning,
.mismatch-warning {
  border-color: var(--warning);
  background: var(--warning-soft);
  color: var(--warning);
}

.sync-card[data-state="done"] .source-badge,
.sync-progress[data-state="done"] .sync-progress-bar i {
  background: var(--success);
}

.sync-card[data-state="failed"] .source-badge,
.sync-card[data-state="manual_entry"] .source-badge,
.sync-progress[data-state="failed"] .sync-progress-bar i,
.sync-progress[data-state="manual_entry"] .sync-progress-bar i {
  background: var(--warning);
}

.sync-card[data-state="pending"] .source-badge,
.sync-card[data-state="running"] .source-badge,
.sync-progress[data-state="pending"] .sync-progress-bar i,
.sync-progress[data-state="running"] .sync-progress-bar i {
  background: var(--accent);
}

.sync-copy {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.sync-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sync-title strong {
  color: var(--ink);
  font-size: 15px;
}

.sync-copy span:not(.source-badge),
.sync-copy small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.source-badge {
  padding: 5px 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.sync-actions {
  display: grid;
  gap: 8px;
}

.sync-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  margin-top: 4px;
}

.sync-progress-bar {
  display: block;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--accent-wash);
}

.sync-progress-bar i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 180ms ease-out;
}

.sync-progress span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 820;
  white-space: nowrap;
}

.mini-action {
  min-width: 76px;
  border-color: var(--accent);
  background: var(--accent);
  color: oklch(98.7% 0.008 7);
  padding: 0 14px;
}

.mini-action.is-secondary,
.secondary-action,
.time-shortcuts button {
  border-color: var(--line);
  background: var(--field);
  color: var(--accent-strong);
}

.bonus-banner {
  border-color: var(--success);
  background: var(--success-soft);
  color: var(--success);
  font-weight: 820;
}

.mismatch-warning {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.45;
}

.manual-amount-fields {
  display: grid;
  gap: 10px;
  border: 1px solid var(--warning);
  border-radius: 8px;
  background: var(--warning-soft);
  padding: 12px;
}

.manual-amount-fields[hidden] {
  display: none;
}

.manual-intro {
  color: var(--warning);
  font-size: 13px;
  font-weight: 820;
  line-height: 1.45;
}

.date-chips {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.date-chip {
  min-height: 44px;
}

.schedule-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.schedule-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 12px;
  align-items: center;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
}

.schedule-card div {
  display: grid;
  gap: 2px;
}

.schedule-card strong {
  font-size: 17px;
}

.schedule-card span,
.schedule-card small {
  color: var(--muted);
}

.schedule-card p {
  color: var(--accent-strong);
  font-size: 19px;
  font-weight: 850;
}

.schedule-card button {
  grid-column: 1 / -1;
  justify-self: stretch;
}

.schedule-status {
  justify-self: end;
  align-self: start;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
}

.schedule-card.is-checked,
.schedule-card.is-too_early,
.schedule-card.is-future_date {
  background: oklch(98% 0.008 7);
}

.schedule-card.is-checked .schedule-status,
.schedule-card.is-too_early .schedule-status,
.schedule-card.is-future_date .schedule-status {
  background: oklch(93% 0.006 7);
  color: var(--muted);
}

.schedule-reason {
  grid-column: 1 / -1;
  color: var(--subtle);
  font-weight: 760;
}

.planned-shift.is-disabled {
  background: oklch(96% 0.006 7);
  color: var(--muted);
}

.empty-state {
  border-style: dashed;
  text-align: center;
}

.wide {
  grid-column: 1 / -1;
}

.action-bar {
  position: sticky;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: oklch(96.7% 0.018 7 / 0.78);
  backdrop-filter: blur(12px);
  padding-top: 8px;
}

.secondary-action {
  min-width: 104px;
  padding: 0 14px;
}

.draft-output {
  display: block;
  min-height: 0;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.55;
}

.draft-output:empty {
  display: none;
}

.time-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  align-items: end;
  background: oklch(25% 0.035 350 / 0.32);
  padding: 12px;
}

.time-sheet-backdrop[hidden] {
  display: none;
}

.time-sheet {
  width: min(100%, 760px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 18px 18px 8px 8px;
  background: oklch(99% 0.006 7 / 0.98);
  box-shadow: 0 28px 70px oklch(25% 0.035 350 / 0.25);
  padding: 10px 14px max(16px, env(safe-area-inset-bottom));
}

.sheet-handle {
  width: 44px;
  height: 5px;
  margin: 0 auto 12px;
  border-radius: 999px;
  background: oklch(78% 0.045 350);
}

.time-picker-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  padding: 12px;
}

.time-picker-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 800;
}

.time-picker-meta strong {
  color: var(--accent-strong);
  font-size: 24px;
}

.time-shortcuts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.time-shortcuts button {
  min-height: 42px;
  padding: 0 8px;
  font-size: 13px;
}

.time-wheel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  height: 188px;
  overflow: hidden;
}

.time-wheel-column {
  height: 188px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 70px 0;
  scroll-snap-type: y mandatory;
  scrollbar-width: none;
}

.time-wheel-column::-webkit-scrollbar {
  display: none;
}

.time-wheel-option {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 48px;
  border: 0;
  background: transparent;
  color: oklch(66% 0.035 350);
  font-size: 21px;
  font-weight: 850;
  scroll-snap-align: center;
}

.time-wheel-option.is-selected {
  color: var(--accent-strong);
  font-size: 28px;
}

.time-wheel-separator {
  z-index: 1;
  align-self: center;
  color: var(--accent-strong);
  font-size: 26px;
  font-weight: 850;
  transform: translateY(-2px);
}

.time-wheel-focus {
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 48px;
  transform: translateY(-50%);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: oklch(91.5% 0.035 7 / 0.46);
  pointer-events: none;
}

.time-sheet-hint {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
  line-height: 1.4;
  text-align: center;
}

.sheet-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  margin-top: 14px;
}

@media (prefers-reduced-motion: no-preference) {
  .entry-tab,
  .primary-action,
  .secondary-action,
  .date-chip,
  .mini-action,
  .time-shortcuts button,
  .conditional,
  .panel {
    transition:
      background-color 180ms ease-out,
      border-color 180ms ease-out,
      box-shadow 180ms ease-out,
      transform 180ms ease-out;
  }

  button:active {
    transform: scale(0.985);
  }
}

@media (max-width: 560px) {
  .shell {
    padding-inline: 12px;
  }

  .brand-logo {
    width: min(140px, 46vw);
  }

  h1 {
    font-size: 20px;
  }

  .status-pill {
    font-size: 12px;
    padding-inline: 8px;
  }

  .panel {
    padding: 14px;
  }

  .control-grid,
  .today-hero,
  .status-grid,
  .sync-card {
    grid-template-columns: 1fr;
  }

  .today-actions,
  .time-summary-grid,
  .action-bar {
    grid-template-columns: 1fr;
  }

  .schedule-card {
    grid-template-columns: 1fr;
  }

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

  .time-sheet-backdrop {
    padding: 10px;
  }

  .time-sheet {
    padding-inline: 12px;
  }

  .time-shortcuts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* final overrides: keep v3 layout after legacy v2 rules */
.time-route-row,
.time-route-row:not(:has(.segment-remove)),
.segment-row.time-route-row,
.segment-row.time-route-row:not(:has(.segment-remove)) {
  display: grid;
  grid-template-columns: minmax(38px, auto) minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.time-route-row:has(.segment-remove),
.segment-row.time-route-row:has(.segment-remove) {
  grid-template-columns: minmax(38px, auto) minmax(0, 1fr) auto minmax(0, 1fr) 34px;
}

.review-choice {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
}

.review-choice label {
  display: flex;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 0 12px;
  color: var(--muted);
}

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

.review-choice label:has(input:checked) {
  background: var(--accent);
  color: oklch(98.7% 0.008 7);
  box-shadow: 0 6px 16px oklch(35% 0.055 350 / 0.12);
}

@media (max-width: 560px) {
  .time-route-row,
  .time-route-row:not(:has(.segment-remove)),
  .segment-row.time-route-row,
  .segment-row.time-route-row:not(:has(.segment-remove)) {
    grid-template-columns: minmax(34px, auto) minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .time-route-row:has(.segment-remove),
  .segment-row.time-route-row:has(.segment-remove) {
    grid-template-columns: minmax(34px, auto) minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .time-route-row .segment-remove {
    grid-column: 1 / -1;
    width: 100%;
  }

  .summary-grid {
    grid-template-columns: 1.2fr 1.2fr 0.8fr;
  }

  .review-choice {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-card dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* v3 polish: staff-facing language and cleaner mobile rhythm */
.shell {
  width: min(100%, 720px);
  padding-inline: 16px;
}

.topbar {
  align-items: center;
  margin-bottom: 8px;
}

.brand-logo {
  width: min(128px, 42vw);
}

.eyebrow,
.topbar h1 {
  display: none;
}

.entry-tabs {
  position: sticky;
  top: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 8px 0 12px;
  padding: 8px 0;
}

.entry-tab {
  min-height: 44px;
  border-radius: 999px;
  font-size: 15px;
}

.entry-tab span {
  font-size: 16px;
}

.panel {
  box-shadow: none;
  padding: 14px;
}

.section-head {
  margin-bottom: 12px;
}

.section-head h2 {
  font-size: 18px;
}

fieldset {
  gap: 12px;
  padding: 14px;
}

legend {
  font-size: 16px;
}

.planned-shift {
  padding: 11px 12px;
  font-size: 14px;
}

.time-route-row,
.time-route-row:not(:has(.segment-remove)) {
  display: grid;
  grid-template-columns: minmax(38px, auto) minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.time-route-row:has(.segment-remove) {
  grid-template-columns: minmax(38px, auto) minmax(0, 1fr) auto minmax(0, 1fr) 34px;
}

.segment-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  white-space: nowrap;
}

.time-point {
  gap: 4px;
}

.time-point span {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 780;
}

.time-point input[type="time"] {
  min-height: 42px;
  padding-inline: 6px;
  font-size: 17px;
  background: var(--field);
}

.time-arrow {
  color: var(--subtle);
  font-weight: 900;
}

.time-route-row .segment-remove {
  width: 34px;
  height: 42px;
}

.sync-card {
  border: 0;
  background: transparent;
  padding: 0;
}

.sync-copy {
  gap: 3px;
}

.sync-title {
  min-height: 0;
}

.source-badge {
  border: 0;
  background: var(--accent-soft);
  padding: 4px 8px;
  font-size: 12px;
}

.summary-grid {
  grid-template-columns: 1.2fr 1.2fr 0.8fr;
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.summary-grid article {
  border: 0;
  border-radius: 0;
  background: var(--surface);
  padding: 12px 10px;
}

.summary-grid span {
  font-size: 12px;
}

.summary-grid strong {
  font-size: 20px;
}

.hint-list {
  gap: 6px;
}

.system-hint {
  border: 0;
  border-radius: 8px;
  padding: 9px 10px;
}

.order-details {
  background: var(--field);
}

.order-details summary {
  color: var(--ink);
  font-size: 14px;
}

.order-card {
  border: 0;
  background: var(--surface);
}

.order-card dl {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.review-choice {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
}

.review-choice label {
  display: flex;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 0 12px;
  color: var(--muted);
}

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

.review-choice label:has(input:checked) {
  background: var(--accent);
  color: oklch(98.7% 0.008 7);
  box-shadow: 0 6px 16px oklch(35% 0.055 350 / 0.12);
}

.pin-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  align-items: end;
  background: oklch(25% 0.035 350 / 0.32);
  padding: 12px;
}

.pin-sheet-backdrop[hidden] {
  display: none;
}

.pin-sheet {
  display: grid;
  gap: 12px;
  width: min(100%, 480px);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 18px 18px 8px 8px;
  background: var(--surface);
  padding: 16px;
  box-shadow: 0 28px 70px oklch(25% 0.035 350 / 0.25);
}

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

.pin-sheet p {
  color: var(--muted);
  font-size: 13px;
}

#pinLoginFields,
#pinChangeFields {
  display: grid;
  gap: 10px;
}

#pinLoginFields[hidden],
#pinChangeFields[hidden] {
  display: none;
}

@media (max-width: 560px) {
  .shell {
    padding-inline: 12px;
  }

  .panel {
    padding: 12px;
  }

  .time-route-row,
  .time-route-row:not(:has(.segment-remove)) {
    grid-template-columns: minmax(34px, auto) minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .time-route-row:has(.segment-remove) {
    grid-template-columns: minmax(34px, auto) minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .time-route-row .segment-remove {
    grid-column: 1 / -1;
    width: 100%;
  }

  .summary-grid,
  .review-choice {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .review-choice {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-card dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* v2 check-in flow */
.entry-tabs {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.brand-block {
  display: grid;
  gap: 2px;
}

.section-head span {
  white-space: nowrap;
}

.segment-list {
  display: grid;
  gap: 10px;
}

.segment-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: end;
}

.segment-row:not(:has(.segment-remove)) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segment-remove {
  width: 42px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--muted);
  font-size: 20px;
  font-weight: 850;
  cursor: pointer;
}

.inline-add {
  min-height: 42px;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: var(--accent-wash);
  color: var(--accent-strong);
  font-weight: 850;
  cursor: pointer;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.summary-grid article {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 12px;
}

.summary-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.summary-grid strong {
  color: var(--accent-strong);
  font-size: 22px;
  line-height: 1;
}

.hint-list {
  display: grid;
  gap: 8px;
}

.system-hint {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 760;
  line-height: 1.42;
}

.system-hint.success {
  border-color: oklch(78% 0.055 150);
  background: var(--success-soft);
  color: var(--success);
}

.system-hint.warning {
  border-color: oklch(78% 0.075 45);
  background: var(--warning-soft);
  color: var(--warning);
}

.order-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 0;
  overflow: hidden;
}

.order-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 12px;
  color: var(--accent-strong);
  font-weight: 850;
  cursor: pointer;
  list-style: none;
}

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

.details-arrow {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 18px;
  line-height: 1;
  transition: transform 180ms ease-out;
}

.order-details[open] .details-arrow {
  transform: rotate(180deg);
}

.order-list {
  display: grid;
  gap: 8px;
  padding: 0 10px 10px;
}

.order-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  padding: 12px;
}

.order-list .order-card + .order-card {
  margin-top: -2px;
}

.order-card div:first-child {
  display: grid;
  gap: 3px;
}

.order-card strong {
  color: var(--ink);
}

.order-card span {
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.order-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.order-card dl div {
  display: grid;
  gap: 2px;
}

.order-card dt,
.order-card dd {
  margin: 0;
}

.order-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.order-card dd {
  color: var(--accent-strong);
  font-weight: 850;
  overflow-wrap: anywhere;
}

.review-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.review-choice label {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  padding: 10px 12px;
  font-weight: 850;
}

.review-choice input,
.toggle-row input {
  accent-color: var(--accent);
}

.issue-note {
  display: none;
}

.issue-note.is-open {
  display: grid;
}

.action-bar {
  grid-template-columns: minmax(0, 1fr);
}

.primary-action:disabled,
.mini-action:disabled {
  cursor: wait;
  opacity: 0.64;
}

@media (max-width: 560px) {
  .segment-row,
  .segment-row:not(:has(.segment-remove)) {
    grid-template-columns: 1fr;
  }

  .segment-remove {
    width: 100%;
  }

  .summary-grid,
  .order-card dl,
  .review-choice {
    grid-template-columns: 1fr;
  }
}

/* final overrides: keep v3 layout after legacy v2 rules */
.time-route-row,
.time-route-row:not(:has(.segment-remove)),
.segment-row.time-route-row,
.segment-row.time-route-row:not(:has(.segment-remove)) {
  display: grid;
  grid-template-columns: minmax(38px, auto) minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 10px;
}

.time-route-row:has(.segment-remove),
.segment-row.time-route-row:has(.segment-remove) {
  grid-template-columns: minmax(38px, auto) minmax(0, 1fr) auto minmax(0, 1fr) 34px;
}

.review-choice {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--field);
}

.review-choice label {
  display: flex;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  padding: 0 12px;
  color: var(--muted);
}

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

.review-choice label:has(input:checked) {
  background: var(--accent);
  color: oklch(98.7% 0.008 7);
  box-shadow: 0 6px 16px oklch(35% 0.055 350 / 0.12);
}

@media (max-width: 560px) {
  .time-route-row,
  .time-route-row:not(:has(.segment-remove)),
  .segment-row.time-route-row,
  .segment-row.time-route-row:not(:has(.segment-remove)) {
    grid-template-columns: minmax(34px, auto) minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .time-route-row:has(.segment-remove),
  .segment-row.time-route-row:has(.segment-remove) {
    grid-template-columns: minmax(34px, auto) minmax(0, 1fr) auto minmax(0, 1fr);
  }

  .time-route-row .segment-remove {
    grid-column: 1 / -1;
    width: 100%;
  }

  .summary-grid {
    grid-template-columns: 1.2fr 1.2fr 0.8fr;
  }

  .review-choice {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .order-card dl {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
