:root {
  color-scheme: light;
  --ink: #152238;
  --muted: #66758c;
  --line: #d7dee8;
  --panel: #ffffff;
  --page: #f4f7fb;
  --navy: #08294b;
  --navy-2: #0f416f;
  --red: #b83226;
  --purple: #6540a3;
  --blue: #1267a8;
  --green: #2f7d3b;
  --amber: #b87911;
  --teal: #167980;
  --shadow: 0 16px 42px rgba(17, 34, 56, 0.12);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}

button,
input,
table {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  color: #ffffff;
  background: var(--navy);
  border-bottom: 4px solid #dce6f3;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  width: 58px;
  height: 58px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--navy);
  font-weight: 900;
}

.company-name,
.section-kicker,
.sidebar-title,
.kpi-label,
.kpi-note {
  margin: 0;
  color: inherit;
}

.company-name {
  color: #c9ddf5;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.18;
  letter-spacing: 0;
}

h1 {
  margin-top: 3px;
  font-size: 26px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-field {
  display: flex;
  align-items: center;
  width: min(370px, 36vw);
  min-width: 230px;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.12);
}

.search-field svg,
.action-button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  color: #ffffff;
  background: transparent;
}

.search-field input::placeholder {
  color: #c1d2e6;
}

.icon-button {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--navy);
}

.icon-button:hover,
.icon-button:focus-visible {
  border-color: #a9bbcf;
  outline: none;
}

.icon-button.small {
  width: 34px;
  height: 34px;
}

.sidebar {
  padding: 22px 16px;
  background: #ffffff;
  border-right: 1px solid var(--line);
}

.sidebar-section + .sidebar-section {
  margin-top: 28px;
}

.sidebar-section.compact {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}

.sidebar-title {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 44px;
  gap: 10px;
  margin-bottom: 6px;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-weight: 700;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: #c8d7e9;
  background: #edf4fc;
  color: var(--navy);
}

.nav-icon {
  position: relative;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: currentColor;
  color: inherit;
}

.nav-icon::before,
.nav-icon::after {
  position: absolute;
  content: "";
  background: #ffffff;
}

.admin-icon::before {
  inset: 6px 8px 5px;
  border-radius: 6px 6px 4px 4px;
}

.admin-icon::after {
  width: 11px;
  height: 5px;
  left: 6px;
  top: 5px;
  border: 2px solid #ffffff;
  border-bottom: 0;
  background: transparent;
  border-radius: 6px 6px 0 0;
}

.rights-icon::before {
  width: 12px;
  height: 12px;
  left: 4px;
  top: 4px;
  border-radius: 50%;
}

.rights-icon::after {
  width: 9px;
  height: 3px;
  right: 4px;
  bottom: 5px;
  box-shadow: -4px -4px 0 #ffffff;
}

.client-icon::before {
  width: 14px;
  height: 9px;
  left: 5px;
  top: 6px;
  border-radius: 2px;
}

.client-icon::after {
  width: 10px;
  height: 2px;
  left: 7px;
  bottom: 6px;
}

.cab-icon::before {
  width: 16px;
  height: 8px;
  left: 4px;
  top: 7px;
  border-radius: 3px;
}

.cab-icon::after {
  width: 4px;
  height: 4px;
  left: 6px;
  bottom: 4px;
  border-radius: 50%;
  box-shadow: 8px 0 0 #ffffff;
}

.gps-icon::before {
  width: 10px;
  height: 10px;
  left: 7px;
  top: 4px;
  border-radius: 50%;
}

.gps-icon::after {
  width: 4px;
  height: 10px;
  left: 10px;
  bottom: 4px;
  border-radius: 0 0 6px 6px;
}

.finance-icon::before {
  width: 14px;
  height: 12px;
  left: 5px;
  top: 6px;
  border-radius: 2px;
}

.finance-icon::after {
  width: 10px;
  height: 2px;
  left: 7px;
  top: 11px;
  box-shadow: 0 4px 0 #ffffff;
}

.report-icon::before {
  width: 4px;
  height: 12px;
  left: 6px;
  bottom: 5px;
  box-shadow: 5px -4px 0 #ffffff, 10px -1px 0 #ffffff;
}

.role-stack {
  display: grid;
  gap: 8px;
}

.role-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.role-chip span {
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #dfeef8;
  color: var(--navy);
  font-size: 11px;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.overview-band {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi-card {
  min-height: 108px;
  padding: 17px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(18, 47, 80, 0.06);
}

.kpi-card:nth-child(2) {
  border-left-color: var(--green);
}

.kpi-card:nth-child(3) {
  border-left-color: var(--amber);
}

.kpi-card:nth-child(4) {
  border-left-color: var(--purple);
}

.kpi-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.kpi-card strong {
  display: block;
  margin: 7px 0 4px;
  font-size: 30px;
  line-height: 1;
}

.kpi-note {
  color: var(--muted);
  font-size: 12px;
}

.kpi-note.success {
  color: #28723b;
}

.kpi-note.warning {
  color: #965f00;
}

.command-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.segmented-control {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.segment {
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: #eff3f8;
  color: #43536b;
  font-weight: 800;
}

.segment:hover,
.segment.is-active {
  border-color: #b8c9dc;
  background: var(--navy);
  color: #ffffff;
}

.command-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-button {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  gap: 8px;
  padding: 9px 13px;
  border: 1px solid #c2cfdd;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--navy);
  font-weight: 900;
}

.action-button.primary {
  border-color: var(--navy);
  background: var(--navy);
  color: #ffffff;
}

.upload-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.module-canvas {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.flow-map {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.stage {
  position: relative;
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--accent), #ffffff 58%);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: 0 10px 28px rgba(18, 47, 80, 0.07);
}

.stage:not(:last-child)::after {
  position: absolute;
  left: 50%;
  bottom: -15px;
  width: 1px;
  height: 14px;
  content: "";
  background: #a6b4c4;
}

.stage.is-muted {
  opacity: 0.42;
}

.stage-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--accent);
  color: #ffffff;
}

.stage-label strong {
  display: block;
  font-size: 17px;
  line-height: 1.15;
}

.stage-label span {
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  font-weight: 800;
}

.stage-badge {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  font-size: 13px;
  font-weight: 900;
}

.node-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 9px;
}

.flow-node {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  min-height: 62px;
  gap: 9px;
  padding: 10px;
  border: 1px solid #d5deea;
  border-radius: var(--radius);
  background: #fbfcff;
  color: var(--ink);
  text-align: left;
}

.flow-node:hover,
.flow-node.is-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent), #ffffff 91%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent), #ffffff 42%);
}

.flow-node svg {
  width: 28px;
  height: 28px;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.flow-node .node-copy,
.flow-node strong,
.flow-node .node-category {
  display: block;
}

.flow-node strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.18;
}

.flow-node .node-category {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.empty-stage {
  display: grid;
  min-height: 58px;
  place-items: center;
  border: 1px dashed #c9d3df;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.detail-panel,
.tool-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--shadow);
}

.detail-panel {
  position: sticky;
  top: 18px;
  overflow: hidden;
}

.detail-header {
  padding: 18px;
  border-left: 6px solid var(--accent);
  background: color-mix(in srgb, var(--accent), #ffffff 92%);
}

.detail-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.detail-title-row svg {
  width: 34px;
  height: 34px;
  color: var(--accent);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.detail-header p {
  margin: 10px 0 0;
  color: #485970;
  line-height: 1.48;
}

.detail-body {
  display: grid;
  gap: 16px;
  padding: 18px;
}

.meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.meta-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.meta-grid dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.meta-grid dd {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 800;
}

.check-list,
.pill-list {
  display: grid;
  gap: 7px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  position: relative;
  padding-left: 20px;
  color: #33445b;
  font-size: 13px;
  line-height: 1.35;
}

.check-list li::before {
  position: absolute;
  left: 0;
  top: 2px;
  width: 12px;
  height: 12px;
  content: "";
  border-radius: 50%;
  background: var(--accent);
  box-shadow: inset 0 0 0 4px #ffffff;
}

.pill-list {
  display: flex;
  flex-wrap: wrap;
}

.pill-list li,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 9px;
  border: 1px solid #cdd7e4;
  border-radius: 999px;
  background: #f6f8fb;
  color: #43536b;
  font-size: 12px;
  font-weight: 800;
}

.status-pill.success {
  border-color: #add5b7;
  background: #edf9f0;
  color: #28723b;
}

.status-pill.warning {
  border-color: #edcf90;
  background: #fff7e7;
  color: #8b5d08;
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(310px, 0.65fr);
  gap: 18px;
  margin-top: 18px;
}

.tool-panel {
  min-width: 0;
  padding: 18px;
}

.roster-panel,
.analytics-panel {
  grid-column: span 1;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-kicker {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #eef3f8;
  color: #4b5d74;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

td {
  color: #26364a;
  font-size: 13px;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-status {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eaf4ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.table-status.assigned {
  background: #edf8ef;
  color: #28723b;
}

.table-status.review {
  background: #fff5dc;
  color: #8b5d08;
}

.monitor-panel canvas {
  display: block;
  width: 100%;
  height: 260px;
  border: 1px solid #cbd8e6;
  border-radius: var(--radius);
  background: #eaf2f8;
}

.route-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.route-row,
.alert-row {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.route-row {
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
}

.route-color {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--route-color);
}

.route-row strong,
.alert-row strong {
  display: block;
  font-size: 13px;
}

.route-row span,
.alert-row span {
  color: var(--muted);
  font-size: 12px;
}

.route-row em {
  color: #28723b;
  font-style: normal;
  font-size: 12px;
  font-weight: 900;
}

.alert-list {
  display: grid;
  gap: 9px;
}

.alert-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.alert-row[data-severity="urgent"] {
  border-left: 5px solid var(--red);
}

.alert-row[data-severity="warning"] {
  border-left: 5px solid var(--amber);
}

.alert-row[data-severity="normal"] {
  border-left: 5px solid var(--green);
}

.alert-tag {
  display: inline-flex;
  padding: 5px 8px;
  border-radius: 999px;
  background: #eef3f8;
  color: #4e6077;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.review-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(115px, 1fr));
  gap: 10px;
}

.review-grid div {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfe;
}

.review-grid span,
.review-grid small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.review-grid strong {
  display: block;
  margin: 6px 0 4px;
  font-size: 22px;
}

.forecast-bars {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.forecast-bars div {
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr) 42px;
  align-items: center;
  gap: 10px;
}

.forecast-bars span,
.forecast-bars em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.forecast-bars b {
  position: relative;
  display: block;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f6;
}

.forecast-bars b::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--bar);
  content: "";
  border-radius: inherit;
  background: var(--teal);
}

@media (max-width: 1180px) {
  .module-canvas,
  .operations-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
  }
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .topbar,
  .command-strip,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .command-actions {
    width: 100%;
  }

  .search-field {
    width: 100%;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-section:first-child {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 8px;
  }

  .sidebar-title {
    grid-column: 1 / -1;
  }

  .nav-item {
    margin: 0;
  }

  .overview-band,
  .review-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stage {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar,
  .workspace,
  .sidebar {
    padding: 16px;
  }

  h1 {
    font-size: 21px;
  }

  .brand-mark {
    width: 48px;
    height: 48px;
  }

  .overview-band,
  .review-grid,
  .meta-grid {
    grid-template-columns: 1fr;
  }

  .command-actions,
  .top-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .action-button {
    justify-content: center;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .top-actions,
  .sidebar,
  .command-strip,
  .operations-grid,
  .detail-panel {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .topbar {
    color: var(--navy);
    background: #ffffff;
    border-bottom: 2px solid var(--navy);
  }

  .brand-mark {
    border-color: var(--navy);
  }

  .company-name {
    color: var(--navy);
  }

  .workspace {
    padding: 18px 0;
  }

  .overview-band {
    grid-template-columns: repeat(4, 1fr);
  }

  .stage {
    break-inside: avoid;
    box-shadow: none;
  }
}
