:root {
  --bg: #eee9de;
  --paper: #f8f4eb;
  --paper-bright: #fffdf8;
  --ink: #1c1c18;
  --muted: #716d64;
  --line: rgba(28, 28, 24, .17);
  --line-strong: rgba(28, 28, 24, .42);
  --copper: #a55f32;
  --copper-light: #d59b6d;
  --forest: #2f453b;
  --green: #2d6a4f;
  --warning: #b06b2b;
  --danger: #a83d32;
  --display: "Iowan Old Style", Baskerville, Georgia, "Songti SC", serif;
  --body: "Avenir Next", "Gill Sans", "PingFang SC", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --shadow: 0 26px 70px rgba(42, 35, 26, .09);
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
body { min-width: 320px; margin: 0; background: var(--bg); font-family: var(--body); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  pointer-events: none;
  opacity: .34;
  background-image:
    linear-gradient(rgba(28, 28, 24, .032) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 28, 24, .032) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, black, transparent 76%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line);
  background: rgba(238, 233, 222, .91);
  backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; font-family: var(--display); font-size: 1.03rem; letter-spacing: .18em; white-space: nowrap; }
.brand span { margin-left: .15em; color: var(--copper); }
.brand i { margin-left: .42em; padding: .24em .38em .2em; border: 1px solid rgba(47,69,59,.48); color: var(--forest); font: 600 .48em/1 var(--mono); letter-spacing: .08em; font-style: normal; }
.topbar-meta { display: flex; align-items: center; gap: 20px; }
.back-link { display: inline-flex; align-items: center; gap: 7px; padding-bottom: 2px; border-bottom: 1px solid rgba(28,28,24,.32); color: var(--ink); font-size: .78rem; transition: color .2s, border-color .2s; }
.back-link:hover { border-color: var(--copper); color: var(--copper); }
.back-short { display: none; }
.privacy-mark { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: .78rem; letter-spacing: .03em; }
.privacy-mark i { width: 7px; height: 7px; border-radius: 50%; background: #4d8265; box-shadow: 0 0 0 5px rgba(77, 130, 101, .12); }
.language-toggle {
  min-width: 44px;
  height: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-family: var(--mono);
  font-size: .78rem;
}

main { padding: 0 clamp(16px, 3.4vw, 56px) 80px; }
.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(360px, .82fr);
  gap: clamp(50px, 9vw, 150px);
  max-width: 1560px;
  margin: 0 auto;
  padding: clamp(58px, 7vw, 108px) 0 clamp(42px, 5vw, 72px);
  align-items: end;
}
.kicker { margin: 0 0 18px; color: var(--copper); font-family: var(--mono); font-size: .7rem; letter-spacing: .16em; }
.intro h1 { margin: 0; font-family: var(--display); font-size: clamp(2.8rem, 5.2vw, 5.8rem); font-weight: 400; line-height: .92; letter-spacing: -.045em; }
.intro h1 em { color: var(--copper); font-weight: 400; }
.intro-copy > p { max-width: 590px; margin: 0 0 34px; color: var(--muted); font-size: .96rem; line-height: 1.8; }
.workflow { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line-strong); }
.workflow span { position: relative; display: flex; flex-direction: column; gap: 8px; padding: 18px 8px 0 0; color: var(--muted); font-size: .86rem; font-weight: 500; line-height: 1.45; }
.workflow b { color: var(--ink); font-family: var(--mono); font-size: .76rem; font-weight: 500; letter-spacing: .03em; }

.planner-shell {
  display: grid;
  grid-template-columns: minmax(520px, .93fr) minmax(520px, 1.07fr);
  gap: 18px;
  max-width: 1560px;
  margin: 0 auto;
  align-items: start;
}
.input-column, .result-column { display: grid; gap: 18px; min-width: 0; }
.panel, .viewer-panel, .result-panel { min-width: 0; border: 1px solid var(--line); background: rgba(248, 244, 235, .85); box-shadow: var(--shadow); }
.panel { width: 100%; padding: clamp(22px, 2.5vw, 38px); }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.panel-heading > div { display: flex; align-items: center; gap: 16px; }
.panel-heading h2, .viewer-head h2 { margin: 0; font-family: var(--display); font-size: 1.82rem; font-weight: 400; letter-spacing: -.025em; }
.panel-heading p { margin: 5px 0 0; color: var(--muted); font-size: .82rem; line-height: 1.5; }
.section-number { display: grid; flex: 0 0 auto; width: 37px; height: 37px; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--copper); font-family: var(--mono); font-size: .74rem; }
.row-count { color: var(--muted); font-family: var(--mono); font-size: .7rem; letter-spacing: .09em; white-space: nowrap; }
.advisor-panel { overflow: hidden; padding: 0; border-color: #353a35; background: #252925; color: #f5efe4; box-shadow: 0 26px 75px rgba(27,31,27,.18); }
.advisor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; padding: 24px 26px 21px; border-bottom: 1px solid rgba(255,255,255,.13); }
.advisor-head > div { display: flex; align-items: flex-start; gap: 15px; }
.advisor-head .kicker { margin: 1px 0 7px; color: var(--copper-light); }
.advisor-head h2 { margin: 0; font-family: var(--display); font-size: 1.65rem; font-weight: 400; letter-spacing: -.02em; }
.advisor-head p:last-child { margin: 6px 0 0; color: rgba(255,255,255,.66); font-size: .9rem; line-height: 1.55; }
.advisor-mark { display: grid; flex: 0 0 auto; width: 44px; height: 38px; place-items: center; border: 1px solid rgba(213,155,109,.72); color: var(--copper-light); font-family: var(--mono); font-size: .66rem; letter-spacing: .06em; }
.advisor-mode { flex: 0 0 auto; padding: 7px 9px; border: 1px solid rgba(255,255,255,.15); color: rgba(255,255,255,.64); font-family: var(--mono); font-size: .72rem; letter-spacing: .04em; }
.advisor-chat { padding: 20px 26px 24px; }
.advisor-messages { display: grid; gap: 12px; max-height: 310px; overflow-y: auto; padding-right: 5px; }
.advisor-message { display: grid; gap: 4px; max-width: 88%; animation: advisor-in .24s ease-out both; }
.advisor-message small { color: rgba(255,255,255,.48); font-family: var(--mono); font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.advisor-message p { margin: 0; padding: 12px 14px; border: 1px solid rgba(255,255,255,.13); background: rgba(255,255,255,.045); color: rgba(255,255,255,.9); font-size: .92rem; line-height: 1.65; }
.advisor-message.user { justify-self: end; }
.advisor-message.user small { text-align: right; }
.advisor-message.user p { border-color: rgba(213,155,109,.32); background: rgba(165,95,50,.18); color: #fff7eb; }
.advisor-replies { position: relative; display: flex; gap: 8px; margin-top: 15px; flex-wrap: wrap; }
.advisor-replies button { min-height: 42px; padding: 0 14px; border: 1px solid rgba(213,155,109,.38); background: transparent; color: #edc8a7; cursor: pointer; font-size: .86rem; transition: background .2s, border-color .2s, color .2s; }
.advisor-replies button:hover { border-color: var(--copper-light); background: rgba(213,155,109,.12); color: white; }
.advisor-replies button.primary { border-color: var(--copper-light); background: var(--copper); color: white; }
.advisor-reply-option { position: static; display: inline-flex; align-items: stretch; }
.advisor-reply-option > [data-advisor-value] { border-right: 0; }
.advisor-replies .advisor-reply-help { width: 42px; padding: 0; border-color: rgba(213,155,109,.38); font-family: var(--mono); font-size: .82rem; font-weight: 700; }
.advisor-reply-tooltip { position: absolute; z-index: 12; right: 0; bottom: calc(100% + 8px); left: 0; display: none; width: 100%; padding: 10px 12px; border: 1px solid rgba(213,155,109,.38); background: #111713; color: rgba(255,255,255,.9); box-shadow: 0 12px 28px rgba(0,0,0,.22); font-size: .75rem; line-height: 1.55; }
.advisor-reply-help:hover + .advisor-reply-tooltip,
.advisor-reply-help:focus-visible + .advisor-reply-tooltip,
.advisor-reply-help[aria-expanded="true"] + .advisor-reply-tooltip { display: block; }
@keyframes advisor-in { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
.project-details { margin: -6px 0 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.project-details summary { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 45px; cursor: pointer; color: var(--ink); font-size: .78rem; list-style: none; }
.project-details summary::-webkit-details-marker { display: none; }
.project-details summary::after { content: "+"; order: 3; color: var(--copper); font-size: 1rem; }
.project-details[open] summary::after { content: "−"; }
.project-details summary small { margin-left: auto; color: var(--muted); font-size: .72rem; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 0 0 15px; }
.project-grid label { display: grid; gap: 6px; color: var(--muted); font-size: .74rem; }
.project-grid input { width: 100%; min-width: 0; height: 39px; padding: 0 9px; border: 1px solid var(--line); border-radius: 0; outline: 0; background: rgba(255,255,255,.45); color: var(--ink); font-size: .8rem; }
.project-grid input:focus { border-color: var(--copper); }
.cargo-heading-meta { display: flex !important; align-items: center; gap: 14px !important; }
.cargo-unit-control { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .76rem; white-space: nowrap; }
.cargo-unit-control select { width: 84px; height: 36px; padding: 0 24px 0 10px; border: 1px solid var(--line); border-radius: 0; background: var(--paper-bright); color: var(--ink); font-family: var(--mono); font-size: .78rem; outline: 0; }
.cargo-unit-control select:focus { border-color: var(--copper); }

.import-bar { display: flex; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.upload-button, .text-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 39px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: var(--paper-bright);
  cursor: pointer;
  font-size: .8rem;
  transition: border-color .2s, background .2s, transform .2s;
}
.upload-button { gap: 9px; border-color: var(--ink); background: var(--ink); color: white; }
.upload-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.upload-button:hover, .text-action:hover { transform: translateY(-1px); }
.text-action:hover { border-color: var(--line-strong); background: white; }
.notice { margin: 0 0 16px; padding: 11px 13px; border-left: 3px solid var(--green); background: rgba(45, 106, 79, .08); color: var(--forest); font-size: .82rem; line-height: 1.5; }
.notice.error { border-color: var(--danger); background: rgba(168, 61, 50, .08); color: var(--danger); }
.hidden { display: none !important; }

.cargo-table-wrap { overflow-x: auto; border-top: 1px solid var(--line); }
.cargo-table { width: 100%; min-width: 860px; border-collapse: collapse; table-layout: fixed; }
.cargo-table th { height: 46px; padding: 0 6px; border-bottom: 1px solid var(--line); color: var(--muted); font-family: var(--mono); font-size: .78rem; font-weight: 500; letter-spacing: .04em; text-align: left; text-transform: uppercase; }
.cargo-table th:first-child { width: 19%; padding-left: 0; }
.cargo-table th:nth-child(2), .cargo-table th:nth-child(3), .cargo-table th:nth-child(4) { width: 8%; }
.cargo-table th:nth-child(5) { width: 8%; }
.cargo-table th:nth-child(6) { width: 10%; }
.cargo-table th:nth-child(7) { width: 12%; }
.cargo-table th:nth-child(8) { width: 16%; }
.cargo-table th:last-child { width: 4%; }
.cargo-table td { padding: 8px 5px; border-bottom: 1px solid var(--line); }
.cargo-table td:first-child { padding-left: 0; }
.cargo-table td:last-child { padding-right: 0; text-align: right; }
.cargo-table input, .cargo-table select {
  width: 100%;
  min-width: 0;
  height: 38px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 0;
  outline: none;
  background: rgba(255,255,255,.45);
  color: var(--ink);
  font-size: .82rem;
  transition: border-color .2s, background .2s;
}
.cargo-table input:focus, .cargo-table select:focus { border-color: var(--copper); background: white; }
.cargo-table input.invalid { border-color: var(--danger); background: rgba(168, 61, 50, .05); }
.cargo-field-note { margin: 11px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.6; }
.remove-row { width: 28px; height: 28px; padding: 0; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; }
.remove-row:hover { color: var(--danger); }
.add-row { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 44px; margin-top: 15px; border: 1px dashed var(--line-strong); background: transparent; cursor: pointer; color: var(--muted); font-size: .8rem; }
.add-row:hover { color: var(--ink); border-style: solid; }
.add-row span:first-child { color: var(--copper); font-size: 1rem; }

.settings-panel { box-shadow: none; }
.panel-heading.compact { margin-bottom: 22px; }
.transport-scene { display: grid; grid-template-columns: 1fr 1fr; margin-bottom: 12px; border: 1px solid var(--line-strong); background: rgba(255,255,255,.25); }
.transport-scene button { position: relative; display: grid; gap: 4px; min-height: 88px; padding: 15px 17px; border: 0; background: transparent; cursor: pointer; text-align: left; transition: background .2s, color .2s; }
.transport-scene button + button { border-left: 1px solid var(--line); }
.transport-scene button::after { position: absolute; right: 14px; top: 14px; width: 8px; height: 8px; border: 1px solid var(--line-strong); border-radius: 50%; content: ""; }
.transport-scene button[aria-pressed="true"] { background: var(--forest); color: #f8f2e8; }
.transport-scene button[aria-pressed="true"]::after { border-color: var(--copper-light); background: var(--copper-light); box-shadow: 0 0 0 4px rgba(213,155,109,.12); }
.transport-scene small { color: var(--copper); font-family: var(--mono); font-size: .66rem; letter-spacing: .1em; }
.transport-scene button[aria-pressed="true"] small { color: var(--copper-light); }
.transport-scene strong { font-family: var(--display); font-size: 1.05rem; font-weight: 400; }
.transport-scene span { color: var(--muted); font-size: .73rem; }
.transport-scene button[aria-pressed="true"] span { color: rgba(255,255,255,.64); }
.container-picker {
  display: grid;
  grid-template-columns: minmax(210px, .82fr) minmax(0, 1.18fr);
  border: 1px solid var(--line-strong);
  background: rgba(255,255,255,.28);
}
.preset-select-label { display: grid; gap: 9px; padding: 16px; border-right: 1px solid var(--line); color: var(--muted); font-size: .78rem; }
.preset-select-label select { width: 100%; min-width: 0; height: 44px; padding: 0 38px 0 12px; border: 1px solid var(--line); border-radius: 0; background: var(--paper-bright); color: var(--ink); font-size: .84rem; }
.container-summary { display: grid; min-width: 0; padding: 16px 18px; align-content: center; gap: 7px; }
.container-summary strong { font-family: var(--display); font-size: 1.34rem; font-weight: 400; }
.container-summary span { color: var(--muted); font-family: var(--mono); font-size: .75rem; line-height: 1.55; }
.container-summary i { width: fit-content; padding: 4px 8px; border: 1px solid rgba(165,95,50,.34); color: var(--copper); font-family: var(--mono); font-size: .7rem; font-style: normal; letter-spacing: .04em; }
.container-editor { margin-top: 10px; padding: 16px; border: 1px solid var(--line); background: rgba(255,253,248,.52); }
.container-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.container-editor-head > div { display: grid; gap: 4px; }
.container-editor-head strong { font-family: var(--display); font-size: 1rem; font-weight: 400; }
.container-editor-head small { color: var(--muted); font-size: .75rem; line-height: 1.55; }
.container-editor-head button { flex: 0 0 auto; min-height: 34px; padding: 0 11px; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--muted); font-size: .76rem; }
.container-editor-head button:hover { border-color: var(--copper); color: var(--copper); }
.container-dimension-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 13px; }
.container-dimension-grid label { display: grid; gap: 7px; color: var(--muted); font-size: .75rem; }
.container-dimension-grid input { width: 100%; min-width: 0; height: 41px; padding: 0 38px 0 10px; border: 1px solid var(--line); border-radius: 0; background: var(--paper-bright); color: var(--ink); font-family: var(--mono); font-size: .8rem; }
.container-dimension-grid input:focus { outline: none; border-color: var(--copper); }
.container-dimension-grid input.invalid { border-color: var(--danger); background: rgba(168,61,50,.05); }
.vehicle-reference-note { margin: 11px 0 0; padding-left: 11px; border-left: 2px solid var(--copper-light); color: var(--muted); font-size: .75rem; line-height: 1.65; }
.setting-row { margin-top: 16px; }
.clearance-setting { display: grid; gap: 8px; color: var(--muted); font-size: .78rem; }
.clearance-setting input { width: 100%; height: 46px; padding: 0 46px 0 12px; border: 1px solid var(--line); border-radius: 0; background: rgba(255,255,255,.45); color: var(--ink); font-size: .82rem; outline: 0; }
.clearance-setting input:focus { border-color: var(--copper); }
.clearance-setting small { color: var(--muted); font-size: .75rem; line-height: 1.55; }
.input-suffix { position: relative; }
.input-suffix b { position: absolute; top: 50%; right: 12px; transform: translateY(-50%); font-family: var(--mono); font-size: .75rem; font-weight: 500; }
.optimization-panel { margin-top: 18px; border: 1px solid var(--line); background: rgba(255,253,248,.46); }
.optimization-grid { display: grid; grid-template-columns: repeat(2, minmax(180px,1fr)); }
.optimization-grid > .optimization-select { min-width: 0; padding: 15px; }
.optimization-select { display: grid; gap: 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: .76rem; }
.optimization-select:first-child { border-right: 1px solid var(--line); }
.optimization-grid select { width: 100%; height: 42px; padding: 0 34px 0 10px; border: 1px solid var(--line); border-radius: 0; background: var(--paper-bright); color: var(--ink); font-size: .8rem; }
.strategy-label-row { position: relative; display: flex; align-items: center; gap: 7px; width: fit-content; }
.strategy-label-row > label { cursor: pointer; }
.strategy-help-button { display: inline-grid; width: 20px; height: 20px; padding: 0; place-items: center; border: 1px solid rgba(165,95,50,.55); border-radius: 50%; background: rgba(165,95,50,.07); color: var(--copper); cursor: help; font: 700 .68rem/1 var(--mono); }
.strategy-help-button:hover, .strategy-help-button:focus-visible, .strategy-help-button[aria-expanded="true"] { border-color: var(--copper); background: var(--copper); color: white; outline: none; }
.strategy-help-tooltip { position: absolute; top: calc(100% + 10px); left: 0; z-index: 12; width: min(290px, calc(100vw - 76px)); padding: 12px 13px; border: 1px solid rgba(213,155,109,.62); background: #292d29; box-shadow: 0 18px 42px rgba(28,29,25,.22); color: rgba(255,255,255,.9); font-size: .78rem; line-height: 1.5; opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .16s ease, transform .16s ease, visibility .16s; pointer-events: none; }
.strategy-help-tooltip::before { position: absolute; bottom: 100%; left: 74px; width: 8px; height: 8px; content: ""; border-top: 1px solid rgba(213,155,109,.62); border-left: 1px solid rgba(213,155,109,.62); background: #292d29; transform: translateY(5px) rotate(45deg); }
.strategy-help-tooltip dl { display: grid; gap: 9px; margin: 0; }
.strategy-help-tooltip dl > div { display: grid; gap: 2px; }
.strategy-help-tooltip dt { color: #edc8a7; font-weight: 600; }
.strategy-help-tooltip dd { margin: 0; color: rgba(255,255,255,.78); }
.strategy-help-button:hover + .strategy-help-tooltip, .strategy-help-button:focus-visible + .strategy-help-tooltip, .strategy-help-button[aria-expanded="true"] + .strategy-help-tooltip { opacity: 1; visibility: visible; transform: translateY(0); }
.cost-settings { padding: 15px; border-top: 1px solid var(--line); }
.cost-settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 11px; }
.cost-settings-head > div:first-child { display: grid; gap: 4px; }
.cost-settings-head strong { font-family: var(--display); font-size: .96rem; font-weight: 400; }
.cost-settings-head small { color: var(--muted); font-size: .7rem; line-height: 1.4; }
.rate-actions { display: flex; flex: 0 0 auto; gap: 6px; }
.rate-actions label, .rate-actions button { display: inline-grid; min-height: 32px; padding: 0 9px; place-items: center; border: 1px solid var(--line); background: transparent; cursor: pointer; color: var(--muted); font-size: .7rem; }
.rate-actions label:hover, .rate-actions button:hover { border-color: var(--copper); color: var(--copper); }
.rate-summary { min-height: 30px; margin-bottom: 8px; padding: 8px 10px; border-left: 2px solid var(--copper); background: rgba(165,95,50,.055); color: var(--muted); font-size: .72rem; line-height: 1.45; }
.cost-inputs { display: grid; border-top: 1px solid var(--line); }
.rate-row { display: grid; grid-template-columns: 30px minmax(135px,1fr) minmax(100px,.74fr) minmax(76px,.44fr); gap: 8px; align-items: center; min-height: 52px; border-bottom: 1px solid var(--line); }
.rate-row > label { min-width: 0; }
.rate-check { display: grid; place-items: center; cursor: pointer; }
.rate-check input { width: 16px; height: 16px; accent-color: var(--copper); }
.rate-identity { display: grid; gap: 2px; }
.rate-identity strong { overflow: hidden; font-family: var(--mono); font-size: .7rem; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }
.rate-identity span { overflow: hidden; color: var(--muted); font-size: .7rem; text-overflow: ellipsis; white-space: nowrap; }
.rate-field { position: relative; }
.rate-field span { position: absolute; left: 9px; top: 5px; z-index: 1; color: var(--muted); font-size: .58rem; line-height: 1; pointer-events: none; }
.cost-inputs input[type="number"] { width: 100%; min-width: 0; height: 40px; padding: 12px 9px 0; border: 1px solid var(--line); border-radius: 0; background: var(--paper-bright); color: var(--ink); font-family: var(--mono); font-size: .76rem; }
.cost-inputs input.invalid { border-color: var(--danger); background: rgba(168,61,50,.05); }
.calculate-button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 58px; margin-top: 22px; padding: 0 21px; border: 0; background: var(--ink); color: white; cursor: pointer; font-family: var(--body); font-size: .86rem; letter-spacing: .04em; }
.calculate-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform .2s; }
.calculate-button:hover svg { transform: translateX(4px); }
.calculate-button[disabled] { cursor: wait; opacity: .65; }
.calculation-note { margin: 12px 0 0; color: var(--muted); font-size: .75rem; line-height: 1.65; }

.viewer-panel { position: relative; overflow: hidden; background: #272b27; color: #f4efe4; }
.viewer-head { display: flex; align-items: center; justify-content: space-between; min-height: 96px; padding: 20px 24px; border-bottom: 1px solid rgba(255,255,255,.14); }
.viewer-head .kicker { margin: 0 0 7px; color: var(--copper-light); }
.viewer-head h2 { color: #f4efe4; }
.viewer-actions { display: flex; gap: 5px; }
.viewer-actions button { width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.22); background: transparent; color: white; cursor: pointer; }
.viewer-actions button:hover { border-color: var(--copper-light); color: var(--copper-light); }
.viewer-actions .view-preset { width: auto; min-width: 46px; padding: 0 9px; color: var(--copper-light); font-family: var(--mono); font-size: .62rem; letter-spacing: .08em; }
.viewer-actions .view-preset.active { border-color: var(--copper-light); background: rgba(213,155,109,.12); color: #fff8ec; }
.canvas-wrap { position: relative; aspect-ratio: 16 / 10; min-height: 390px; background: radial-gradient(circle at 50% 42%, #3d443e, #242723 72%); overflow: hidden; }
.canvas-wrap::before { position: absolute; inset: 0; content: ""; opacity: .18; background-image: linear-gradient(rgba(255,255,255,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.08) 1px, transparent 1px); background-size: 28px 28px; }
#loadCanvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; }
#loadCanvas:active { cursor: grabbing; }
.canvas-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 27px; color: rgba(255,255,255,.52); pointer-events: none; }
.canvas-empty p { margin: 0; font-size: .82rem; letter-spacing: .03em; }
.empty-cube { position: relative; width: 78px; height: 54px; border: 1px solid rgba(213,155,109,.7); transform: skewY(-17deg); }
.empty-cube::before, .empty-cube::after { position: absolute; content: ""; border: 1px solid rgba(213,155,109,.45); }
.empty-cube::before { inset: -17px 13px 17px -14px; }
.empty-cube::after { inset: 14px -15px -15px 14px; }
.canvas-badge { position: absolute; right: 15px; bottom: 13px; color: rgba(255,255,255,.56); font-family: var(--mono); font-size: .7rem; letter-spacing: .06em; pointer-events: none; }
.container-switcher { display: flex; align-items: center; justify-content: center; gap: 16px; min-height: 42px; border-top: 1px solid rgba(255,255,255,.1); border-bottom: 1px solid rgba(255,255,255,.1); }
.container-switcher button { border: 0; background: transparent; color: var(--copper-light); cursor: pointer; }
.container-switcher span { font-family: var(--mono); font-size: .76rem; letter-spacing: .09em; }
.legend { display: flex; gap: 15px; min-height: 48px; padding: 14px 20px; flex-wrap: wrap; align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 7px; color: rgba(255,255,255,.76); font-size: .76rem; }
.legend i { width: 9px; height: 9px; border-radius: 2px; }

.result-panel { padding: clamp(22px, 2.5vw, 34px); box-shadow: none; }
.result-status { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 23px; border-bottom: 1px solid var(--line); }
.status-dot { width: 11px; height: 11px; margin-top: 5px; border-radius: 50%; background: #aaa59b; box-shadow: 0 0 0 6px rgba(113,109,100,.1); }
.status-dot.success { background: var(--green); box-shadow: 0 0 0 6px rgba(45,106,79,.11); }
.status-dot.warning { background: var(--warning); box-shadow: 0 0 0 6px rgba(176,107,43,.11); }
.result-status strong { font-family: var(--display); font-size: 1.12rem; font-weight: 400; }
.result-status p { margin: 5px 0 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.metrics { display: grid; grid-template-columns: 1fr 1fr; border-left: 1px solid var(--line); border-top: 1px solid var(--line); margin-top: 24px; }
.metrics article { min-height: 112px; padding: 17px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.metrics small { display: block; margin-bottom: 12px; color: var(--muted); font-family: var(--mono); font-size: .76rem; letter-spacing: .04em; text-transform: uppercase; }
.metrics strong { display: block; font-family: var(--display); font-size: 2rem; font-weight: 400; line-height: 1; }
.metrics span { display: block; margin-top: 8px; color: var(--muted); font-size: .76rem; }
.metric-container-nav { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.metric-container-nav.hidden { display: none; }
.metric-container-nav button { min-height: 30px; padding: 0 10px; border: 1px solid var(--line-dark); background: transparent; color: var(--muted); font-family: var(--mono); font-size: .68rem; cursor: pointer; transition: border-color .18s, background .18s, color .18s; }
.metric-container-nav button:hover { border-color: var(--copper); color: var(--ink); }
.metric-container-nav button.active, .metric-container-nav button[aria-current="true"] { border-color: var(--forest); background: var(--forest); color: #fff; }
.result-narrative { margin-top: 18px; padding: 16px 17px 17px; border-left: 3px solid var(--copper); background: linear-gradient(100deg, rgba(165,95,50,.09), rgba(248,244,235,.22)); }
.result-narrative > div { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.result-narrative small, .result-narrative span { color: var(--muted); font-family: var(--mono); font-size: .65rem; letter-spacing: .055em; text-transform: uppercase; }
.result-narrative strong { display: block; margin-top: 9px; font-family: var(--display); font-size: 1.2rem; font-weight: 400; }
.result-narrative p { margin: 7px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.6; }
.result-narrative em { display: block; margin-top: 7px; color: var(--forest); font-size: .72rem; font-style: normal; line-height: 1.55; }
.load-diagnostics { margin-top: 26px; }
.diagnostics-head { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 10px; }
.diagnostics-head h3 { margin: 0; font-family: var(--display); font-size: 1.15rem; font-weight: 400; }
.diagnostics-head span { color: var(--muted); font-size: .74rem; }
.diagnostic-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.diagnostic-card { min-height: 96px; padding: 14px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.diagnostic-card small { display: block; color: var(--muted); font-family: var(--mono); font-size: .68rem; letter-spacing: .04em; }
.diagnostic-card strong { display: block; margin-top: 10px; font-family: var(--display); font-size: 1.35rem; font-weight: 400; }
.diagnostic-card span { display: block; margin-top: 6px; color: var(--muted); font-size: .7rem; line-height: 1.45; }
.diagnostic-card.warning strong { color: var(--danger); }
.diagnostic-note { margin: 10px 0 0; padding-left: 10px; border-left: 2px solid var(--copper-light); color: var(--muted); font-size: .72rem; line-height: 1.6; }
.comparison { margin-top: 26px; }
.comparison-head { display: flex; align-items: baseline; justify-content: space-between; gap: 15px; margin-bottom: 9px; }
.comparison-head h3 { margin: 0; font-family: var(--display); font-size: 1.15rem; font-weight: 400; }
.comparison-head > span { color: var(--muted); font-size: .76rem; }
.comparison-row { display: grid; width: 100%; grid-template-columns: minmax(92px,auto) 1fr auto; gap: 12px; align-items: center; min-height: 48px; padding: 0; border: 0; border-bottom: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.comparison-row:hover, .comparison-row.active { background: rgba(165,95,50,.055); }
.comparison-row strong { font-family: var(--mono); font-size: .78rem; }
.comparison-row .bar { height: 5px; background: rgba(28,28,24,.09); }
.comparison-row .bar i { display: block; height: 100%; background: var(--copper); }
.comparison-row span { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.comparison-row.recommended strong::after { content: "★"; margin-left: 5px; color: var(--copper); }
.result-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 24px; }
.result-actions button { min-height: 46px; border: 1px solid var(--line-strong); background: transparent; cursor: pointer; font-size: .8rem; }
.result-actions button:last-child { background: var(--forest); border-color: var(--forest); color: white; }
.result-actions button:disabled { opacity: .4; cursor: not-allowed; }
.report-notice { margin: 10px 0 0; padding: 10px 12px; border-left: 3px solid var(--green); background: rgba(45,106,79,.08); color: var(--forest); font-size: .78rem; line-height: 1.5; }
.report-notice.error { border-color: var(--danger); background: rgba(168,61,50,.08); color: var(--danger); }
.risk-boundary { margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: .78rem; line-height: 1.7; }

.print-report { display: none; }

@media (max-width: 1180px) {
  .planner-shell { grid-template-columns: 1fr; }
  .result-column { grid-row: 1; }
  .viewer-panel { position: relative; top: auto; }
  .intro { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 1400px) and (min-width: 1181px) {
  .container-picker { grid-template-columns: 1fr; }
  .preset-select-label { border-right: 0; border-bottom: 1px solid var(--line); }
}

@media (max-width: 760px) {
  .privacy-mark span { display: none; }
  .topbar-meta { gap: 12px; }
  .back-full { display: none; }
  .back-short { display: inline; }
  main { padding-inline: 11px; }
  .intro { grid-template-columns: 1fr; gap: 30px; padding-top: 48px; }
  .intro h1 { font-size: clamp(2.7rem, 10vw, 4.4rem); }
  .planner-shell { display: flex; flex-direction: column; }
  .result-column { display: contents; }
  .viewer-panel { order: 1; width: 100%; }
  .input-column { display: contents; }
  .advisor-panel { order: 2; width: 100%; }
  .cargo-panel { order: 3; width: 100%; }
  .settings-panel { order: 4; width: 100%; }
  .result-panel { order: 5; width: 100%; }
  .panel-heading { align-items: flex-start; }
  .panel-heading .row-count { display: none; }
  .container-picker { grid-template-columns: 1fr; }
  .preset-select-label { border-right: 0; border-bottom: 1px solid var(--line); }
  .container-dimension-grid { grid-template-columns: 1fr 1fr; }
  .optimization-grid { grid-template-columns: 1fr; }
  .optimization-select:first-child { border-right: 0; }
  .canvas-wrap { min-height: 280px; }
}

@media (max-width: 460px) {
  .topbar { min-height: 66px; }
  .brand { font-size: .88rem; }
  .intro { padding-bottom: 30px; }
  .intro h1 { font-size: 2.65rem; }
  .workflow span { gap: 7px; padding-top: 16px; font-size: .84rem; }
  .workflow b { font-size: .76rem; }
  .panel, .result-panel { padding: 19px 15px; }
  .advisor-panel { padding: 0; }
  .advisor-head { display: grid; padding: 20px 17px 18px; }
  .advisor-mode { width: fit-content; margin-left: 53px; }
  .advisor-chat { padding: 17px; }
  .advisor-message { max-width: 95%; }
  .panel-heading h2 { font-size: 1.5rem; }
  .cargo-panel .panel-heading { flex-wrap: wrap; }
  .cargo-heading-meta { width: 100%; padding-left: 53px; margin-top: -7px; }
  .import-bar { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, .9fr); }
  .viewer-head { min-height: 82px; padding: 15px; }
  .viewer-head h2 { font-size: 1.45rem; }
  .canvas-wrap { aspect-ratio: 1 / 1; min-height: 0; }
  .metrics article { min-height: 100px; }
  .metrics strong { font-size: 1.65rem; }
  .result-actions { grid-template-columns: 1fr; }
  .container-dimension-grid { grid-template-columns: 1fr; }
  .container-editor-head { display: grid; }
  .project-grid { grid-template-columns: 1fr; }
  .cost-settings-head { display: grid; }
  .rate-actions { flex-wrap: wrap; }
  .rate-row { grid-template-columns: 28px minmax(118px,1fr) minmax(90px,.7fr) 72px; }
}

@media print {
  @page { size: A4 landscape; margin: 10mm; }
  .topbar, main { display: none !important; }
  html, body { background: white; }
  .print-report { display: block !important; color: #1c1c18; background: white; }
  .print-page { min-height: 186mm; break-after: page; page-break-after: always; font-family: var(--body); }
  .print-page:last-child { break-after: auto; page-break-after: auto; }
  .print-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 5mm; border-bottom: 1px solid rgba(28,28,24,.25); }
  .print-head span { font-family: var(--display); font-size: 10pt; letter-spacing: .16em; }
  .print-head span b { color: var(--copper); font-weight: 400; }
  .print-head span i { margin-left: 1.2mm; color: var(--forest); font: 600 5.5pt/1 var(--mono); font-style: normal; }
  .print-head h1 { margin: 2mm 0 0; font-family: var(--display); font-size: 22pt; font-weight: 400; }
  .print-head p { margin: 0; color: var(--muted); font-size: 7.5pt; line-height: 1.5; text-align: right; }
  .print-container-title { display: flex; justify-content: space-between; align-items: flex-end; margin: 5mm 0 3mm; }
  .print-container-title div { display: grid; gap: 1mm; }
  .print-container-title small { color: var(--copper); font-family: var(--mono); font-size: 7.5pt; letter-spacing: .1em; text-transform: uppercase; }
  .print-container-title strong { font-family: var(--display); font-size: 20pt; font-weight: 400; }
  .print-container-title > span { color: var(--green); font-size: 7.5pt; }
  .print-visual { height: 88mm; overflow: hidden; border: 1px solid rgba(28,28,24,.16); background: #272b27; }
  .print-visual img { display: block; width: 100%; height: 100%; object-fit: contain; }
  .print-metrics { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 3mm; border-top: 1px solid rgba(28,28,24,.2); border-left: 1px solid rgba(28,28,24,.2); }
  .print-metrics div { min-height: 17mm; padding: 3mm; border-right: 1px solid rgba(28,28,24,.2); border-bottom: 1px solid rgba(28,28,24,.2); }
  .print-metrics small { display: block; margin-bottom: 1.5mm; color: var(--muted); font-family: var(--mono); font-size: 6.5pt; text-transform: uppercase; }
  .print-metrics strong { font-family: var(--display); font-size: 15pt; font-weight: 400; }
  .print-diagnosis { margin-top: 3mm; padding: 3mm 4mm; border: 1px solid rgba(28,28,24,.2); background: #f5f0e6; }
  .print-diagnosis > div { display: flex; justify-content: space-between; gap: 4mm; color: var(--copper); font-family: var(--mono); font-size: 6.5pt; letter-spacing: .04em; text-transform: uppercase; }
  .print-diagnosis strong { display: block; margin-top: 1.5mm; font-family: var(--display); font-size: 12pt; font-weight: 400; }
  .print-diagnosis h3 { margin: 2mm 0 .5mm; font-family: var(--display); font-size: 9pt; font-weight: 400; }
  .print-diagnosis p, .print-diagnosis em { display: block; margin: .8mm 0 0; color: var(--muted); font-size: 6.5pt; font-style: normal; line-height: 1.45; }
  .print-diagnosis em { color: var(--green); }
  .print-sku { margin-top: 4mm; }
  .print-sku h2 { margin: 0 0 2mm; font-family: var(--display); font-size: 11pt; font-weight: 400; }
  .print-sku table { width: 100%; border-collapse: collapse; font-size: 7.5pt; }
  .print-sku td { padding: 1.5mm 2mm; border-bottom: 1px solid rgba(28,28,24,.13); text-align: right; }
  .print-sku td:first-child { text-align: left; }
  .print-sku i { display: inline-block; width: 2.2mm; height: 2.2mm; margin-right: 2mm; border-radius: 1px; vertical-align: middle; }
  .print-page footer { margin-top: 3mm; color: var(--muted); font-family: var(--mono); font-size: 6.5pt; text-align: right; }
}
