:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #17202a;
  --muted: #627083;
  --line: #d9e0e8;
  --accent: #12664f;
  --accent-strong: #0d4f3d;
  --warning-bg: #fff7e6;
  --warning-line: #e8c36d;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.layout {
  width: min(1680px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  font-weight: 700;
}

h1 a {
  color: inherit;
  text-decoration: none;
}

h1 a:hover {
  color: var(--accent);
}

h2 {
  font-size: 18px;
}

.topbar p,
.section-head span,
.empty-state {
  color: var(--muted);
}

.quote-panel,
.results {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quote-panel {
  padding: 18px;
  margin-bottom: 18px;
}

.quote-form {
  display: grid;
  grid-template-columns: minmax(260px, 1.6fr) minmax(90px, 0.5fr) minmax(140px, 0.75fr) minmax(200px, 1.1fr) minmax(90px, 0.45fr) minmax(90px, 0.45fr) minmax(110px, 0.6fr) auto;
  gap: 14px;
  align-items: end;
}

label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.label-text,
.th-label {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 1px solid #9babbc;
  border-radius: 50%;
  color: #536273;
  background: #ffffff;
  cursor: help;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  text-transform: none;
}

.info-tip::after {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  z-index: 5;
  width: max-content;
  max-width: 260px;
  padding: 8px 10px;
  border: 1px solid #2f3b48;
  border-radius: 6px;
  background: #17202a;
  color: #ffffff;
  content: attr(aria-label);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.35;
  opacity: 0;
  pointer-events: none;
  text-align: left;
  text-transform: none;
  transform: translate(-50%, 4px);
  transition: opacity 120ms ease, transform 120ms ease;
  white-space: normal;
}

.info-tip::before {
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  z-index: 6;
  width: 8px;
  height: 8px;
  background: #17202a;
  content: "";
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px) rotate(45deg);
  transition: opacity 120ms ease, transform 120ms ease;
}

.info-tip:hover::after,
.info-tip:focus-visible::after,
.info-tip:hover::before,
.info-tip:focus-visible::before {
  opacity: 1;
  transform: translate(-50%, 0);
}

input,
select,
button {
  height: 42px;
  border-radius: 6px;
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 0 11px;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  background: var(--accent);
  color: #ffffff;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 700;
}

button:hover {
  background: var(--accent-strong);
}

.notice {
  margin-top: 14px;
  border: 1px solid var(--warning-line);
  background: var(--warning-bg);
  border-radius: 6px;
  padding: 10px 12px;
}

.quote-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 14px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.section-actions {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
}

.reset-link {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-strong);
  padding: 7px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.reset-link:hover {
  border-color: var(--accent);
  background: #f4faf8;
}

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

.data-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 16px 18px;
}

.data-nav a {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--accent-strong);
  padding: 8px 11px;
  text-decoration: none;
}

.data-nav a:hover {
  border-color: var(--accent);
  background: #f4faf8;
}

.data-note {
  padding: 0 18px 14px;
  color: var(--muted);
  font-size: 14px;
}

.data-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.data-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  padding: 0 18px 18px;
}

.data-card {
  display: grid;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  padding: 14px;
  text-decoration: none;
}

.data-card:hover {
  border-color: var(--accent);
  background: #f8fcfa;
}

.data-card span {
  color: var(--muted);
  font-size: 14px;
}

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

.data-table {
  min-width: 900px;
}

.matrix-table {
  min-width: 760px;
}

th,
td {
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #eef2f5;
  color: #3c4856;
  font-size: 12px;
  text-transform: uppercase;
}

th .info-tip {
  border-color: #a8b4c0;
  background: #f8fafb;
}

th .info-tip::after {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translate(-50%, -4px);
}

th .info-tip::before {
  top: calc(100% + 3px);
  bottom: auto;
  transform: translate(-50%, -4px) rotate(45deg);
}

th .info-tip:hover::after,
th .info-tip:focus-visible::after {
  transform: translate(-50%, 0);
}

th .info-tip:hover::before,
th .info-tip:focus-visible::before {
  transform: translate(-50%, 0) rotate(45deg);
}

td {
  font-size: 14px;
}

.data-table th,
.data-table td {
  white-space: normal;
}

.data-table td {
  vertical-align: top;
}

.matrix-table th,
.matrix-table td {
  text-align: right;
}

.matrix-table th:first-child,
.matrix-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: #ffffff;
  text-align: left;
  font-weight: 700;
}

.matrix-table th:first-child {
  z-index: 2;
  background: #eef2f5;
}

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

.price {
  font-weight: 700;
}

.charge-list {
  display: grid;
  gap: 3px;
  margin: 6px 0 0;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  list-style: none;
}

.charge-list li {
  max-width: 220px;
  white-space: normal;
}

.empty-state {
  padding: 28px 18px;
}

.customer-layout {
  width: min(960px, calc(100vw - 48px));
}

.customer-quote-form {
  grid-template-columns: 1fr;
  align-items: stretch;
}

.customer-form-head,
.customer-form-footer {
  align-items: end;
  gap: 14px;
}

.customer-form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.customer-sku-list {
  display: grid;
  gap: 12px;
}

.customer-sku-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 110px 84px;
  gap: 12px;
  align-items: end;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.customer-form-footer {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 0.7fr) minmax(160px, 0.6fr) auto;
}

button.secondary-button,
button.remove-sku-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--accent-strong);
}

button.secondary-button:hover,
button.remove-sku-button:hover {
  border-color: var(--accent);
  background: #f4faf8;
}

button.add-sku-button {
  height: 36px;
  padding: 0 12px;
}

button.remove-sku-button {
  padding: 0 10px;
  color: var(--muted);
  font-size: 13px;
}

button.remove-sku-button:disabled {
  border-color: var(--line);
  background: #f3f5f7;
  color: #9aa5b1;
  cursor: not-allowed;
}

.customer-line-summary {
  display: grid;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}

.customer-line-summary-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) minmax(220px, 1.5fr) auto;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.customer-line-summary-row span:first-child {
  color: var(--text);
  font-weight: 700;
}

.customer-line-summary-row strong {
  color: var(--text);
  text-align: right;
}

.customer-rate-table {
  min-width: 0;
}

.customer-rate-table th:last-child,
.customer-rate-table td:last-child {
  text-align: right;
}

.customer-rate-table td {
  height: 48px;
}

.resolved-zone-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f4faf8;
}

.resolved-zone-summary strong {
  color: var(--accent-strong);
}

.shipment-map-section {
  min-width: 0;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.shipment-map-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.shipment-map-heading h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0;
}

.shipment-map-heading span,
.shipment-map-status {
  color: var(--muted);
  font-size: 13px;
}

.shipment-map {
  display: grid;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  aspect-ratio: 12 / 7;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #eef3f2;
}

.shipment-map-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.shipment-map-state {
  fill: #f8faf9;
  stroke: #77837f;
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
}

.shipment-map-marker {
  stroke: #ffffff;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.shipment-map-label {
  fill: #14201d;
  stroke: #ffffff;
  stroke-width: 4px;
  paint-order: stroke;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0;
}

.customer-rate-table tr.selected-zone-row td {
  background: #e7f5ef;
  font-weight: 700;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 720px) {
  .layout {
    width: min(100vw - 20px, 1680px);
    padding-top: 18px;
  }

  .topbar,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar-actions {
    width: 100%;
  }

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

  .customer-layout {
    width: min(100vw - 20px, 960px);
  }

  .customer-sku-row {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .customer-sku-field {
    grid-column: 1 / -1;
  }

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

  .resolved-zone-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .shipment-map-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .customer-line-summary-row {
    grid-template-columns: 1fr auto;
  }

  .customer-line-summary-row span:nth-child(2) {
    grid-column: 1;
  }

  .customer-line-summary-row strong {
    grid-column: 2;
    grid-row: 2;
  }

  button {
    width: 100%;
  }

  button.add-sku-button,
  button.remove-sku-button {
    width: auto;
  }
}
