:root {
  --navy: #0b2f52;
  --route-navy: #103b64;
  --blue: #0877e1;
  --blue-dark: #075fae;
  --blue-wash: #e8f4ff;
  --amber: #f4ad22;
  --amber-wash: #fff0c8;
  --green: #127257;
  --green-wash: #dff3ea;
  --red: #a92f32;
  --red-wash: #fde5e4;
  --ink: #11243a;
  --muted: #5f7185;
  --line: #d8e0e8;
  --paper: #fff;
  --wash: #f3f6f9;
  --canvas: #e8edf2;
  --shadow: 0 12px 28px rgba(11, 47, 82, .1);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-size: 16px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; }
button, input, select, textarea { font: inherit; }
button, select, summary { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid #ffbf3f; outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 19ch; margin-bottom: 10px; font-size: clamp(2rem, 5vw, 3.25rem); line-height: 1.04; letter-spacing: -.035em; text-wrap: balance; }
h2 { margin-bottom: 10px; font-size: 1.3rem; line-height: 1.2; letter-spacing: -.02em; }
h3 { margin-bottom: 4px; font-size: 1rem; }
p { max-width: 70ch; margin-bottom: 0; color: var(--muted); line-height: 1.5; }

.shell { max-width: 1180px; min-height: 100vh; margin: auto; background: var(--wash); box-shadow: 0 0 60px rgba(8, 35, 58, .16); }
.masthead { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 17px clamp(18px, 4vw, 34px); background: var(--navy); color: white; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand strong, .brand span { display: block; }
.brand strong { font-size: 1.05rem; }
.brand span, .place { color: #cce4f8; font-size: .78rem; letter-spacing: .04em; }
.place { text-align: right; }
.seal { display: grid; width: 42px; height: 42px; place-items: center; border: 2px solid #7bc6ff; border-radius: 50%; color: #7bc6ff; font-weight: 900; }
.rolebar { display: flex; overflow: auto; border-bottom: 1px solid #315778; background: var(--route-navy); color: #dbe9f5; scrollbar-width: none; }
.rolebar button { min-width: max-content; flex: 1; padding: 15px 18px; border: 0; background: transparent; color: inherit; font-weight: 750; }
.rolebar button[aria-current="true"] { background: #174d7d; color: white; box-shadow: inset 0 -4px var(--amber); }
.role-select { display: none; padding: 10px 16px; background: var(--route-navy); }
.role-select label { display: block; margin-bottom: 5px; color: #cce4f8; font-size: .75rem; font-weight: 800; }
.role-select select { width: 100%; padding: 11px; border: 0; border-radius: 8px; background: white; color: var(--navy); font-weight: 800; }
.notice { display: flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-bottom: 1px solid #eddda9; background: #fff4d8; color: #62420c; font-size: .8rem; }
.notice span { display: grid; width: 19px; height: 19px; place-items: center; border: 1px solid currentColor; border-radius: 50%; font-weight: 900; }
main { padding: 24px clamp(16px, 4vw, 34px) 36px; }
.view { max-width: 980px; margin: auto; }

.page-head { margin-bottom: 18px; padding: clamp(22px, 4vw, 30px); border-radius: 16px; background: var(--paper); box-shadow: var(--shadow); }
.page-head > div:first-child > p { font-size: 1.02rem; }
.next-action { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 20px; margin-top: 22px; padding: 20px; border-radius: 14px; background: var(--blue-dark); color: white; }
.next-action h2 { margin-bottom: 5px; }
.next-action p { color: #d8efff; }
.action-buttons { display: flex; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.button { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; padding: 12px 17px; border: 0; border-radius: 10px; background: var(--blue); color: white; font-weight: 800; text-decoration: none; }
.button:hover { filter: brightness(.96); }
.button.light { background: white; color: var(--blue-dark); }
.button.outline-light { border: 1px solid #a9d4f6; background: transparent; color: white; }
.button:disabled, .order-button:disabled { cursor: not-allowed; opacity: .42; }
.link { display: inline-flex; min-height: 32px; align-items: center; padding: 5px 0; border: 0; background: none; color: var(--blue); font-weight: 800; text-decoration: underline; }
.section-head .link { margin-top: 8px; font-size: .82rem; }
@media (max-width: 600px), (pointer: coarse) { .link { min-height: 44px; } }

.workflow, .panel, .customer-card, .empty-state, .metric-band { margin-bottom: 18px; padding: 20px; border-radius: 16px; background: white; }
.workflow-track { display: flex; align-items: flex-start; overflow: auto; padding: 7px 2px 2px; }
.workflow-stop { position: relative; min-width: 105px; flex: 1; color: #718094; font-size: .74rem; font-weight: 750; text-align: center; }
.workflow-stop::before { position: relative; z-index: 2; display: block; width: 17px; height: 17px; margin: 0 auto 9px; border: 4px solid #aeb8c3; border-radius: 50%; background: white; content: ""; }
.workflow-stop::after { position: absolute; top: 8px; right: -50%; left: 50%; height: 4px; background: #c9d1da; content: ""; }
.workflow-stop:last-child::after { display: none; }
.workflow-stop.done::before, .workflow-stop.done::after { border-color: var(--blue); background: var(--blue); }
.workflow-stop.current { color: var(--ink); }
.workflow-stop.current::before { border-color: var(--amber); }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.section-head h2, .section-head p { margin-bottom: 0; }
.section-head > span { color: var(--muted); font-size: .82rem; font-weight: 750; }

.filter-field { min-width: 180px; }
.filter-field label, .assignment label, .field label { display: block; margin-bottom: 6px; color: var(--ink); font-size: .78rem; font-weight: 800; }
select, input, textarea { width: 100%; padding: 12px; border: 1px solid #b8c7d5; border-radius: 10px; background: white; color: var(--ink); }
textarea { resize: vertical; }
.inspection-row { display: grid; grid-template-columns: 105px minmax(190px, 1fr) auto minmax(190px, 220px); align-items: center; gap: 12px 16px; padding: 17px 0; border-top: 1px solid var(--line); }
.inspection-row:first-child { border-top: 0; }
.record-id { color: var(--muted); font-size: .78rem; font-weight: 800; }
.record-main p { font-size: .86rem; }
.inspection-row details { grid-column: 2 / -1; }
details > summary { display: inline-flex; width: fit-content; min-height: 32px; align-items: center; color: var(--blue-dark); font-size: .82rem; font-weight: 800; }
@media (max-width: 600px), (pointer: coarse) { details > summary { min-height: 44px; padding-right: 10px; } }
.details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 13px 0 0; }
.details div { min-width: 0; }
.details dt { color: var(--muted); font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.details dd { margin: 4px 0 0; line-height: 1.4; }
.status { display: inline-flex; width: fit-content; align-items: center; white-space: nowrap; padding: 7px 10px; border-radius: 999px; background: var(--blue-wash); color: #075cae; font-size: .75rem; font-weight: 800; }
.status.green { background: var(--green-wash); color: #07593f; }
.status.red { background: var(--red-wash); color: #872523; }
.status.amber { background: var(--amber-wash); color: #744600; }
.status.gray { background: #e8edf2; color: #536477; }

.route-list { border-top: 1px solid var(--line); }
.route-row { display: grid; grid-template-columns: 62px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.route-row:last-child { border-bottom: 0; }
.route-row details { grid-column: 2 / -1; }
.stop-number { display: grid; align-self: stretch; place-content: center; border-radius: 12px; background: var(--blue-wash); color: var(--blue-dark); text-align: center; }
.stop-number span, .stop-number small { font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.stop-number strong { font-size: 1.6rem; line-height: 1; }
.record-main .status { margin-top: 8px; }
.reorder { display: flex; gap: 7px; }
.order-button { min-height: 42px; padding: 8px 10px; border: 1px solid #b8c7d5; border-radius: 10px; background: white; color: var(--navy); font-size: .76rem; font-weight: 800; }
.result-panel { scroll-margin-top: 18px; }
.form-grid { display: grid; grid-template-columns: .7fr 1.3fr; gap: 0 16px; }
.field { margin-bottom: 17px; }
.field small { display: block; margin-top: 6px; color: var(--muted); }
.form-grid .field:last-child { grid-column: 2; }
.form-error { display: none; margin: 0 0 14px; padding: 12px; border-radius: 10px; background: var(--red-wash); color: #872523; font-weight: 750; }
.form-error.show { display: block; }

.customer-card { padding: clamp(22px, 5vw, 34px); }
.queue-position { margin: 22px 0; padding: 22px; border-radius: 14px; background: var(--navy); color: white; text-align: center; }
.queue-position span { display: block; color: #cce4f8; font-size: .78rem; font-weight: 800; }
.queue-position strong { display: block; margin: 5px 0; font-size: clamp(2rem, 7vw, 3.5rem); letter-spacing: -.04em; }
.queue-position p { margin: auto; color: #d8efff; }
.customer-details { padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.plain-note { margin-top: 18px; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.compact-field { max-width: 520px; margin: 0; }

.metric-band { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px; overflow: hidden; padding: 0; background: var(--line); }
.metric { min-width: 0; padding: 18px 13px; background: white; }
.metric strong, .metric span { display: block; }
.metric strong { font-size: 1.8rem; letter-spacing: -.04em; }
.metric span { margin-top: 3px; color: var(--muted); font-size: .74rem; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.readiness { padding: 15px 0; border-top: 1px solid var(--line); }
.readiness:first-of-type { border-top: 0; }
.readiness > div:first-child { display: flex; justify-content: space-between; gap: 12px; }
.readiness span, .readiness em { color: var(--muted); font-size: .78rem; font-style: normal; }
.bar { height: 7px; margin: 10px 0 7px; overflow: hidden; border-radius: 10px; background: #dfe6ed; }
.bar span { display: block; height: 100%; background: var(--blue); }
.activity { position: relative; margin-left: 6px; }
.activity::before { position: absolute; top: 8px; bottom: 16px; left: 6px; width: 2px; background: #cbd6df; content: ""; }
.event { position: relative; padding: 0 0 19px 27px; }
.event:last-child { padding-bottom: 0; }
.event::before { position: absolute; top: 4px; left: 0; width: 10px; height: 10px; border: 3px solid var(--blue); border-radius: 50%; background: white; content: ""; }
.event time { color: var(--muted); font-size: .7rem; }
.event p { margin-top: 2px; color: var(--ink); font-size: .87rem; }
.notification-list { margin: 14px 0 0; padding: 0; list-style: none; }
.notification-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-top: 1px solid var(--line); }
.notification-list strong, .notification-list span { display: block; }
.notification-list div > span { margin-top: 3px; color: var(--muted); font-size: .82rem; }
.empty-state { padding: clamp(28px, 7vw, 60px); text-align: center; }
.empty-state h2, .empty-state p { margin-right: auto; margin-left: auto; }
.empty-state.compact { margin: 0; padding: 24px; box-shadow: none; }
.demo-tools { display: flex; justify-content: space-between; gap: 18px; margin: 28px auto 0; padding-top: 14px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
#toast { position: fixed; z-index: 20; bottom: 28px; left: 50%; max-width: calc(100vw - 32px); padding: 12px 16px; overflow: hidden; transform: translate(-50%, 20px); border-radius: 10px; background: var(--ink); box-shadow: var(--shadow); color: white; opacity: 0; pointer-events: none; text-overflow: ellipsis; white-space: nowrap; transition: .2s ease-out; }
#toast.show { transform: translate(-50%, 0); opacity: 1; }

/* simulated phone thread for the on-site contact */
.phone { overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--wash); }
.phone-bar { padding: 10px 14px; background: var(--navy); color: white; font-size: .76rem; font-weight: 800; letter-spacing: .02em; text-align: center; }
.phone-thread { display: grid; gap: 12px; padding: 14px; }
.sms { max-width: 94%; padding: 12px 14px; border-radius: 16px 16px 16px 4px; background: white; box-shadow: 0 1px 3px rgba(11, 47, 82, .13); }
.sms p { max-width: none; margin: 0; color: var(--ink); font-size: .88rem; line-height: 1.45; white-space: pre-line; }
.sms time { display: block; margin-top: 8px; color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.sms.empty { background: transparent; box-shadow: none; }
.sms.empty p { color: var(--muted); font-size: .86rem; }
.route-row.depot .record-main h3 { color: var(--muted); font-size: .92rem; }
.route-row.depot .record-main p { font-size: .8rem; }
.stop-number.depot-mark { place-content: center; padding: 0 14px; background: var(--canvas); color: var(--muted); font-size: .82rem; font-weight: 800; }
.muted-line { color: var(--muted); font-size: .9em; }
.customer-card .compact-field, .panel .plain-note + .compact-field { margin-top: 18px; }

.note-stack { display: grid; gap: 10px; margin-top: 13px; }
.note { padding: 11px 13px; border-radius: 10px; }
.note p { max-width: 62ch; margin: 3px 0 0; color: var(--ink); font-size: .88rem; line-height: 1.45; }
.note-label { display: block; font-size: .7rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.note-public { border-left: 4px solid var(--blue); background: var(--blue-wash); }
.note-public .note-label { color: var(--blue-dark); }
.note-internal { border-left: 4px dashed var(--muted); background: var(--canvas); }
.note-internal .note-label { color: var(--muted); }

@media (min-width: 760px) {
  .shell { min-height: calc(100vh - 32px); margin: 16px auto; overflow: hidden; border-radius: 20px; }
}

@media (max-width: 820px) {
  .inspection-row { grid-template-columns: 90px 1fr auto; }
  .inspection-row .assignment { grid-column: 2 / -1; }
  .metric-band { grid-template-columns: repeat(3, 1fr); }
  .two-column { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .place, .rolebar { display: none; }
  .masthead { padding: 12px 16px; }
  .seal { width: 36px; height: 36px; }
  .brand strong { font-size: .92rem; }
  .brand span { font-size: .7rem; }
  .role-select { display: block; }
  .notice { align-items: flex-start; justify-content: flex-start; padding: 8px 14px; font-size: .72rem; }
  main { padding-top: 14px; }
  h1 { font-size: 1.85rem; }
  .page-head { padding: 18px; }
  .next-action { grid-template-columns: 1fr; gap: 14px; margin-top: 16px; padding: 16px; }
  .action-buttons, .action-buttons .button { width: 100%; }
  .section-head { align-items: stretch; flex-direction: column; }
  .filter-field { width: 100%; }
  .inspection-row { grid-template-columns: 1fr auto; gap: 10px; }
  .record-id { grid-column: 1 / -1; }
  .inspection-row .assignment, .inspection-row details { grid-column: 1 / -1; }
  .details, .customer-details { grid-template-columns: 1fr; }
  .route-row { grid-template-columns: 58px 1fr; }
  .route-row .reorder { grid-column: 2; }
  .route-row details { grid-column: 1 / -1; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field:last-child { grid-column: 1; }
  .metric-band { grid-template-columns: repeat(2, 1fr); }
  .demo-tools { align-items: flex-start; flex-direction: column; }
  #toast { bottom: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
