:root {
  color-scheme: light;
  --ink: #17201f;
  --muted: #5c6863;
  --line: #d9dfd8;
  --paper: #f7f6f0;
  --panel: #ffffff;
  --green: #256b57;
  --blue: #285f8f;
  --amber: #c9852d;
  --red: #ad453c;
  --shadow: 0 18px 45px rgba(36, 48, 43, .12);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--paper);
  color: var(--ink);
}

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px clamp(16px, 4vw, 42px);
  background: rgba(247, 246, 240, .94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}

.brand, .nav, .lang, .hero-actions, .export-actions, .panel-head, .tabs {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
}

.mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  color: white;
  background: var(--green);
}

.nav {
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.lang {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: white;
}

.lang button {
  border: 0;
  padding: 7px 10px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.lang button.active { background: var(--ink); color: white; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(300px, .95fr);
  gap: clamp(24px, 5vw, 64px);
  align-items: center;
  min-height: calc(100vh - 160px);
  padding: clamp(30px, 6vw, 70px) clamp(16px, 4vw, 42px) 24px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  text-transform: uppercase;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(42px, 7vw, 82px);
  line-height: .95;
  letter-spacing: 0;
}

.hero-copy p:not(.eyebrow) {
  max-width: 680px;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.55;
}

.hero-actions, .export-actions { gap: 10px; flex-wrap: wrap; }

.primary, .secondary, .icon-btn, .tabs button {
  border-radius: 7px;
  border: 1px solid transparent;
  min-height: 42px;
  padding: 10px 14px;
  font-weight: 850;
}

.primary { background: var(--green); color: white; }
.secondary { background: white; color: var(--ink); border-color: var(--line); }
.icon-btn { width: 38px; padding: 0; background: var(--ink); color: white; }

.yard-visual {
  position: relative;
  min-height: 390px;
  border: 1px solid #ccd6d2;
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(255,255,255,.7) 48% 52%, transparent 52%),
    repeating-linear-gradient(0deg, rgba(23,32,31,.08) 0 1px, transparent 1px 48px),
    #dde6df;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.road {
  position: absolute;
  inset: auto 0 0;
  height: 34%;
  background: #3b4547;
}

.bay {
  position: absolute;
  top: 13%;
  width: 31%;
  height: 45%;
  border: 3px solid var(--green);
  background: rgba(255,255,255,.38);
}
.bay-one { left: 12%; }
.bay-two { right: 12%; border-color: var(--blue); }

.truck {
  position: absolute;
  width: 118px;
  height: 54px;
  border-radius: 4px;
  box-shadow: 0 10px 20px rgba(0,0,0,.15);
}
.truck::after {
  content: "";
  position: absolute;
  right: -18px;
  top: 10px;
  width: 20px;
  height: 34px;
  background: inherit;
  border-radius: 0 8px 8px 0;
}
.truck-a { left: 8%; bottom: 15%; background: var(--green); }
.truck-b { right: 14%; bottom: 24%; background: var(--blue); }
.truck-c { left: 41%; bottom: 7%; background: var(--amber); }
.dock-label { position: absolute; top: 22px; left: 24px; font-size: 56px; font-weight: 950; color: rgba(23,32,31,.18); }

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 380px) minmax(0, 1fr);
  gap: 18px;
  padding: 0 clamp(16px, 4vw, 42px) 46px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(36, 48, 43, .08);
}

.setup { padding: 18px; }
.panel-head { justify-content: space-between; gap: 14px; margin-bottom: 10px; }
h2 { margin: 0; font-size: 21px; }

label {
  display: grid;
  gap: 7px;
  margin: 13px 0;
  color: var(--muted);
  font-weight: 750;
  font-size: 14px;
}

input[type="range"], select {
  width: 100%;
  min-height: 40px;
}

select, textarea {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
}

.delivery-list { display: grid; gap: 10px; margin-top: 16px; }
.delivery {
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr 82px 78px;
  gap: 8px;
}
.delivery input, .delivery select {
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
}

.output { min-height: 650px; overflow: hidden; }
.tabs {
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tabs button { background: #eef1ed; color: var(--muted); white-space: nowrap; }
.tabs button.active { background: var(--ink); color: white; }

.view { display: none; padding: 18px; }
.view.active { display: block; }

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfbf8;
}
.metric strong { display: block; font-size: 30px; }
.metric span { color: var(--muted); font-weight: 750; font-size: 13px; }

.timeline {
  display: grid;
  gap: 10px;
}
.slot {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) 90px;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
}
.slot-time { font-weight: 900; color: var(--blue); }
.slot-bar {
  min-height: 36px;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--green), #6f9b8a);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 12px;
  font-weight: 850;
  overflow: hidden;
}
.slot-risk { text-align: right; font-weight: 900; }
.slot-risk.high { color: var(--red); }
.slot-risk.mid { color: var(--amber); }
.slot-risk.low { color: var(--green); }

.conflicts, .brief {
  display: grid;
  gap: 12px;
}
.conflict, .brief p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfbf8;
  line-height: 1.5;
}

textarea {
  width: 100%;
  min-height: 430px;
  margin-top: 12px;
  resize: vertical;
  line-height: 1.45;
}

footer {
  padding: 22px clamp(16px, 4vw, 42px) 34px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.doc-main {
  max-width: 920px;
  margin: 0 auto;
  padding: clamp(30px, 6vw, 70px) 16px;
}
.doc-block { display: grid; gap: 16px; line-height: 1.65; }
.doc-block.hidden { display: none; }
.doc-block h1 { font-size: clamp(38px, 6vw, 64px); }

@media (max-width: 880px) {
  .hero, .workspace { grid-template-columns: 1fr; }
  .hero { min-height: auto; }
  .yard-visual { min-height: 300px; }
  .score-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .topbar { align-items: flex-start; }
  .nav { gap: 8px; }
  .delivery { grid-template-columns: 1fr; }
  .slot { grid-template-columns: 1fr; }
  .slot-risk { text-align: left; }
  .score-grid { grid-template-columns: 1fr; }
  h1 { font-size: 40px; }
}
