:root {
  color-scheme: light;
  --bg: #f6f4ee;
  --surface: #ffffff;
  --surface-soft: #f0f5ef;
  --text: #20231f;
  --muted: #646b60;
  --line: #d9ded3;
  --brand: #24563a;
  --brand-strong: #153f2a;
  --accent: #d08b37;
  --danger: #a34232;
  --success: #2d6f45;
  --shadow: 0 18px 40px rgba(32, 35, 31, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(36, 86, 58, 0.08), transparent 32%),
    var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 28px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.8);
}

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

h1 {
  max-width: 760px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
}

h2 {
  font-size: clamp(24px, 3vw, 36px);
  line-height: 1.12;
}

h3 {
  margin-bottom: 18px;
  font-size: 19px;
}

.eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.tabs {
  display: inline-grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  min-width: min(100%, 560px);
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.tab {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  cursor: pointer;
}

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

main {
  width: min(1180px, calc(100% - 36px));
  margin: 34px auto 64px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.section-heading {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin-bottom: 24px;
}

.section-heading p:not(.eyebrow) {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.55;
}

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

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: clamp(18px, 3vw, 28px);
}

.field-group {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

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

label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 10px 12px;
}

input:focus,
select:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(36, 86, 58, 0.14);
}

button.primary {
  width: 100%;
  min-height: 48px;
  border: 0;
  border-radius: 7px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

button.primary:hover {
  background: var(--brand-strong);
}

button.primary:disabled {
  background: var(--muted);
  cursor: wait;
}

.product-list {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 0 0 20px;
  list-style: none;
}

.product-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.product-list span {
  color: var(--muted);
}

.summary,
.tracking-header {
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 8px;
  background: var(--surface-soft);
}

.summary div,
.tracking-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.summary span,
.tracking-header span,
.summary-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.confirmation {
  margin-top: 18px;
}

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

.summary-grid div {
  display: grid;
  gap: 5px;
  min-height: 70px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.summary-grid strong {
  overflow-wrap: anywhere;
}

.message {
  margin: 4px 0 14px;
  line-height: 1.45;
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--success);
}

.hidden {
  display: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff !important;
}

.status-steps {
  display: grid;
  gap: 12px;
  padding: 0;
  margin: 22px 0;
  list-style: none;
}

.status-steps li {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 12px;
  align-items: start;
  color: var(--muted);
}

.status-steps li::before {
  content: "";
  width: 18px;
  height: 18px;
  margin-top: 2px;
  border: 2px solid var(--line);
  border-radius: 50%;
  background: #fff;
}

.status-steps li.done,
.status-steps li.active {
  color: var(--text);
}

.status-steps li.done::before,
.status-steps li.active::before {
  border-color: var(--brand);
  background: var(--brand);
}

.status-steps strong {
  display: block;
  margin-bottom: 4px;
}

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

.delivery-list article {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.delivery-list article:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.delivery-list div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.delivery-list span,
.delivery-list small,
.ai-route small,
.ai-route span,
.recommendations {
  color: var(--muted);
}

.route-summary {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.route-summary div {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.route-summary span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.ai-route {
  display: grid;
  gap: 14px;
  padding: 0;
  margin: 18px 0 0;
  list-style: none;
}

.ai-route li {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.ai-route li.empty-state {
  display: block;
  color: var(--muted);
}

.route-stop-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.ai-route strong,
.ai-route span,
.ai-route small {
  display: block;
}

.ai-route strong,
.ai-route span {
  margin-bottom: 5px;
}

.recommendations {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding-left: 20px;
  line-height: 1.45;
}

.route-map {
  width: 100%;
  height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-soft);
}

@media (max-width: 820px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .tabs,
  .layout,
  .field-row,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    min-width: 0;
  }

  .delivery-list div {
    flex-direction: column;
  }

  .route-map {
    height: 300px;
  }
}
