:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #17202a;
  --muted: #667085;
  --line: #d8dee6;
  --brand: #2f6f83;
  --brand-dark: #174d62;
  --accent: #f59e0b;
  --danger: #b42318;
  --ok: #2f6f83;
  --shadow: 0 18px 46px rgba(15, 23, 42, .08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(47, 111, 131, .07), rgba(243, 245, 247, 0) 280px),
    var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

label.btn {
  cursor: pointer;
  font-size: inherit;
  line-height: 1;
}

.app-shell {
  width: min(1480px, calc(100% - 36px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

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

.brand-mark {
  width: min(420px, 52vw);
  max-width: 100%;
  display: block;
}

.brand-mark img {
  display: block;
  width: 100%;
  height: auto;
}

h1 {
  margin: 0;
  font-size: clamp(1.55rem, 2.4vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.subtitle {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .96rem;
}

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

.btn {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 7px;
  background: #e7ecef;
  color: #1f2937;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .12s ease;
}

.btn svg {
  width: 18px;
  height: 18px;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--brand-dark);
}

.btn:not(.btn-primary):not(.btn-danger):not(.btn-ghost):hover,
.btn:not(.btn-primary):not(.btn-danger):not(.btn-ghost):focus-visible {
  background: #d9e1e7;
  color: #111827;
}

.btn-danger {
  background: #fee4e2;
  color: var(--danger);
}

.btn-danger:hover,
.btn-danger:focus-visible {
  background: #fecdca;
  color: #7a271a;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: #344054;
}

.btn-ghost:hover,
.btn-ghost:focus-visible,
label.btn:hover,
label.btn:focus-visible {
  border-color: rgba(47, 111, 131, .45);
  background: #eef8f8;
  color: var(--brand-dark);
}

.btn:hover,
.btn:focus-visible,
.icon-btn:hover,
.icon-btn:focus-visible,
.tab:hover,
.tab:focus-visible,
.choice-btn:hover,
.choice-btn:focus-visible {
  box-shadow: 0 4px 14px rgba(16, 24, 40, .09);
}

.btn:active,
.icon-btn:active,
.tab:active,
.choice-btn:active {
  transform: translateY(1px);
}

.subscription-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin: 18px 18px 0;
  padding: 14px;
  border: 1px solid #b7d9c6;
  border-radius: 8px;
  background: #effaf3;
  color: #216e43;
}

.subscription-banner[hidden],
#subscribeBtn[hidden] {
  display: none;
}

.subscription-banner div {
  display: grid;
  gap: 4px;
}

.subscription-banner span {
  color: #2f6b49;
  line-height: 1.4;
}

.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 22px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: rgba(255, 255, 255, .78);
}

.app-footer div {
  display: grid;
  gap: 3px;
}

.app-footer strong {
  color: #fff;
}

.app-footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 16px;
}

.app-footer .btn {
  min-height: auto;
  padding: 0;
  background: transparent;
  border: 0;
  color: #fff;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.app-footer .btn:hover {
  background: transparent;
  border: 0;
  color: #eaf4ff;
}

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

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  min-width: 0;
  background: var(--panel);
  border: 1px solid rgba(216, 222, 230, .85);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-header {
  padding: 18px 18px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.panel-header > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.panel-title {
  margin: 0;
  font-size: 1.05rem;
}

.panel-kicker {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.panel-body {
  padding: 18px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.guided-form {
  display: grid;
  gap: 14px;
}

.form-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.form-step-action {
  background: #eef8f8;
}

.step-marker {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-weight: 950;
}

.step-content {
  min-width: 0;
  display: grid;
  gap: 12px;
}

.step-content h3 {
  margin: 0;
  color: var(--ink);
  font-size: .98rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

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

.modal-error {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  background: #fef2f2;
  color: #b42318;
  font-size: .84rem;
  font-weight: 850;
  line-height: 1.35;
}

label {
  font-size: .82rem;
  color: #344054;
  font-weight: 800;
}

.info-dot {
  width: 17px;
  height: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  border: 1px solid #b8c4d2;
  border-radius: 50%;
  color: #2f6f83;
  font-size: .7rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1;
  cursor: help;
  position: relative;
}

[data-tip] {
  position: relative;
}

.info-dot:hover::after,
.info-dot:focus-visible::after {
  display: none;
}

.floating-tip {
  position: fixed;
  z-index: 1000;
  width: max-content;
  max-width: min(320px, calc(100vw - 16px));
  padding: 8px 10px;
  border-radius: 7px;
  background: #101828;
  color: #fff;
  font-size: .76rem;
  font-weight: 750;
  line-height: 1.35;
  text-transform: none;
  white-space: normal;
  box-shadow: 0 12px 30px rgba(16, 24, 40, .22);
  pointer-events: none;
}

[hidden] {
  display: none !important;
}

.combo-field {
  position: relative;
  z-index: 1;
  display: flex;
  isolation: isolate;
}

.combo-field:focus-within {
  z-index: 140;
}

.combo-field input {
  padding-right: 42px;
}

.combo-toggle {
  width: 36px;
  position: absolute;
  top: 3px;
  right: 3px;
  bottom: 3px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #f8fafc;
  color: #344054;
  border: 1px solid transparent;
}

.combo-toggle:hover {
  background: #eef6ff;
  border-color: #cfe2f3;
}

.combo-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

.combo-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  left: 0;
  z-index: 160;
  max-height: 220px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #344054;
  box-shadow: 0 18px 36px rgba(16, 24, 40, .16);
}

.combo-menu button,
.combo-menu span {
  width: 100%;
  display: block;
  padding: 8px 9px;
  background: #fff;
  border: 0;
  border-radius: 6px;
  color: #344054;
  text-align: left;
  font-weight: 750;
}

.combo-menu button:hover {
  background: #eef6ff;
  color: var(--brand-dark);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cfd7e2;
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

select {
  appearance: none;
  padding-right: 38px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 18px 18px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(47, 111, 131, .13);
}

input:disabled,
select:disabled,
textarea:disabled {
  background-color: #f2f4f7;
  color: #98a2b3;
  border-color: #d8dee6;
  cursor: not-allowed;
  box-shadow: none;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.segmented button {
  min-height: 42px;
  color: #344054;
  background: transparent;
  border-right: 1px solid var(--line);
  font-weight: 800;
}

.segmented button:last-child {
  border-right: 0;
}

.segmented button.active {
  background: #e8f3f5;
  color: var(--brand-dark);
}

.extras-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  max-height: min(54vh, 430px);
  overflow: auto;
  padding-right: 0;
  scrollbar-gutter: stable;
}

.extras-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 100%;
  max-height: 92px;
  margin-bottom: 8px;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 1px 2px 2px 0;
  scrollbar-width: thin;
}

.extra-filter-btn {
  flex: 0 1 auto;
  min-height: 26px;
  max-width: 100%;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #475467;
  font-size: .68rem;
  font-weight: 850;
  line-height: 1.12;
  overflow-wrap: anywhere;
  text-align: left;
}

.extra-filter-btn.active {
  border-color: rgba(47, 111, 131, .7);
  background: #e8f3f5;
  color: var(--brand-dark);
}

.check-row {
  position: relative;
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 12px;
  background: #fbfcfd;
  min-height: 0;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}

.check-row:hover,
.check-row:focus-within,
.check-row:focus-visible {
  border-color: rgba(47, 111, 131, .48);
  background: #fff;
}

.check-row.selected,
.check-row:has(input:checked) {
  border-color: rgba(47, 111, 131, .8);
  background: #eef8f8;
  box-shadow: inset 3px 0 0 var(--brand);
}

.extra-card.compact {
  padding-top: 12px;
  padding-bottom: 12px;
}

.check-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.extra-card-body {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.extra-card-head {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 0;
}

.extra-card-head strong {
  min-width: 0;
  color: #344054;
  font-size: .84rem;
  font-weight: 900;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.extra-card-head small {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 2px 7px;
  border: 1px solid rgba(47, 111, 131, .24);
  border-radius: 6px;
  background: #e8f3f5;
  color: var(--brand-dark);
  line-height: 1;
  white-space: nowrap;
  font-size: .68rem;
  font-weight: 950;
  text-align: center;
}

.extra-price-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}

.extra-price-pill {
  min-width: 0;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 2px 8px 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  font-size: .67rem;
  line-height: 1.2;
  min-height: 25px;
  overflow: visible;
  box-shadow: 0 1px 0 rgba(16, 24, 40, .03);
}

.extra-price-pill b {
  min-width: 0;
  flex: 0 1 auto;
  color: #344054;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.extra-price-pill em {
  flex: 0 0 auto;
  color: #344054;
  font-style: normal;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.zone-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 10px;
}

.zone-card,
.service-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.zone-card.inactive,
.service-card.inactive {
  opacity: .62;
  background: #f8fafc;
}

.status-toggle.inactive {
  background: #fff7ed;
  color: #9a3412;
}

.status-toggle.active {
  background: #e7f6ec;
  color: #067647;
}

.zone-card-head,
.service-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.zone-card-head > div:first-child,
.service-card-head > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.zone-card-title,
.service-card-title {
  margin: 0;
  font-size: .98rem;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.zone-card-meta,
.service-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.mini-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #475467;
  font-size: .72rem;
  font-weight: 850;
}

.zone-card-ranges {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.price-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  justify-content: flex-start;
}

.price-preview span {
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  font-size: .72rem;
  font-weight: 750;
}

.service-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 10px;
}

.price-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 92px), 1fr));
  gap: 10px;
}

.add-price-slot {
  min-height: 42px;
  align-self: end;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-weight: 950;
}

.zone-matrix-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 8px;
}

.matrix-weight-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-weight: 850;
}

.matrix-weight-field[hidden] {
  display: none;
}

.matrix-weight-field input,
.matrix-weight-field select {
  width: 92px;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font: inherit;
  font-weight: 850;
  text-align: right;
}

.matrix-weight-field select {
  width: 74px;
  text-align: left;
}

.zone-matrix-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.zone-matrix-table {
  width: 100%;
  min-width: calc(150px + (var(--zone-matrix-zone-count, 3) * 90px));
  table-layout: fixed;
  border-collapse: collapse;
  border-spacing: 0;
}

.zone-matrix-table th,
.zone-matrix-table td {
  min-width: 90px;
  padding: 4px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  vertical-align: middle;
}

.zone-matrix-table th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  width: 150px;
  min-width: 150px;
  background: #f8fafc;
  color: #475467;
  text-align: center;
  overflow-wrap: anywhere;
}

.zone-matrix-table thead th {
  background: #f8fafc;
}

.zone-matrix-table tbody tr:last-child th,
.zone-matrix-table tbody tr:last-child td {
  border-bottom: 0;
}

.zone-matrix-table th:last-child,
.zone-matrix-table td:last-child {
  border-right: 0;
}

.zone-matrix-table input,
.zone-matrix-table textarea {
  min-height: 34px;
  padding: 5px 6px;
  font-size: .82rem;
  line-height: 1.18;
  text-align: center;
  align-content: center;
}

.zone-matrix-table textarea {
  height: 34px;
  min-height: 34px;
  overflow: hidden;
  resize: none;
}

.zone-matrix-table .zone-matrix-name {
  min-height: 34px;
  overflow-wrap: anywhere;
}

.matrix-row-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.matrix-row-edit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid #c8d7e8;
  border-radius: 7px;
  background: #fff;
  color: var(--primary);
  cursor: pointer;
}

.matrix-row-edit svg {
  width: 14px;
  height: 14px;
}

.matrix-weight-popup-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .34);
}

.matrix-weight-popup {
  width: min(420px, 100%);
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 18px 55px rgba(15, 23, 42, .18);
}

.matrix-weight-popup h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.matrix-weight-edit-field {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr) auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.matrix-weight-edit-field input,
.matrix-weight-edit-field select {
  min-height: 42px;
}

.matrix-weight-popup-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.tier-table {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.service-tier-editor {
  align-self: stretch;
}

.service-tier-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.service-tier-head > label:first-child {
  margin-bottom: 0;
}

.service-tier-basis {
  width: min(220px, 100%);
  display: grid;
  gap: 6px;
}

.tier-row {
  display: grid;
  grid-template-columns: minmax(110px, .9fr) minmax(110px, 1fr) minmax(110px, 1fr);
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

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

.tier-row.tier-head {
  background: #f8fafc;
  color: #475467;
  font-size: .78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.tier-row select,
.tier-row input {
  min-height: 36px;
}

.tier-disabled {
  opacity: .55;
  pointer-events: none;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 128px), 1fr));
  gap: 8px;
}

.choice-btn {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: #344054;
  font-weight: 850;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .12s ease;
}

.choice-btn:hover,
.choice-btn:focus-visible {
  border-color: rgba(47, 111, 131, .45);
  background: #eef8f8;
  color: var(--brand-dark);
}

.choice-btn.active {
  border-color: rgba(47, 111, 131, .38);
  background: #e8f3f5;
  color: var(--brand-dark);
}

.choice-btn.active:hover,
.choice-btn.active:focus-visible {
  border-color: rgba(47, 111, 131, .65);
  background: #d9eef2;
}

.main-stack {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.admin-panel.locked .tabs,
.admin-panel.locked .admin-section,
.admin-panel.locked .admin-helper {
  display: none;
}

.admin-lock {
  padding: 22px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.admin-panel.locked .admin-lock {
  display: flex;
}

.admin-helper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 14px 18px 18px;
  padding: 14px;
  border: 1px solid #d8e9ed;
  border-radius: var(--radius);
  background: #eef8f8;
}

.admin-helper div {
  display: grid;
  gap: 4px;
}

.admin-helper strong {
  color: var(--ink);
}

.admin-helper span {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.45;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  min-height: 86px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fbfcfd;
}

.metric-label {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  margin-top: 8px;
  font-size: 1.38rem;
  font-weight: 900;
}

.results {
  display: grid;
  gap: 12px;
}

.quote-card {
  display: grid;
  grid-template-columns: minmax(160px, 1.1fr) minmax(180px, .9fr) minmax(180px, 1.1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.quote-card:hover,
.quote-card:focus-visible {
  border-color: rgba(47, 111, 131, .55);
  box-shadow: 0 8px 24px rgba(16, 24, 40, .08);
}

.quote-card.best {
  border-color: rgba(47, 111, 131, .32);
  box-shadow: inset 5px 0 0 var(--ok);
}

.quote-card-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: stretch;
}

.carrier-name {
  font-size: 1.08rem;
  font-weight: 900;
}

.muted {
  color: var(--muted);
}

.price {
  font-size: 1.55rem;
  font-weight: 950;
  color: #101828;
  white-space: nowrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e7f6ec;
  color: #067647;
  font-size: .78rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge-neutral {
  background: #eef2f6;
  color: #344054;
}

.breakdown {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.breakdown span {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 999px;
  padding: 4px 8px;
  color: #344054;
  font-size: .78rem;
  font-weight: 700;
}

.tabs {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: thin;
}

.tab {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 7px;
  background: transparent;
  color: #344054;
  font-weight: 850;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .12s ease;
}

.tab:hover,
.tab:focus-visible {
  background: #eef8f8;
  color: var(--brand-dark);
}

.tab.active {
  background: var(--brand);
  color: #fff;
}

.tab.active:hover,
.tab.active:focus-visible {
  background: var(--brand-dark);
  color: #fff;
}

.tabs .settings-stats {
  margin-left: auto;
  flex: 0 0 auto;
  align-self: flex-end;
}

.settings-stats {
  min-height: 36px;
  padding: 0 11px;
}

.settings-logout {
  flex: 0 0 auto;
}

.admin-panel.locked .settings-stats,
.admin-panel.locked .settings-logout {
  display: none;
}

.admin-section {
  display: none;
  padding: 18px;
  overflow-x: auto;
}

.admin-section.active {
  display: block;
}

.settings-stats-dialog {
  display: grid;
  gap: 14px;
}

.stats-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.stats-nav .choice-btn {
  min-height: 34px;
  padding: 0 10px;
  font-size: .82rem;
}

.stats-content {
  display: grid;
  gap: 11px;
}

.stats-filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.stats-filter-bar label {
  display: grid;
  gap: 5px;
  color: #475467;
  font-size: .72rem;
  font-weight: 900;
}

.stats-filter-bar select {
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-weight: 750;
}

.stats-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 135px), 1fr));
  gap: 8px;
}

.stats-card {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.stats-card span {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stats-card strong {
  color: var(--ink);
  font-size: 1.1rem;
  line-height: 1.1;
}

.stats-card small {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
}

.stats-section {
  display: grid;
  gap: 8px;
}

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

.stats-chart,
.stats-bars {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stats-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.stats-chart line {
  stroke: #d8dee6;
  stroke-width: 1.5;
}

.stats-chart polyline {
  fill: none;
  stroke: var(--brand);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.stats-chart circle {
  fill: #fff;
  stroke: var(--brand);
  stroke-width: 2.4;
}

.stats-chart text {
  fill: #667085;
  font-size: 11px;
  font-weight: 800;
}

.stats-chart .axis-label {
  fill: #344054;
  font-size: 12px;
  font-weight: 900;
}

.stats-chart .axis-value {
  fill: #667085;
  font-size: 11px;
  font-weight: 800;
}

.stats-bars {
  display: grid;
  gap: 6px;
}

.stats-bar-row {
  display: grid;
  grid-template-columns: minmax(82px, .8fr) minmax(80px, 1fr) auto;
  gap: 6px;
  align-items: center;
  font-size: .68rem;
}

.stats-bar-row span {
  min-width: 0;
  color: #475467;
  font-weight: 850;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats-bar-row div {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #eef2f6;
}

.stats-bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.stats-bar-row strong {
  color: var(--ink);
  font-size: .7rem;
  white-space: nowrap;
}

.stats-section h3 {
  margin: 0;
  color: #344054;
  font-size: .96rem;
}

.stats-table-wrap {
  max-height: min(48vh, 420px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

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

.stats-table th,
.stats-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

.stats-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafc;
  color: #475467;
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stats-table tr:last-child td {
  border-bottom: 0;
}

.stats-warning-list {
  display: grid;
  gap: 7px;
}

.stats-warning-list div {
  padding: 9px 10px;
  border: 1px solid #fedf89;
  border-radius: 8px;
  background: #fffaeb;
  color: #7a4b00;
  font-size: .84rem;
  font-weight: 750;
}

.toolbar {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.toolbar > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.toolbar-actions {
  display: flex;
  gap: 10px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  justify-content: flex-end;
  margin-left: auto;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr));
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.filter-bar label {
  display: grid;
  gap: 6px;
}

.filter-bar span {
  color: #475467;
  font-size: .76rem;
  font-weight: 850;
  text-transform: uppercase;
}

.data-table {
  width: 100%;
  max-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px;
  text-align: left;
  vertical-align: top;
}

.data-table th {
  background: #f8fafc;
  color: #475467;
  font-size: .78rem;
  text-transform: uppercase;
  white-space: nowrap;
}

.history-table th {
  overflow: visible;
  position: relative;
}

.data-table tr.inactive-row td {
  background: #f8fafc;
  color: #98a2b3;
}

.data-table tr.inactive-row strong,
.data-table tr.inactive-row .muted {
  color: #98a2b3;
}

.country-table td {
  vertical-align: middle;
}

.country-table tr.country-dragging td {
  opacity: .55;
}

.country-table tr.country-drop-before td {
  box-shadow: inset 0 2px 0 var(--brand);
}

.country-table tr.country-drop-after td {
  box-shadow: inset 0 -2px 0 var(--brand);
}

.country-table th:last-child,
.country-table td:last-child {
  width: 224px;
  text-align: right;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.data-table input,
.data-table select {
  min-height: 36px;
  padding: 7px 8px;
}

.data-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  accent-color: var(--brand);
}

.data-table textarea {
  min-height: 64px;
  padding: 7px 8px;
}

.carrier-table {
  table-layout: fixed;
}

.carrier-table th,
.carrier-table td {
  vertical-align: middle;
}

.carrier-table th:nth-child(1),
.carrier-table td:nth-child(1) {
  width: 22%;
}

.carrier-table th:nth-child(2),
.carrier-table td:nth-child(2) {
  width: auto;
}

.carrier-table th:nth-child(3),
.carrier-table td:nth-child(3) {
  width: 220px;
  text-align: right;
}

.carrier-table td:first-child input {
  margin: 0 auto;
}

.carrier-table textarea {
  min-height: 46px;
  max-height: 88px;
}

.carrier-actions {
  grid-area: actions;
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.carrier-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
  gap: 10px;
}

.carrier-card {
  display: grid;
  gap: 8px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.carrier-card.inactive {
  opacity: .62;
  background: #f8fafc;
}

.carrier-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.carrier-card-head > div:first-child {
  min-width: 0;
  flex: 1 1 auto;
}

.carrier-card-title {
  margin: 0 0 7px;
  font-size: .98rem;
  font-weight: 900;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.carrier-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.carrier-note {
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.carrier-section-label {
  margin: 2px 0 3px;
  color: #475467;
  font-size: .73rem;
  font-weight: 900;
  letter-spacing: .01em;
}

.carrier-editor-relations {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.card-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-left: auto;
}

.carrier-detail-row {
  background: #f8fafc;
  border-top: 1px solid var(--line);
  padding: 12px 14px 14px;
}

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

.detail-section-title {
  margin-bottom: 8px;
  color: #475467;
  font-size: .78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.detail-item {
  width: 100%;
  min-height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 7px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: inherit;
  text-align: left;
}

.detail-item strong,
.detail-item small {
  display: block;
}

.detail-item small {
  margin-top: 2px;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 900;
  white-space: nowrap;
}

.status-badge.active {
  background: #e7f6ec;
  color: #067647;
}

.status-badge.inactive {
  background: #fee4e2;
  color: var(--danger);
}

.carrier-detail-add {
  width: 100%;
  margin-top: 3px;
}

.compact-empty {
  padding: 14px;
  min-height: 50px;
}

.fuel-country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 6px;
}

.fuel-country-grid label {
  display: grid;
  gap: 4px;
  color: #475467;
  font-size: .74rem;
  line-height: 1.2;
}

.fuel-country-grid span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.carrier-metrics-fuel {
  display: grid;
  grid-template-columns: minmax(220px, 240px) minmax(0, 1fr);
  gap: 10px;
  align-items: stretch;
}

.carrier-metrics-fuel .fuel-country-grid {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

.fuel-readout-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 3px;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #475467;
  font-size: .72rem;
  line-height: 1.2;
  text-align: left;
}

button.fuel-readout-item {
  cursor: pointer;
}

button.fuel-readout-item:hover,
button.fuel-readout-item:focus-visible {
  border-color: rgba(47, 111, 131, .45);
  box-shadow: 0 4px 14px rgba(16, 24, 40, .07);
}

.fuel-readout-item strong {
  color: var(--ink);
  font-size: .8rem;
  white-space: nowrap;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: #f2f4f7;
  color: #344054;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .12s ease;
}

.icon-btn:hover,
.icon-btn:focus-visible {
  background: #e4e9ef;
  color: var(--brand-dark);
}

.icon-btn.danger {
  background: #fee4e2;
  color: var(--danger);
}

.icon-btn.danger:hover,
.icon-btn.danger:focus-visible {
  background: #fecdca;
  color: #7a271a;
}

.icon-btn.edit {
  background: var(--brand);
  color: #fff;
}

.icon-btn.edit:hover,
.icon-btn.edit:focus-visible {
  background: var(--brand-dark);
  color: #fff;
}

.icon-btn.country-drag-handle {
  cursor: grab;
  color: #475467;
}

.icon-btn.country-drag-handle:active {
  cursor: grabbing;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

.empty {
  padding: 28px;
  border: 1px dashed #b8c4d2;
  border-radius: var(--radius);
  background: #fbfcfd;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.empty-guidance {
  display: grid;
  gap: 6px;
}

.empty-guidance strong {
  color: var(--ink);
  font-size: 1rem;
}

.empty-guidance span {
  color: var(--muted);
  line-height: 1.45;
}

.empty-workflow {
  justify-items: center;
}

.empty-steps {
  max-width: 760px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
}

.empty-steps span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #344054;
  font-size: .72rem;
  font-weight: 850;
  line-height: 1.15;
}

.notice {
  margin: 0 0 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
  font-weight: 700;
}

.history-panel-header {
  align-items: center;
  gap: 14px;
  flex-wrap: nowrap;
}

.history-panel-header .panel-kicker {
  margin-top: 2px;
}

.history-panel {
  max-height: 430px;
  overflow: auto;
  padding: 12px;
}

.history-tools {
  display: contents;
}

.history-table {
  width: 100%;
  min-width: 960px;
  table-layout: fixed;
  font-size: .9rem;
}

.history-table th,
.history-table td {
  padding: 7px 6px;
  line-height: 1.25;
  vertical-align: middle;
}

.history-table th:first-child,
.history-table td:first-child {
  padding-left: 12px;
}

.history-table th:last-child,
.history-table td:last-child {
  padding-right: 12px;
}

.history-table .history-cell-number {
  text-align: center;
}

.history-table .history-head-number {
  text-align: center;
}

.history-table .history-cell-center,
.history-table th:last-child,
.history-table td:last-child {
  text-align: center;
}

.history-table td {
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-table tbody tr.history-row {
  cursor: pointer;
}

.history-table tbody tr.history-row:hover td {
  background: #f8fafc;
}

.history-table td.history-action-cell {
  overflow: visible;
  text-overflow: clip;
  white-space: nowrap;
}

.history-row-actions {
  display: inline-flex;
  justify-content: center;
  gap: 6px;
}

.history-table .history-cell-date,
.history-table .history-cell-date .history-cell-text {
  white-space: nowrap;
}

.history-table .history-cell-carrier .history-cell-text {
  max-width: 100%;
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.history-cell-text {
  display: -webkit-box;
  white-space: normal;
  overflow-wrap: anywhere;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.history-shipment-summary {
  display: inline-block;
  cursor: help;
}

.history-total-cell {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.history-table input[type="checkbox"] {
  width: 17px;
  height: 17px;
  min-height: 17px;
}

.history-table th button {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  white-space: nowrap;
}

.history-table th button .sort-arrow {
  flex: 0 0 auto;
  min-width: 9px;
  text-align: center;
}

.history-table th button[data-tip]:hover::after,
.history-table th button[data-tip]:focus-visible::after {
  display: none;
}

.compact-actions {
  display: flex;
  gap: 8px;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: flex-end;
  overflow: visible;
  max-width: 100%;
}

.compact-actions .btn,
.compact-actions .badge {
  white-space: nowrap;
}

.history-search {
  width: 270px;
  min-height: 36px;
  padding: 7px 10px;
  font-size: .95rem;
}

.history-column-menu {
  position: relative;
  flex: 0 0 auto;
}

.history-column-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 130;
  width: 230px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.history-column-popover[hidden] {
  display: none;
}

.history-column-popover label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border-radius: 7px;
  color: #344054;
  font-weight: 750;
  cursor: pointer;
}

.history-column-popover label:hover {
  background: #f3f6f9;
}

.history-column-popover input {
  width: 16px;
  height: 16px;
  min-height: 16px;
}

@media (max-width: 1180px) {
  .history-panel-header {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .compact-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .history-search {
    flex: 1 1 260px;
  }

  .carrier-detail-grid {
    grid-template-columns: 1fr;
  }
}

.admin-only {
  display: none;
}

body.admin .admin-only {
  display: inline-flex;
}

body.admin .history-column-menu.admin-only {
  display: block;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 10;
  max-width: min(420px, calc(100% - 36px));
  padding: 13px 15px;
  border-radius: var(--radius);
  background: #102a43;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: .2s ease;
  font-weight: 800;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(16, 24, 40, .42);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(860px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: var(--radius);
  box-shadow: 0 26px 70px rgba(16, 24, 40, .24);
}

.modal-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin-left: auto;
}

.modal pre {
  margin: 0;
  padding: 16px;
  background: #0f172a;
  color: #e2e8f0;
  overflow: auto;
  border-radius: 7px;
  white-space: pre-wrap;
}

.quote-detail-sum {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.quote-detail-group {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.quote-detail-group-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
}

.quote-detail-group-head > span {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 10ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.quote-detail-group-head > span strong {
  font-weight: 950;
}

.quote-detail-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(10ch, auto);
  gap: 18px;
  align-items: baseline;
  color: #475467;
  font-size: .98rem;
}

.quote-detail-row.muted-row {
  color: var(--muted);
}

.quote-detail-note {
  grid-template-columns: minmax(0, 1fr);
  color: var(--muted);
}

.quote-detail-row strong {
  color: var(--ink);
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 1rem;
  font-weight: 500;
}

.quote-detail-grand-total {
  margin-top: 4px;
  padding: 10px 12px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-weight: 950;
}

.quote-detail-grand-total span,
.quote-detail-grand-total strong {
  font-size: 1.06rem;
}

.quote-detail-grand-total strong {
  font-weight: 950;
}

.quote-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.history-note {
  margin-top: 12px;
}

.history-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: stretch;
  margin-bottom: 10px;
}

.history-detail-grid div {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.history-detail-grid span,
.history-detail-grid strong {
  display: block;
}

.history-detail-grid span {
  color: var(--muted);
  font-size: .66rem;
  font-weight: 850;
  line-height: 1.12;
  text-transform: uppercase;
}

.history-detail-grid strong {
  margin-top: 3px;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 900;
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.history-detail-grid .history-invoice-status.open {
  color: #b42318;
}

.history-detail-grid .history-invoice-status.received {
  color: #067647;
}

.history-edited-badge {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #f7b27a;
  border-radius: 999px;
  background: #fff7ed;
  color: #b54708;
  font-size: .78rem;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.history-detail-sum {
  margin-top: 0;
  gap: 6px;
  padding: 10px;
}

.history-detail-sum .quote-detail-group {
  gap: 5px;
  padding: 8px 10px;
}

.history-detail-sum .quote-detail-row {
  gap: 12px;
  font-size: .9rem;
}

.history-detail-sum .quote-detail-grand-total {
  margin-top: 2px;
  padding: 8px 10px 0;
}

.history-detail-sum .quote-detail-grand-total span,
.history-detail-sum .quote-detail-grand-total strong {
  font-size: .98rem;
}

.admin-example {
  display: grid;
  gap: 10px;
}

.admin-example div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.admin-example span {
  color: var(--muted);
  line-height: 1.45;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.inline-check {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-weight: 850;
}

.inline-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.next-step-panel {
  display: grid;
  gap: 10px;
}

.next-step-panel .btn {
  justify-content: center;
}

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

.switch-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #344054;
  font-size: .82rem;
  font-weight: 850;
  cursor: pointer;
  white-space: nowrap;
}

.switch-control em {
  display: inline-flex;
  align-items: center;
  font-style: normal;
}

.switch-control input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  width: 42px;
  height: 24px;
  position: relative;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #d0d5dd;
  transition: background .16s ease;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .22);
  transition: transform .16s ease;
}

.switch-control input:checked + .switch-track {
  background: var(--brand);
}

.switch-control input:checked + .switch-track::after {
  transform: translateX(18px);
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .brand {
    gap: 14px;
  }

  .top-actions {
    justify-content: flex-start;
  }

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

  .toolbar {
    align-items: flex-start;
  }

  .toolbar > div:first-child {
    flex: 1 1 auto;
  }

  .toolbar-actions {
    justify-content: flex-end;
  }

  .quote-card {
    grid-template-columns: 1fr 1fr;
  }

  .summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 16px, 1480px);
    padding-top: 14px;
  }

  .topbar,
  .account-actions,
  .form-grid,
  .quote-card,
  .history-detail-grid,
  .summary-grid,
  .stats-chart-grid {
    grid-template-columns: 1fr;
  }

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

  .admin-helper {
    align-items: stretch;
    flex-direction: column;
    margin: 12px 14px 14px;
  }

  .top-actions {
    justify-content: stretch;
  }

  .top-actions .btn {
    flex: 1 1 calc(50% - 6px);
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .brand-mark {
    width: min(360px, 100%);
  }

  .panel-header,
  .panel-body,
  .admin-section {
    padding: 14px;
  }

  .tabs {
    padding: 8px 14px;
    flex-wrap: wrap;
    overflow-x: visible;
  }

  .tab {
    flex: 1 1 calc(50% - 6px);
    min-height: 34px;
    padding: 0 10px;
  }

  .tabs .settings-logout {
    margin-left: auto;
  }

  .admin-lock {
    align-items: stretch;
    flex-direction: column;
    padding: 16px 14px;
  }

  .top-actions .btn {
    width: 100%;
  }

  .toolbar-actions .btn,
  .toolbar-actions label.btn {
    width: auto;
  }

  .app-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .app-footer nav {
    justify-content: flex-start;
  }

  .panel-header,
  .toolbar {
    align-items: flex-start;
  }

  .compact-actions {
    width: auto;
    justify-content: flex-end;
    margin-left: auto;
  }

  .toolbar,
  .toolbar-actions {
    width: auto;
  }

  .toolbar-actions {
    justify-content: flex-end;
  }

  .filter-bar {
    padding: 10px;
  }

  .admin-section .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .fuel-country-grid,
  .carrier-metrics-fuel .fuel-country-grid {
    grid-template-columns: 1fr;
  }

  .carrier-detail-row {
    padding: 10px;
  }

  .carrier-table {
    min-width: 820px;
    table-layout: auto;
  }

  .country-table {
    min-width: 520px;
  }

  .zone-card-head,
  .service-card-head,
  .carrier-card-head {
    align-items: flex-start;
    gap: 10px;
  }

  .zone-card-title,
  .service-card-title,
  .carrier-card-title {
    font-size: 1rem;
  }

  .card-actions {
    flex: 0 0 auto;
  }

  .zone-matrix-actions {
    justify-content: stretch;
  }

  .matrix-weight-field {
    width: 100%;
  }

  .matrix-weight-field input {
    flex: 1 1 auto;
    width: auto;
  }

  .zone-matrix-actions .btn {
    flex: 1 1 160px;
  }

  .history-search {
    width: 100%;
    flex: 1 1 100%;
  }

  .history-panel {
    padding: 8px;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 1.35rem;
  }

  .subtitle,
  .panel-kicker {
    font-size: .84rem;
  }

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

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

  .segmented button:last-child {
    border-bottom: 0;
  }

  .extra-card-head {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 5px;
  }

  .top-actions .btn,
  .tab {
    flex-basis: 100%;
  }

  .summary-grid {
    gap: 8px;
  }

  .metric {
    min-height: auto;
    padding: 12px;
  }

  .quote-card {
    padding: 12px;
    gap: 10px;
  }

  .price {
    font-size: 1.32rem;
  }

  .admin-helper {
    margin: 12px 10px 10px;
    padding: 12px;
  }

  .admin-section {
    padding: 10px;
  }

  .filter-bar {
    gap: 8px;
    margin-bottom: 10px;
  }

  .zone-list,
  .service-list {
    gap: 8px;
  }

  .zone-card,
  .service-card {
    padding: 12px;
  }

  .zone-card-head,
  .service-card-head,
  .carrier-card-head,
  .detail-item {
    align-items: flex-start;
  }

  .card-actions,
  .carrier-actions {
    justify-content: flex-end;
  }

  .zone-matrix-table {
    min-width: calc(118px + (var(--zone-matrix-zone-count, 3) * 78px));
  }

  .zone-matrix-table th,
  .zone-matrix-table td {
    min-width: 78px;
    padding: 3px;
  }

  .zone-matrix-table th:first-child {
    width: 118px;
    min-width: 118px;
    font-size: .86rem;
  }

  .zone-matrix-table input,
  .zone-matrix-table textarea {
    font-size: .76rem;
  }

  .matrix-row-label {
    gap: 4px;
  }

  .matrix-weight-popup-actions {
    grid-template-columns: 1fr;
  }

  .extra-price-list {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .extra-price-pill {
    min-width: 0;
    max-width: none;
  }

  .tier-row {
    grid-template-columns: 1fr;
  }

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

  .tier-row.tier-head {
    display: none;
  }

  .modal-backdrop {
    padding: 8px;
  }

  .modal {
    max-height: calc(100dvh - 16px);
  }
}
