:root {
  color-scheme: light;
  --bg: #f4f7f2;
  --panel: #ffffff;
  --ink: #15221b;
  --muted: #66746c;
  --line: #dfe7dd;
  --brand: #24563f;
  --brand-dark: #17392a;
  --brand-soft: #eaf3e5;
  --focus: rgba(36, 86, 63, 0.16);
  --danger: #9d2f25;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(36, 86, 63, 0.12), transparent 30rem),
    var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
  padding: 13px 16px;
}

.button-link {
  display: inline-grid;
  min-height: 48px;
  align-items: center;
  border-radius: 8px;
  padding: 13px 16px;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

button:hover {
  background: var(--brand-dark);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.secondary {
  background: #e7eee6;
  color: var(--ink);
}

.secondary:hover {
  background: #dbe6dc;
}

.text-button {
  min-height: auto;
  background: transparent;
  color: var(--brand);
  padding: 0;
}

.text-button:hover {
  background: transparent;
  color: var(--brand-dark);
}

.app-shell {
  width: 100%;
}

.auth-screen {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  min-height: 100svh;
  padding: 18px;
}

.brand-block {
  display: grid;
  justify-items: center;
  text-align: center;
  min-height: 78px;
}

.brand-logo,
.topbar-logo {
  display: block;
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 8px;
}

.logo-fallback,
.topbar-fallback {
  display: grid;
  place-items: center;
  width: 70px;
  height: 70px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
}

.topbar-logo,
.topbar-fallback {
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 32px;
  line-height: 1.05;
  letter-spacing: -0.01em;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
  line-height: 1.2;
}

h3 {
  margin-bottom: 4px;
  font-size: 17px;
  line-height: 1.25;
}

p {
  color: var(--muted);
  line-height: 1.5;
}

.auth-card,
.panel {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 18px 48px rgba(27, 42, 33, 0.1);
}

.auth-center {
  align-self: center;
  display: grid;
  justify-items: center;
  gap: 18px;
  width: 100%;
  padding-bottom: 56px;
}

.auth-copy {
  max-width: 460px;
  text-align: center;
}

.auth-copy p:last-child {
  margin-bottom: 0;
}

.auth-card {
  display: grid;
  gap: 14px;
  max-width: 430px;
  margin: 0 auto;
  padding: 18px;
}

.auth-card-title h2 {
  margin-bottom: 4px;
}

.auth-card-title p {
  margin-bottom: 0;
}

.auth-help {
  margin: 0;
  text-align: center;
  font-size: 14px;
}

.auth-help a {
  color: var(--brand);
  font-weight: 800;
}

.home-recent {
  display: grid;
  gap: 10px;
  width: 100%;
  max-width: 430px;
}

.home-recent-heading {
  text-align: center;
}

.home-recent-heading h2 {
  margin-bottom: 0;
  font-size: 16px;
}

.home-recent-list {
  display: grid;
  grid-auto-columns: minmax(180px, 72%);
  grid-auto-flow: column;
  gap: 10px;
  overflow-x: auto;
  padding: 1px 2px 8px;
  scroll-snap-type: x proximity;
}

.home-recent-card {
  display: grid;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  padding: 11px 12px;
  scroll-snap-align: start;
}

.home-recent-card span {
  color: var(--muted);
  font-size: 12px;
}

.app-footer {
  display: flex;
  justify-content: center;
  gap: 18px;
  padding-top: 18px;
  color: var(--muted);
  font-size: 14px;
}

.app-footer a {
  color: var(--muted);
  font-weight: 750;
}

.app-footer a:hover {
  color: var(--brand);
}

.workspace-footer {
  padding: 20px 0 4px;
}

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

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

input,
select,
textarea {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  padding: 12px 13px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--focus);
}

.workspace {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px;
}

.topbar {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  justify-items: center;
  text-align: center;
}

.topbar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.topbar .eyebrow {
  margin: 0 0 4px;
}

.topbar h1 {
  font-size: 22px;
}

.page-heading {
  max-width: 680px;
  margin: 0 auto 14px;
  text-align: center;
}

.page-heading h1 {
  margin-bottom: 8px;
  font-size: 28px;
}

.page-heading p {
  margin-bottom: 0;
}

.content-grid,
.side,
.form-grid,
.address-step-fields {
  display: grid;
  gap: 14px;
}

.panel {
  padding: 18px;
}

.panel-intro {
  margin-bottom: 16px;
}

.tight {
  padding: 16px;
}

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

.form-step-heading {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding-top: 4px;
}

.form-step-heading:not(:first-child) {
  margin-top: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.form-step-heading p {
  margin-bottom: 0;
}

.package-step-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 12px;
}

.package-step-cta button {
  width: auto;
}

.address-summary {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand-soft);
  padding: 13px;
}

.address-summary p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.package-step {
  display: grid;
  gap: 14px;
  margin-top: 12px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.estimate-route-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand-soft);
  padding: 14px;
}

.estimate-route-card h3,
.estimate-route-card .eyebrow {
  margin-bottom: 0;
}

.estimate-route-card h3 {
  font-size: 16px;
  font-weight: 500;
}

.estimate-route-card button {
  width: auto;
}

.route-swap-button {
  display: grid;
  width: 40px;
  min-width: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.estimate-note {
  margin: 12px 0 0;
  font-size: 12px;
}

.collapsible-trigger {
  display: flex;
  width: 100%;
  min-height: auto;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: transparent;
  color: var(--ink);
  padding: 0;
  text-align: left;
  font-weight: 850;
}

.collapsible-trigger:hover {
  background: transparent;
  color: var(--brand-dark);
}

.collapsible-trigger span:last-child {
  font-size: 18px;
  transition: transform 0.16s ease;
}

.collapsible-trigger[aria-expanded="true"] span:last-child {
  transform: rotate(180deg);
}

.collapsible-body {
  margin-top: 12px;
}

.section-heading {
  justify-content: flex-start;
}

.section-title h2,
.section-heading h2 {
  margin-bottom: 4px;
}

.section-title .eyebrow,
.section-heading + .form-grid {
  margin-top: 0;
}

.step-badge {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 900;
}

.wide {
  grid-column: 1 / -1;
}

.address-search,
.manual-address {
  display: grid;
  gap: 12px;
}

.search-input-wrap {
  position: relative;
  display: block;
}

.search-input-wrap input {
  padding-right: 68px;
}

.input-spinner {
  position: absolute;
  top: 50%;
  right: 40px;
  width: 18px;
  height: 18px;
  border: 2px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 999px;
  transform: translateY(-50%);
  animation: spin 0.75s linear infinite;
}

.search-clear {
  position: absolute;
  top: 50%;
  right: 8px;
  display: grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-size: 20px;
  line-height: 1;
  transform: translateY(-50%);
}

.search-clear:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

@keyframes spin {
  to {
    transform: translateY(-50%) rotate(360deg);
  }
}

.address-suggestions {
  display: grid;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.address-suggestions button {
  min-height: auto;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: #fff;
  color: var(--ink);
  padding: 12px 13px;
  text-align: left;
  font-weight: 650;
}

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

.address-suggestions button:hover {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.address-attribution {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.location-bias {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.location-bias input {
  width: 18px;
  min-height: 18px;
  margin-top: 1px;
  flex: 0 0 auto;
}

.location-status {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.address-confirm {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.address-confirm input {
  width: 18px;
  min-height: 18px;
  margin-top: 1px;
  flex: 0 0 auto;
}

.custom-package {
  display: none;
  gap: 12px;
}

.custom-package.active {
  display: grid;
}

.actions {
  display: grid;
  gap: 10px;
}

.address-block,
.rates,
.recent {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.rate-card,
.request-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.best-rate {
  border-color: rgba(36, 86, 63, 0.38);
  background: linear-gradient(180deg, #fff, rgba(234, 243, 229, 0.7));
}

.best-pill {
  display: inline-grid;
  align-items: center;
  min-height: 22px;
  margin-left: 8px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.cached-labels {
  display: grid;
  grid-auto-columns: minmax(230px, 78%);
  grid-auto-flow: column;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scroll-snap-type: x proximity;
}

.request-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.request-top span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.cached-labels .request-card {
  scroll-snap-align: start;
}

.rate-card + .rate-card,
.request-card + .request-card {
  margin-top: 10px;
}

.rate-top {
  display: grid;
  gap: 4px;
  color: var(--ink);
  font-weight: 850;
}

.rate-card p,
.request-card p {
  margin: 5px 0 12px;
}

.request-card small,
.request-link {
  display: block;
  margin-top: 6px;
}

.request-link {
  color: var(--brand-dark);
  font-weight: 850;
  text-decoration: none;
}

.rate-card button {
  width: 100%;
}

.price {
  color: var(--brand-dark);
  font-size: 22px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
}

.toast {
  position: fixed;
  top: 14px;
  left: 50%;
  z-index: 10;
  display: none;
  width: max-content;
  max-width: calc(100vw - 28px);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 11px 16px 13px;
  overflow: hidden;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.18);
  transform: translateX(-50%);
}

.toast.error {
  background: var(--danger);
}

.toast::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: rgba(255, 255, 255, 0.7);
  content: "";
  transform-origin: left;
}

.toast.running::after {
  animation: toast-timer var(--toast-duration, 3200ms) linear forwards;
}

@keyframes toast-timer {
  from {
    transform: scaleX(1);
  }

  to {
    transform: scaleX(0);
  }
}

@media (min-width: 680px) {
  .auth-screen {
    padding: 26px;
  }

  .workspace {
    padding: 24px;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    justify-items: stretch;
    text-align: left;
  }

  .topbar-brand {
    flex-direction: row;
    justify-self: start;
  }

  .form-grid,
  .address-step-fields,
  .custom-package {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .actions {
    grid-template-columns: max-content max-content;
    justify-content: end;
  }

  .rate-top {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: baseline;
  }

  .cached-labels {
    grid-auto-columns: minmax(260px, 46%);
  }

  .toast {
    max-width: 360px;
  }
}

@media (min-width: 960px) {
  .auth-screen {
    max-width: 1040px;
    margin: 0 auto;
    padding-top: 28px;
  }

  .brand-block {
    justify-items: start;
  }

  .auth-center {
    grid-template-columns: minmax(0, 1fr) 430px;
    align-items: center;
    justify-items: stretch;
    gap: 48px;
    padding-bottom: 96px;
  }

  .auth-copy {
    text-align: left;
  }

  .auth-card {
    margin: 0;
  }

  .home-recent {
    grid-column: 2;
    max-width: none;
  }

  .brand-logo,
  .logo-fallback {
    width: 78px;
    height: 78px;
  }

  h1 {
    font-size: 44px;
  }

  .content-grid {
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.75fr);
    align-items: start;
  }
}
