:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #61707b;
  --line: #d8e0e6;
  --paper: #ffffff;
  --wash: #f4f7f8;
  --accent: #176b87;
  --accent-strong: #0f5268;
  --good: #13795b;
  --warn: #9a5b00;
  --bad: #b42318;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--wash);
  color: var(--ink);
}

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

button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--ink);
  min-height: 44px;
  padding: 0 14px;
  cursor: pointer;
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.87rem;
  font-weight: 650;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px clamp(16px, 5vw, 40px);
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.2rem, 3.5vw, 1.8rem);
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.role-chip,
.section-head span,
.status {
  border-radius: 999px;
  padding: 5px 9px;
  background: #e9f3f6;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 800;
}

.auth-box {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 800;
  padding: 0 14px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--paper);
  text-decoration: none;
}

.shell {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr));
  gap: 14px;
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px clamp(12px, 4vw, 28px) 32px;
}

.panel {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
}

.notice {
  grid-column: 1 / -1;
  padding: 12px 16px;
  color: var(--accent-strong);
  font-weight: 750;
}

.notice.error {
  color: var(--bad);
}

.error-text {
  color: var(--bad);
}

.restricted {
  border-color: #ead4d1;
}

.new-ride,
.ride-detail {
  grid-row: span 2;
}

.section-head,
.field-row,
.button-row,
.search-row {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
}

.check-row input {
  width: 18px;
  height: 18px;
  padding: 0;
}

.override-row {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff8ea;
  padding: 12px;
}

.section-head h2 {
  margin: 0;
  font-size: 1.02rem;
}

.field-row > label {
  flex: 1;
  min-width: 0;
}

.search-row input {
  min-width: 0;
}

.primary,
.copy-button {
  width: 100%;
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 800;
}

.copy-button {
  min-height: 54px;
  background: #1c7c54;
  border-color: #1c7c54;
}

.result-row,
.task-card,
.table-row {
  display: grid;
  grid-template-columns: 0.8fr 1.6fr;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 54px;
  text-align: left;
}

.result-row {
  margin-top: 8px;
}

.task-card {
  grid-template-columns: 1fr auto;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.task-card p,
.empty {
  margin: 3px 0 0;
  color: var(--muted);
}

.debug-sample {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.5;
}

.text-button {
  min-height: 36px;
  color: var(--bad);
}

.trip-code {
  overflow-wrap: anywhere;
  border: 1px dashed var(--accent);
  border-radius: 8px;
  background: #eef8fb;
  padding: 18px;
  color: var(--accent-strong);
  text-align: center;
  font-size: clamp(1.6rem, 8vw, 2.6rem);
  font-weight: 900;
  letter-spacing: 0;
}

.detail-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.detail-list div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

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

.detail-list dd {
  margin: 0;
  text-align: right;
}

.mini-table {
  display: grid;
  gap: 8px;
}

.import-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 750;
}

.import-summary span {
  border-radius: 999px;
  background: #eef8fb;
  padding: 4px 8px;
}

.table-row {
  grid-template-columns: 1fr 1fr 1fr auto;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
  font-size: 0.9rem;
}

.receipt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  font-size: 0.9rem;
}

.receipt-row.export-row {
  grid-template-columns: auto minmax(0, 1fr) auto auto;
}

.queue-check {
  display: grid;
  place-items: center;
}

.receipt-row p {
  margin: 3px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.receipt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.pending-receipt {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef8fb;
  color: var(--accent-strong);
  margin: 0;
  padding: 10px;
  font-weight: 750;
}

.allocation-row {
  grid-template-columns: 0.8fr 0.7fr 1.2fr auto;
}

.status.ready,
.status.matched,
.status.finalized {
  background: #e7f6ef;
  color: var(--good);
}

.status.exception,
.status.unmatched,
.status.skipped {
  background: #fff2e0;
  color: var(--warn);
}

.csv-preview {
  overflow: auto;
  min-height: 180px;
  max-height: 320px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
  color: #f8fbfd;
  padding: 12px;
  font-size: 0.8rem;
}

.settings-grid {
  display: grid;
  gap: 12px;
}

.drop-zone {
  display: grid;
  gap: 8px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfdfe;
  padding: 10px;
  color: var(--muted);
}

.drop-zone.dragging {
  border-color: var(--accent);
  background: #eef8fb;
}

.phone-topbar {
  padding: 12px 14px;
}

.phone-topbar h1 {
  font-size: 1.35rem;
}

.phone-shell {
  display: block;
  max-width: 460px;
  padding: 12px;
}

.phone-shell .notice {
  margin-bottom: 12px;
}

.phone-creator-panel {
  gap: 16px;
  padding: 14px;
}

.phone-field-row {
  display: grid;
  grid-template-columns: 1fr;
}

.phone-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
}

.phone-detail-block {
  display: grid;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.phone-detail-block .trip-code {
  font-size: 2.1rem;
  padding: 20px 12px;
}

@media (max-width: 720px) {
  .topbar {
    align-items: flex-start;
    padding: 12px;
  }

  .auth-box {
    align-items: flex-end;
    flex-direction: column;
  }

  .shell {
    display: block;
    padding: 12px;
  }

  .panel + .panel {
    margin-top: 12px;
  }

  .field-row,
  .button-row {
    display: grid;
  }

  .table-row,
  .receipt-row,
  .allocation-row {
    grid-template-columns: 1fr;
  }
}
