/* Layout and components. Every colour, shadow and the font come from theme.css. */

/* ===== Base ===== */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scrollbar-color: var(--line-strong) transparent; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.55;
  color: var(--ink); background: var(--ground); caret-color: var(--action);
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--action); color: var(--action-ink); }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; border-radius: 6px; }
.rail :focus-visible { outline-color: var(--foil); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; text-wrap: balance; }
p { margin: 0; }
button { font: inherit; cursor: pointer; }
.num { font-variant-numeric: tabular-nums lining-nums; }
.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ===== Shell: sidebar on a laptop, top bar on a phone ===== */
.app { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.rail {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 30px;
  padding: 28px 16px 18px; background: var(--shell); color: var(--shell-ink);
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; color: var(--shell-ink); text-decoration: none; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-name { display: block; font-size: 27px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.brand-sub { display: block; margin-top: 5px; font-size: 12.5px; font-weight: 600; color: var(--foil); letter-spacing: 0.01em; }
.nav { display: grid; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--shell-muted); text-decoration: none; font-weight: 600; font-size: 15px;
  transition: background-color .15s, color .15s;
}
.nav a:hover { background: var(--shell-raise); color: var(--shell-ink); }
.nav a[aria-current="page"] { background: var(--shell-raise); color: var(--shell-ink); }
.nav a[aria-current="page"] .i { color: var(--foil); }
.badge {
  margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--foil); color: var(--shell); font-size: 12.5px; font-weight: 800;
  display: inline-grid; place-items: center;
}
.agent { margin-top: auto; padding: 16px; border-radius: 14px; background: var(--shell-raise); display: grid; gap: 10px; }
.agent-state { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.agent p { font-size: 13px; color: var(--shell-muted); line-height: 1.45; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--mark); flex: none; }
.is-paused .live-dot { background: var(--shell-muted); }
.btn-shell {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 12px;
  border-radius: 10px; border: 1px solid color-mix(in srgb, var(--shell-ink) 24%, transparent);
  background: transparent; color: var(--shell-ink); font-weight: 700; font-size: 14px;
}
.btn-shell:hover { background: color-mix(in srgb, var(--shell-ink) 8%, transparent); }
.btn-shell .i { width: 16px; height: 16px; }
.agent dl { margin: 0; display: grid; gap: 6px; font-size: 13px; padding-top: 10px; border-top: 1px solid color-mix(in srgb, var(--shell-ink) 12%, transparent); }
.agent dl div { display: flex; justify-content: space-between; gap: 10px; }
.agent dt { color: var(--shell-muted); }
.agent dd { margin: 0; font-weight: 600; text-align: right; }
.agent-chip { display: none; }

.main { min-width: 0; padding: 36px 44px 120px; }
.banners { max-width: 1180px; margin: 0 auto; display: grid; gap: 12px; }
.banners:not(:empty) { margin-bottom: 24px; }
.view { max-width: 1180px; margin: 0 auto; display: grid; gap: 32px; }

/* ===== Page head ===== */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 28px; flex-wrap: wrap; }
h1 { font-size: 33px; font-weight: 800; }
h1 .hl { color: var(--wait); }
.lede { margin-top: 8px; font-size: 16px; color: var(--muted); max-width: 62ch; }
.head-side { display: grid; justify-items: end; gap: 10px; }
.when { font-size: 13px; color: var(--muted); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 16px;
  border-radius: 10px; border: 1px solid var(--line-strong); background: var(--paper); color: var(--ink);
  font-weight: 700; font-size: 14.5px; transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { border-color: var(--ink); }
.btn .i { width: 18px; height: 18px; }
.btn-primary { background: var(--action); border-color: var(--action); color: var(--action-ink); }
.btn-primary:hover { background: var(--action-hover); border-color: var(--action-hover); }
.btn-danger { background: var(--stop); border-color: var(--stop); color: var(--on-color); }
.btn-danger:hover { border-color: var(--stop); filter: brightness(.92); }
.btn-quiet {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 6px; border: 0; background: none;
  color: var(--muted); font-weight: 600; font-size: 14px;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--line-strong);
}
.btn-quiet:hover { color: var(--ink); text-decoration-color: currentColor; }
.btn-quiet.danger:hover { color: var(--stop); }
.btn[disabled], .btn.is-busy, .btn-quiet[disabled] { pointer-events: none; opacity: .6; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); }
.icon-btn:hover { border-color: var(--ink); }

/* ===== Banners and notices ===== */
.banner { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 12px 14px 12px 16px; border-radius: 14px; background: var(--wait-soft); font-size: 14.5px; }
.banner > .i { color: var(--wait); }
.banner p { flex: 1 1 320px; }
.banner.offline { background: var(--stop-soft); }
.banner.offline > .i { color: var(--stop); }
.banner a { color: inherit; font-weight: 800; }

/* ===== Needs you ===== */
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 14px; }
h2 { font-size: 19px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.section-note { font-size: 13.5px; color: var(--muted); }
.count { font-size: 13px; font-weight: 800; padding: 0 10px; border-radius: 999px; background: var(--wait-soft); color: var(--wait); line-height: 24px; }
.needs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 20px; align-items: start; }
.msg { background: var(--paper); border-radius: 16px; padding: 22px; display: grid; gap: 16px; align-content: start; box-shadow: var(--shadow-card); }
.msg-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.msg-head h3 { font-size: 18px; font-weight: 800; }
.msg-sub { margin-top: 2px; font-size: 13.5px; color: var(--muted); }
.value { font-size: 23px; font-weight: 800; white-space: nowrap; line-height: 1.1; }
.value small { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: 4px; }
.items { margin-top: -8px; font-size: 14px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { font-size: 12.5px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: var(--cream); }

.wa { margin: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.wa-top { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 12px; padding: 7px 12px; font-size: 12.5px; color: var(--muted); background: var(--cream); }
.wa-top span { display: inline-flex; align-items: center; gap: 6px; }
.wa-top .i { width: 15px; height: 15px; }
.wa-wall { background: var(--wa-wall); padding: 14px 14px 14px 36px; display: flex; justify-content: flex-end; }
.wa-bubble {
  max-width: 100%; background: var(--wa-bubble); color: var(--wa-ink); border-radius: 10px 2px 10px 10px; padding: 8px 12px 7px;
  font-size: 15.5px; line-height: 1.75; box-shadow: var(--wa-shadow); white-space: pre-wrap; overflow-wrap: anywhere;
}
.wa-link { color: var(--wa-link); }
.wa-en { padding: 12px 14px; font-size: 14px; border-top: 1px solid var(--line); background: var(--paper); white-space: pre-wrap; overflow-wrap: anywhere; }
.wa-en b { display: block; margin-bottom: 2px; font-size: 12px; color: var(--muted); }
.wa-details summary { cursor: pointer; font-size: 14px; font-weight: 700; color: var(--muted); list-style: none; display: inline-flex; align-items: center; gap: 6px; }
.wa-details summary::-webkit-details-marker { display: none; }
.wa-details summary .i { width: 16px; height: 16px; transition: transform .2s; }
.wa-details[open] summary .i { transform: rotate(90deg); }
.wa-details[open] summary { margin-bottom: 10px; }

.coupon { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.coupon .i { width: 17px; height: 17px; margin-top: 2px; color: var(--ink); }
.coupon b { font-weight: 800; letter-spacing: .02em; }
.ok-text { color: var(--ok); font-weight: 700; }
.checks { display: grid; gap: 7px; font-size: 13.5px; padding: 12px 14px; border-radius: 12px; background: var(--ground); }
.check-row { display: flex; gap: 9px; align-items: flex-start; }
.check-row .i { width: 17px; height: 17px; margin-top: 2px; }
.check-row.ok .i { color: var(--ok); }
.check-row.later { color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; }
.confirm-stop { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border-radius: 12px; background: var(--stop-soft); width: 100%; }
.confirm-stop p { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; color: var(--stop); flex: 1 1 220px; font-size: 14px; }
.confirm-stop .i { width: 18px; height: 18px; }

.send-steps { list-style: none; margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--wait-soft); display: grid; gap: 8px; font-size: 14px; }
.send-steps li { display: flex; gap: 10px; align-items: center; }
.step-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12.5px; font-weight: 800; flex: none; border: 1.5px solid color-mix(in srgb, var(--wait) 55%, transparent); color: var(--wait); }
.step-dot .i { width: 14px; height: 14px; stroke-width: 2.6; }
.send-steps .done { color: var(--muted); }
.send-steps .done .step-dot { background: var(--ok); border-color: var(--ok); color: var(--on-color); }
.send-steps .now { font-weight: 800; color: var(--wait); }
.send-steps .now .step-dot { background: var(--wait); border-color: var(--wait); color: var(--on-color); }

.clear-bar { display: flex; gap: 12px; align-items: center; padding: 16px 18px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); font-size: 15px; }
.clear-bar .i { color: var(--ok); width: 22px; height: 22px; }

/* ===== From cart to order ===== */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 22px 24px; min-width: 0; }
.route-labels { list-style: none; margin: 18px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stop-n { display: block; font-size: 27px; font-weight: 800; line-height: 1.15; }
.stop-l { display: block; font-size: 13.5px; color: var(--muted); }
.route-labels .end { text-align: right; }
.route-labels .end .stop-n { color: var(--ok); }
.band { display: block; width: 100%; height: 56px; margin-top: 10px; }
.band .flow { fill: var(--ink); }
.band .flow-ok { fill: var(--ok); }
.route-foot { margin-top: 14px; font-size: 13.5px; color: var(--muted); }
.flow-empty { margin-top: 12px; font-size: 15px; color: var(--muted); }

/* ===== Carts + activity ===== */
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); gap: 24px; align-items: start; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.link { color: var(--action); font-weight: 700; font-size: 14px; text-decoration: underline; text-underline-offset: 4px; text-decoration-color: color-mix(in srgb, var(--action) 35%, transparent); display: inline-flex; align-items: center; gap: 4px; }
.link:hover { text-decoration-color: currentColor; }
.link .i { width: 16px; height: 16px; }

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { font-size: 12.5px; font-weight: 700; color: var(--muted); text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 13px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr { cursor: pointer; transition: background-color .12s; }
.table tbody tr:hover { background: var(--ground); }
.table tbody tr:last-child td { border-bottom: 0; }
.row-link { display: block; padding: 0; border: 0; background: none; color: var(--ink); font-weight: 700; text-align: left; }
.row-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.c-cust span, .c-cart span { display: block; font-size: 12.5px; color: var(--muted); }
.c-cust { min-width: 150px; }
.c-cust span { white-space: nowrap; } /* long names may wrap; the masked phone never does */
.c-next { min-width: 190px; }
.c-cart b { font-weight: 700; white-space: nowrap; }
.c-cart span { max-width: 24ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.compact .c-cart span { display: none; }
.c-last { color: var(--muted); font-size: 13px; white-space: nowrap; }
.empty-row td { text-align: center; color: var(--muted); padding: 28px; cursor: default; }
.next { display: flex; gap: 8px; align-items: flex-start; }
.next .i { width: 16px; height: 16px; margin-top: 3px; color: var(--muted); }
.next.needs { color: var(--wait); font-weight: 700; }
.next.needs .i, .next.ok .i { color: currentColor; }
.next.ok { color: var(--ok); font-weight: 700; }
.next.closed { color: var(--muted); }

/* The journey: a cart tracked like a parcel. Shape AND colour carry the state. */
.journey { --row: 0; display: flex; align-items: center; width: 132px; } /* --row and --k stagger the drawing; set per row */
.journey .seg { --k: 0; flex: 1; height: 2px; background: var(--ink); transform-origin: left; }
.journey .seg.todo { height: 0; background: none; border-top: 2px dashed var(--line-strong); }
.jn { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--ink); display: grid; place-items: center; }
.jn .i { width: 10px; height: 10px; stroke-width: 3; }
.jn.now { width: 16px; height: 16px; background: var(--paper); border: 4px solid var(--wait); }
.jn.todo { width: 12px; height: 12px; background: var(--paper); border: 2px solid var(--line-strong); }
.jn.ok { width: 16px; height: 16px; background: var(--ok); color: var(--on-color); }
.jn.x { width: 16px; height: 16px; background: var(--cream); color: var(--muted); border: 1.5px solid var(--line-strong); }
.jn.x .i { width: 9px; height: 9px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }

.feed { list-style: none; margin: 0; padding: 0; }
.feed li { display: grid; grid-template-columns: 42px 30px minmax(0, 1fr); gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); font-size: 14px; align-items: start; }
.feed li:last-child { border-bottom: 0; }
.feed time { font-size: 12.5px; color: var(--muted); padding-top: 4px; font-variant-numeric: tabular-nums; }
.ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--cream); color: var(--ink); }
.ic .i { width: 16px; height: 16px; }
.ic.ok { background: var(--ok-soft); color: var(--ok); }
.ic.wait { background: var(--wait-soft); color: var(--wait); }
.ic.stop { background: var(--stop-soft); color: var(--stop); }
.feed b { font-weight: 700; }
.feed small { display: block; color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.empty { color: var(--muted); font-size: 14px; }
.feed li.empty { display: block; }

/* ===== Carts page ===== */
.toolbar { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.segmented { display: inline-flex; padding: 4px; gap: 4px; background: var(--cream); border-radius: 12px; flex-wrap: wrap; }
.segmented button { border: 0; background: none; padding: 7px 14px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); }
.segmented button[aria-pressed="true"] { background: var(--paper); color: var(--ink); box-shadow: 0 1px 2px color-mix(in srgb, var(--shell) 14%, transparent); }
.segmented .n { font-weight: 600; margin-left: 4px; color: var(--muted); }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; min-height: 42px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--paper); min-width: min(100%, 260px); }
.search .i { width: 17px; height: 17px; color: var(--muted); }
.search input { border: 0; outline: 0; font: inherit; color: var(--ink); background: none; width: 100%; }
.search:focus-within { outline: 2px solid var(--action); outline-offset: 2px; }

/* ===== Side panel: one cart's whole story ===== */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(470px, 100%); z-index: 40; display: flex; flex-direction: column;
  background: var(--paper); box-shadow: var(--shadow-panel);
  transform: translateX(104%); transition: transform .34s cubic-bezier(.2, .8, .2, 1), visibility 0s linear .34s; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; transition: transform .34s cubic-bezier(.2, .8, .2, 1); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 21px; }
.drawer-head p { margin-top: 2px; font-size: 13.5px; color: var(--muted); }
.drawer-body { overflow: auto; padding: 20px 24px 32px; display: grid; gap: 20px; align-content: start; }
.dr-now { display: grid; gap: 10px; padding: 14px 16px; border-radius: 12px; background: var(--ground); }
.dr-now .journey { width: 100%; max-width: 300px; }
.dr-items { font-size: 14px; }
.drawer h3 { font-size: 16px; font-weight: 800; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 64px 18px minmax(0, 1fr); gap: 12px; padding-bottom: 18px; }
.timeline li::before { content: ""; position: absolute; left: calc(64px + 12px + 8px); top: 20px; bottom: 0; width: 2px; background: var(--ink); opacity: .85; }
.timeline li:last-child::before { display: none; }
.timeline .jn { margin-top: 4px; justify-self: center; }
.tl-time { font-size: 12.5px; color: var(--muted); text-align: right; padding-top: 1px; font-variant-numeric: tabular-nums; }
.tl-title { font-weight: 700; }
.tl-d { font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.stamps { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.stamp { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 700; color: var(--ok); border: 1.5px solid color-mix(in srgb, var(--ok) 40%, transparent); border-radius: 999px; padding: 0 9px 0 7px; line-height: 22px; }
.stamp .i { width: 13px; height: 13px; stroke-width: 2.6; }

/* ===== Rules ===== */
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 470px), 1fr)); gap: 20px; align-items: start; }
.rule-group { margin: 0; min-width: 0; border: 1px solid var(--line); border-radius: 16px; background: var(--paper); padding: 20px 22px 22px; display: grid; gap: 16px; }
.rule-group legend { float: left; width: 100%; padding: 0; font-size: 18px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.rule-group legend .i { color: var(--muted); }
.rule-group legend + * { clear: both; }
.sentence { display: block; font-size: 15.5px; line-height: 2.25; }
.sentence input, .sentence select {
  font: inherit; font-weight: 800; color: var(--ink); text-align: center; padding: 1px 4px; margin: 0 3px;
  border: 0; border-bottom: 2px solid var(--line-strong); border-radius: 6px 6px 0 0; background: var(--cream);
  font-variant-numeric: tabular-nums;
}
.sentence input { width: 3.6em; }
.sentence select { padding-right: 2px; }
.sentence input:hover, .sentence select:hover { border-bottom-color: var(--ink); }
.sentence input:focus-visible, .sentence select:focus-visible { border-bottom-color: var(--action); outline-offset: 3px; }
.sentence small, .hint { display: block; font-size: 13px; color: var(--muted); line-height: 1.5; }
.switch-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: start; cursor: pointer; }
.switch-row strong { display: block; font-size: 15.5px; }
.switch-row small { display: block; font-size: 13.5px; color: var(--muted); }
.switch { appearance: none; -webkit-appearance: none; margin: 2px 0 0; width: 46px; height: 27px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; transition: background-color .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 21px; height: 21px; border-radius: 50%; background: var(--on-color); box-shadow: var(--shadow-knob); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.switch:checked { background: var(--action); }
.switch:checked::after { transform: translateX(19px); }
.switch:disabled { opacity: .55; cursor: not-allowed; }
.switch-row:has(.switch:disabled) { cursor: default; }
.example { padding: 12px 14px; border-radius: 12px; background: var(--ground); font-size: 14px; display: grid; gap: 8px; }
.example ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.example li { display: inline-flex; align-items: center; gap: 6px; }
.example .tag { background: var(--paper); border: 1px solid var(--line); }
.example .arrow { color: var(--muted); }
.connection { display: grid; }
.conn-row { display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 16px 0; border-bottom: 1px solid var(--line); }
.conn-row:last-child { border-bottom: 0; padding-bottom: 4px; }
.conn-row > .i { color: var(--muted); }
.conn-row div { flex: 1 1 260px; }
.conn-row strong { display: block; }
.conn-row span { font-size: 13.5px; color: var(--muted); }
.savebar {
  position: sticky; bottom: 16px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 10px 10px 18px; border-radius: 14px; background: var(--shell); color: var(--shell-ink); box-shadow: var(--shadow-lift);
}
.savebar.error { background: var(--stop); color: var(--on-color); }
.savebar div { display: flex; gap: 8px; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; max-width: min(560px, calc(100% - 32px));
  padding: 12px 18px; border-radius: 12px; background: var(--shell); color: var(--shell-ink); font-size: 14.5px; font-weight: 600;
  box-shadow: var(--shadow-lift);
  transform: translate(-50%, 16px); opacity: 0; pointer-events: none; transition: transform .28s cubic-bezier(.2, .8, .2, 1), opacity .2s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ===== Motion: the routes draw themselves once, when a page first appears ===== */
@keyframes grow { from { transform: scaleX(0); } }
@keyframes reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } }
.view:not(.drawn) .journey .seg { animation: grow .5s cubic-bezier(.2, .8, .2, 1) both; animation-delay: calc(var(--row, 0) * 45ms + var(--k, 0) * 110ms); }
.view:not(.drawn) .band { animation: reveal 1.1s cubic-bezier(.2, .8, .2, 1) both; }
.view:not(.drawn) .msg { animation: arrive .45s cubic-bezier(.2, .8, .2, 1) both; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ===== Smaller laptops ===== */
@media (max-width: 1180px) {
  .split { grid-template-columns: minmax(0, 1fr); }
}

/* ===== Phone / small tablet: the sidebar becomes a top bar ===== */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .rail { height: auto; align-self: start; z-index: 30; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 16px 10px; }
  .brand { padding: 0; }
  .brand-mark { width: 28px; height: 28px; }
  .brand-name { font-size: 23px; }
  .brand-sub { display: none; }
  .agent { display: none; }
  .agent-chip { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; padding: 6px 12px; border-radius: 999px; background: var(--shell-raise); font-size: 13px; font-weight: 700; border: 0; color: var(--shell-ink); }
  .nav { order: 3; width: 100%; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 6px; }
  .nav a { justify-content: center; padding: 8px 6px; font-size: 14px; gap: 8px; }
  .nav .badge { margin-left: 2px; }
  .main { padding: 20px 16px 140px; }
  .view { gap: 26px; }
  h1 { font-size: 26px; }
  .lede { font-size: 15px; }
  .head-side { justify-items: start; }
  .msg { padding: 18px 16px; }
  .actions .btn { flex: 1 1 auto; }
  .actions .btn.btn-primary { flex: 1 1 100%; }
  .panel { padding: 18px 16px; }
  .route-labels { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; }
  .route-labels .end { text-align: left; }
  .stop-n { font-size: 23px; }
  .band { height: 44px; }
  .rule-group { padding: 18px 16px; }
  .toolbar .search { flex: 1 1 100%; }
}
@media (max-width: 700px) {
  .table thead { display: none; }
  .table, .table tbody { display: block; }
  .table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px 2px; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { display: block; padding: 0; border: 0; }
  .table td.c-cart { text-align: right; }
  .table td.c-cart span { display: none; }
  .table td.c-journey, .table td.c-next { grid-column: 1 / -1; }
  .table td.c-last { display: none; }
  .wa-wall { padding-left: 14px; }
}
