:root {
  --bg: #f3efe6;
  --ink: #1c2420;
  --muted: #5c6a62;
  --accent: #0f5c4c;
  --accent-soft: #d7ebe4;
  --line: #d5d0c4;
  --panel: #fffdf8;
  --error: #8b1e1e;
  --warn: #7a5a12;
  --ok: #0f5c4c;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: "Avenir Next", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(circle at top left, #e7f2ec 0, transparent 42%),
    linear-gradient(160deg, #f7f3ea, #ebe4d6 55%, #e4ece7);
  min-height: 100vh;
}
a { color: var(--accent); }
.wrap { width: min(960px, calc(100% - 2rem)); margin: 0 auto; }

.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 253, 248, 0.85);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
}
.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.9rem 0;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.brand-logo { display: block; flex: none; border-radius: 50%; }
.site-header--branded .header-inner { padding: 0.625rem 0; }
.brand--logo { gap: 0.65rem; color: #102f4d; line-height: 1.15; }
.brand--logo:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; border-radius: 4px; }
.brand-wordmark { display: flex; flex-direction: column; gap: 0.25rem; }
.brand-name { font-size: 1.25rem; letter-spacing: -0.025em; }
.brand-domain { color: #93703b; }
.brand-tagline {
  font-family: var(--font-body);
  font-size: 0.55rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  color: #526575;
}
.nav { display: flex; gap: 1rem; }
.nav a { text-decoration: none; color: var(--muted); font-size: 0.95rem; }
.nav a:hover { color: var(--accent); }
.nav a.is-current { font-weight: 700; color: var(--ink); }
.settings-nav-wrap { padding-bottom: 0.75rem; }
.settings-nav { margin: 0; }

main.wrap { padding: 1.75rem 0 3rem; }

.hero-copy { margin-bottom: 1.5rem; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--accent);
  margin: 0 0 0.4rem;
}
.eyebrow a { color: inherit; text-decoration: underline; text-underline-offset: 0.18em; }
h1, h2, h3 { font-family: var(--font-display); margin: 0 0 0.5rem; }
.order-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.15rem 0.75rem;
  margin: 0 0 0.35rem;
}
.order-title h1,
.order-title p { margin: 0; }
.order-links { display: flex; flex-wrap: wrap; gap: 0.35rem 0.85rem; }
.admin-head > .decision-form { margin: 0.35rem 0 0.6rem; }
.lede { color: var(--muted); max-width: 40rem; }

.booking-form, .login-form, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin: 0 0 1rem;
  padding: 1rem;
}
legend {
  font-family: var(--font-display);
  padding: 0 0.35rem;
}
label { display: block; margin-bottom: 0.75rem; font-size: 0.92rem; }
.checkbox { display: flex; align-items: center; gap: 0.5rem; }
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.input, textarea.input, select.input {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
}
.btn, button.btn {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 1.2rem;
  background: var(--accent);
  color: #fff;
  font: inherit;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary { background: var(--accent); }
.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}
.actions { margin-top: 0.5rem; }
.settings-links { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.client-transfer { overflow-wrap: anywhere; margin: 0.35rem 0; }
.client-request-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.client-request-actions .btn { min-height: 44px; display: inline-flex; align-items: center; }
.request-pending { border-left: 4px solid var(--warn); padding: 0.75rem 1rem; background: #f7efd5; border-radius: 8px; margin: 0.75rem 0; }
.request-comment { white-space: pre-wrap; overflow-wrap: anywhere; }
.request-acknowledgement { align-items: flex-start; margin-top: 1rem; }
.request-acknowledgement input { flex-shrink: 0; margin-top: 0.25rem; }
.client-request-form textarea { width: 100%; }
.client-request-form-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  max-width: 28rem;
  margin-top: 1rem;
}
.client-request-form-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.65rem 0.5rem;
  font-size: clamp(0.8rem, 3.4vw, 1rem);
  line-height: 1.25;
  text-align: center;
}
.request-history summary { cursor: pointer; font-weight: 600; min-height: 24px; }
a.order-ref { text-decoration: none; }
a.order-ref:hover { text-decoration: underline; }
.answers-table { table-layout: fixed; }
.answers-table th:last-child, .answers-table td:last-child { width: 3rem; }
.answers-table td { overflow-wrap: anywhere; }
.answer-body { min-height: 18rem; resize: vertical; }
.answer-preview {
  white-space: pre-wrap;
  margin: 0.5rem 0 0;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  font: inherit;
}
.order-card .inline-form { margin: 0; }
.error { color: var(--error); display: block; font-size: 0.85rem; margin-top: 0.25rem; }
.error[hidden] { display: none; }
.error button {
  background: none;
  border: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.narrow { max-width: 420px; }

.flashes { list-style: none; padding: 0; }
.flash {
  padding: 0.7rem 0.9rem;
  border-radius: 8px;
  margin-bottom: 0.75rem;
  background: var(--accent-soft);
}
.flash-error { background: #f6e0e0; color: var(--error); }
.flash-warning { background: #f7efd5; color: var(--warn); }
.flash-success { background: var(--accent-soft); color: var(--ok); }

.orders-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.orders-table col.col-customer { width: 22%; }
.orders-table col.col-email { width: 16%; }
.orders-table col.col-when { width: 8%; }
.orders-table col.col-flight { width: 12%; }
.orders-table col.col-driver { width: 7%; }
.orders-table col.col-decision { width: 15%; }
.orders-table th, .orders-table td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  overflow-wrap: break-word;
}
.orders-table td.col-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.orders-table td.col-when { white-space: nowrap; font-size: 0.82rem; line-height: 1.35; }
/* The one-way price from Settings → Prices, as on the phone card (van price for a van). */
.orders-table td.col-when .when-price { margin-top: 0.3rem; font-weight: 700; font-size: 0.9rem; }
/* The customer cell opens the order: the name, the time until the transfer and the step. */
.orders-table a.order-open { display: block; color: inherit; text-decoration: none; }
.orders-table a.order-open:hover strong { text-decoration: underline; }
.orders-table a.order-open .badge { font-weight: 600; vertical-align: 1px; }
.orders-table .decision-form .btn,
.orders-table .decision-form button.btn {
  padding: 0.22rem 0.4rem;
  font-size: 0.72rem;
}
@media (min-width: 1100px) {
  body.owner:has(.orders-table) .wrap { width: min(1360px, calc(100% - 2rem)); }
}
.orders-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  background: #f7f3ea;
}
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.8rem;
}
.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem 1rem;
  margin: 0;
}
.detail-grid dt { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.detail-grid dd { margin: 0.15rem 0 0; }
.trip-card {
  border-top: 1px solid var(--line);
  padding-top: 0.9rem;
  margin-top: 0.9rem;
}
.trip-card:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.trip-card-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  margin: 0 0 0.55rem;
}
.trip-status {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}
.message-list { list-style: none; padding: 0; }
.message-list li { margin-bottom: 1rem; }
.message-list li.msg-collapsed { margin-bottom: 0.5rem; }
.message-meta { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.msg-fold > summary {
  cursor: pointer;
  list-style: none;
}
.msg-fold > summary::-webkit-details-marker { display: none; }
.msg-fold .fold-toggle { margin-left: auto; text-decoration: underline; text-underline-offset: 2px; }
.msg-fold .fold-close { display: none; }
.msg-fold[open] .fold-open { display: none; }
.msg-fold[open] .fold-close { display: inline; }
.msg-collapsed .message-meta strong {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: min(42rem, 70vw);
}
.email-body {
  white-space: pre-wrap;
  background: #f7f3ea;
  border-radius: 8px;
  padding: 0.75rem;
  font-size: 0.9rem;
  overflow: auto;
}
.msg-latest {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.85rem;
  background: #fffdf8;
}
.inline-form { margin: 0.75rem 0 0; }
.inbox-actions {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.inbox-actions .inline-form { margin: 0; }
.inbox-actions .btn { margin-top: 0; }
.inbox-actions a.btn.is-active { background: var(--accent); color: #fff; }
.gmail-list { padding: 0; overflow: hidden; }
.gmail-thread { border-bottom: 1px solid var(--line); }
.gmail-thread:last-child { border-bottom: 0; }
.order-cards { display: none; list-style: none; padding: 0; margin: 0; }
.decision-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
}
.decision-form .btn,
.decision-form button.btn {
  margin: 0;
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.2;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
}
.decision-form .btn.is-active,
.decision-form button.btn.is-active {
  background: var(--accent);
  color: #fff;
}
.decision-form .decision-cancel { border-color: var(--error); color: var(--error); }
.decision-form .decision-cancel.is-active { background: var(--error); color: #fff; }
.decision-form .decision-wait { border-color: var(--warn); color: var(--warn); }
.decision-form .decision-wait.is-active { background: var(--warn); color: #fff; }
.decision-bar {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.55rem;
  margin: 0 0 1rem;
}
.transfer-decision-bar { flex-wrap: wrap; }
.transfer-decision-bar > span { flex-basis: 100%; }
.trip-decision { margin-bottom: 1rem; align-items: center; }
.trip-decision .btn { min-height: 44px; }
.decision-bar .btn,
.decision-bar button.btn {
  flex: 1 1 0;
  min-width: 0;
  padding: 0.95rem 0.4rem;
  font-size: 1.05rem;
  line-height: 1.2;
  text-align: center;
  border-width: 2px;
}
.order-card {
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
  padding: 0.7rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  background: var(--panel);
}
.order-cards li:first-child .order-card { border-radius: 12px 12px 0 0; }
.order-cards li:last-child .order-card { border-radius: 0 0 12px 12px; border-bottom: 0; }
.order-cards li:only-child .order-card { border-radius: 12px; }
.driver-assigned {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
}
.trips-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.75rem;
}
.trips-head h2 { margin: 0; }
.trip-driver {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0;
}
.trip-driver .btn { margin: 0; }
.driver-banner-label {
  margin: 0;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.driver-banner-name {
  display: block;
  margin-top: 0.15rem;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  text-decoration: none;
}
.order-card-top, .order-card-foot {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
}
.order-card-top strong {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-card-top time { color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.order-card-price { font-weight: 700; font-size: 0.9rem; white-space: nowrap; }
.order-card-route {
  color: var(--muted);
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.order-card-party, .order-party {
  color: var(--ink);
  font-size: 0.88rem;
}
.order-party { margin-top: 0.2rem; }
.place-lookup {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.6rem;
  margin: 0.25rem 0 0.15rem;
}
.place-lookup .btn {
  margin: 0;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
}
.place-distance { color: var(--muted); font-size: 0.82rem; }
.place-far {
  flex-basis: 100%;
  color: var(--error);
  font-size: 0.82rem;
  font-weight: 650;
}
.order-cards .place-lookup { padding: 0 0.75rem; }
.order-card-foot { justify-content: space-between; }
.order-card-foot .badge { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.order-card-foot { flex-wrap: wrap; }
.gmail-row {
  display: grid;
  grid-template-columns: minmax(9rem, 14rem) 1.4rem minmax(0, 1fr) auto auto;
  gap: 0.55rem;
  align-items: center;
  padding: 0.42rem 0.8rem;
  cursor: pointer;
  list-style: none;
}
.gmail-when {
  color: var(--ink);
  font-size: 0.82rem;
  white-space: nowrap;
}
.gmail-row::-webkit-details-marker { display: none; }
.gmail-row:hover { background: #f6f1e6; }
.gmail-thread[open] > .gmail-row { background: #f3eee3; }
.gmail-who, .gmail-subject {
  font-weight: 600;
  color: var(--ink);
}
.gmail-who {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  line-height: 1.25;
  white-space: normal;
}
.gmail-who-name,
.gmail-wrote {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gmail-wrote {
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--muted);
}
a.gmail-who,
.gmail-msg > summary a {
  color: inherit;
  text-decoration: none;
}
a.gmail-who:hover,
.gmail-msg > summary a:hover {
  text-decoration: underline;
}
.gmail-main {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gmail-subject {
  display: inline-block;
  max-width: min(24rem, 52%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.gmail-count {
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}
.gmail-snippet { color: var(--muted); font-weight: 400; }
.gmail-meta {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--ink);
  font-size: 0.82rem;
  white-space: nowrap;
}
.gmail-open {
  padding: 0.15rem 0.85rem 0.7rem 1.1rem;
  background: #fffdf8;
}
.gmail-msg { border-top: 1px solid var(--line); }
.gmail-msg > summary {
  display: flex;
  gap: 0.65rem;
  align-items: baseline;
  padding: 0.4rem 0;
  cursor: pointer;
  list-style: none;
}
.gmail-msg > summary::-webkit-details-marker { display: none; }
.gmail-msg > summary time { margin-left: auto; color: var(--muted); font-size: 0.82rem; }
.gmail-msg .email-body { margin: 0 0 0.6rem; max-height: 18rem; }
.thread-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}
.thread-head h2 { font-size: 1.15rem; }
.badge-warn {
  background: #f3e6c8;
  color: var(--warn);
}
.badge-ok {
  background: var(--accent-soft);
  color: var(--ok);
}
.badge-bad {
  background: #f6e4e4;
  color: var(--error);
}
.when-tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.8rem 0 0.2rem; }
.when-tabs .inline-form { margin: 0 0 0 auto; }
.when-tab,
.admin-head .when-tabs .btn,
.admin-head .when-tabs button.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.9rem;
  line-height: 1.2;
}
.when-tab {
  background: var(--panel);
  color: var(--ink);
  text-decoration: none;
}
.admin-head .when-tabs .btn,
.admin-head .when-tabs button.btn {
  border-color: var(--accent);
}
.when-tab span { color: var(--muted); }
.when-tab.is-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.when-tab.is-active span { color: #d7ebe4; }
.when-tab.is-static { color: var(--muted); }
.badge-when-future { background: #d9e4f5; color: #1d3f73; }
.badge-when-past { background: #ece7df; color: #5c6a62; }
.badge-when-undated { background: #f3e6c8; color: var(--warn); }
.client-status {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem 1.4rem;
  margin-bottom: 1rem;
}
.client-status h1 { font-size: 1.85rem; }
.owner-trip { margin: 0 0 0.35rem; font-size: 1.2rem; line-height: 1.35; }
.owner-price { color: var(--accent); font-weight: 600; }
/* Sergio's and Artur's page: the customer's latest letter, above the decision buttons. */
.owner-letter { margin-bottom: 1rem; }
.owner-letter .eyebrow { margin: 0 0 0.35rem; }
.owner-letter-head { margin: 0; }
.owner-letter-text { margin: 0.5rem 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.owner-party { display: flex; gap: 1.4rem; margin: 0.15rem 0 0.2rem; }
.owner-party div { display: flex; flex-direction: column; gap: 0.1rem; }
.owner-party dt {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.owner-party dd { margin: 0; font-size: 1.45rem; font-weight: 650; line-height: 1.1; }
.client-status-waiting_client { background: #f3e6c8; }
.client-status-waiting_driver { background: #d9e4f5; }
.client-status-confirmed { background: #d7ebe4; }
.client-status-unavailable,
.client-status-cancelled { background: #f6e4e4; }
/* One stage per order: action = we must act, wait = the customer must, done = nothing to do */
.badge-step-action { background: #f3e6c8; color: var(--warn); }
.badge-step-wait { background: #d9e4f5; color: #1d3f73; }
.badge-step-done { background: #ece7df; color: var(--muted); }
/* Early booking: requested more than 120 days ahead, plans check two months before */
.badge-early { background: #e9e0f5; color: #4b2a7a; }
/* Labels for work by hand (orders/flags.py): bad = act now, warn = check, info = good to know. */
.badge-flag-bad { background: #f6dede; color: #8a1f1f; font-weight: 600; }
.badge-flag-warn { background: #f3e6c8; color: var(--warn); }
.badge-flag-info { background: #e3eee6; color: #2f5b3f; }
.badge-overdue { background: #b42318; color: #fff; font-weight: 700; }
.flag-line { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0.4rem 0 0; }
.mark-form { margin-top: 0.5rem; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.mark-form button.btn {
  margin: 0;
  padding: 0.28rem 0.55rem;
  font-size: 0.78rem;
  line-height: 1.2;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
}
.when-tab-reply { font-weight: 700; }
.attach-form { margin: 0.4rem 0 0.6rem; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.attach-form .input { width: 11rem; margin-left: 0.3rem; }
.trips-head .btn { margin-left: auto; }
.trip-edit { margin-bottom: 0.8rem; }
.trip-edit legend { font-weight: 700; padding: 0 0.3rem; }
.trip-edit.has-errors { border-color: var(--error); }
.trip-edit.trip-new { border-style: dashed; }
.trip-edit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr)); gap: 0.6rem 0.8rem; }
.trip-edit-grid label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.85rem; }
.trip-edit-grid label.wide { grid-column: span 2; }
.trip-edit-grid .trip-remove { flex-direction: row; align-items: center; gap: 0.4rem; color: var(--error); }
.form-actions { display: flex; gap: 0.6rem; }
.step-line { margin-top: 0.3rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; }
.step-template {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--warn);
  border-radius: 6px;
  color: var(--warn);
  font-size: 0.8rem;
  font-weight: 700;
}
.next-step h2 { margin-top: 0; }
.reply-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem; margin-bottom: 0.5rem; }
.reply-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.reply-actions form { margin: 0; }
.reply-actions .btn,
.reply-actions button.btn {
  display: inline-flex;
  align-items: center;
  margin: 0;
  white-space: nowrap;
}
.reply-text { width: 100%; min-height: 16rem; font-family: var(--font-body); line-height: 1.45; white-space: pre-wrap; }
.vehicle-choice { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; margin: 0 0 0.75rem; }
.vehicle-choice .btn { margin: 0; }
.reply-view {
  min-height: 12rem;
  max-height: 28rem;
  overflow: auto;
}
.reply-view strong { font-weight: 700; }
.reply-view .letter-link { font-weight: 700; text-decoration: underline; }
.reply-view .letter-button { margin: 0.25rem 0; text-decoration: none; }
.reply-source { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.reply-choice { margin-top: 0.75rem; display: flex; align-items: flex-end; gap: 0.5rem; }
.order-ref { font-size: 1.05rem; }
.sla-dot {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: middle;
  flex-shrink: 0;
}
.sla-ok { background: #1f8a5b; box-shadow: 0 0 0 2px rgba(31, 138, 91, 0.2); }
.sla-late { background: #c0392b; box-shadow: 0 0 0 2px rgba(192, 57, 43, 0.2); }
.admin-head .btn { margin-top: 0.5rem; }
.prices-scroll { overflow-x: auto; }
.flights-scroll { overflow: auto; }
.flights-scroll.is-main { max-height: calc(100vh - 14rem); }
.flights-table { min-width: 52rem; font-size: 0.92rem; }
.flights-table thead th { position: sticky; top: 0; z-index: 1; }
.flight-day-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; margin: 0.6rem 0; }
.flight-day-filters .btn { margin-top: 0; }
.flight-day-filters a.btn-secondary,
.flight-day-filters button.btn-secondary {
  background: #fff;
  color: #000;
  border: 1px solid #000;
}
.flight-day-filters a.btn-secondary.is-active,
.flight-day-filters button.btn-secondary.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.flight-add-form { margin: 0.4rem 0 1rem; }
.flight-manual-slot { box-shadow: inset 0 0 0 1px var(--accent); border-radius: 6px; }
.flights-table th.flight-day,
.flights-table td.flight-day {
  text-align: center;
  white-space: nowrap;
  width: 4.8rem;
  text-transform: none;
  letter-spacing: 0;
}
.flight-day-name, .flight-day-date { display: block; }
.flight-day-date { font-size: 0.75rem; font-weight: 500; }
.flights-table th.is-day-focus,
.flights-table td.is-day-focus { background: var(--accent-soft); }
a.flight-order-slot {
  display: inline-block;
  margin: 0.1rem 0;
  padding: 0.05rem 0.35rem;
  border-radius: 6px;
  background: #f3e6c8;
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
}
a.flight-order-slot.is-off-schedule { background: #f6e0e0; }
.quota-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.75rem;
  margin: 0.4rem 0 0.8rem;
}
.quota-stat {
  background: #f7f3ea;
  border-radius: 8px;
  padding: 0.7rem 0.8rem;
}
.quota-stat strong { display: block; margin-top: 0.15rem; font-size: 1.15rem; }
.prices-table { table-layout: fixed; min-width: 68rem; }
.revenue-table { min-width: 60rem; }
.price-id { display: block; color: var(--muted, #6d675d); font-size: 0.75rem; }
.night-rule { display: flex; flex-wrap: wrap; gap: 0.8rem; align-items: end; margin: 0.4rem 0 0.6rem; }
.night-rule label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; }
.night-rule .input { width: 6.5rem; }
.product-form { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.product-form .input { min-width: min(100%, 28rem); }
.prices-table .input { margin-top: 0; }
.prices-table .price-num {
  width: calc(3ch + 2.6rem);
  padding-left: 0.45rem;
  padding-right: 0.45rem;
}
.prices-table th:last-child,
.prices-table td:last-child { width: 2.4rem; text-align: center; }
.driver-edit-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.driver-edit-actions .inline-form { margin: 0; }
.driver-edit-actions .price-remove { font-size: 1.25rem; }
.price-remove {
  border: 0;
  background: transparent;
  padding: 0.15rem 0.25rem;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}
.confirm-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(28, 36, 32, 0.45);
}
.confirm-modal[hidden] { display: none; }
.confirm-modal-card {
  width: min(26rem, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.25rem;
}
.confirm-modal-actions { display: flex; gap: 0.6rem; }
.prices-table .price-num .input {
  width: calc(3ch + 1rem);
  padding-left: 0.3rem;
  padding-right: 0.3rem;
  text-align: right;
}
.price-revenue { background: #f7f3ea; color: var(--ink); }
.prices-table td:last-child { white-space: nowrap; }
.price-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.price-history { list-style: none; padding: 0; margin: 0; }
.price-history li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}
.price-history li:last-child { border-bottom: 0; padding-bottom: 0; }
.job-progress { margin-top: 0.85rem; max-width: 28rem; }
.sync-status { margin: 0.6rem 0 0; }
.sync-status.is-late { color: var(--warn); font-weight: 600; }
.token-paste { margin-top: 0.8rem; }
.token-paste p { margin: 0 0 0.7rem; }
.token-paste-form { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.token-paste-form .input { flex: 1 1 16rem; margin: 0; }
.h1-sync { font-size: 0.55em; font-weight: 400; color: var(--muted); white-space: nowrap; }
.h1-sync.is-late { color: var(--warn); font-weight: 600; }
.job-progress-track {
  height: 0.55rem;
  border-radius: 999px;
  background: #e6e0d4;
  overflow: hidden;
}
.job-progress-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.25s ease;
}
button.btn:disabled { opacity: 0.55; cursor: progress; }

@media (max-width: 720px) {
  .wrap { width: min(960px, calc(100% - 1rem)); }
  main.wrap { padding: 1rem 0 2rem; }
  .header-inner { padding: 0.65rem 0; gap: 0.5rem; }
  .brand { font-size: 1.15rem; }
  .brand--logo .brand-logo { width: 40px; height: 40px; }
  .brand-name { font-size: 1.15rem; }
  .brand-tagline { font-size: 0.5rem; }
  .nav { gap: 0.7rem; }
  .nav a { font-size: 0.85rem; }
  h1 { font-size: 1.55rem; }
  .admin-head .muted { font-size: 0.88rem; }
  .admin-head .btn { display: block; text-align: center; }
  .when-tabs .btn { display: inline-block; width: auto; text-align: center; }
  .reply-head { align-items: flex-start; }
  .reply-actions { width: 100%; }
  .reply-choice { flex-direction: column; align-items: stretch; }
  .reply-choice label { width: 100%; }
  .reply-choice .btn { align-self: flex-start; }
  .admin-head .inbox-actions .btn {
    display: inline-block;
    width: auto;
    padding: 0.55rem 0.7rem;
    font-size: 0.85rem;
  }
  .grid-2, .detail-grid { grid-template-columns: 1fr; }
  .trip-card-title { margin-bottom: 0.85rem; }
  .trip-facts {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 0.85rem 0.6rem;
  }
  .trip-card > .muted { margin: 0.95rem 0 0; }
  .trip-facts .trip-when,
  .trip-facts .trip-from { grid-column: span 3; }
  .trip-facts .trip-to { grid-column: 1 / -1; }
  .trip-facts .trip-flight,
  .trip-facts .trip-pax,
  .trip-facts .trip-bags { grid-column: span 2; }
  .trip-card { padding-top: 0.65rem; margin-top: 0.65rem; }
  .orders-table { display: none; }
  .orders-table.prices-table { display: table; }
  .orders-table.flights-table { display: table; }
  .orders-table.revenue-table { display: table; }
  .order-cards {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
  }
  .order-cards li {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
  }
  .order-card-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem 0.7rem;
  }
  .order-cards .decision-form { flex: 1; min-width: 0; padding: 0; }
  .order-cards li:last-child { border-bottom: 0; }
  .order-cards li:first-child .order-card,
  .order-cards li:last-child .order-card,
  .order-cards li:only-child .order-card,
  .order-cards .order-card {
    flex: 1;
    min-width: 0;
    border-bottom: 0;
    border-radius: 0;
  }
  .order-card-driver {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.28rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    text-align: center;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    color: var(--ink);
  }
  .order-card-driver.is-add {
    border-color: var(--accent);
    color: var(--accent);
  }
  .thread-head { flex-direction: column; }
  .gmail-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas:
      "who count when"
      "meta meta meta"
      "main main main";
    align-items: center;
    row-gap: 0.2rem;
  }
  .gmail-who { grid-area: who; }
  .gmail-count { grid-area: count; }
  .gmail-when { grid-area: when; color: var(--muted); }
  .gmail-meta { grid-area: meta; }
  .gmail-main { grid-area: main; }
  .gmail-subject { max-width: 100%; }
  .gmail-snippet { display: none; }
  .gmail-open { padding-left: 0.7rem; padding-right: 0.7rem; }
  .gmail-msg > summary { flex-wrap: wrap; }
  .gmail-msg .email-body { max-height: 14rem; font-size: 0.85rem; }
  .order-ref { overflow-wrap: anywhere; }
}

/* Workflow page: steps 1–4 left to right, 5–8 back under them, then the ways out. */
.workflow-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2.2rem 2rem; margin: 1.2rem 0 0.4rem; }
.workflow-exits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.workflow-step { position: relative; display: block; padding: 0.7rem 0.6rem 0.8rem; border: 1px solid var(--accent); border-radius: 12px; background: var(--accent-soft); color: var(--accent); text-align: center; text-decoration: none; }
.workflow-step:hover { background: #c5e2d8; }
.workflow-step strong { display: block; color: #0b3f34; }
.workflow-step small { display: block; margin-top: 0.15rem; }
.workflow-count { position: absolute; top: -0.65rem; right: -0.6rem; min-width: 1.6rem; padding: 0.1rem 0.45rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.8rem; font-weight: 600; }
.workflow-step.is-exit { border-color: var(--error); background: #f6e3dc; color: var(--error); }
.workflow-step.is-exit:hover { background: #efd2c7; }
.workflow-step.is-exit strong { color: #5e1414; }
.workflow-step.is-exit .workflow-count { background: var(--error); }
.workflow-steps .step-5 { grid-row: 2; grid-column: 4; }
.workflow-steps .step-6 { grid-row: 2; grid-column: 3; }
.workflow-steps .step-7 { grid-row: 2; grid-column: 2; }
.workflow-steps .step-8 { grid-row: 2; grid-column: 1; }
.workflow-step.arrow-right::after,
.workflow-step.arrow-left::after,
.workflow-step.arrow-down::after { position: absolute; color: var(--muted); font-size: 1.1rem; }
.workflow-step.arrow-right::after { content: "→"; right: -1.5rem; top: 50%; transform: translateY(-50%); }
.workflow-step.arrow-left::after { content: "←"; left: -1.5rem; top: 50%; transform: translateY(-50%); }
.workflow-step.arrow-down::after { content: "↓"; bottom: -1.9rem; left: 50%; transform: translateX(-50%); }
.workflow-loop { margin: 1rem 0 0; color: var(--muted); text-align: center; }
.workflow-filter { margin: 0.6rem 0 0; }
.workflow-history { margin: 0.4rem 0 0.6rem; padding-left: 1.2rem; }
.workflow-history li { margin: 0.3rem 0; }
.workflow-history time { margin-right: 0.35rem; color: var(--muted); font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .workflow-steps, .workflow-exits { grid-template-columns: 1fr; gap: 1.7rem; }
  .workflow-steps .workflow-step { grid-row: auto; grid-column: auto; }
  .workflow-step.arrow-right::after,
  .workflow-step.arrow-left::after,
  .workflow-step.arrow-down::after { content: "↓"; top: auto; right: auto; bottom: -1.6rem; left: 50%; transform: translateX(-50%); }
}

/* Per-transfer controls on Sergio's and Artur's order links. */
.transfer-details + .transfer-details { border-top: 1px solid #dce1e5; margin-top: 1.5rem; padding-top: 1.5rem; }
.transfer-settings { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.transfer-settings label { min-width: 0; }
.transfer-settings .btn { justify-self: start; }
.transfer-settings .muted { display: block; font-size: 0.85rem; margin-top: 0.4rem; }
@media (max-width: 600px) { .transfer-settings { grid-template-columns: minmax(0, 1fr); } }

.receipt-reminder-link { display: table; max-width: 100%; white-space: normal; margin-top: 0.4rem; padding: 0.45rem 0.75rem; font-size: 0.82rem; }
#receipt-reminder { scroll-margin-top: 4rem; }

/* Optional booking deposit controls shared by the owner and Sergio. */
.prepayment-toggle { display: flex; align-items: center; gap: .65rem; min-height: 44px; font-weight: 600; }
.prepayment-toggle input { width: 20px; height: 20px; flex: 0 0 auto; }
.prepayment-fields:not([hidden]) { display: grid; grid-template-columns: minmax(120px, 180px) minmax(0, 1fr); gap: 1rem; margin: .75rem 0; }
.prepayment-fields label { display: grid; gap: .35rem; }
.prepayment-fields .input { width: 100%; min-width: 0; box-sizing: border-box; }
.prepayment-fields p { grid-column: 1 / -1; margin: 0; }
@media (max-width: 600px) { .prepayment-fields:not([hidden]) { grid-template-columns: 1fr; } }
