: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;
}

/* Mobile settings must never widen the document. Only the actual zone-price
   matrix is allowed to scroll horizontally inside its own viewport. */
@media (max-width: 720px) {
  .main-stack {
    min-height: 0;
  }

  .history-section {
    flex: 0 0 auto;
  }

  .history-section .history-panel {
    min-height: 240px;
  }

  html,
  body {
    inline-size: 100% !important;
    max-width: 100% !important;
    max-inline-size: 100vw !important;
    overflow-x: clip !important;
  }

  .admin-panel,
  .admin-panel > .tabs,
  .admin-section,
  .admin-section.active,
  .carrier-list,
  .zone-list,
  .service-list,
  .carrier-list > *,
  .zone-list > *,
  .service-list > * {
    box-sizing: border-box !important;
    min-inline-size: 0 !important;
    max-inline-size: 100% !important;
  }

  .admin-panel,
  .admin-panel > .tabs,
  .admin-section,
  .admin-section.active,
  .carrier-list,
  .zone-list,
  .service-list {
    inline-size: 100% !important;
    overflow-x: hidden !important;
  }

  .admin-panel {
    inline-size: min(100%, 100vw) !important;
    max-inline-size: 100vw !important;
    margin-inline: 0 !important;
  }

  main,
  .app-shell,
  .app-main,
  .page-shell {
    min-inline-size: 0 !important;
    max-inline-size: 100vw !important;
    overflow-x: clip !important;
  }

  .carrier-list,
  .zone-list,
  .service-list {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .carrier-card,
  .zone-card,
  .service-card {
    inline-size: 100% !important;
    min-inline-size: 0 !important;
    max-inline-size: 100% !important;
    overflow-x: hidden !important;
  }

  .zone-matrix-wrap {
    overflow-x: auto !important;
    overflow-y: hidden !important;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

.app-shell {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

html.modal-open {
  overflow: hidden;
  overscroll-behavior: none;
}

body.modal-open {
  position: fixed;
  inset-inline: 0;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.auth-gate {
  display: none;
}

html.auth-pending body {
  background: #eef4f6;
}

html.auth-pending .app-shell,
html.auth-pending .modal-backdrop,
html.auth-pending .toast {
  display: none !important;
}

html.auth-pending .auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.auth-gate section {
  width: min(420px, 100%);
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-gate img {
  width: min(280px, 82%);
  margin-bottom: 8px;
}

.auth-gate strong {
  font-size: 1.1rem;
}

.auth-gate span {
  color: var(--muted);
}

.auth-gate button {
  margin-top: 8px;
}

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));
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  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;
}

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

.workspace-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: min(44vw, 560px);
  padding: 5px 12px;
  border: 1px solid #b7d9c6;
  border-radius: 999px;
  background: #f2fbf6;
  color: #156d3f;
  font-size: clamp(.9rem, 1.15vw, 1.15rem);
  font-weight: 800;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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 {
  border: 1px solid #f3c7c2;
  background: #fff;
  color: var(--danger);
}

.btn-danger:hover,
.btn-danger:focus-visible {
  border-color: #e7aaa3;
  background: #fff7f6;
  color: #912018;
}

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

.btn.btn-ghost:hover,
.btn.btn-ghost:focus-visible,
label.btn.btn-ghost:hover,
label.btn.btn-ghost:focus-visible {
  border-color: #b8c6d3;
  background: #f3f7f9;
  color: var(--brand-dark);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .08);
}

.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.is-disabled,
.btn.is-disabled:hover,
.btn.is-disabled:focus-visible {
  border-color: #d0d5dd;
  background: #e4e7ec;
  color: #667085;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

.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;
}

.subscription-banner.archive {
  border-color: #9fc9d3;
  background: #eef8fa;
  color: #175f70;
}

.subscription-banner.archive span {
  color: #355f69;
}

.subscription-banner .archive-owner-note {
  max-width: 270px;
  text-align: right;
  font-weight: 700;
}

.workspace-start-notice {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid #b7d9c6;
  border-radius: 8px;
  background: #f2fbf6;
}

.workspace-start-notice strong {
  color: var(--ink);
}

.workspace-start-notice span {
  color: #475467;
  font-weight: 650;
  line-height: 1.45;
}

.workspace-start-actions {
  margin-top: 16px;
}

.confirmed-checkout-form {
  grid-template-columns: minmax(0, 1fr);
}

.confirmation-success {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 7px;
  padding: 7px 11px;
  border: 1px solid #a7d9ba;
  border-radius: 999px;
  background: #f0faf4;
  color: #137a45;
  font-size: .84rem;
  font-weight: 850;
}

.confirmation-success span {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border-radius: 50%;
  background: #137a45;
  color: #fff;
  font-size: .72rem;
  line-height: 1;
}

.confirmed-checkout-actions {
  grid-column: 1 / -1;
  width: 100%;
}

.confirmed-checkout-actions .btn {
  width: 100%;
}

.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,
.footer-brand-link {
  color: #fff;
  text-decoration: none;
}

.footer-brand-link {
  width: fit-content;
  font-weight: 700;
}

.footer-brand-link:hover {
  color: #eaf4ff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.app-footer .btn {
  min-height: 40px;
  padding: 8px 13px;
  background: rgba(255, 255, 255, .12);
  border: 1px solid rgba(255, 255, 255, .62);
  border-radius: 8px;
  color: #fff;
  font-weight: 750;
  text-decoration: none;
  text-underline-offset: 0;
}

.app-footer .btn:hover {
  background: rgba(255, 255, 255, .22);
  border-color: #fff;
  color: #fff;
}

.footer-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.footer-action-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.account-settings-section {
  margin-top: 22px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.account-settings-section-single {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
}

.account-settings-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.account-settings-section-head h3,
.account-settings-section-head p {
  margin: 0;
}

.account-settings-section-head h3 {
  color: var(--ink);
}

.account-settings-section-head p {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 750;
}

.account-settings-subsection-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 22px 0 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.account-settings-subsection-head h4,
.account-settings-subsection-head p {
  margin: 0;
}

.account-settings-subsection-head h4 {
  color: var(--ink);
}

.account-settings-subsection-head p {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 750;
}

.account-team-note {
  display: grid;
  gap: 3px;
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid #b7d9c6;
  border-radius: 8px;
  background: #f2fbf6;
}

.account-team-note strong {
  color: var(--ink);
}

.account-team-note span {
  color: #475467;
  font-size: .84rem;
  font-weight: 750;
  line-height: 1.35;
}

.account-email-change-note,
.email-change-confirmation {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 13px 14px;
  border: 1px solid #e4c36a;
  border-radius: 8px;
  background: #fff9e8;
}

.account-email-change-note strong,
.email-change-confirmation-head strong {
  color: var(--ink);
}

.account-email-change-note span,
.email-change-confirmation-head span,
.email-change-confirmation p {
  margin: 0;
  color: #475467;
  font-size: .88rem;
  font-weight: 700;
  line-height: 1.45;
}

.email-change-confirmation.complete {
  border-color: #9ed6b7;
  background: #f2fbf6;
}

.email-change-confirmation-head {
  display: grid;
  gap: 4px;
}

.email-change-recipients {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.email-change-recipients > div {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.email-change-recipients span {
  color: var(--muted);
  font-size: .75rem;
  font-weight: 800;
}

.email-change-recipients strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: .9rem;
}

@media (max-width: 620px) {
  .email-change-recipients {
    grid-template-columns: 1fr;
  }
}

.account-team-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.account-workspace-tabs {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.account-tab-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f6;
}

.account-tab-switch button {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: .88rem;
  font-weight: 900;
  cursor: pointer;
}

.account-tab-switch button[aria-selected="true"] {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 20px rgba(47, 111, 131, .16);
}

.account-workspace-tabs .account-team-panel,
.account-workspace-tabs .account-activity-panel {
  margin-bottom: 0;
}

.account-activity-section {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.account-activity-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.account-activity-heading h3 {
  margin: 0;
  color: var(--ink);
}

.account-activity-heading span {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 800;
}

.account-workspace-tabs .account-activity-panel {
  max-height: min(55vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
}

.account-activity-panel {
  display: grid;
  gap: 0;
  margin-bottom: 16px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.account-team-head,
.team-block-title,
.team-invite-result {
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-team-head,
.team-block-title {
  justify-content: space-between;
}

.account-team-head h3,
.team-block-title h4 {
  margin: 0;
  color: var(--ink);
}

.account-team-head p,
.team-block-title span,
.team-member-row span,
.team-empty-note {
  margin: 0;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 750;
}

.team-role-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #eaf3f6;
  color: var(--primary);
  font-size: .78rem;
  font-weight: 900;
  white-space: nowrap;
}

.team-name-pill {
  border: 1px solid #9ed6b7;
  background: #e8f8ee;
  color: #10713f;
  max-width: min(280px, 42vw);
  overflow: hidden;
  text-overflow: ellipsis;
}

button.team-name-pill {
  cursor: pointer;
  font: inherit;
  font-weight: 900;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

button.team-name-pill:hover {
  border-color: #64b48a;
  background: #d9f3e4;
  transform: translateY(-1px);
}

.team-invite-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 2.2fr) auto;
  align-items: end;
  gap: 10px;
}

.team-block {
  display: grid;
  gap: 9px;
}

.team-invite-open-btn {
  justify-self: stretch;
  width: 100%;
  margin-top: 2px;
}

.activity-log-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-log-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) max-content;
  gap: 10px;
  align-items: center;
  min-height: 34px;
  padding: 6px 0;
  border-top: 1px solid #edf1f6;
}

.activity-log-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.activity-log-row:last-child {
  padding-bottom: 0;
}

.activity-log-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(47, 111, 131, .12);
}

.activity-log-dot.activity-dot-danger {
  background: #d92d20;
  box-shadow: 0 0 0 4px rgba(217, 45, 32, .12);
}

.activity-log-dot.activity-dot-success {
  background: #198754;
  box-shadow: 0 0 0 4px rgba(25, 135, 84, .12);
}

.activity-log-dot.activity-dot-team {
  background: #d99000;
  box-shadow: 0 0 0 4px rgba(217, 144, 0, .14);
}

.activity-log-dot.activity-dot-edit {
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(47, 111, 131, .12);
}

.activity-log-row strong {
  display: block;
  color: var(--ink);
  font-size: .86rem;
  font-weight: 400;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.activity-log-row span:not(.activity-log-dot),
.activity-log-empty {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
}

.activity-log-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  min-width: max-content;
  text-align: right;
}

.activity-log-actor {
  color: var(--ink);
  font-size: .72rem;
  font-weight: 400;
}

.activity-log-time {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 400;
}

.activity-log-row span.activity-log-actor,
.activity-log-row span.activity-log-time {
  font-weight: 400 !important;
}

.activity-log-empty {
  padding: 8px 0 2px;
}

.team-member-list {
  display: grid;
  gap: 8px;
}

.team-member-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 14px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.team-member-row-button {
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.team-member-row-button:hover,
.team-member-row-button:focus-visible {
  border-color: rgba(47, 111, 131, .45);
  background: #fff;
  box-shadow: 0 4px 14px rgba(16, 24, 40, .09);
  outline: none;
}

.team-member-row > div:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.team-member-person {
  display: grid !important;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  column-gap: 0;
}

.team-member-person-button {
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.team-member-person-button:hover .team-member-avatar,
.team-member-person-button:focus-visible .team-member-avatar {
  background: #d4e9ee;
}

.team-member-person > div {
  display: grid;
  gap: 2px;
  min-width: 0;
  margin-left: 18px !important;
}

.team-member-person > div > span {
  font-weight: 400;
}

.team-member-avatar {
  display: inline-flex;
  flex: 0 0 38px;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #e5f1f4;
  color: var(--primary);
  font-size: .78rem;
  font-weight: 850;
  letter-spacing: .02em;
}

.team-member-row strong {
  overflow-wrap: anywhere;
  color: var(--ink);
}

.team-member-row.pending {
  background: #fbfcfd;
}

.team-member-row.pending > div > span {
  font-weight: 400;
}

.team-member-actions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: max-content;
  align-items: center;
  justify-content: end;
  gap: 10px;
}

.team-member-actions .compact-select {
  width: 160px;
}

.team-member-role-button {
  border: 1px solid #d8dee6;
  background: #eef2f6;
  color: #475467;
  font-family: inherit;
  cursor: default;
  pointer-events: none;
}

.team-member-dialog,
.team-member-activity,
.team-member-manage-form {
  display: grid;
  gap: 14px;
}

.team-member-dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.team-member-dialog-heading h3 {
  margin: 0;
  color: var(--ink);
}

.team-member-dialog-heading span {
  color: var(--muted);
  font-size: .84rem;
  font-weight: 800;
}

.team-member-activity .account-activity-panel {
  max-height: min(42vh, 380px);
  margin: 0;
  overflow-y: auto;
}

.team-member-manage-form {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.team-member-manage-form .field {
  max-width: 360px;
}

.team-member-dialog-actions {
  margin-top: 0;
}

.compact-select {
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid #cfd7e2;
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  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;
  cursor: pointer;
}

.btn-small {
  min-height: 42px;
  padding: 8px 12px;
  font-size: .86rem;
}

.team-invite-form {
  grid-template-columns: minmax(0, 1fr) 160px max-content;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.team-invite-form input,
.team-invite-form .compact-select,
.team-invite-form .btn {
  min-height: 42px;
}

.team-invite-form .btn {
  min-width: 132px;
}

.team-member-actions .btn {
  min-width: 132px;
}

.team-invite-result {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 8px 10px;
}

.team-invite-link-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: .84rem;
  font-weight: 750;
}

.team-invite-result input {
  width: 100%;
}

.team-invite-dialog-form > .full {
  grid-column: 1 / -1;
}

.team-invite-dialog-form .team-invite-result,
.team-invite-link-dialog .team-invite-result {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7fbfc;
}

.team-invite-link-dialog {
  display: grid;
  gap: 14px;
}

.team-invite-delivery-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 800;
}

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

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

.subscription-choice-card h3 {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 1.05rem;
}

.subscription-choice-card p {
  margin: 0;
  color: #667085;
  font-size: .84rem;
  font-weight: 750;
  line-height: 1.35;
}

.subscription-choice-card .btn {
  width: 100%;
  justify-content: center;
}

.subscription-business-check {
  grid-column: 1 / -1;
}

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

.layout > section:first-child {
  align-self: start;
}

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

.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;
}

.settings-view-label {
  display: block;
  margin-bottom: 3px;
  color: var(--brand);
  font-size: .72rem;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.settings-view-label + .panel-title {
  font-size: 1.32rem;
  line-height: 1.2;
}

.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;
  cursor: pointer;
  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);
}

.field.has-character-limit-error input,
.field.has-character-limit-error textarea,
input.character-limit-error,
textarea.character-limit-error {
  border-color: #d92d20;
  background: #fff7f6;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, .1);
}

.character-limit-message {
  display: block;
  margin-top: -2px;
  color: #667085;
  font-size: .75rem;
  line-height: 1.3;
  text-align: right;
}

.character-limit-message.is-error {
  color: #b42318;
  font-weight: 750;
}

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;
  grid-auto-rows: max-content;
  align-items: start;
  gap: 7px;
  max-height: min(54vh, 430px);
  overflow: auto;
  padding-right: 0;
  scrollbar-gutter: stable;
}

.extras-grid.readonly {
  opacity: .62;
  pointer-events: none;
}

.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;
  height: auto;
  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;
}

.subscription-business-check {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 12px 14px;
  background: #fbfcfd;
  color: #344054;
  font-weight: 850;
  line-height: 1.3;
}

.subscription-business-check:has(input:checked) {
  box-shadow: none;
}

.subscription-business-check.error {
  border-color: #f0b4b4;
  background: #fff4f4;
  color: var(--red);
  box-shadow: inset 3px 0 0 var(--red);
}

.subscription-business-check input {
  position: static;
  flex: 0 0 auto;
  width: 22px;
  min-height: 22px;
  height: 22px;
  opacity: 1;
  pointer-events: auto;
  accent-color: var(--brand);
}

.extra-card-body {
  min-width: 0;
  min-height: 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;
  min-height: 0;
}

.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 {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  overscroll-behavior-x: contain;
  contain: inline-size;
  -webkit-overflow-scrolling: touch;
  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-row.has-error {
  background: #fff7f6;
}

.tier-row [aria-invalid="true"] {
  border-color: #d92d20;
  box-shadow: 0 0 0 2px rgba(217, 45, 32, .08);
}

.tier-validation-message {
  margin-top: 8px;
  padding: 9px 11px;
  border: 1px solid #f3b7b2;
  border-radius: 7px;
  background: #fff7f6;
  color: #b42318;
  font-weight: 750;
}

.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: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  /* The content itself determines the page height. A viewport-based minimum
     here pushed the footer below the fold even when the visible panels fit. */
  min-height: 0;
}

.history-section {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  min-height: 0;
}

.history-section .history-panel {
  flex: 0 0 auto;
  min-height: 0;
  max-height: none;
  overflow: visible;
}

.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-lock-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
}

.admin-lock-actions .btn {
  flex: 0 0 auto;
}

.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;
}

.market-options {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.excluded-carriers {
  display: grid;
  gap: 12px;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.excluded-carriers[hidden] {
  display: none;
}

.excluded-carriers-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.excluded-carriers-head h3 {
  margin: 0;
  font-size: 1.02rem;
}

.excluded-carriers-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.4;
}

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

.excluded-carrier-row {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}

.excluded-carrier-row > strong {
  color: var(--ink);
}

.excluded-carrier-reasons {
  display: grid;
  gap: 6px;
}

.excluded-carrier-reason {
  display: grid;
  gap: 2px;
  padding-left: 9px;
  border-left: 3px solid #d9a441;
}

.excluded-carrier-reason b {
  color: #7a4b00;
  font-size: .8rem;
}

.excluded-carrier-reason small {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

.market-options[hidden] {
  display: none;
}

.market-options-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}

.market-options-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.market-options-title-row h3 {
  margin: 0;
  font-size: 1.08rem;
}

.market-options-head p,
.market-options-note,
.market-option-card p {
  color: var(--muted);
}

.market-options-head p {
  margin: 5px 0 0;
  line-height: 1.45;
}

.market-options-status {
  flex: 0 0 auto;
  padding: 7px 9px;
  border-radius: 6px;
  background: #eef2f6;
  color: #475467;
  font-size: .76rem;
  font-weight: 850;
  white-space: nowrap;
}

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

.market-option-card {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
}

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

.market-option-card h4 {
  margin: 0;
  font-size: 1rem;
}

.market-option-card-head > div > span,
.market-option-service {
  color: #475467;
  font-size: .82rem;
  font-weight: 750;
}

.market-option-card p {
  margin: 0;
  line-height: 1.42;
}

.market-option-card .btn {
  width: 100%;
}

.market-options-note {
  margin: 10px 0 0;
  font-size: .78rem;
  line-height: 1.45;
}

.market-options-empty {
  grid-column: 1 / -1;
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px dashed #b9c7d5;
  border-radius: var(--radius);
  color: var(--muted);
}

.market-options-empty strong {
  color: var(--ink);
}

.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;
}

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

.admin-panel-tab-list {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.panel-view-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 7px;
  margin-left: auto;
}

.panel-switch-btn {
  min-height: 38px;
  padding-inline: 12px;
  font-size: .82rem;
}

.panel-export-btn {
  min-height: 38px;
  padding-inline: 11px;
  font-size: .82rem;
}

.panel-export-btn svg,
.panel-switch-btn svg {
  width: 17px;
  height: 17px;
}

.admin-panel > .tabs .tab {
  min-height: 38px;
  padding: 0 13px;
  font-size: .86rem;
}

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

.admin-section {
  display: none;
  min-width: 0;
  padding: 18px;
  overflow-x: hidden;
  contain: inline-size;
}

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

.stats-panel-tabs {
  align-items: center;
  overflow: visible;
}

.stats-panel-tab-list {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: wrap;
  gap: 7px;
}

.stats-panel-tab-list .tab {
  min-height: 38px;
  padding: 0 13px;
  font-size: .86rem;
}

.stats-panel-tabs .settings-logout {
  margin-left: 0;
}

.stats-panel-content {
  padding: 20px;
}

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

.stats-view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.stats-view-header > div {
  min-width: 0;
}

.stats-view-header span {
  display: block;
  margin-bottom: 3px;
  color: var(--brand);
  font-size: .72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stats-view-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.32rem;
  line-height: 1.2;
}

.stats-view-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: .9rem;
}

.stats-view-header > strong {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid #abd9c2;
  border-radius: 999px;
  background: #eefaf3;
  color: #067647;
  font-size: .78rem;
}

.stats-filter-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.stats-filter-bar.has-package {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.stats-filter-bar select {
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  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(4, minmax(0, 1fr));
  gap: 10px;
}

.stats-card {
  display: grid;
  align-content: start;
  gap: 3px;
  min-height: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .045);
}

.stats-card span {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 900;
  line-height: 1.2;
}

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

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

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

.stats-primary-grid,
.stats-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 12px;
}

.stats-primary-grid {
  grid-template-columns: minmax(0, 1.7fr) minmax(270px, .75fr);
  align-items: stretch;
}

.stats-primary-grid.equal {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-primary-grid > .stats-visual-card {
  height: 100%;
}

.stats-primary-grid > .stats-visual-card > .stats-chart svg {
  max-height: none;
}

.stats-visual-card {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 12px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.stats-visual-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: .98rem;
}

.stats-visual-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: .78rem;
}

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

.stats-visual-card > .stats-chart,
.stats-visual-card > .stats-bars {
  padding: 0;
  border: 0;
  border-radius: 0;
}

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

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

.stats-chart .chart-grid-line {
  stroke: #e9eef2;
  stroke-width: 1;
}

.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: 12px;
  font-weight: 800;
}

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

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

.stats-chart .chart-point-value {
  fill: var(--brand-dark);
  font-size: 12px;
  font-weight: 900;
  paint-order: stroke;
  stroke: #fff;
  stroke-width: 4px;
  stroke-linejoin: round;
}

.stats-chart-expandable {
  cursor: zoom-in;
  transition: background .16s ease, box-shadow .16s ease;
}

.stats-chart-expandable:hover {
  background: #f8fbfc;
  box-shadow: 0 0 0 2px rgba(47, 111, 131, .12);
}

.stats-chart-expandable:focus-visible {
  outline: 3px solid rgba(47, 111, 131, .28);
  outline-offset: 3px;
}

.stats-chart-modal {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.stats-chart-modal .stats-chart {
  min-width: 700px;
  padding: 14px;
}

.stats-chart-modal .stats-chart svg {
  max-height: none;
}

.stats-bars {
  display: grid;
  align-content: start;
  gap: 10px;
}

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

.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: 7px;
  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: .76rem;
  white-space: nowrap;
}

.stats-donut-layout {
  display: grid;
  grid-template-columns: minmax(128px, .8fr) minmax(160px, 250px);
  align-items: center;
  justify-content: center;
  gap: 16px;
  min-width: 0;
}

.stats-donut {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 180px);
  aspect-ratio: 1;
  margin: auto;
}

.stats-donut-svg {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.stats-donut-track,
.stats-donut-segment {
  fill: none;
  stroke-width: 24;
}

.stats-donut-track {
  stroke: #eef2f6;
}

.stats-donut > div {
  z-index: 1;
  grid-area: 1 / 1;
  display: grid;
  gap: 2px;
  text-align: center;
}

.stats-donut strong {
  color: var(--ink);
  font-size: 1.35rem;
}

.stats-donut span {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 800;
}

.stats-donut-legend {
  display: grid;
  gap: 9px;
  width: 100%;
  max-width: 250px;
  min-width: 0;
  padding-inline: 4px;
}

.stats-donut-legend > div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--muted);
  font-size: .76rem;
}

.stats-donut-legend span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stats-donut-legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--legend-color);
}

.stats-donut-legend strong {
  color: var(--ink);
  min-width: 2ch;
  text-align: right;
}

.stats-invoice-open-total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .76rem;
  font-weight: 800;
}

.stats-invoice-open-total strong {
  color: var(--ink);
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stats-primary-grid:not(.equal) > .stats-visual-card:last-child .stats-donut-layout {
  grid-template-columns: 1fr;
  gap: 10px;
}

.stats-primary-grid:not(.equal) > .stats-visual-card:last-child .stats-donut {
  width: min(150px, 100%);
}

.stats-primary-grid:not(.equal) > .stats-visual-card:last-child .stats-donut-legend {
  justify-self: center;
  max-width: 220px;
}

.stats-quality-column {
  display: grid;
  align-content: start;
  min-width: 0;
  gap: 12px;
}

.stats-quality-column:last-child > .stats-visual-card:last-child .stats-donut-layout {
  grid-template-columns: minmax(120px, 150px) minmax(150px, 220px);
  justify-content: start;
  gap: 14px;
}

.stats-quality-column:last-child > .stats-visual-card:last-child .stats-donut {
  width: min(145px, 100%);
  margin: 0 auto;
}

.stats-insight-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.stats-insight {
  min-width: 0;
  padding: 12px;
  border-left: 3px solid var(--brand);
  border-radius: 0 7px 7px 0;
  background: #f4f9fa;
}

.stats-insight span {
  display: block;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 850;
}

.stats-insight strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-size: .9rem;
  overflow-wrap: anywhere;
}

.stats-insight p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .73rem;
  line-height: 1.35;
}

.stats-quality {
  display: inline-flex;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 850;
}

.stats-quality.good {
  background: #e7f6ec;
  color: #067647;
}

.stats-quality.warning {
  background: #fff4e5;
  color: #9a4c00;
}

.stats-success-message {
  padding: 12px;
  border: 1px solid #abd9c2;
  border-radius: 8px;
  background: #eefaf3;
  color: #067647;
  font-weight: 800;
}

.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;
}

.admin-section .toolbar-actions .btn {
  min-height: 38px;
  font-size: .86rem;
  font-weight: 850;
}

.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: 8px;
  background: #f8fafc;
}

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

.filter-bar span {
  color: inherit;
  font: inherit;
  text-transform: none;
}

.filter-bar select {
  min-height: 38px;
  padding-top: 7px;
  padding-bottom: 7px;
  color: var(--ink);
  font-weight: 750;
}

.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;
}

.history-section .history-table thead,
.history-modal-content .history-table thead {
  position: sticky;
  top: 0;
  z-index: 4;
}

.history-section .history-table th,
.history-modal-content .history-table th {
  position: sticky;
  top: 0;
  z-index: 5;
  background: #f8fafc;
  box-shadow: inset 0 -1px 0 var(--line);
}

.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;
}

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

.market-options-setting > div {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.market-options-setting strong {
  font-size: .9rem;
  line-height: 1.25;
}

.market-options-setting span {
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

.market-options-setting .switch-control {
  flex: 0 0 auto;
}

.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);
}

.carrier-editor-relations[hidden] {
  display: none;
}

.carrier-relations-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
}

.carrier-relations-toggle-icon {
  display: inline-flex;
  width: 16px;
  height: 16px;
  transition: transform .18s ease;
}

.carrier-relations-toggle-icon svg {
  width: 16px;
  height: 16px;
}

.carrier-relations-toggle[aria-expanded="true"] .carrier-relations-toggle-icon {
  transform: rotate(180deg);
}

.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;
}

.fuel-editor-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.fuel-country-edit {
  min-width: 0;
  display: grid;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.fuel-country-edit > span {
  color: #475467;
  font-size: .74rem;
  font-weight: 850;
}

.fuel-country-edit .switch-control {
  justify-content: flex-start;
}

.fuel-current-card {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 7px 10px;
  border: 1px solid #b7d9c6;
  border-radius: 8px;
  background: #f2fbf6;
}

.fuel-current-card > div {
  min-width: 0;
  text-align: left;
}

.fuel-current-card strong,
.fuel-current-card span,
.fuel-current-card small {
  display: block;
}

.fuel-current-card strong {
  font-size: .84rem;
  line-height: 1.15;
}

.fuel-current-actions {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
}

.fuel-fetch-control {
  display: grid;
  justify-items: center;
  gap: 2px;
}

.fuel-current-card .fuel-fetch-control small {
  margin: 0;
  color: #667085;
  font-size: .62rem;
  font-weight: 750;
  line-height: 1.1;
  white-space: nowrap;
}

.fuel-current-actions .info-dot {
  margin-left: 0;
  color: transparent;
}

.fuel-current-actions .info-dot::before {
  content: "i";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #2f6f83;
  font-size: .7rem;
  font-weight: 900;
  line-height: 1;
}

.fuel-current-card span {
  margin-top: 1px;
  color: #2f6b49;
  font-size: .74rem;
  line-height: 1.15;
}

.fuel-current-card small {
  margin-top: 1px;
  color: #667085;
  font-size: .65rem;
  font-weight: 750;
  line-height: 1.15;
}

.fuel-current-card .btn {
  flex: 0 0 auto;
  min-height: 36px;
  padding: 7px 12px;
  font-size: .82rem;
}

.fuel-tier-table {
  display: grid;
  gap: 4px;
}

.fuel-tier-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.fuel-tier-row div {
  min-width: 0;
}

.fuel-tier-row input {
  min-width: 0;
  min-height: 32px;
  padding: 5px 8px;
  font-size: .82rem;
}

.fuel-tier-add {
  justify-self: end;
  margin-top: 6px;
  min-height: 40px;
  padding: 0 12px;
  font-size: .84rem;
}

.fuel-result-note {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: #475467;
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.2;
}

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

.fuel-result-note span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fuel-result-note small {
  color: #667085;
  font-size: .68rem;
  font-weight: 750;
  white-space: nowrap;
}

.fuel-result-note small.fuel-status-ok {
  color: #047857;
}

.fuel-result-note small.fuel-status-danger {
  color: #b42318;
}

.fuel-result-note small.fuel-status-warning {
  color: #b54708;
}

.fuel-result-note .btn {
  min-height: 30px;
  padding: 5px 10px;
  font-size: .72rem;
}

.fuel-settings-summary {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.fuel-settings-summary > div {
  display: grid;
  gap: 3px;
}

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

.fuel-settings-summary span {
  color: #667085;
  font-size: .84rem;
  font-weight: 750;
}

.fuel-table-list {
  display: grid;
  gap: 10px;
}

.fuel-table-list + .fuel-tier-add {
  margin-top: 6px;
}

.modal:has(#fuelTableEditorPopup) {
  position: relative;
}

.modal:has(#fuelTableEditorPopup) > .panel-header,
.modal:has(#fuelTableEditorPopup) > .panel-body {
  pointer-events: none;
}

.fuel-table-editor-popup-backdrop {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  min-width: 0;
  padding: 14px;
  pointer-events: auto;
  background: rgba(16, 24, 40, .42);
}

.fuel-table-editor-popup {
  display: flex;
  flex-direction: column;
  width: min(760px, 100%);
  max-height: 100%;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(16, 24, 40, .24);
}

.fuel-table-editor-popup-head {
  flex: 0 0 auto;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.fuel-table-editor-popup-head h3,
.fuel-table-editor-popup-head p {
  margin: 0;
}

.fuel-table-editor-popup-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: .82rem;
}

.fuel-table-editor-popup-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 12px;
}

.fuel-table-editor-popup-body > .fuel-table-body {
  display: grid;
  gap: 8px;
  padding: 0;
  border: 0;
}

.fuel-table-editor-popup-actions {
  flex: 0 0 auto;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.fuel-table-editor-popup-actions svg {
  width: 17px;
  height: 17px;
}

#carrierFuelTablesForm .field.full:has(.fuel-table-list) {
  gap: 6px;
}

#carrierFuelTablesForm .field.full:has(.fuel-table-list) > label {
  font-size: .82rem;
  line-height: 1.2;
}

.fuel-table-card {
  display: grid;
  gap: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  overflow: hidden;
}

.fuel-table-card.open {
  background: #fff;
}

.fuel-table-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.fuel-table-summary-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  min-height: 48px;
  padding: 9px 12px;
  border: 0;
  border-radius: 0;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
}

.fuel-table-summary-toggle:hover {
  background: #eef5f7;
}

.fuel-table-chevron {
  color: var(--primary);
  font-size: 1rem;
  font-weight: 950;
  transition: transform .15s ease;
}

.fuel-table-card.open .fuel-table-chevron {
  transform: rotate(90deg);
}

.fuel-table-summary-toggle span:last-of-type {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.fuel-table-summary-toggle strong,
.fuel-table-summary-toggle small,
.fuel-table-summary-toggle em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fuel-table-summary-toggle strong {
  font-size: .84rem;
  font-weight: 900;
}

.fuel-table-summary-toggle small {
  color: #667085;
  font-size: .68rem;
  font-weight: 750;
}

.fuel-table-summary-toggle em {
  color: #2f6f83;
  font-size: .72rem;
  font-style: normal;
  font-weight: 850;
}

.fuel-table-body {
  display: grid;
  gap: 7px;
  padding: 12px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.fuel-table-body[hidden] {
  display: none;
}

.fuel-table-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.fuel-table-head input {
  min-height: 34px;
  padding: 6px 9px;
  font-size: .88rem;
  font-weight: 850;
}

.fuel-table-head .icon-btn {
  width: 36px;
  height: 36px;
}

.fuel-table-countries {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.fuel-table-countries label {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: #344054;
  font-size: .7rem;
  font-weight: 850;
  line-height: 1.1;
  cursor: pointer;
}

.fuel-table-countries label:has(input:checked) {
  border-color: rgba(47, 111, 131, .55);
  background: #eaf5f8;
  color: var(--primary);
}

.fuel-table-countries label.disabled {
  border-color: #e5e7eb;
  background: #f2f4f7;
  color: #98a2b3;
}

.fuel-table-countries label.disabled:has(input:checked) {
  border-color: #e5e7eb;
  background: #f2f4f7;
  color: #98a2b3;
}

.fuel-table-countries input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.fuel-table-countries label:focus-within {
  outline: 2px solid rgba(47, 111, 131, .22);
  outline-offset: 2px;
}

.fuel-tier-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(100px, .42fr) 34px;
  gap: 6px;
  align-items: center;
  padding: 0 4px 2px;
  color: #667085;
  font-size: .68rem;
  font-weight: 850;
}

.fuel-tier-table-compact .fuel-tier-row {
  grid-template-columns: minmax(0, 1fr) minmax(100px, .42fr) auto;
  padding: 3px 0;
}

.fuel-tier-table-compact .icon-btn {
  width: 32px;
  height: 32px;
}

.fuel-country-controls {
  display: grid;
  gap: 6px;
}

.fuel-country-control-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(82px, 110px) auto;
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.fuel-country-control-row > div:first-child {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.fuel-country-control-row strong,
.fuel-country-control-row span,
.fuel-country-control-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fuel-country-control-row strong {
  color: var(--ink);
  font-size: .78rem;
  font-weight: 900;
}

.fuel-country-control-row span {
  color: #667085;
  font-size: .68rem;
  font-weight: 750;
}

.fuel-country-control-row small {
  color: #667085;
  font-size: .62rem;
  font-weight: 750;
}

.fuel-country-control-row small.fuel-status-ok {
  color: #047857;
}

.fuel-country-control-row small.fuel-status-danger {
  color: #b42318;
}

.fuel-country-control-row small.fuel-status-warning {
  color: #b54708;
}

.fuel-country-control-row input {
  min-height: 34px;
  padding: 6px 8px;
  font-size: .82rem;
}

.fuel-country-control-row .switch-control {
  justify-self: end;
}

.fuel-inline-country-control-row {
  padding: 12px;
  gap: 10px;
}

.fuel-inline-country-control-row input {
  min-height: 40px;
  font-size: .9rem;
}

.fuel-inline-country-control-row #carrierFuelEditorMain {
  color: #667085;
  font-size: .82rem;
}

.fuel-inline-country-control-row #carrierFuelEditorStatus {
  font-size: .76rem;
}

.fuel-inline-table-action {
  justify-items: start;
}

.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: 8px;
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #475467;
  font-size: .72rem;
  line-height: 1.2;
  text-align: left;
}

.fuel-readout-item span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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: .86rem;
  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 {
  border: 1px solid #f3c7c2;
  background: #fff;
  color: var(--danger);
}

.icon-btn.danger:hover,
.icon-btn.danger:focus-visible {
  border-color: #e7aaa3;
  background: #fff7f6;
  color: #912018;
}

.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-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
}

.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;
  cursor: pointer;
}

.history-panel-header:focus-visible {
  outline: 3px solid rgba(47, 111, 131, .24);
  outline-offset: -3px;
}

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

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

.history-table-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: auto;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.history-table-head {
  flex: 0 0 auto;
  overflow: hidden;
}

.history-table-body {
  flex: 0 0 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.history-table-head .data-table,
.history-table-body .data-table {
  border: 0;
  border-radius: 0;
}

.history-modal {
  width: min(1760px, 100%);
  max-width: min(1760px, calc(100vw - 36px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.history-modal > .panel-header {
  flex: 0 0 auto;
}

.history-modal > #modalContent {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  padding: 0;
}

.history-modal-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  max-height: none;
  overflow: hidden;
  padding: 18px;
}

.history-modal-content .history-panel {
  max-height: none;
  padding: 0;
}

.history-modal-content .history-table-shell {
  flex: 1 1 auto;
  height: auto;
  min-height: 0;
}

.history-modal-content .history-table-body {
  flex: 1 1 auto;
}

.history-popup-toolbar {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 10px;
  padding: 0 0 12px;
}

.history-popup-toolbar .history-search {
  width: min(360px, 42vw);
}

.history-popup-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

.history-popup-sort-hint {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
  white-space: nowrap;
}

.history-popup-table-wrap {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  overflow: visible;
  border: 0;
  border-radius: 0;
}

.history-popup-table-wrap > .empty {
  flex: 1 1 auto;
  width: 100%;
}

.history-modal-content .history-table {
  min-width: 0;
  font-size: .82rem;
}

.history-modal-content .history-table th,
.history-modal-content .history-table td {
  padding: 6px 5px;
}

.history-modal-content .history-table th {
  isolation: isolate;
}

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

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

.history-modal-content .history-table .history-cell-text {
  -webkit-line-clamp: 2;
  overflow-wrap: anywhere;
}

.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 .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%;
}

.history-tools-trigger svg,
.history-edit-icon-btn svg {
  width: 18px;
  height: 18px;
}

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

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

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

.history-tools-trigger {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding-inline: 0;
}

.history-edit-icon-btn {
  width: 36px;
  min-width: 36px;
  height: 36px;
  min-height: 36px;
  padding-inline: 0;
}

.history-tools-trigger > .history-tools-chevron,
.history-tools-item > .history-tools-chevron {
  width: 17px;
  height: 17px;
  margin-left: auto;
  transition: transform .16s ease;
}

.history-tools-trigger[aria-expanded="true"] > .history-tools-chevron,
.history-tools-item[aria-expanded="true"] > .history-tools-chevron {
  transform: rotate(180deg);
}

.history-tools-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 130;
  width: 238px;
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
  overflow-x: hidden;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

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

.history-tools-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.history-tools-item:hover,
.history-tools-item:focus-visible {
  background: #edf4f7;
  outline: none;
}

.history-tools-item > svg {
  width: 20px;
  height: 20px;
}

.history-tools-danger {
  color: var(--danger);
}

.history-tools-danger:hover,
.history-tools-danger:focus-visible {
  background: #fff1f0;
}

.history-column-popover {
  margin: 2px 0 5px;
  padding: 5px;
  border: 1px solid #dce5eb;
  border-radius: 7px;
  background: #f7fafb;
}

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

.history-row-limit-popover {
  margin: 2px 0 5px;
  padding: 5px 0;
  border: 1px solid #dce5eb;
  border-radius: 7px;
  background: #f7fafb;
}

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

.history-row-limit-control {
  display: grid;
  gap: 7px;
  padding: 9px 0 7px;
}

.history-row-limit-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #344054;
  font-size: .78rem;
  font-weight: 800;
  padding: 0 8px;
}

.history-row-limit-label strong {
  display: inline-grid;
  min-width: 25px;
  min-height: 22px;
  place-items: center;
  border-radius: 999px;
  background: #e4eef2;
  color: var(--brand-dark);
  font-size: .76rem;
}

.history-row-limit-control input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: calc(100% - 24px);
  height: 8px;
  min-height: 8px;
  margin: 7px 12px 10px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  outline: none;
  background: linear-gradient(to right, var(--brand) 0 var(--history-row-limit-progress, 47%), #cfd6df var(--history-row-limit-progress, 47%) 100%);
  cursor: pointer;
}

.history-row-limit-control input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border: 1px solid #d1d7df;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(16, 24, 40, .16);
}

.history-row-limit-control input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 1px solid #d1d7df;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(16, 24, 40, .16);
}

.history-row-limit-control input[type="range"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(47, 111, 131, .22);
}

.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-tools-menu.admin-only {
  display: block;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 2000;
  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);
}

.team-sync-warning {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid #e4ad4a;
  border-radius: 7px;
  background: #fff8e8;
  color: #713f12;
  font-weight: 700;
  line-height: 1.4;
}

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

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

.workspace-load-error {
  position: fixed;
  inset: 0;
  z-index: 4000;
  display: grid;
  place-items: center;
  padding: 18px;
  background: #eef4f6;
}

.workspace-load-error section {
  width: min(520px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.workspace-load-error h1 { margin: 0 0 10px; font-size: 1.45rem; }
.workspace-load-error p { margin: 0 0 18px; color: var(--muted); }

.modal {
  width: min(860px, 100%);
  min-width: 0;
  max-width: min(860px, calc(100vw - 36px));
  max-height: 90vh;
  overflow: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  contain: inline-size;
  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;
  border-color: #9fc9d3;
  background: #eef8fa;
  color: #175f70;
}

.carrier-detail-note {
  margin-top: 14px;
  border-color: #9fc9d3;
  background: #eef8fa;
  color: #175f70;
}

.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-manual-badge {
  border-color: #a8cbd8;
  background: #edf7fa;
  color: #1e6178;
}

.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;
}

.setup-guide {
  display: grid;
  gap: 16px;
}

.setup-guide-context {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid #b8dfe2;
  border-left: 4px solid var(--brand);
  border-radius: 10px;
  background: linear-gradient(110deg, #eef8f8, #f8fbfc);
}

.setup-guide-context > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.setup-guide-context strong {
  color: var(--brand-dark);
  font-size: .9rem;
}

.setup-guide-context span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.setup-guide-context > b {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 999px;
  background: #d9eef0;
  color: var(--brand-dark);
  font-size: .72rem;
}

.setup-guide-map {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 2px;
  color: var(--muted);
  font-size: .7rem;
  font-weight: 900;
}

.setup-guide-map span {
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #344054;
}

.setup-guide-map i {
  color: var(--brand);
  font-size: .8rem;
  font-style: normal;
}

.setup-guide-nav {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(165px, 1fr));
  gap: 7px;
}

.setup-guide-step {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #475467;
  cursor: pointer;
  text-align: left;
}

.setup-guide-step:hover,
.setup-guide-step:focus-visible {
  border-color: #8dbec8;
  background: #eef7f8;
}

.setup-guide-step.active {
  border-color: var(--brand);
  border-left: 3px solid var(--brand);
  background: #e8f3f5;
  box-shadow: none;
  color: var(--brand-dark);
}

.setup-guide-step span {
  width: 28px;
  height: 28px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: #dfe7ec;
  font-size: .82rem;
  font-weight: 950;
}

.setup-guide-step.active span {
  background: var(--brand);
  color: #fff;
}

.setup-guide-step em {
  min-width: 0;
  overflow: hidden;
  font-size: .78rem;
  font-style: normal;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-guide-stage {
  display: grid;
  gap: 15px;
  padding: 18px;
  border: 1px solid #cdd9e3;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .05);
}

.setup-guide-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.setup-guide-stage-head > div {
  display: grid;
  gap: 2px;
}

.setup-guide-kicker {
  color: var(--brand);
  font-size: .72rem;
  font-weight: 950;
  text-transform: uppercase;
}

.setup-guide-stage h3,
.setup-guide-stage p,
.setup-guide-preview {
  margin: 0;
}

.setup-guide-stage h3 {
  font-size: 1.2rem;
}

.setup-guide-lead {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.55;
}

.setup-guide-procedure {
  display: grid;
  gap: 8px;
  padding: 13px 14px;
  border: 1px solid #b8dfe2;
  border-radius: 9px;
  background: #eef8f8;
}

.setup-guide-procedure > strong,
.setup-guide-cases > strong {
  font-size: .82rem;
}

.setup-guide-procedure ol {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.setup-guide-procedure li {
  min-width: 0;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: start;
  gap: 7px;
}

.setup-guide-procedure li > span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-size: .72rem;
  font-weight: 950;
}

.setup-guide-procedure p {
  padding-top: 2px;
  color: #344054;
  font-size: .76rem;
  font-weight: 750;
  line-height: 1.38;
}

.setup-guide-preview {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid #cdd9e3;
  border-radius: 8px;
  background: #f8fafc;
}

.setup-guide-preview figcaption {
  color: #344054;
  font-size: .8rem;
  font-weight: 900;
}

.setup-guide-fields {
  display: grid;
  gap: 8px;
}

.setup-guide-fields-two {
  grid-template-columns: .75fr 1.25fr;
}

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

.setup-guide-fields > div {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.setup-guide-fields span {
  color: var(--muted);
  font-size: .68rem;
  font-weight: 850;
}

.setup-guide-fields strong {
  overflow: hidden;
  font-size: .88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-guide-preview-note,
.setup-guide-mini-list {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #475467;
  font-size: .8rem;
  font-weight: 700;
}

.setup-guide-mini-list {
  align-items: stretch;
  flex-wrap: wrap;
}

.setup-guide-mini-list span {
  padding: 6px 8px;
  border-radius: 999px;
  background: #eaf0f4;
}

.setup-guide-check {
  width: 21px;
  height: 21px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #dff3e7;
  color: #067647;
  font-weight: 950;
}

.setup-guide-country-order {
  display: grid;
  gap: 7px;
}

.setup-guide-country-order > div {
  display: grid;
  grid-template-columns: 16px 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.setup-guide-country-order > div.is-default {
  border-color: #8dbec8;
  background: #eef8f8;
}

.setup-guide-country-order i {
  width: 15px;
  height: 14px;
  background: repeating-linear-gradient(to bottom, #667085 0 2px, transparent 2px 5px);
  opacity: .75;
}

.setup-guide-country-order b {
  color: var(--brand-dark);
  font-size: .78rem;
}

.setup-guide-country-order span {
  min-width: 0;
  display: grid;
  gap: 1px;
}

.setup-guide-country-order strong {
  overflow: hidden;
  font-size: .84rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.setup-guide-country-order small {
  color: var(--muted);
  font-size: .69rem;
  font-weight: 700;
}

.setup-guide-country-order em {
  padding: 4px 7px;
  border-radius: 999px;
  background: #dff3e7;
  color: #067647;
  font-size: .68rem;
  font-style: normal;
  font-weight: 900;
}

.setup-guide-matrix-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.setup-guide-matrix {
  width: 100%;
  min-width: 570px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.setup-guide-matrix th,
.setup-guide-matrix td {
  padding: 9px 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-size: .78rem;
  text-align: center;
}

.setup-guide-matrix th {
  color: #344054;
  background: #f3f6f8;
  font-weight: 900;
}

.setup-guide-matrix small {
  color: var(--muted);
  font-weight: 750;
}

.setup-guide-matrix tr:last-child > * {
  border-bottom: 0;
}

.setup-guide-matrix tr > *:last-child {
  border-right: 0;
}

.setup-guide-matrix tr.is-current td,
.setup-guide-matrix tr.is-current th {
  background: #eaf7ef;
  color: #067647;
  font-weight: 900;
}

.setup-guide-matrix-compact {
  min-width: 520px;
}

.setup-guide-weight-matrix {
  min-width: 600px;
}

.setup-guide-fuel-head,
.setup-guide-mode-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.setup-guide-fuel-head span,
.setup-guide-mode-row span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.setup-guide-fuel-head span {
  grid-template-columns: auto auto;
  align-items: baseline;
  gap: 8px;
}

.setup-guide-fuel-head em {
  padding: 5px 8px;
  border-radius: 999px;
  background: #dff3e7;
  color: #067647;
  font-size: .74rem;
  font-style: normal;
  font-weight: 900;
}

.setup-guide-mode-row small {
  color: #067647;
  font-size: .7rem;
  font-weight: 800;
}

.setup-guide-mode-row.manual small {
  color: var(--muted);
}

.setup-guide-mode-row > strong {
  font-variant-numeric: tabular-nums;
}

.setup-guide-service-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.setup-guide-cases {
  display: grid;
  gap: 7px;
}

.setup-guide-cases > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.setup-guide-cases article {
  min-width: 0;
  display: grid;
  gap: 3px;
  padding: 9px 10px;
  border-left: 3px solid #8dbec8;
  border-radius: 0 7px 7px 0;
  background: #f6f8fa;
}

.setup-guide-cases article b {
  font-size: .76rem;
}

.setup-guide-cases article span {
  color: var(--muted);
  font-size: .73rem;
  font-weight: 700;
  line-height: 1.38;
}

.setup-guide-service-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 2px solid var(--brand);
  border-left-width: 4px;
  border-radius: 8px;
  background: #fff;
}

.setup-guide-service-card > div {
  display: grid;
  gap: 2px;
}

.setup-guide-service-card span {
  color: var(--muted);
  font-size: .74rem;
  font-weight: 750;
}

.setup-guide-calculation {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 7px;
  overflow: hidden;
  background: #fff;
}

.setup-guide-calculation > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: #475467;
  font-size: .8rem;
}

.setup-guide-calculation > div:last-child {
  border-bottom: 0;
}

.setup-guide-calculation > div.total {
  background: #eaf7ef;
  color: #067647;
  font-size: .88rem;
  font-weight: 950;
}

.setup-guide-calculation strong {
  min-width: 8ch;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.setup-guide-calculation .total strong {
  color: #067647;
}

.setup-guide-history-matrix {
  min-width: 760px;
}

.setup-guide-history-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  border-radius: 999px;
  color: #8a5200;
  background: #fff4d8;
  font-size: .82rem;
  font-weight: 800;
}

.setup-guide-history-detail {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.setup-guide-history-detail > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.setup-guide-history-detail span {
  color: var(--muted);
  font-size: .78rem;
  font-weight: 700;
}

.setup-guide-history-detail strong {
  color: var(--ink);
  font-size: .95rem;
  font-variant-numeric: tabular-nums;
}

.setup-guide-history-detail .total {
  border-color: #9bd7b5;
  background: #eaf7ef;
}

.setup-guide-history-detail .total strong {
  color: #067647;
}

.setup-guide-notes {
  display: grid;
  gap: 6px;
}

.setup-guide-notes > strong {
  font-size: .83rem;
}

.setup-guide-notes ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 20px;
  color: #475467;
  font-size: .82rem;
  line-height: 1.42;
}

.setup-guide-warning {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  border: 1px solid #f0c36b;
  border-radius: 8px;
  background: #fff8e8;
  color: #713f12;
  font-size: .8rem;
  line-height: 1.4;
}

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

.form-actions > .btn-danger,
.form-actions > label.btn-danger {
  order: -1;
  margin-right: auto;
}

.form-actions.full {
  grid-column: 1 / -1;
}

.export-format-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.export-format-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px 11px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
  color: var(--ink);
  text-align: left;
  transition: background-color .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.export-format-card:hover,
.export-format-card:focus-visible {
  border-color: rgba(47, 111, 131, .55);
  background: #eef8f8;
  box-shadow: 0 0 0 3px rgba(47, 111, 131, .1);
}

.export-format-card strong {
  align-self: end;
  font-size: .94rem;
}

.export-format-card small {
  grid-column: 2;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
  line-height: 1.4;
}

.export-format-icon {
  grid-row: 1 / span 2;
  width: 44px;
  height: 44px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-size: .72rem;
  font-weight: 900;
}

.stats-export-form {
  display: grid;
  gap: 15px;
}

.export-selection-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.export-selection-head > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.export-selection-head > div:last-child {
  display: flex;
  gap: 6px;
}

.export-selection-head span {
  color: var(--muted);
  font-size: .8rem;
  font-weight: 700;
}

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

.export-option-card {
  min-width: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease;
}

.export-option-card:hover,
.export-option-card:focus-within,
.export-option-card:has(input:checked) {
  border-color: rgba(47, 111, 131, .48);
  background: #eef8f8;
}

.export-option-card input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  margin-top: 1px;
  padding: 0;
  accent-color: var(--brand);
  cursor: pointer;
}

.export-option-card span {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.export-option-card strong {
  font-size: .85rem;
}

.export-option-card small {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 700;
  line-height: 1.35;
}

.stats-export-filter-note {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid #b9ddc8;
  border-radius: 7px;
  background: #f0faf4;
}

.stats-export-filter-note strong {
  color: var(--green, #067647);
  font-size: .78rem;
}

.stats-export-filter-note span {
  color: #475467;
  font-size: .76rem;
  font-weight: 700;
}

.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;
}

.created-carrier-editor {
  display: grid;
  gap: 12px;
}

.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) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    overscroll-behavior-x: none;
  }

  @supports (overflow: clip) {
    html,
    body,
    .app-shell {
      overflow-x: clip;
    }
  }

  img,
  video,
  canvas,
  svg {
    max-width: 100%;
  }

  .app-shell,
  .layout,
  .main-stack,
  .panel,
  .admin-panel,
  .admin-panel > .tabs,
  .panel-header,
  .panel-body,
  .admin-section,
  .admin-section.active,
  .toolbar,
  .toolbar > div,
  .filter-bar,
  .carrier-list,
  .zone-list,
  .service-list,
  .carrier-card,
  .zone-card,
  .service-card,
  .modal,
  .modal .panel-body,
  .field,
  .form-step,
  .step-content {
    min-width: 0;
    max-width: 100%;
  }

  .admin-panel,
  .admin-panel > .tabs,
  .admin-section,
  .admin-section.active,
  .carrier-list,
  .zone-list,
  .service-list {
    width: 100%;
    overflow-x: hidden;
  }

  @supports (overflow: clip) {
    .admin-panel,
    .admin-panel > .tabs,
    .admin-section,
    .admin-section.active,
    .carrier-list,
    .zone-list,
    .service-list {
      overflow-x: clip;
    }
  }

  .admin-section .toolbar,
  .admin-section .toolbar > div:first-child,
  .admin-section .toolbar-actions,
  .admin-section .filter-bar > label,
  .admin-section .filter-bar select,
  .carrier-card-head > div:first-child,
  .zone-card-head > div:first-child,
  .service-card-head > div:first-child {
    min-width: 0;
    max-width: 100%;
  }

  .admin-section .filter-bar select {
    width: 100%;
  }

  .carrier-card-head,
  .zone-card-head,
  .service-card-head {
    width: 100%;
  }

  /* Keep wide settings content inside its card on phones. Price matrices may
     still scroll horizontally in their own wrapper. */
  .carrier-list,
  .zone-list,
  .service-list {
    grid-template-columns: minmax(0, 1fr);
    min-inline-size: 0;
    max-inline-size: 100%;
    contain: inline-size;
  }

  .carrier-card,
  .zone-card,
  .service-card {
    inline-size: 100%;
    min-inline-size: 0;
    max-inline-size: 100%;
    box-sizing: border-box;
  }

  .carrier-card > *,
  .zone-card > *,
  .service-card > * {
    min-inline-size: 0;
    max-inline-size: 100%;
  }

  .carrier-card-head,
  .zone-card-head,
  .service-card-head {
    flex-wrap: wrap;
  }

  .zone-matrix-wrap {
    inline-size: 100%;
    max-inline-size: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .market-options-head {
    align-items: stretch;
    flex-direction: column;
  }

  .market-options-status {
    align-self: flex-start;
    white-space: normal;
  }

  .market-option-grid {
    grid-template-columns: 1fr;
  }

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

  .workspace-title-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 7px;
  }

  .workspace-badge {
    width: fit-content;
    max-width: 100%;
    padding: 5px 10px;
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: break-word;
    word-break: normal;
  }

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

  .history-panel-header .compact-actions {
    flex-wrap: wrap;
  }

  .history-panel-header .compact-actions {
    justify-content: flex-start;
  }

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

  .stats-primary-grid {
    align-items: start;
  }

  .stats-primary-grid > .stats-visual-card {
    height: auto;
  }

  .stats-primary-grid > .stats-visual-card > .stats-chart svg {
    max-height: 310px;
  }

  .stats-filter-bar,
  .stats-filter-bar.has-package,
  .stats-card-grid,
  .stats-insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stats-view-header {
    align-items: flex-start;
  }

  .stats-donut-layout {
    grid-template-columns: minmax(120px, .8fr) minmax(130px, 250px);
  }

  .team-invite-form,
  .team-invite-result {
    grid-template-columns: 1fr;
  }

  .account-team-head,
  .team-member-row {
    align-items: flex-start;
  }

  .team-member-row {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    row-gap: 0;
  }

  .activity-log-row {
    grid-template-columns: 12px minmax(0, 1fr);
    gap: 6px 10px;
  }

  .activity-log-row span:not(.activity-log-dot) {
    grid-column: 2;
  }

  .team-member-actions {
    justify-self: end;
  }

  .team-member-row.pending {
    grid-template-columns: 1fr;
    row-gap: 10px;
  }

  .team-member-row.pending .team-member-actions {
    justify-self: stretch;
    grid-auto-flow: row;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .team-member-row.pending .team-member-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .team-member-dialog-actions {
    grid-template-columns: 1fr;
  }

  .subscription-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .subscription-banner .archive-owner-note {
    max-width: none;
    text-align: left;
  }

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

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

  .setup-guide-context,
  .setup-guide-stage-head {
    align-items: stretch;
    flex-direction: column;
  }

  .setup-guide-context span {
    text-align: left;
  }

  .setup-guide-map {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .setup-guide-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .setup-guide-fields-two,
  .setup-guide-fields-three {
    grid-template-columns: 1fr;
  }

  .setup-guide-service-list {
    grid-template-columns: 1fr;
  }

  .setup-guide-procedure ol,
  .setup-guide-cases > div,
  .setup-guide-history-detail {
    grid-template-columns: 1fr;
  }

  .setup-guide-stage-head .btn {
    width: 100%;
  }

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

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

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

  .brand > div:last-child {
    width: 100%;
    min-width: 0;
  }

  .brand-mark {
    width: min(300px, 82vw);
  }

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

  .panel-header > div:first-child,
  .toolbar > div:first-child,
  .account-team-head > div:first-child {
    min-width: 0;
  }

  .panel-title,
  .panel-kicker,
  .toolbar h3,
  .toolbar p,
  .modal h2,
  .modal p,
  .btn,
  .detail-item strong,
  .detail-item small {
    overflow-wrap: anywhere;
  }

  .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-panel > .tabs {
    align-items: stretch;
    padding-right: 14px;
  }

  .admin-panel > .tabs .settings-logout {
    position: static;
    margin: 0;
  }

  .admin-panel-tab-list,
  .stats-panel-tab-list {
    flex: 1 1 100%;
    width: 100%;
  }

  .panel-view-actions {
    order: -1;
    width: 100%;
    justify-content: flex-end;
  }

  .panel-view-actions .settings-logout {
    margin-left: 0;
  }

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

  .admin-lock-actions {
    display: flex;
  }

  .admin-lock-actions .btn {
    flex: 1 1 0;
    width: auto;
  }

  .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: hidden;
  }

  .admin-section.active {
    overflow-x: hidden;
  }

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

  .fuel-current-card {
    align-items: center;
    flex-direction: row;
  }

  .fuel-current-card > div:first-child {
    flex: 1 1 auto;
  }

  .fuel-current-actions {
    align-self: center;
    justify-content: flex-end;
  }

  .fuel-result-note {
    grid-template-columns: 1fr auto;
  }

  .fuel-result-note span,
  .fuel-result-note small {
    grid-column: 1 / -1;
    white-space: normal;
  }

  .fuel-result-note .btn {
    grid-column: 2;
    grid-row: 1;
  }

  .fuel-table-head {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .fuel-table-summary-toggle {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .fuel-table-summary-toggle em {
    grid-column: 2;
  }

  .fuel-country-control-row {
    grid-template-columns: 1fr;
  }

  .fuel-country-control-row .switch-control {
    justify-self: start;
  }

  .fuel-tier-header {
    grid-template-columns: minmax(0, 1fr) minmax(74px, .45fr) 32px;
  }

  .fuel-tier-row {
    grid-template-columns: minmax(0, 1fr) minmax(74px, .45fr) auto;
  }

  .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 {
    max-height: min(62vh, 560px);
    overflow-x: hidden;
    padding: 8px;
  }

  .history-panel-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }

  .history-panel-header .compact-actions {
    width: 100%;
    min-width: 0;
    justify-content: flex-start;
    margin-left: 0;
  }

  .history-panel-header .compact-actions .btn,
  .history-panel-header .compact-actions label.btn,
  .history-panel-header .compact-actions .badge,
  .history-tools-menu {
    flex: 1 1 auto;
  }

  .history-tools-menu > .btn {
    width: 100%;
  }

  #historyToolbar {
    flex: 0 0 auto;
  }

  #historyToolbar > .btn {
    width: 36px;
  }

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

  .history-panel-header .compact-actions .badge {
    flex: 0 0 auto;
  }

  .history-panel-header .compact-actions .history-search {
    width: auto;
    min-width: 0;
    flex: 1 1 auto;
  }

  .history-panel-header .compact-actions #historyToolbar {
    width: 36px;
    flex: 0 0 36px;
  }

  .history-tools-popover {
    right: 0;
    width: min(238px, calc(100vw - 24px));
    max-height: min(70vh, 480px);
    overflow-y: auto;
  }

  .history-modal {
    max-width: calc(100vw - 20px);
  }

  .history-modal-content {
    max-height: calc(90vh - 82px);
    padding: 12px;
  }

  .history-popup-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .history-popup-toolbar .history-search {
    width: 100%;
  }

  .history-popup-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    margin-left: 0;
  }

  .history-popup-sort-hint {
    display: none;
  }

  .history-table {
    display: block;
    width: 100%;
    min-width: 0;
    border: 0;
    background: transparent;
    font-size: .86rem;
  }

  .history-table-head {
    display: none;
  }

  .history-table-shell {
    height: auto;
    border: 0;
    border-radius: 0;
    overflow: visible;
  }

  .history-table-body {
    flex: 0 0 auto;
    overflow-y: auto;
    overflow-x: hidden;
  }

  .history-modal-content .history-table-shell {
    height: 100%;
  }

  .history-modal-content .history-table-body {
    flex: 1 1 auto;
  }

  .history-table colgroup,
  .history-table thead {
    display: none;
  }

  .history-table tbody {
    display: grid;
    gap: 8px;
  }

  .history-table tbody tr.history-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .history-table tbody tr.history-row:hover {
    border-color: rgba(47, 111, 131, .45);
    background: #f8fafc;
  }

  .history-table tbody tr.history-row td {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: start;
    gap: 3px;
    min-width: 0;
    padding: 0;
    border: 0;
    overflow: visible;
    text-align: left;
  }

  .history-modal-content .history-table tbody tr.history-row td:first-child {
    padding-left: 0;
  }

  .history-table tbody tr.history-row td::before,
  .country-table tbody td::before,
  .stats-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: .64rem;
    font-weight: 900;
    line-height: 1.1;
    text-transform: uppercase;
  }

  .history-table .history-cell-text {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
  }

  .history-table .history-total-cell {
    justify-content: flex-start;
  }

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

  .history-table input[type="checkbox"] {
    justify-self: start;
  }

  .country-table {
    display: block !important;
    width: 100%;
    min-width: 0;
    overflow: visible !important;
    border: 0;
    background: transparent;
  }

  .country-table thead {
    display: none;
  }

  .country-table tbody {
    display: grid;
    gap: 8px;
  }

  .country-table tbody tr {
    display: grid;
    grid-template-columns: minmax(54px, .42fr) minmax(82px, 1fr) auto;
    grid-template-areas:
      "country-code country-name country-actions"
      "zip-length zip-length country-actions";
    gap: 9px 12px;
    align-items: start;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .country-table tbody td,
  .country-table tbody td:last-child {
    display: grid;
    align-content: start;
    gap: 3px;
    width: auto;
    min-width: 0;
    padding: 0;
    border: 0;
    text-align: left;
  }

  .country-table tbody td:last-child {
    grid-area: country-actions;
    align-self: start;
  }

  .country-table tbody td:nth-child(1) {
    grid-area: country-code;
  }

  .country-table tbody td:nth-child(2) {
    grid-area: country-name;
  }

  .country-table tbody td:nth-child(3) {
    grid-area: zip-length;
  }

  .country-table .carrier-actions {
    justify-content: flex-end;
    flex-wrap: nowrap;
    gap: 6px;
    width: max-content;
    margin-left: 0;
  }

  .country-table tbody td:last-child::before {
    display: none;
  }

  .stats-table-wrap {
    max-height: min(58vh, 480px);
    overflow-x: hidden;
    border: 0;
    background: transparent;
  }

  .stats-table,
  .stats-table tbody,
  .stats-table tr,
  .stats-table td {
    display: block;
    width: 100%;
  }

  .stats-table thead {
    display: none;
  }

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

  .stats-table tr {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
  }

  .stats-table td,
  .stats-table tr:last-child td {
    display: grid;
    grid-template-columns: minmax(92px, .42fr) minmax(0, 1fr);
    gap: 10px;
    padding: 5px 0;
    border: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .stats-table td::before {
    align-self: start;
    padding-top: 2px;
  }

  .zone-matrix-wrap {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    contain: inline-size;
    touch-action: pan-x pan-y;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable;
  }

  .service-carrier-required {
    display: grid;
    gap: 4px;
    margin-bottom: 12px;
    text-align: left;
  }

  .service-carrier-required span {
    color: var(--muted);
    font-size: .82rem;
    line-height: 1.4;
  }

  .market-options-setting {
    align-items: flex-start;
  }

  .modal-backdrop {
    overflow: hidden;
    padding: 8px;
  }

  .modal {
    width: 100%;
    max-width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    overflow-x: hidden;
  }

  button,
  input,
  select,
  textarea {
    touch-action: manipulation;
  }

  @supports (-webkit-touch-callout: none) {
    input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
    select,
    textarea {
      font-size: 16px !important;
    }
  }

  .modal > .panel-header {
    position: sticky;
    top: 0;
    z-index: 12;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    background: #fff;
  }

  .modal-actions {
    min-width: max-content;
    max-width: none;
    align-items: flex-start;
  }

  #modalHeaderControl,
  #modalHeaderControl > * {
    min-width: 0;
    max-width: none;
  }

  .history-edited-badge {
    min-height: 32px;
    padding: 0 9px;
    font-size: .7rem;
  }

  .quote-detail-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .quote-detail-group-head > span {
    min-width: 0;
  }

  .form-actions,
  .quote-detail-actions {
    width: 100%;
  }

  .export-selection-head {
    align-items: stretch;
  }
}

@media (max-width: 520px) {
  .stats-panel-content {
    padding: 14px;
  }

  .stats-view-header {
    align-items: stretch;
    flex-direction: column;
    gap: 9px;
  }

  .stats-view-header > strong {
    align-self: flex-start;
  }

  .stats-filter-bar,
  .stats-filter-bar.has-package,
  .stats-card-grid,
  .stats-insight-grid,
  .stats-donut-layout {
    grid-template-columns: 1fr;
  }

  .stats-quality-column:last-child > .stats-visual-card:last-child .stats-donut-layout {
    grid-template-columns: 1fr;
  }

  .stats-card {
    min-height: 0;
  }

  .stats-donut {
    width: min(160px, 72vw);
  }

  .stats-donut-legend {
    justify-self: center;
    width: min(100%, 280px);
  }

  .stats-bar-row {
    grid-template-columns: minmax(82px, .85fr) minmax(60px, 1fr) auto;
  }

  .panel-view-actions {
    gap: 5px;
  }

  .panel-export-btn,
  .panel-switch-btn {
    min-height: 36px;
    padding-inline: 8px;
    font-size: .72rem;
  }

  .panel-export-btn svg,
  .panel-switch-btn svg {
    width: 15px;
    height: 15px;
  }

  .export-format-grid,
  .export-selection-grid {
    grid-template-columns: 1fr;
  }

  .export-selection-head {
    flex-direction: column;
  }

  .export-selection-head > div:last-child {
    align-self: flex-start;
  }

  .setup-guide-nav {
    grid-template-columns: 1fr;
  }

  .setup-guide-step {
    padding: 7px 8px;
  }

  .setup-guide-stage {
    padding: 12px;
  }

  .setup-guide-service-card,
  .setup-guide-warning,
  .setup-guide-fuel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .setup-guide-country-order > div {
    grid-template-columns: 14px 22px minmax(0, 1fr);
  }

  .setup-guide-country-order em {
    grid-column: 3;
    justify-self: start;
  }

  h1 {
    font-size: 1.35rem;
  }

  .subscription-choice-grid {
    grid-template-columns: 1fr;
  }

  .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 {
    flex-basis: 100%;
  }

  .tab {
    flex: 1 1 calc(50% - 6px);
  }

  .tabs .settings-logout {
    flex: 0 0 36px;
  }

  .stats-panel-tabs {
    flex-wrap: wrap;
  }

  .stats-panel-tab-list .tab {
    flex: 1 1 calc(50% - 6px);
  }

  .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);
  }

  .modal .panel-header {
    padding: 12px;
  }

  .modal .panel-body {
    padding: 12px;
  }

  .modal-actions {
    gap: 6px;
  }

  .form-actions .btn,
  .quote-detail-actions .btn,
  .workspace-start-actions .btn {
    width: 100%;
    white-space: normal;
    text-align: center;
  }

  .account-team-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .team-name-pill {
    max-width: min(42vw, 150px);
  }

  .market-options-setting {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
  }

  .market-options-setting .switch-control {
    align-self: start;
  }

  .history-table tbody tr.history-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 10px;
  }
}

/* On phones the app itself must never become a horizontal scroll surface.
   Wide content gets clipped at the nearest settings/page container; the
   zone-price matrix popup remains the explicit horizontal-scroll exception. */
@media (max-width: 720px) {
  html,
  body,
  .app-shell,
  .layout,
  .main-stack,
  .admin-panel,
  .admin-panel > .tabs,
  .admin-panel-tab-list,
  .panel-view-actions,
  .admin-section,
  .admin-section.active,
  .carrier-list,
  .zone-list,
  .service-list,
  .carrier-card,
  .zone-card,
  .service-card,
  .stats-panel,
  .stats-panel-content,
  .stats-content,
  .stats-table-wrap {
    min-width: 0 !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    overscroll-behavior-x: none !important;
    touch-action: pan-y;
  }

  @supports (overflow: clip) {
    html,
    body,
    .app-shell,
    .layout,
    .main-stack,
    .admin-panel,
    .admin-panel > .tabs,
    .admin-panel-tab-list,
    .panel-view-actions,
    .admin-section,
    .admin-section.active,
    .carrier-list,
    .zone-list,
    .service-list,
    .carrier-card,
    .zone-card,
    .service-card,
    .stats-panel,
    .stats-panel-content,
    .stats-content,
    .stats-table-wrap {
      overflow-x: clip !important;
    }
  }

  .zone-matrix-wrap {
    overflow-x: auto !important;
    overscroll-behavior-x: contain !important;
    touch-action: pan-x pan-y !important;
  }

  /* Keep card actions anchored in the top-right corner. Long names use the
     flexible left column and wrap there instead of pushing the actions down. */
  .carrier-card-head,
  .zone-card-head,
  .service-card-head {
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
  }

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

  .carrier-card-title,
  .zone-card-title,
  .service-card-title {
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .carrier-card-head .card-actions,
  .zone-card-head .card-actions,
  .service-card-head .card-actions {
    flex: 0 0 auto !important;
    margin-left: 8px;
  }

  /* Keep a short team name beside the cockpit title. A longer name wraps as
     one flex item onto the next line instead of forcing the title away. */
  .workspace-title-row {
    display: flex !important;
    align-items: center;
    flex-wrap: wrap;
    gap: 7px 10px;
  }

  .workspace-title-row h1 {
    flex: 0 0 auto;
    min-width: 0;
  }

  .workspace-title-row .workspace-badge {
    flex: 0 1 auto;
    max-width: 100%;
    min-width: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }
}
