:root {
  color-scheme: light;
  --ink: #172145;
  --muted: #5a6684;
  --rail: #151d34;
  --rail-text: #f3f6ff;
  --accent: #3a40bf;
  --accent-bright: #caff68;
  --rail-width: 242px;
  --line: #e1e6f4;
  --canvas: #f3f5fc;
  --motion: 190ms cubic-bezier(.2,.7,.25,1);
}
* { box-sizing: border-box; }
html { overflow-x: hidden; }
html.frame-fit { overflow-y: hidden; }
body {
  display: flow-root;
  margin: 0;
  color: var(--ink);
  background: linear-gradient(to right, var(--rail) var(--rail-width), var(--canvas) var(--rail-width));
  font: 14px/1.48 Inter, "Segoe UI", Arial, sans-serif;
}
[hidden] { display: none !important; }
p { margin: 0 0 9px; }
h1, h2, h3 { margin: 0; }
h1 { font-size: clamp(24px, 3.4vw, 36px); line-height: 1.12; letter-spacing: -.045em; }
h2 { font-size: 16px; line-height: 1.25; letter-spacing: -.012em; }
h3 { font-size: 14px; margin-bottom: 8px; }
a { color: var(--accent); }
:where(button, a, input, select, summary, [tabindex]):focus-visible { outline: 2px solid #5363dc; outline-offset: 3px; }

.workbench { display: grid; grid-template-columns: var(--rail-width) minmax(0, 1fr); min-height: 650px; }
.route-rail {
  min-width: 0;
  padding: 26px 19px;
  background: var(--rail);
  color: var(--rail-text);
}
.rail-brand { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.brand-icon { position: relative; display: grid; place-items: center; width: 33px; height: 33px; flex: none; background: var(--accent-bright); border-radius: 10px; }
.brand-icon i { width: 15px; height: 11px; border: 2px solid var(--rail); border-radius: 4px; transform: rotate(-29deg); }
.brand-icon i::before, .brand-icon i::after { content: ""; position: absolute; width: 5px; height: 5px; border-radius: 50%; background: var(--rail); }
.brand-icon i::before { top: 1px; left: -6px; }
.brand-icon i::after { bottom: 1px; right: -6px; }

.route-heading { display: flex; justify-content: space-between; align-items: center; gap: 9px; margin-top: 30px; }
.route-heading h2 { color: #e7edff; }
#route-count { color: #bec9e8; font-size: 12px; font-variant-numeric: tabular-nums; }
.route-meter { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 4px; margin: 10px 0 16px; }
.route-meter span { height: 4px; border-radius: 5px; background: #3b4663; transition: background var(--motion); }
.route-meter .current { background: #8b9cff; }
.route-meter .confirmed { background: var(--accent-bright); }
.route-tabs { display: grid; gap: 5px; }
.route-tab {
  appearance: none;
  display: grid;
  grid-template-columns: 34px minmax(0,1fr) 9px;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--rail-text);
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: background var(--motion), border-color var(--motion), transform var(--motion);
}
.route-tab:hover { background: #232e4c; transform: translateX(2px); }
.route-tab:active { transform: scale(.98); }
.route-tab:focus-visible { outline-color: #c2ccff; }
.route-tab[aria-selected=true] { background: #303a5d; border-color: #495676; }
.route-icon, .document-icon {
  display: grid;
  place-items: center;
  background: #28334f;
  color: #c8d4fb;
  border-radius: 10px;
  width: 34px;
  height: 34px;
}
.route-tab[aria-selected=true] .route-icon { background: #e5eaff; color: #293694; }
.route-tab[data-tone=success] .route-icon { background: #283e3b; color: #b3edc7; }
.route-tab[data-tone=success][aria-selected=true] .route-icon { background: #d9fae5; color: #175f46; }
.route-text { display: grid; min-width: 0; gap: 2px; }
.route-name { font-size: 14px; font-weight: 700; }
.route-status { color: #bac6e4; font-size: 11px; overflow-wrap: anywhere; }
.route-indicator { width: 7px; height: 7px; border-radius: 50%; background: #7382a6; }
.route-tab[data-tone=success] .route-indicator { background: var(--accent-bright); }
.route-tab[data-tone=attention] .route-indicator { background: #ffc983; }
.route-tab[data-tone=active] .route-indicator { background: #9dacff; }
.route-tab[data-tone=error] .route-indicator { background: #ff9e9f; }
.route-tab.route-current .route-indicator { box-shadow: 0 0 0 3px #8b9cff25; }

.glyph { position: relative; display: block; width: 14px; height: 17px; color: inherit; border: 1.5px solid currentColor; border-radius: 3px; }
.glyph::before, .glyph::after { content: ""; position: absolute; }
.glyph-file::before, .glyph-list::before, .glyph-receipt::before {
  top: 5px; left: 3px; width: 6px; height: 1px; background: currentColor; box-shadow: 0 3px currentColor;
}
.glyph-list::after { width: 6px; height: 3px; top: -3px; left: 2px; border: 1.5px solid currentColor; border-radius: 2px; background: inherit; }
.glyph-receipt { border-radius: 2px 2px 5px 5px; }
.glyph-receipt::after { top: 11px; left: 3px; width: 4px; height: 1px; background: currentColor; }
.glyph-truck { width: 14px; height: 10px; border-radius: 2px; margin-right: 6px; margin-top: -3px; }
.glyph-truck::before { right: -6px; bottom: -1.5px; width: 6px; height: 8px; border: 1.5px solid currentColor; border-left: 0; border-radius: 0 4px 2px 0; }
.glyph-truck::after { bottom: -4px; left: 1px; width: 4px; height: 4px; border-radius: 50%; background: currentColor; box-shadow: 11px 0 currentColor; }

.workspace { width: 100%; max-width: 1180px; min-width: 0; padding: 31px clamp(18px, 3.5vw, 50px) 26px; }
.shipment-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 22px; }
.shipment-state, .shipment-identity { min-width: 0; }
.shipment-title { color: var(--muted); margin: 4px 0 0; overflow-wrap: anywhere; }
.shipment-state { text-align: right; flex: 0 1 auto; }
.shipment-badges { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 5px; }
.badge, .status { display: inline-block; padding: 4px 8px; font-size: 12px; line-height: 1.3; font-weight: 650; border-radius: 6px; }
.badge { background: #e6eafb; color: #49558b; }
.status { color: #505e7b; background: #edf0f8; }
.status.success { color: #165848; background: #dcf3e8; }
.status.active { color: #323a9d; background: #e8eafb; }
.status.attention { color: #734714; background: #fff0d9; }
.status.error { color: #972f44; background: #fce5ea; }
.sync-status { color: var(--muted); font-size: 12px; margin-top: 7px; }
.sync-label::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 6px; vertical-align: .15em; background: #2a8971; }
.sync-label.error { color: #972f44; }
.sync-label.error::before { background: #b7455a; }
.sync-label.pending::before { background: #9a671f; }
.sync-date { padding-left: 6px; white-space: nowrap; }
.sync-details p { max-width: 32ch; margin-left: auto; }

.manager-panel {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: clamp(19px, 3vw, 29px);
  margin-bottom: 21px;
  border-radius: 20px;
  color: #fff;
  background: #323baf;
  box-shadow: 0 12px 25px -17px #2e38a2a8;
}
.manager-panel::before, .manager-panel::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  width: 284px;
  height: 196px;
  border: 1px solid #b2bbff38;
  border-radius: 65px;
  transform: rotate(-31deg);
  right: -105px;
  top: -98px;
}
.manager-panel::after { right: -56px; top: -63px; }
.manager-panel.requires-action { background: linear-gradient(112deg, #2732a7, #4348c9); }
.manager-panel.complete { background: linear-gradient(110deg, #154340, #22665d); box-shadow: 0 12px 25px -17px #1c5a4ea8; }
#manager-heading { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 0 0 9px; color: #e6eaff; }
.action-signal { width: 8px; height: 8px; flex: none; border-radius: 50%; background: #b4c4ff; box-shadow: 0 0 0 3px #b4c4ff28; }
.requires-action .action-signal, .complete .action-signal { background: var(--accent-bright); box-shadow: 0 0 0 3px #caff6836; }
.primary-task, .waiting-task { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px 22px; animation: arrive var(--motion) both; }
.task-copy { flex: 1 1 240px; min-width: 0; overflow-wrap: anywhere; }
.task-copy strong { display: block; font-weight: 700; }
.manager-panel .task-copy strong { font-size: clamp(19px,3vw,30px); line-height: 1.15; letter-spacing: -.04em; }
.task-copy p { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.manager-panel .task-copy p { color: #f0f2ff; }
#manager-tasks > p { margin: 0; }

button:not(.route-tab), .button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 13px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: var(--accent);
  color: white;
  font: 650 13px/1.28 Inter, "Segoe UI", Arial, sans-serif;
  cursor: pointer;
  text-decoration: none;
  transition: background var(--motion), box-shadow var(--motion), transform var(--motion), border-color var(--motion);
}
button:not(.route-tab):not(:disabled):hover, .button:hover { transform: translateY(-2px); box-shadow: 0 5px 10px -5px #252f7766; }
button:not(.route-tab):not(:disabled):active, .button:active { transform: scale(.97); }
button:disabled { opacity: .5; cursor: default; }
button.secondary, .button.secondary { background: white; color: #383f9e; border-color: #d5dcf2; }
.button.hero-button, button.hero-button {
  color: #192531;
  background: var(--accent-bright);
  border-color: var(--accent-bright);
  border-radius: 11px;
  padding: 11px 12px 11px 15px;
  font-size: 14px;
  font-weight: 750;
}
.hero-button:focus-visible { outline-color: #ecfecc; }
.action-arrow { display: inline-grid; min-width: 24px; height: 24px; place-items: center; background: #333a9e0d; border-radius: 6px; font-size: 17px; line-height: 1; transition: transform var(--motion), background var(--motion); }
.hero-button .action-arrow { background: #20312515; }
.button:hover .action-arrow, button:hover .action-arrow { transform: translateX(3px); }

.task-queue { margin-bottom: 20px; }
.task-queue h2 { margin: 0 0 8px; }
.task-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px; }
.task-grid .manager-task { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; min-width: 0; padding: 11px 12px; background: white; border: 1px solid var(--line); border-radius: 12px; }
.task-grid .task-copy { flex-basis: 160px; }
.task-category { display: inline-block; margin-bottom: 3px; color: #555fa2; font-size: 11px; font-weight: 700; }
.task-grid .task-copy strong { font-size: 13px; }
.task-grid .task-copy p { margin-top: 3px; font-size: 12px; }
.task-button { justify-content: space-between; }

button.route-return { display: none; }
.document-step { border: 1px solid var(--line); border-radius: 17px; background: #fff; overflow-wrap: anywhere; }
.document-step:not([hidden]) { animation: arrive var(--motion) both; }
.document-header { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; gap: 11px; align-items: center; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.document-header h2 { min-width: 0; }
.document-icon { color: #3e49aa; background: #eaedff; }
.document-step[data-tone=success] .document-icon { color: #236b54; background: #e2f4eb; }
.step-body { min-width: 0; padding: 14px 16px 16px; }
.step-message, .waybill-note, .muted, .doc-meta, .small { color: var(--muted); font-size: 13px; }
.step-message, .waybill-note { line-height: 1.45; }
[id^=step-], .loading-editor, .document-editor { scroll-margin: 10px; }
.title-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 8px 0 5px; }
.title-status strong { font-size: 13px; }
.links { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 13px; margin: 7px 0; }
.links a { font-size: 13px; }
.job-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 7px; }
.job { border-top: 1px solid var(--line); padding: 9px 0; }
.job-error, .field-error { color: #9b2943; font-size: 13px; margin-top: 5px; }
.issue-list { padding-left: 18px; }

summary { cursor: pointer; font-weight: 650; padding: 5px 0; }
details > summary { font-size: 13px; }
.step-body > details { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 6px; }
.step-body > details > summary { color: #343d91; }
.step-body > details[open] > summary { margin-bottom: 8px; }
.document-comments { color: var(--muted); margin: 5px 0; }
.document-comments p { font-size: 13px; margin: 4px 0 0; }
fieldset { margin: 0; padding: 8px 0 0; border: 0; min-width: 0; }
legend { padding: 0; font-size: 13px; font-weight: 700; }
.role-options { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; margin-top: 7px; }
.role-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 5px;
  min-height: 82px;
  padding: 11px 5px 8px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
  transition: background var(--motion), border-color var(--motion);
}
.role-card:hover { background: #f3f5ff; }
.role-card:has(input:checked) { border-color: var(--accent); background: #ecedff; }
.role-card:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.role-card input[type=radio] { position: absolute; top: 7px; right: 7px; width: 13px; height: 13px; margin: 0; accent-color: var(--accent); }
.role-icon { display: grid; place-items: center; color: var(--accent); }
.role-icon svg { width: 23px; height: 23px; }
.role-caption { font-weight: 650; }

label { display: block; min-width: 0; color: #425173; font-size: 13px; }
input, select {
  width: 100%;
  min-width: 0;
  margin-top: 4px;
  padding: 8px 9px;
  border: 1px solid #ccd5ed;
  border-radius: 7px;
  color: var(--ink);
  background: white;
  font: inherit;
}
input[readonly] { background: #eff2fa; }
input:disabled, select:disabled { opacity: .7; }
input[type=checkbox] { width: auto; margin: 0 7px 0 0; accent-color: var(--accent); }
input[aria-invalid=true], select[aria-invalid=true] { border-color: #a53248; }
.grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 9px 12px; }
.group { margin-top: 14px; }
.confirmations { display: grid; gap: 7px; padding-top: 10px; margin: 14px 0 0; border-top: 1px solid var(--line); }
.actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 11px; }
.small { margin: 8px 0 0; }
.small:empty { display: none; }
.cargo { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 9px; padding: 10px; margin-bottom: 10px; border-radius: 8px; background: #f0f3fb; }
.cargo small, .toolbar span { display: block; color: var(--muted); font-size: 12px; }
.cargo strong { display: block; }
#order-participants { grid-template-columns: repeat(2,minmax(0,1fr)); }
#order-participants:empty { display: none; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 7px 0; }
.test-tools { margin: 6px 0; color: var(--muted); }
.party-search { margin-top: 8px; }
.party-results { list-style: none; margin: 5px 0 0; padding: 4px; border: 1px solid #d7dff4; background: white; border-radius: 8px; }
.party-result { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 8px; border-radius: 5px; cursor: pointer; }
.party-result:hover, .party-result[aria-selected=true] { background: #ebeeff; }
.party-kind, .party-status { font-size: 12px; color: var(--muted); }
.party-status { margin: 4px 0 0; }
.party-status:empty { display: none; }
.notice { padding: 9px 11px; margin-bottom: 11px; border-radius: 8px; background: #fff0d9; color: #754a14; white-space: pre-line; }
.notice.success { color: #1b5c49; background: #e2f4eb; }
.form-feedback { margin: 10px 0 0; }
.form-feedback ul { margin: 5px 0 0; padding-left: 19px; }

@keyframes arrive { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 960px) {
  :root { --rail-width: 205px; }
  .task-grid { grid-template-columns: 1fr; }
  .route-rail { padding: 21px 13px; }
}
@media (max-width: 700px) {
  body { background: var(--canvas); }
  .workbench { display: block; min-height: 0; }
  .route-rail { padding: 13px 14px 15px; }
  .route-heading { margin-top: 13px; }
  .route-meter { margin: 6px 0 8px; }
  .route-tabs { grid-template-columns: repeat(4,minmax(0,1fr)); }
  .route-tab { min-height: 57px; padding: 4px; grid-template-columns: 23px minmax(0,1fr); gap: 5px; }
  .route-icon { width: 23px; height: 26px; border-radius: 6px; }
  .route-indicator { display: none; }
  .route-name { font-size: 13px; }
  .route-status { font-size: 10px; }
  .workspace { padding: 16px 13px; }
  .shipment-header { margin-bottom: 13px; }
  .manager-panel { margin-bottom: 14px; }
  button.route-return { display: inline-flex; margin-bottom: 8px; }
}
@media (max-width: 470px) {
  .route-tabs { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .route-tab { min-height: 44px; }
  .route-icon { margin-left: 3px; }
  .shipment-header { flex-direction: column; gap: 7px; }
  .shipment-state { text-align: left; }
  .shipment-badges { justify-content: flex-start; }
  .sync-details p { margin-left: 0; }
  .document-header { grid-template-columns: 30px minmax(0,1fr); gap: 5px 9px; padding: 10px 11px; }
  .document-icon { width: 30px; height: 30px; grid-row: 1 / span 2; }
  .document-header .status { grid-column: 2; justify-self: start; }
  .step-body { padding: 11px; }
  .grid { grid-template-columns: 1fr; }
  .cargo { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #cargo > div:first-child { grid-column: 1 / -1; }
  .role-caption { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .route-tab:hover, .route-tab:active, button:not(.route-tab):not(:disabled):hover, .button:hover, .button:active,
  button:not(.route-tab):not(:disabled):active, .button:hover .action-arrow, button:hover .action-arrow { transform: none; }
}

