:root {
  --ink: #202c39;
  --paper: #f4f1de;
  --blue: #3d5a80;
  --coral: #e07a5f;
  --muted: #6f756f;
  --line: rgba(32, 44, 57, .15);
  --white: #fffef7;
  --rail: 176px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--paper); color: var(--ink); }
body { font-family: "Arial Narrow", "Roboto Condensed", Arial, sans-serif; font-size: 14px; }
button, input { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 3px solid rgba(224,122,95,.45); outline-offset: 2px; }
.app-shell { min-height: 100vh; display: grid; grid-template: 62px 1fr / var(--rail) 1fr; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; background: var(--ink); color: var(--paper); border-bottom: 1px solid rgba(244,241,222,.15); }
.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 11px; font-family: Georgia, serif; font-size: 18px; }
.brand img { display: block; }
.topbar-meta { display: flex; align-items: center; gap: 10px; }
.connection { font-size: 12px; color: rgba(244,241,222,.72); margin-right: 12px; }
.connection i { display: inline-block; width: 7px; height: 7px; background: #82b48b; border-radius: 50%; margin-right: 7px; }
.icon-button, .avatar { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(244,241,222,.22); background: transparent; color: inherit; border-radius: 50%; cursor: pointer; }
.icon-button:hover { background: rgba(244,241,222,.1); }
.avatar { border: 0; background: var(--coral); color: var(--ink); font-weight: 800; font-size: 11px; }
.rail { grid-row: 2; display: flex; flex-direction: column; background: var(--ink); color: var(--paper); padding: 20px 12px 16px; min-height: calc(100vh - 62px); }
.nav-button { position: relative; display: grid; grid-template-columns: 27px 1fr auto; align-items: center; gap: 8px; width: 100%; min-height: 42px; padding: 0 10px; border: 0; background: transparent; color: rgba(244,241,222,.64); text-align: left; border-radius: 6px; cursor: pointer; }
.nav-button:hover { color: var(--paper); }
.nav-button.active { background: rgba(244,241,222,.1); color: var(--paper); }
.nav-button.active:before { content: ""; position: absolute; left: -12px; height: 23px; width: 3px; background: var(--coral); }
.nav-icon { font-size: 19px; text-align: center; }
.nav-button b { min-width: 20px; padding: 3px 6px; border-radius: 10px; background: var(--coral); color: var(--ink); font-size: 10px; text-align: center; }
.rail-foot { margin-top: auto; padding: 16px 10px 0; border-top: 1px solid rgba(244,241,222,.15); display: grid; gap: 4px; letter-spacing: .08em; }
.rail-foot small { color: rgba(244,241,222,.45); letter-spacing: 0; }
main { grid-row: 2; min-width: 0; }
.view { display: none; padding: 34px clamp(22px, 3vw, 48px) 48px; animation: enter .22s ease-out; }
.view.active { display: block; }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }
.workspace-head { min-height: 70px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); }
.eyebrow { margin: 0 0 5px; text-transform: uppercase; letter-spacing: .1em; color: var(--blue); font-size: 10px; font-weight: 800; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 500; }
h1 { font-size: clamp(28px, 3vw, 39px); line-height: 1; margin: 0; letter-spacing: -.025em; }
.metric-line { display: grid; grid-template-columns: auto auto; column-gap: 12px; align-items: end; text-align: right; }
.metric-line span { grid-column: 1 / -1; color: var(--muted); font-size: 11px; }
.metric-line strong { font-family: Georgia, serif; font-size: 29px; }
.metric-line small { padding-bottom: 4px; color: var(--blue); }
.filters { display: flex; align-items: center; gap: 4px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.filter { border: 0; padding: 7px 10px; background: transparent; color: var(--muted); cursor: pointer; border-radius: 3px; }
.filter b { font-size: 10px; margin-left: 3px; }
.filter.active { background: var(--ink); color: var(--paper); }
.search { margin-left: auto; position: relative; display: flex; align-items: center; }
.search span { position: absolute; left: 9px; color: var(--muted); font-size: 18px; }
.search input { width: 190px; border: 0; border-left: 1px solid var(--line); background: transparent; padding: 8px 8px 8px 34px; color: var(--ink); }
.dispatch-layout { display: grid; grid-template-columns: minmax(390px, 1fr) minmax(330px, 410px); min-height: 685px; }
.queue-pane { padding-right: 28px; border-right: 1px solid var(--line); min-width: 0; }
.section-label { display: flex; justify-content: space-between; padding: 15px 0 9px; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; font-size: 9px; font-weight: 800; }
.request-list { border-top: 1px solid var(--ink); }
.request-row { width: 100%; min-height: 88px; display: grid; grid-template-columns: 8px 1fr auto; gap: 13px; align-items: center; padding: 13px 11px 13px 3px; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; transition: background .15s, transform .15s; }
.request-row:hover { background: rgba(255,255,255,.42); }
.request-row.selected { background: var(--white); transform: translateX(4px); box-shadow: inset 3px 0 var(--blue); }
.route-marker { width: 7px; height: 7px; border: 1px solid var(--blue); transform: rotate(45deg); }
.route-marker.urgent { background: var(--coral); border-color: var(--coral); }
.request-main, .request-side { display: grid; gap: 4px; min-width: 0; }
.request-main strong { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.request-main small, .request-side small { color: var(--muted); font-size: 11px; }
.request-id { color: var(--blue); font-size: 9px; letter-spacing: .09em; text-transform: uppercase; font-weight: 800; }
.request-side { text-align: right; }
.request-side strong { font-family: Georgia, serif; font-size: 14px; }
.route-pane { padding: 18px 0 0 28px; background: rgba(255,255,255,.18); }
.route-head { display: flex; justify-content: space-between; min-height: 94px; }
.route-head h2 { font-size: 22px; line-height: 1.12; margin: 7px 0 4px; max-width: 300px; }
.route-head p { margin: 0; color: var(--muted); }
.icon-button.light { border-color: var(--line); color: var(--blue); flex: 0 0 auto; }
.mini-map { position: relative; overflow: hidden; height: 104px; margin: 9px 0 15px; background: var(--blue); color: var(--paper); }
.map-grid { position: absolute; inset: 0; opacity: .15; background-image: linear-gradient(rgba(255,255,255,.5) 1px, transparent 1px), linear-gradient(90deg,rgba(255,255,255,.5) 1px, transparent 1px); background-size: 26px 26px; transform: rotate(-5deg) scale(1.2); }
.mini-map svg { position: absolute; inset: 8px 6px; width: calc(100% - 12px); height: calc(100% - 16px); }
.mini-map path { fill: none; stroke: var(--paper); stroke-width: 2; stroke-dasharray: 4 4; }
.mini-map .point { position: absolute; width: 11px; height: 11px; background: var(--coral); border: 3px solid var(--paper); border-radius: 50%; z-index: 2; }
.p1 { left: 7%; bottom: 23%; }.p2 { right: 6%; top: 13%; }
.mini-map b { position: absolute; z-index: 2; font-size: 8px; letter-spacing: .1em; }
.mini-map b:nth-of-type(1) { left: 5%; bottom: 7px; }.mini-map b:nth-of-type(2) { right: 4%; top: 5px; }
.route-facts { display: grid; grid-template-columns: 1.2fr 1fr 1fr; border-block: 1px solid var(--line); }
.route-facts span { padding: 10px 8px 10px 0; display: grid; gap: 4px; }
.route-facts small, .route-note span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.route-facts strong { font-size: 12px; }
.route-timeline { list-style: none; margin: 19px 0 14px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); }
.route-timeline li { position: relative; display: grid; gap: 8px; }
.route-timeline li:after { content: ""; position: absolute; top: 11px; left: 26px; width: calc(100% - 28px); height: 1px; background: var(--line); }
.route-timeline li:last-child:after { display: none; }
.route-timeline li > span { position: relative; z-index: 1; display: grid; place-items: center; width: 22px; height: 22px; border: 1px solid var(--line); border-radius: 50%; background: var(--paper); color: var(--muted); font-size: 9px; }
.route-timeline li.done > span { background: var(--blue); border-color: var(--blue); color: white; }
.route-timeline li.current > span { background: var(--coral); border-color: var(--coral); color: var(--ink); }
.route-timeline li div { display: grid; gap: 2px; }
.route-timeline strong { font-size: 10px; }.route-timeline small { color: var(--muted); font-size: 8px; }
.route-note { min-height: 64px; padding: 11px 0; border-top: 1px solid var(--line); }
.route-note p { margin: 5px 0 0; line-height: 1.35; font-size: 12px; }
.advance-button, .text-button { border: 0; cursor: pointer; font-weight: 800; }
.advance-button { width: 100%; display: flex; justify-content: space-between; padding: 13px 15px; background: var(--coral); color: var(--ink); }
.advance-button:hover { filter: brightness(.96); }
.text-button { padding: 10px 15px; background: var(--blue); color: white; border-radius: 3px; }
.empty-state { padding: 70px 20px; text-align: center; }
.empty-state > span { font-size: 30px; color: var(--coral); }
.empty-state h2 { margin: 12px 0 7px; }.empty-state p { color: var(--muted); }
.history-toolbar { display: flex; justify-content: space-between; margin-top: 22px; padding-bottom: 12px; border-bottom: 1px solid var(--ink); }
.history-toolbar p { margin: 0; font-family: Georgia, serif; font-size: 19px; }.history-toolbar span { color: var(--muted); }
.activity-log { list-style: none; margin: 0; padding: 0; max-width: 850px; }
.activity-log li { min-height: 79px; display: grid; grid-template-columns: 65px 18px 1fr; gap: 14px; align-items: start; padding-top: 18px; position: relative; }
.activity-log li:after { content: ""; position: absolute; left: 87px; top: 31px; bottom: -13px; width: 1px; background: var(--line); }
.activity-log li:last-child:after { display: none; }
.activity-log time { color: var(--muted); font-size: 11px; }
.log-node { width: 9px; height: 9px; margin-top: 1px; border-radius: 50%; border: 2px solid var(--blue); background: var(--paper); z-index: 1; }
.log-node.latest { background: var(--coral); border-color: var(--coral); }
.activity-log p { margin: -3px 0 0; line-height: 1.5; }.activity-log p small { display: block; color: var(--blue); font-size: 9px; letter-spacing: .08em; }
.saved-state { color: var(--muted); font-size: 11px; padding-top: 8px; }
.workflow-board { margin-top: 23px; border-top: 1px solid var(--ink); }
.workflow-step { min-height: 104px; display: grid; grid-template-columns: 45px 1fr 36px; align-items: center; gap: 20px; border-bottom: 1px solid var(--line); }
.workflow-step > span { width: 33px; height: 33px; display: grid; place-items: center; transform: rotate(45deg); border: 1px solid var(--blue); color: var(--blue); }
.workflow-step > div { display: grid; grid-template-columns: 90px 180px 1fr; align-items: center; }
.workflow-step small { color: var(--muted); text-transform: uppercase; font-size: 9px; letter-spacing: .08em; }
.workflow-step strong { font-family: Georgia, serif; font-size: 18px; }.workflow-step p { color: var(--muted); }
.rules-strip { margin-top: 25px; padding: 18px 0; border-block: 1px solid var(--ink); display: flex; justify-content: space-between; align-items: center; }
.rules-strip div { display: grid; gap: 4px; }.rules-strip span { color: var(--muted); font-size: 11px; }.rules-strip strong { font-size: 14px; }
.switch input { position: absolute; opacity: 0; }.switch > span { display: block; width: 40px; height: 22px; background: #aaa; border-radius: 12px; padding: 3px; cursor: pointer; }
.switch > span:after { content: ""; display: block; width: 16px; height: 16px; background: white; border-radius: 50%; transition: transform .2s; }
.switch input:checked + span { background: var(--blue); }.switch input:checked + span:after { transform: translateX(18px); }
.team-summary { min-height: 90px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--ink); }
.team-summary strong { font-family: Georgia, serif; font-size: 27px; }.team-summary span { color: var(--muted); }.team-summary i { height: 31px; width: 1px; background: var(--line); margin: 0 20px; }
.team-list { max-width: 900px; }
.person-row { min-height: 82px; display: grid; grid-template-columns: 44px 1fr 120px 36px; align-items: center; gap: 16px; border-bottom: 1px solid var(--line); }
.person-avatar { position: relative; width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid var(--blue); border-radius: 50%; color: var(--blue); font-size: 11px; font-weight: 800; }
.person-avatar i { position: absolute; right: 0; bottom: 0; width: 9px; height: 9px; border-radius: 50%; background: #9ca29c; border: 2px solid var(--paper); }.person-avatar i.online { background: #58a26c; }
.person-row > div { display: grid; gap: 4px; }.person-row small, .load { color: var(--muted); }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 10; padding: 12px 16px; background: var(--ink); color: var(--paper); transform: translateY(20px); opacity: 0; pointer-events: none; transition: .2s; box-shadow: 0 8px 24px rgba(32,44,57,.2); }
.toast.show { transform: translateY(0); opacity: 1; }
body.compact .request-row { min-height: 66px; }.compact .route-note { min-height: 48px; }

@media (max-width: 760px) {
  :root { --rail: 0px; }
  .app-shell { display: block; padding: 55px 0 66px; }
  .topbar { position: fixed; inset: 0 0 auto; height: 55px; z-index: 6; padding: 0 13px; }
  .brand { font-size: 16px; }.brand img { width: 29px; height: 29px; }
  .connection, .topbar-meta .icon-button { display: none; }
  .rail { position: fixed; z-index: 6; inset: auto 0 0; min-height: 0; height: 66px; padding: 5px 8px 4px; flex-direction: row; background: var(--ink); }
  .nav-button { display: flex; flex: 1; flex-direction: column; justify-content: center; gap: 1px; min-height: 54px; padding: 2px; text-align: center; font-size: 9px; }
  .nav-button.active:before { inset: auto 25% -4px; width: 50%; height: 3px; }
  .nav-button b { position: absolute; top: 2px; right: 18%; min-width: 16px; padding: 2px 4px; }
  .nav-icon { font-size: 18px; }.rail-foot { display: none; }
  .view { padding: 21px 14px 28px; }
  .workspace-head { min-height: 63px; }
  h1 { font-size: 28px; }
  .metric-line { column-gap: 5px; }.metric-line strong { font-size: 22px; }.metric-line small { display: none; }
  .filters { overflow-x: auto; scrollbar-width: none; }
  .filter { white-space: nowrap; }
  .search { margin-left: 2px; min-width: 36px; }
  .search input { width: 36px; transition: width .2s; border-left: 0; }
  .search input:focus, .search input:not(:placeholder-shown) { width: 145px; border-left: 1px solid var(--line); }
  .dispatch-layout { display: block; min-height: 0; }
  .queue-pane { padding: 0; border: 0; }
  .request-row { grid-template-columns: 7px minmax(0, 1fr) 82px; min-height: 82px; padding-right: 3px; }
  .request-row.selected { transform: none; }
  .request-side strong { font-size: 12px; }
  .route-pane { position: fixed; z-index: 5; inset: 55px 0 66px; overflow-y: auto; padding: 20px 16px; background: var(--paper); transform: translateX(105%); transition: transform .24s ease; }
  .request-row.selected + * {}
  body:has(.request-row.selected:focus) .route-pane { transform: translateX(0); }
  .route-pane.mobile-open { transform: translateX(0); }
  .route-head { min-height: 88px; }
  .mini-map { height: 118px; }
  .route-timeline { margin-top: 22px; }
  .advance-button { margin-top: 5px; }
  .workflow-step { grid-template-columns: 40px 1fr 34px; gap: 12px; }
  .workflow-step > div { display: grid; grid-template-columns: 1fr; gap: 3px; padding: 15px 0; }
  .workflow-step p { margin: 3px 0 0; }
  .team-summary { flex-wrap: wrap; padding: 14px 0; gap: 7px; }.team-summary i { margin: 0 7px; }
  .person-row { grid-template-columns: 42px 1fr 33px; gap: 11px; }.person-row .load { display: none; }
  .toast { right: 12px; left: 12px; bottom: 78px; text-align: center; }
}
