:root {
  --ink: #18242e;
  --muted: #667582;
  --subtle: #8a98a3;
  --line: #d7dfe4;
  --line-strong: #c1ccd3;
  --surface: #ffffff;
  --surface-2: #f5f7f8;
  --canvas: #edf1f3;
  --nav: #101820;
  --nav-hover: #1b2a35;
  --gold: #f2b720;
  --gold-dark: #c98f00;
  --blue: #236b9b;
  --blue-soft: #e7f1f7;
  --green: #22734c;
  --green-soft: #e7f3ec;
  --red: #a23a36;
  --red-soft: #f8eaea;
  --orange: #a85f12;
  --orange-soft: #f8eee2;
  --purple: #73538f;
  --shadow: 0 10px 30px rgba(20, 35, 47, .09);
  --sidebar-width: 248px;
  --topbar-height: 70px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input[type="checkbox"],
input[type="file"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(35, 107, 155, .22);
  outline-offset: 1px;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: .58;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 1.38rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.55rem;
  line-height: 1.2;
}

h3 {
  font-size: 1rem;
  line-height: 1.3;
}

h4 {
  font-size: .82rem;
  line-height: 1.3;
}

svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
  flex: 0 0 auto;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1100;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 16px 12px 12px;
  color: #eef4f7;
  background: var(--nav);
  border-right: 1px solid #26343e;
}

.brand {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 5px 14px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  color: #101820;
  background: var(--gold);
  font-weight: 900;
  font-size: .92rem;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: .96rem;
}

.brand-copy span {
  color: #aebbc4;
  font-size: .7rem;
  white-space: nowrap;
}

.primary-nav {
  min-height: 0;
  display: grid;
  gap: 3px;
  overflow-y: auto;
  padding-bottom: 8px;
  scrollbar-width: none;
}

.primary-nav::-webkit-scrollbar {
  width: 0;
}

.nav-label {
  padding: 17px 10px 6px;
  color: #71838f;
  font-size: .66rem;
  font-weight: 800;
  text-transform: uppercase;
}

.nav-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 0 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #c8d3da;
  background: transparent;
  text-align: left;
  font-size: .85rem;
}

.nav-item svg {
  color: #8fa2ae;
}

.nav-item:hover {
  color: #fff;
  background: var(--nav-hover);
}

.nav-item.active {
  color: #fff;
  background: #24333d;
  border-color: #344650;
  box-shadow: inset 3px 0 0 var(--gold);
}

.nav-item.active svg {
  color: var(--gold);
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: auto 5px 10px;
  padding: 10px 8px;
  border-top: 1px solid #283640;
  border-bottom: 1px solid #283640;
}

.sidebar-status > div {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.sidebar-status strong,
.sidebar-status span {
  font-size: .7rem;
}

.sidebar-status span {
  color: #8fa2ae;
}

.status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(242, 183, 32, .14);
}

.status-dot.online {
  background: #58bd83;
  box-shadow: 0 0 0 3px rgba(88, 189, 131, .14);
}

.status-dot.offline {
  background: #dc726d;
  box-shadow: 0 0 0 3px rgba(220, 114, 109, .14);
}

.user-menu-wrap {
  position: relative;
}

.user-menu-button {
  min-height: 54px;
  display: grid;
  grid-template-columns: 34px 1fr 18px;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: #fff;
  background: transparent;
  text-align: left;
}

.user-menu-button:hover,
.user-menu-button[aria-expanded="true"] {
  background: #1b2a35;
  border-color: #30414c;
}

.user-menu-copy {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.user-menu-copy strong {
  overflow: hidden;
  font-size: .76rem;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.user-menu-copy small {
  color: #91a3af;
  font-size: .68rem;
}

.avatar {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #15212a;
  background: #e9c860;
  font-size: .72rem;
  font-weight: 850;
}

.avatar.large {
  width: 52px;
  height: 52px;
  font-size: 1rem;
}

.user-menu {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(100% + 7px);
  z-index: 1200;
  display: grid;
  padding: 6px;
  border: 1px solid #3a4a54;
  border-radius: 7px;
  background: #1a2730;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
}

.user-menu[hidden] {
  display: none;
}

.user-menu button {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 9px;
  border: 0;
  border-radius: 5px;
  color: #dce5ea;
  background: transparent;
  text-align: left;
  font-size: .76rem;
}

.user-menu button:hover {
  background: #2a3943;
}

.app-shell {
  min-height: 100vh;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  min-height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 22px;
  background: rgba(255, 255, 255, .97);
  border-bottom: 1px solid var(--line);
}

.page-heading {
  display: grid;
  gap: 2px;
}

.page-heading p,
.section-head span,
.directory-head span,
.dialog-head span {
  color: var(--muted);
  font-size: .69rem;
  font-weight: 750;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.security-state {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  color: var(--orange);
  background: var(--orange-soft);
  border: 1px solid #efd3b4;
  border-radius: 5px;
  font-size: .72rem;
  font-weight: 750;
}

.security-state.secured {
  color: var(--green);
  background: var(--green-soft);
  border-color: #c4dfcf;
}

.button,
.icon-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  background: var(--surface);
  font-size: .76rem;
  font-weight: 700;
}

.button {
  padding: 0 12px;
}

.icon-button {
  width: 36px;
  padding: 0;
}

.button:hover,
.icon-button:hover {
  border-color: #9fadb6;
  background: var(--surface-2);
}

.button.primary,
.icon-button.primary {
  color: #111b22;
  border-color: var(--gold-dark);
  background: var(--gold);
}

.button.primary:hover,
.icon-button.primary:hover {
  background: #ffc637;
}

.button.quiet {
  border-color: transparent;
  background: transparent;
}

.button.grow {
  flex: 1;
}

.mobile-menu-button {
  display: none;
}

main {
  min-width: 0;
  padding: 18px 22px 28px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.tool-view {
  min-height: calc(100vh - var(--topbar-height) - 46px);
}

.tool-view-header {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.tool-view-header > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.tool-view-header h2 {
  font-size: 1.08rem;
}

.integration-state {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-size: .64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.integration-state.pending {
  color: var(--orange);
}

.integration-state svg {
  width: 14px;
  height: 14px;
}

.embedded-tool-shell {
  height: calc(100vh - var(--topbar-height) - 122px);
  min-height: 680px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #dfe6eb;
  box-shadow: var(--shadow);
}

.embedded-tool-shell iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
}

.placeholder-workspace {
  min-height: 580px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 9px;
  border: 1px dashed #aebbc4;
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface);
  text-align: center;
}

.placeholder-workspace > strong {
  color: var(--ink);
  font-size: 1rem;
}

.placeholder-workspace > span {
  font-size: .72rem;
}

.placeholder-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 1px solid #d5bd79;
  border-radius: 7px;
  color: #7f5a00;
  background: #fff5d5;
}

.placeholder-mark svg {
  width: 28px;
  height: 28px;
}

.integration-checks {
  width: min(560px, calc(100% - 32px));
  margin: 18px 0 0;
  border-top: 1px solid var(--line);
}

.integration-checks > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--line);
  font-size: .7rem;
  text-align: left;
}

.integration-checks dt,
.integration-checks dd {
  margin: 0;
}

.integration-checks dd {
  color: var(--orange);
  font-weight: 800;
}

.command-hero {
  min-height: 272px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 26px;
  margin-bottom: 14px;
  padding: 28px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(10, 18, 25, .92) 0%, rgba(10, 18, 25, .65) 54%, rgba(10, 18, 25, .18) 100%),
    url("./assets/Gene-Blabey-LAL-Conductor_1972-960x650.jpg") center 44% / cover;
  border: 1px solid #192832;
  border-radius: 7px;
  box-shadow: var(--shadow);
}

.hero-copy {
  max-width: 680px;
  display: grid;
  align-items: start;
  gap: 12px;
}

.hero-copy p {
  color: #f2d77e;
  font-size: .72rem;
  font-weight: 850;
  text-transform: uppercase;
}

.hero-copy h2 {
  max-width: 650px;
  font-size: 2.25rem;
}

.hero-copy .button {
  width: max-content;
  margin-top: 5px;
}

.hero-figures {
  display: grid;
  grid-template-columns: repeat(3, minmax(110px, 1fr));
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 7px;
  background: rgba(8, 16, 22, .78);
  backdrop-filter: blur(5px);
}

.hero-figures div {
  min-width: 0;
  padding: 14px;
  border-right: 1px solid rgba(255, 255, 255, .16);
}

.hero-figures div:last-child {
  border-right: 0;
}

.hero-figures span {
  display: block;
  font-size: 1.25rem;
  font-weight: 850;
}

.hero-figures small {
  color: #aebbc4;
  font-size: .66rem;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.metric-grid article {
  min-height: 104px;
  display: grid;
  align-content: center;
  gap: 3px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.metric-grid article > span {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
}

.metric-grid strong {
  font-size: 1.55rem;
}

.metric-grid small {
  color: var(--subtle);
  font-size: .66rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 10px;
}

.workspace-section {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.section-head,
.directory-head,
.subsection-head,
.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-head {
  margin-bottom: 13px;
}

.section-head.compact {
  margin-bottom: 10px;
}

.section-head > div,
.directory-head > div,
.dialog-head > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.section-head > svg {
  color: var(--blue);
}

.section-intro {
  margin: -3px 0 14px;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.5;
}

.record-list,
.timeline,
.rate-list,
.customer-list {
  display: grid;
}

.record-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 2px;
  border-bottom: 1px solid #e8edef;
}

.record-row:last-child {
  border-bottom: 0;
}

.record-row > div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.record-row strong {
  overflow: hidden;
  font-size: .78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-row span,
.record-row p,
.timeline-item p {
  color: var(--muted);
  font-size: .7rem;
  line-height: 1.4;
}

.record-row .record-value {
  color: var(--green);
  font-weight: 800;
}

.timeline {
  position: relative;
}

.timeline-item {
  position: relative;
  display: grid;
  gap: 3px;
  padding: 10px 4px 10px 24px;
  border-bottom: 1px solid #e8edef;
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 15px;
  left: 5px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 4px var(--blue-soft);
}

.timeline-item strong {
  font-size: .76rem;
}

.timeline-item span {
  color: var(--subtle);
  font-size: .66rem;
}

.empty-state {
  min-height: 110px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 5px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  font-size: .75rem;
}

.empty-state svg {
  width: 24px;
  height: 24px;
  color: var(--subtle);
}

.routing-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 390px;
  gap: 12px;
  min-height: calc(100vh - var(--topbar-height) - 46px);
}

.map-workspace {
  position: relative;
  min-height: 720px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #e5ebe7;
}

.map-titlebar {
  position: absolute;
  z-index: 700;
  top: 12px;
  left: 50px;
  right: 12px;
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 8px 7px 12px;
  border: 1px solid rgba(159, 173, 182, .92);
  border-radius: 7px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 6px 20px rgba(18, 32, 42, .13);
}

.map-titlebar > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.map-titlebar strong {
  overflow: hidden;
  font-size: .74rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.live-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--green);
  font-size: .64rem;
  font-weight: 800;
  text-transform: uppercase;
}

.live-indicator > span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #3a9b67;
}

.segmented {
  display: inline-flex;
  flex: 0 0 auto;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #eef2f4;
}

.segmented button {
  min-height: 27px;
  padding: 0 9px;
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
  font-size: .68rem;
  font-weight: 750;
}

.segmented button.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(18, 32, 42, .13);
}

#map {
  width: 100%;
  height: 100%;
  min-height: 720px;
  background:
    linear-gradient(rgba(54, 86, 104, .07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(54, 86, 104, .07) 1px, transparent 1px),
    #e5ebe7;
  background-size: 32px 32px;
}

.map-empty {
  position: absolute;
  z-index: 350;
  inset: auto auto 76px 12px;
  max-width: 220px;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 2px 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #d5c3a9;
  border-radius: 6px;
  color: #6c4c28;
  background: rgba(255, 249, 237, .96);
  font-size: .67rem;
}

.map-empty[hidden] {
  display: none;
}

.map-empty svg {
  grid-row: span 2;
}

.map-empty span {
  color: #8c6a42;
}

.map-toolbar {
  position: absolute;
  z-index: 700;
  bottom: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 6px 20px rgba(18, 32, 42, .13);
}

.map-toolbar input {
  display: none;
}

.map-legend {
  position: absolute;
  z-index: 700;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  max-width: 380px;
  padding: 9px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: rgba(255, 255, 255, .96);
  color: var(--muted);
  box-shadow: 0 6px 20px rgba(18, 32, 42, .13);
  font-size: .64rem;
  font-weight: 700;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-line {
  width: 18px;
  height: 4px;
  display: inline-block;
  border-radius: 2px;
  background: var(--gold);
}

.legend-line.bh {
  background: var(--blue);
}

.legend-line.wnyp {
  background: var(--green);
}

.legend-line.omid {
  background: var(--purple);
}

.legend-point {
  width: 7px;
  height: 7px;
  display: inline-block;
  border: 1px solid #263640;
  border-radius: 50%;
  background: #fff;
}

.route-builder {
  min-width: 0;
  padding: 15px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #cfdae0;
  border-radius: 999px;
  color: #455661;
  background: #edf2f4;
  font-size: .64rem;
  font-weight: 800;
  white-space: nowrap;
}

.badge.active {
  color: var(--green);
  border-color: #bfdcca;
  background: var(--green-soft);
}

.badge.warning {
  color: var(--orange);
  border-color: #e7c9a5;
  background: var(--orange-soft);
}

.badge.risk {
  color: var(--red);
  border-color: #e4c5c3;
  background: var(--red-soft);
}

.route-endpoints {
  position: relative;
  display: grid;
  gap: 10px;
  margin: 12px 0 14px;
  padding-left: 28px;
}

.endpoint-line {
  position: absolute;
  top: 26px;
  bottom: 26px;
  left: 9px;
  width: 2px;
  background: #ccd7dd;
}

.route-endpoints label {
  position: relative;
}

.endpoint-dot {
  position: absolute;
  z-index: 2;
  top: 28px;
  left: -25px;
  width: 11px;
  height: 11px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 2px var(--green);
}

.endpoint-dot.via {
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--gold-dark);
}

.endpoint-dot.destination {
  background: var(--red);
  box-shadow: 0 0 0 2px var(--red);
}

label {
  min-width: 0;
  display: grid;
  gap: 5px;
  color: #556672;
  font-size: .69rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  background: #fff;
  font-size: .76rem;
}

input,
select {
  min-height: 36px;
  padding: 0 9px;
}

textarea {
  min-height: 84px;
  padding: 9px;
  resize: vertical;
  line-height: 1.45;
}

input:hover,
select:hover,
textarea:hover {
  border-color: #9fadb6;
}

.assumptions {
  margin: 0 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.assumptions summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #43545f;
  font-size: .72rem;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.assumptions summary::-webkit-details-marker {
  display: none;
}

.assumptions[open] summary svg {
  transform: rotate(180deg);
}

.assumptions .form-grid {
  padding-bottom: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.button-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.button-row.end {
  justify-content: flex-end;
}

.route-message {
  min-height: 48px;
  margin: 12px 0;
  padding: 10px 11px;
  border-left: 3px solid var(--blue);
  color: #52636f;
  background: var(--blue-soft);
  font-size: .7rem;
  line-height: 1.45;
}

.route-message.error {
  border-left-color: var(--red);
  color: #713734;
  background: var(--red-soft);
}

.route-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.route-results div {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.route-results div.wide {
  grid-column: span 2;
}

.route-results span {
  color: var(--muted);
  font-size: .64rem;
}

.route-results strong {
  font-size: 1rem;
}

.layer-manager,
.saved-routes {
  margin-top: 16px;
}

.subsection-head {
  align-items: end;
  margin-bottom: 7px;
}

.subsection-head strong {
  font-size: .74rem;
}

.subsection-head span {
  color: var(--subtle);
  font-size: .62rem;
}

.layer-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) 30px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #e8edef;
}

.layer-row input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.layer-row > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.layer-row strong {
  overflow: hidden;
  font-size: .7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-row span {
  color: var(--muted);
  font-size: .62rem;
}

.layer-row .icon-button {
  min-height: 30px;
  width: 30px;
  border-color: transparent;
}

.saved-route-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px solid #e8edef;
}

.saved-route-row > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.saved-route-row strong {
  overflow: hidden;
  font-size: .7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.saved-route-row span {
  color: var(--muted);
  font-size: .62rem;
}

.customers-layout,
.rates-layout {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-height) - 46px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.customer-directory,
.rate-directory {
  min-width: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #f8fafb;
}

.directory-head {
  min-height: 64px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.directory-head strong {
  font-size: .86rem;
}

.search-field {
  position: relative;
  display: block;
  margin: 10px 10px 7px;
}

.search-field svg {
  position: absolute;
  top: 9px;
  left: 10px;
  z-index: 2;
  width: 16px;
  height: 16px;
  color: var(--subtle);
}

.search-field input {
  padding-left: 33px;
  background: #fff;
}

.filter-row {
  display: flex;
  gap: 4px;
  padding: 0 10px 9px;
  overflow-x: auto;
}

.filter-row button {
  min-height: 27px;
  flex: 0 0 auto;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--muted);
  background: transparent;
  font-size: .62rem;
  font-weight: 750;
}

.filter-row button.active {
  color: var(--blue);
  border-color: #c7dbe7;
  background: var(--blue-soft);
}

.customer-list,
.rate-list {
  min-height: 0;
  overflow: auto;
}

.customer-list.compact .customer-row {
  min-height: 52px;
}

.customer-row,
.rate-row {
  min-height: 65px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 8px 10px;
  border: 0;
  border-bottom: 1px solid #e4eaed;
  border-radius: 0;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.customer-row:hover,
.rate-row:hover {
  background: #fff;
}

.customer-row.active,
.rate-row.active {
  background: #fff;
  box-shadow: inset 3px 0 0 var(--gold);
}

.customer-row > div,
.rate-row > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.customer-row strong,
.rate-row strong {
  overflow: hidden;
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-row small,
.rate-row small {
  overflow: hidden;
  color: var(--muted);
  font-size: .62rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.directory-monogram {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  color: #284454;
  background: #dce8ee;
  font-size: .64rem;
  font-weight: 850;
}

.customer-workspace,
.rate-workspace {
  min-width: 0;
  overflow: auto;
}

.customer-header {
  min-height: 84px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.customer-identity {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.customer-identity > div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.customer-title-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.customer-title-line h2 {
  overflow: hidden;
  font-size: 1.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-identity p {
  overflow: hidden;
  color: var(--muted);
  font-size: .7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-monogram {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 6px;
  color: #172936;
  background: #d9e6ec;
  font-weight: 900;
}

.customer-actions {
  display: flex;
  gap: 7px;
}

.record-tabs {
  display: flex;
  gap: 2px;
  padding: 0 16px;
  overflow-x: auto;
  border-bottom: 1px solid var(--line);
  background: #fbfcfc;
}

.record-tabs button {
  min-height: 44px;
  flex: 0 0 auto;
  padding: 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  background: transparent;
  font-size: .69rem;
  font-weight: 750;
}

.record-tabs button.active {
  color: var(--ink);
  border-bottom-color: var(--blue);
}

.customer-panel {
  padding: 17px 18px 28px;
}

.profile-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 8px;
  margin-bottom: 15px;
}

.profile-summary div {
  display: grid;
  gap: 3px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.profile-summary span {
  color: var(--muted);
  font-size: .62rem;
}

.profile-summary strong {
  font-size: .78rem;
}

.profile-sections {
  display: grid;
  gap: 14px;
}

.profile-section {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.profile-section:last-child {
  border-bottom: 0;
}

.profile-section-head {
  display: grid;
  grid-template-columns: minmax(150px, 220px) minmax(0, 1fr);
  gap: 18px;
  margin-bottom: 11px;
}

.profile-section-head strong {
  font-size: .78rem;
}

.profile-section-head p {
  color: var(--muted);
  font-size: .68rem;
  line-height: 1.4;
}

.profile-fields {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.profile-fields .wide {
  grid-column: span 2;
}

.profile-fields .full {
  grid-column: 1 / -1;
}

.checkbox-field {
  min-height: 36px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  background: #fff;
}

.checkbox-field input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

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

.repeat-row {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.repeat-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.repeat-row-head strong {
  font-size: .72rem;
}

.repeat-row .icon-button {
  width: 30px;
  min-height: 30px;
  color: var(--red);
  background: transparent;
  border-color: transparent;
}

.preference-checks {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  padding-top: 4px;
}

.preference-checks label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .64rem;
}

.preference-checks input {
  width: 15px;
  min-height: 15px;
}

.panel-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 10px;
}

.service-note-form {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.service-note-form textarea {
  min-height: 58px;
}

.private-field {
  border-left: 3px solid var(--orange);
  padding-left: 10px;
}

.field-readonly-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 8px;
  color: var(--orange);
  font-size: .66rem;
  font-weight: 750;
}

.page-tools {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.pipeline-summary {
  display: flex;
  gap: 20px;
  color: var(--muted);
  font-size: .72rem;
}

.pipeline-summary strong {
  color: var(--ink);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(215px, 1fr));
  gap: 9px;
  overflow-x: auto;
}

.kanban-lane {
  min-height: calc(100vh - 154px);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f7f9fa;
}

.kanban-lane.drag-over {
  outline: 2px solid var(--gold);
  outline-offset: -2px;
}

.kanban-lane h3 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: .74rem;
}

.deal-card {
  display: grid;
  gap: 6px;
  margin-bottom: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 3px 10px rgba(21, 35, 45, .05);
  cursor: grab;
}

.deal-card:active {
  cursor: grabbing;
}

.deal-card span,
.deal-card small {
  color: var(--muted);
  font-size: .64rem;
}

.deal-card strong {
  font-size: .74rem;
  line-height: 1.35;
}

.deal-card footer {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 5px;
  border-top: 1px solid #e8edef;
}

.deal-card footer span:first-child {
  color: var(--green);
  font-weight: 800;
}

.rate-row {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 9px 11px;
}

.rate-workspace {
  padding: 16px 18px 28px;
}

.form-section {
  display: grid;
  gap: 11px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.form-section h4 {
  color: #425560;
}

.fuel-section .subsection-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.fuel-result {
  min-height: 36px;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 5px 9px;
  border: 1px solid #d6c17d;
  border-radius: 5px;
  background: #fff7da;
}

.fuel-result span,
.fuel-total span {
  color: var(--muted);
  font-size: .62rem;
}

.fuel-result strong {
  color: #765500;
  font-size: .86rem;
}

.fuel-total {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 10px;
  border-top: 2px solid var(--gold);
  border-bottom: 1px solid var(--line);
}

.fuel-total strong {
  font-size: 1rem;
}

.form-note {
  color: var(--muted);
  font-size: .64rem;
  line-height: 1.45;
}

.operations-grid,
.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.admin-grid {
  grid-template-columns: 1.2fr .8fr;
}

.admin-grid .full {
  grid-column: 1 / -1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .72rem;
}

th {
  color: var(--muted);
  background: var(--surface-2);
  font-size: .62rem;
  text-align: left;
  text-transform: uppercase;
}

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

td strong,
td span {
  display: block;
}

td span {
  color: var(--muted);
  font-size: .63rem;
}

td select {
  min-width: 138px;
}

.permission-matrix {
  display: grid;
  gap: 8px;
}

.permission-role {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.permission-role strong {
  font-size: .7rem;
}

.permission-role div {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.permission-chip {
  display: inline-flex;
  min-height: 21px;
  align-items: center;
  padding: 0 6px;
  border-radius: 4px;
  color: #40535f;
  background: #e9eff2;
  font-size: .58rem;
  font-weight: 750;
}

.security-checklist {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.security-check {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.security-check svg {
  color: var(--green);
}

.security-check.warning svg {
  color: var(--orange);
}

.security-check > div {
  display: grid;
  gap: 3px;
}

.security-check strong {
  font-size: .7rem;
}

.security-check span {
  color: var(--muted);
  font-size: .63rem;
  line-height: 1.4;
}

dialog {
  width: min(480px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 24px 70px rgba(12, 24, 32, .28);
}

dialog::backdrop {
  background: rgba(9, 19, 26, .55);
}

.dialog-shell {
  display: grid;
  gap: 14px;
  padding: 17px;
}

.profile-dialog-identity {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
}

.profile-dialog-identity > div {
  display: grid;
  gap: 3px;
}

.profile-dialog-identity strong {
  font-size: .82rem;
}

.profile-dialog-identity span {
  color: var(--muted);
  font-size: .68rem;
}

.toggle-row {
  grid-template-columns: minmax(0, 1fr) 36px;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.toggle-row span {
  display: grid;
  gap: 2px;
}

.toggle-row small {
  color: var(--muted);
  font-size: .63rem;
  font-weight: 500;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
  justify-self: end;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.toast-region {
  position: fixed;
  z-index: 2000;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  width: min(350px, calc(100vw - 36px));
}

.toast {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 10px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: .72rem;
}

.toast.success svg {
  color: var(--green);
}

.toast.error svg {
  color: var(--red);
}

.mobile-scrim {
  display: none;
}

.leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid var(--line-strong) !important;
  border-radius: 6px !important;
  box-shadow: 0 6px 20px rgba(18, 32, 42, .12) !important;
}

.leaflet-control-zoom a {
  color: var(--ink) !important;
}

.leaflet-control-attribution {
  font-size: 9px !important;
}

.leaflet-pane > svg {
  width: auto;
  height: auto;
}

.leaflet-tooltip {
  border-color: var(--line-strong);
  border-radius: 5px;
  color: var(--ink);
  box-shadow: 0 5px 18px rgba(18, 32, 42, .14);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: .66rem;
}

@media (max-width: 1220px) {
  .routing-layout {
    grid-template-columns: minmax(460px, 1fr) 350px;
  }

  .map-legend {
    max-width: 300px;
  }

  .profile-fields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-fields .wide {
    grid-column: span 2;
  }

  .form-grid.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1020px) {
  :root {
    --sidebar-width: 222px;
  }

  main {
    padding: 14px;
  }

  .topbar {
    padding-inline: 14px;
  }

  .command-hero {
    grid-template-columns: 1fr;
  }

  .hero-figures {
    max-width: 520px;
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

  .routing-layout {
    grid-template-columns: 1fr;
  }

  .map-workspace,
  #map {
    min-height: 610px;
  }

  .route-builder {
    overflow: visible;
  }

  .customers-layout,
  .rates-layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

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

@media (max-width: 820px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

  body.nav-open .sidebar {
    transform: translateX(0);
  }

  .app-shell {
    margin-left: 0;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .brand .mobile-menu-button {
    margin-left: auto;
    color: #dce5ea;
    border-color: transparent;
    background: transparent;
  }

  .mobile-scrim {
    position: fixed;
    inset: 0;
    z-index: 1050;
    background: rgba(8, 18, 24, .5);
  }

  body.nav-open .mobile-scrim {
    display: block;
  }

  .security-state {
    display: none;
  }

  .customers-layout,
  .rates-layout {
    grid-template-columns: 1fr;
    overflow: visible;
  }

  .customer-directory,
  .rate-directory {
    max-height: 390px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .customer-workspace,
  .rate-workspace {
    overflow: visible;
  }

  .customer-header {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .admin-grid .full {
    grid-column: auto;
  }

  .security-checklist {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .topbar {
    min-height: 62px;
    gap: 9px;
    padding: 8px 10px;
  }

  .page-heading p {
    display: none;
  }

  .page-heading h1 {
    font-size: 1.08rem;
  }

  .topbar-actions .button span {
    display: none;
  }

  .topbar-actions .button {
    width: 36px;
    padding: 0;
  }

  main {
    padding: 10px;
  }

  .command-hero {
    min-height: 390px;
    padding: 18px;
    background-position: 58% 44%;
  }

  .hero-copy h2 {
    font-size: 1.75rem;
  }

  .hero-figures {
    grid-template-columns: 1fr;
  }

  .hero-figures div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 11px;
    border-right: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .16);
  }

  .hero-figures div:last-child {
    border-bottom: 0;
  }

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

  .metric-grid article {
    min-height: 112px;
  }

  .map-workspace,
  #map {
    min-height: 570px;
  }

  .map-titlebar {
    left: 46px;
  }

  .map-titlebar .segmented {
    position: absolute;
    top: 58px;
    right: 0;
    display: inline-flex;
  }

  .map-titlebar .segmented button {
    padding-inline: 7px;
    font-size: .62rem;
  }

  .map-legend {
    left: 12px;
    right: 12px;
    bottom: 64px;
    max-width: none;
  }

  .route-builder {
    padding: 12px;
  }

  .form-grid,
  .form-grid.three,
  .profile-fields,
  .profile-summary {
    grid-template-columns: 1fr;
  }

  .profile-fields .wide,
  .route-results div.wide {
    grid-column: auto;
  }

  .customer-header {
    padding: 12px;
  }

  .customer-actions {
    width: 100%;
  }

  .customer-actions .button {
    flex: 1;
  }

  .customer-panel {
    padding: 13px 12px 24px;
  }

  .profile-section-head {
    grid-template-columns: 1fr;
    gap: 3px;
  }

  .service-note-form {
    grid-template-columns: 1fr;
  }

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

  .pipeline-summary {
    display: grid;
    gap: 2px;
  }

  .kanban {
    grid-template-columns: repeat(5, 225px);
  }

  .permission-role {
    grid-template-columns: 1fr;
  }
}
