/* LoadLogic: Multi-Stop Moving Truck Planner */
:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #1f2a37;
  --ink-soft: #4b5563;
  --muted: #7b8490;
  --line: #d9d2c5;
  --accent: #2f5c54;
  --accent-ink: #ffffff;
  --warn: #b84a2a;
  --stop-1: #2f5c54;
  --stop-2: #5c8a4b;
  --stop-3: #c98a2f;
  --stop-4: #4a6d8c;
  --stop-5: #8c4a6d;
  --stop-6: #6d4a8c;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(31,42,55,0.06), 0 6px 18px rgba(31,42,55,0.06);
  --max: 1180px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 0.7rem; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
}
.brand h1 { font-size: 1.1rem; margin: 0; letter-spacing: -0.01em; }
.tagline { margin: 0; font-size: 0.78rem; color: var(--muted); }
.topnav { display: flex; gap: 0.25rem; flex-wrap: wrap; }
.topnav a {
  display: inline-block;
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  border-radius: 999px;
}
.topnav a:hover { background: var(--surface-2); text-decoration: none; }

main { max-width: var(--max); margin: 0 auto; padding: 1.25rem; }

.app-shell {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1rem;
  align-items: start;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  box-shadow: var(--shadow);
}
.controls h2 { margin-top: 0; font-size: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.25rem; margin-bottom: 0.75rem; }
.field span { font-size: 0.78rem; color: var(--ink-soft); font-weight: 600; }
.field input, .field select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  font-size: 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
}

.actions { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.5rem; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.ghost { background: transparent; }
.btn:hover { filter: brightness(0.98); }
.hint { font-size: 0.75rem; color: var(--muted); margin-top: 0.5rem; }

.capacity-bar-wrap { margin-bottom: 1rem; }
.capacity-labels { display: flex; justify-content: space-between; font-size: 0.85rem; color: var(--ink-soft); }
.capacity-bar {
  height: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.35rem;
}
.capacity-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.3s ease;
}
.capacity-fill.over { background: var(--warn); }

.layout-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1rem;
}
.truck-preview h3, .stop-priority h3, .item-controls h3, .items-table-wrap h3 { margin-top: 0; font-size: 0.95rem; }
.truck-bed {
  position: relative;
  min-height: 280px;
  background: var(--surface-2);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-auto-rows: 36px;
  gap: 4px;
}
.truck-bed .empty-state {
  grid-column: 1 / -1;
  align-self: center;
  justify-self: center;
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem;
}
.truck-item {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  text-align: center;
  color: #fff;
  border-radius: 4px;
  padding: 2px;
  overflow: hidden;
  cursor: default;
  border: 1px solid rgba(0,0,0,0.1);
}
.truck-item.stop-1 { background: var(--stop-1); }
.truck-item.stop-2 { background: var(--stop-2); }
.truck-item.stop-3 { background: var(--stop-3); }
.truck-item.stop-4 { background: var(--stop-4); }
.truck-item.stop-5 { background: var(--stop-5); }
.truck-item.stop-6 { background: var(--stop-6); }

.legend { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.5rem; font-size: 0.75rem; color: var(--ink-soft); }
.legend .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.sw.stop-1 { background: var(--stop-1); }
.sw.stop-2 { background: var(--stop-.sw.stop-3 { background: var(--stop-3); }
.sw.stop-4 { background: var(--stop-4); }
.sw.stop-5 { background: var(--stop-5); }
.sw.stop-6 { background: var(--stop-6); }

.stop-list { display: flex; flex-direction: column; gap: 0.5rem; }
.stop-group { border-left: 4px solid var(--accent); padding: 0.4rem 0.6rem; background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.stop-group h4 { margin: 0 0 0.25rem; font-size: 0.85rem; }
.stop-group ul { margin: 0; padding-left: 1rem; font-size: 0.85rem; color: var(--ink-soft); }
.stop-group .muted { color: var(--muted); font-size: 0.78rem; }

.item-controls { margin-top: 1rem; }
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); margin-bottom: 0.75rem; }
.tab {
  background: transparent;
  border: none;
  padding: 0.5rem 0.8rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.preset-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.5rem;
}
.preset-list li {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0.55rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.preset-list .preset-name { font-weight: 600; font-size: 0.88rem; }
.preset-list .preset-size { font-size: 0.75rem; color: var(--muted); }
.preset-list .preset-add {
  margin-top: 0.3rem;
  align-self: flex-start;
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  font-size: 0.75rem;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.custom-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 0.5rem; align-items: end; }
.custom-form label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.78rem; color: var(--ink-soft); }
.custom-form input { padding: 0.5rem; border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 0.9rem; background: var(--surface-2); }
.custom-form .btn { height: fit-content; }

.table-scroll { overflow-x: auto; }
.items-table, .ref-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.items-table th, .items-table td, .ref-table th, .ref-table td { padding: 0.5rem; text-align: left; border-bottom: 1px solid var(--line); }
.items-table th, .ref-table th { background: var(--surface-2); font-weight: 600; }
.items-table .item-remove { background: transparent; border: none; color: var(--warn); cursor: pointer; font-size: 0.85rem; }
.muted { color: var(--muted); font-weight: normal; font-size: 0.8rem; }

.content-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-top: 1.25rem;
  box-shadow: var(--shadow);
}
.content-section h2 { margin-top: 0; font-size: 1.1rem; }
.content-section h3 { font-size: 1rem; margin-top: 1.25rem; }
.steps, .tips-list { padding-left: 1.25rem; }
.steps li, .tips-list li { margin-bottom: 0.5rem; }

.saved-list { list-style: none; padding: 0; margin: 0.75rem 0 0; display: grid; gap: 0.5rem; }
.saved-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.saved-list .saved-meta { font-size: 0.78rem; color: var(--muted); }
.saved-list .saved-actions { display: flex; gap: 0.4rem; }

.sitefoot {
  margin-top: 2rem;
  padding: 1.25rem;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
.legal-links { margin.4rem; }
.legal-links a { margin: 0 0.25rem; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .controls { order: 0; }
  .layout-grid { grid-template-columns: 1fr; }
  .truck-bed { min-height: 220px; grid-template-columns: repeat(4, 1fr); }
}

@media print {
  body { background: #fff; }
  .topbar, .controls, .item-controls, .legend, .sitefoot, .btn, .item-remove { display: none !important; }
  .panel { box-shadow: none; border: 1px solid #ccc; }
  .truck-bed { border: 1px solid #ccc; }
  .content-section { page-break-inside: avoid; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.factory-fallback-nav {
  width: min(900px, calc(100% - 32px));
  margin: 24px auto 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  align-items: center;
  font-size: 0.95rem;
}

.factory-fallback-nav a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}
