:root {
  --bg: #f2f0e9;
  --paper: #fffefa;
  --ink: #171814;
  --muted: #696b63;
  --line: #d9d6cc;
  --accent: #f4b942;
  --accent-dark: #b97a00;
  --green: #18794e;
  --danger: #b42318;
  --radius: 14px;
  --shadow: 0 12px 35px rgba(42, 39, 28, .08);
}
* { box-sizing: border-box; }
html { color-scheme: light; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: "Trebuchet MS", "Segoe UI", sans-serif; font-size: 15px; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.topbar { height: 72px; background: var(--paper); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 max(20px, calc((100vw - 1320px)/2)); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; background: var(--ink); color: var(--accent); font-weight: 900; border-radius: 10px 10px 10px 3px; letter-spacing: -.05em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.top-actions { display: flex; gap: 8px; }
.button { border: 1px solid var(--line); min-height: 44px; padding: 0 17px; border-radius: 9px; background: var(--paper); color: var(--ink); font-weight: 700; }
.button:hover { transform: translateY(-1px); }
.button.dark { background: var(--ink); border-color: var(--ink); color: white; }
.button.primary { background: var(--accent); border-color: var(--accent); color: #2d2105; }
.button.full { width: 100%; }
.shell { max-width: 1320px; margin: 0 auto; padding: 44px 20px 90px; display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px; align-items: start; }
.workspace { min-width: 0; }
.intro { margin: 0 0 26px; max-width: 700px; }
.eyebrow { font: 800 12px/1.2 ui-monospace, monospace; letter-spacing: .13em; color: var(--accent-dark); margin: 0 0 10px; }
h1 { font-family: Georgia, serif; font-size: clamp(32px, 5vw, 52px); line-height: 1.03; letter-spacing: -.035em; margin: 0 0 12px; }
.intro > p:last-child { color: var(--muted); font-size: 17px; line-height: 1.55; margin: 0; }
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; margin-bottom: 16px; box-shadow: 0 1px 0 rgba(255,255,255,.8) inset; }
.product-panel { padding: 18px 24px; }
.product-panel label { display: grid; grid-template-columns: 150px 1fr; align-items: center; gap: 16px; font-weight: 800; }
.product-name { font-size: 17px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 6px; }
.section-heading > div { display: flex; align-items: center; gap: 10px; }
h2 { font-size: 20px; margin: 0; letter-spacing: -.02em; }
.step { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; font: 800 11px/1 ui-monospace, monospace; }
.step.neutral { background: #e7e4db; }
.text-button { border: 0; background: none; color: var(--accent-dark); font-weight: 800; min-height: 44px; padding: 0 4px; }
.text-button:hover { text-decoration: underline; }
.hint { color: var(--muted); margin: 4px 0 18px 40px; font-size: 13px; }
.rows { display: grid; gap: 9px; }
.row { display: grid; gap: 10px; align-items: end; border-top: 1px solid var(--line); padding-top: 13px; }
.filament-row { grid-template-columns: 1.3fr repeat(3, minmax(105px, .72fr)) 90px 36px; }
.accessory-row { grid-template-columns: 1.8fr minmax(100px,.6fr) minmax(120px,.8fr) 90px 36px; }
.row label, .field-grid label { position: relative; display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.row label span, .field-grid label span { position: absolute; right: 10px; bottom: 13px; color: var(--muted); font-size: 11px; pointer-events: none; }
.input { border: 1px solid #c9c6bb; background: white; color: var(--ink); min-height: 44px; width: 100%; border-radius: 8px; padding: 9px 12px; outline: none; }
label span + .input { padding-right: 38px; }
.input:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 3px rgba(244,185,66,.25); }
.row-total { min-height: 44px; display: flex; align-items: center; justify-content: flex-end; font-weight: 900; font-variant-numeric: tabular-nums; }
.remove { width: 36px; height: 44px; border: 0; border-radius: 8px; color: var(--muted); background: transparent; font-size: 24px; }
.remove:hover { background: #f7e6e2; color: var(--danger); }
.field-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 13px; margin-top: 18px; }
.price-grid { grid-template-columns: repeat(4, 1fr); }
.presets { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 8px; }
.chip { min-height: 38px; border: 1px solid var(--line); background: #f7f5ee; border-radius: 999px; padding: 0 14px; color: var(--muted); font-weight: 700; }
.chip.active { background: var(--ink); color: white; border-color: var(--ink); }
.error { color: var(--danger); font-weight: 700; margin: 14px 0 0; }
.summary { position: sticky; top: 96px; background: var(--ink); color: white; border-radius: 18px; padding: 28px; box-shadow: var(--shadow); overflow: hidden; }
.summary::before { content: ""; position: absolute; width: 170px; height: 170px; background: var(--accent); border-radius: 50%; top: -115px; right: -55px; opacity: .95; }
.summary-label { color: #b8b9b3; font: 800 11px/1 ui-monospace, monospace; letter-spacing: .13em; }
.suggested-price { font: 700 clamp(43px, 5vw, 62px)/1 Georgia, serif; letter-spacing: -.045em; margin: 12px 0; font-variant-numeric: tabular-nums; }
.summary-note { color: #b8b9b3; line-height: 1.45; font-size: 13px; margin: 0 0 24px; }
.summary-lines { border-top: 1px solid #373933; padding-top: 15px; }
.summary-lines div, .cost-total { display: flex; justify-content: space-between; gap: 15px; padding: 8px 0; }
.summary-lines span { color: #b8b9b3; }
.summary-lines strong, .cost-total strong { font-variant-numeric: tabular-nums; }
.cost-total { border-top: 1px solid #4b4d46; margin-top: 10px; padding: 17px 0; font-size: 17px; }
.profit-box { background: #272922; border: 1px solid #41443b; border-radius: 10px; padding: 16px; display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; margin: 4px 0 18px; }
.profit-box span { color: #c8c9c3; }
.profit-box strong { color: #8fe1b9; font-size: 19px; }
.profit-box small { color: #8e9089; grid-column: 1 / -1; }
.privacy { text-align: center; color: #8e9089; font-size: 11px; margin: 12px 0 0; }
.history-list { display: grid; gap: 8px; margin-top: 16px; }
.empty { color: var(--muted); margin: 4px 0; }
.history-item { border-top: 1px solid var(--line); padding: 13px 0 4px; display: grid; grid-template-columns: minmax(0,1fr) auto auto; align-items: center; gap: 12px; }
.history-item strong, .history-item small { display: block; }
.history-item small { color: var(--muted); margin-top: 4px; }
.history-item .history-price { font: 700 20px/1 Georgia, serif; }
.history-item button { border: 0; background: none; color: var(--accent-dark); font-weight: 700; min-height: 40px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--ink); color: white; padding: 12px 18px; border-radius: 9px; box-shadow: var(--shadow); opacity: 0; pointer-events: none; transition: .2s ease; z-index: 50; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 980px) {
  .shell { grid-template-columns: 1fr; }
  .summary { position: relative; top: 0; grid-row: 1; }
  .workspace { grid-row: 2; }
  .filament-row { grid-template-columns: repeat(2, 1fr); padding-bottom: 12px; }
  .filament-row .row-total { justify-content: flex-start; }
  .accessory-row { grid-template-columns: repeat(2, 1fr); padding-bottom: 12px; }
  .field-grid, .price-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .topbar { height: 64px; padding: 0 14px; }
  .brand small, .button.ghost { display: none; }
  .button { padding: 0 12px; }
  .shell { padding: 24px 12px 70px; }
  .intro { margin-bottom: 18px; }
  .panel, .summary { border-radius: 12px; padding: 18px; }
  .product-panel label { grid-template-columns: 1fr; gap: 8px; }
  .section-heading { align-items: flex-start; }
  .hint { margin-left: 0; }
  .filament-row, .accessory-row, .field-grid, .price-grid { grid-template-columns: 1fr 1fr; }
  .filament-row label:first-child, .accessory-row .wide { grid-column: 1 / -1; }
  .row-total { justify-content: flex-start; }
  .history-item { grid-template-columns: 1fr auto; }
  .history-item button { grid-column: 1 / -1; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }

.topbar-right { display: flex; align-items: center; gap: 20px; }
.top-nav { display: flex; align-items: center; gap: 4px; }
.nav-link { min-height: 38px; display: inline-flex; align-items: center; padding: 0 10px; border-radius: 8px; color: var(--muted); text-decoration: none; font-size: 13px; font-weight: 800; }
.nav-link:hover { color: var(--ink); background: #f4f2ea; }
.nav-link.active { color: var(--ink); background: #ece9df; }
.measure-shell { align-items: stretch; }
.measure-panel { min-height: 358px; }
.axis-inputs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.axis-field { min-height: 210px; border: 1px solid var(--line); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 7px; background: #fcfbf7; }
.axis-field strong { font-size: 18px; }
.axis-field small { min-height: 34px; color: var(--muted); line-height: 1.35; }
.axis-tag { width: 35px; height: 35px; display: grid; place-items: center; border-radius: 9px; background: #f7d8d8; color: #b42318; font: 900 15px/1 ui-monospace, monospace; }
.axis-y-field .axis-tag, .axis-y-tag { background: #d9f0df; color: #18794e; }
.axis-z-field .axis-tag, .axis-z-tag { background: #e0e6fb; color: #3247a8; }
.unit-input { position: relative; display: block; margin-top: auto; }
.unit-input input { padding-right: 44px; font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.unit-input b { position: absolute; right: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 12px; pointer-events: none; }
.measure-summary { display: flex; flex-direction: column; }
.dimension-readout { font: 700 clamp(31px, 4vw, 46px)/1.08 Georgia, serif; letter-spacing: -.045em; margin: 13px 0; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.measure-results { border-top: 1px solid #373933; margin: 0 0 18px; padding-top: 10px; }
.measure-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 0; border-bottom: 1px solid #373933; }
.measure-result span { display: flex; align-items: center; gap: 8px; color: #c8c9c3; }
.measure-result span b { display: grid; width: 23px; height: 23px; place-items: center; border-radius: 6px; background: #662529; color: #ffd6d6; font: 900 12px/1 ui-monospace, monospace; }
.axis-y-result span b { background: #245d3d; color: #cef8d9; }
.axis-z-result span b { background: #2e3d80; color: #d9e1ff; }
.measure-result strong { font-size: 18px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.measure-summary .privacy { margin-top: 12px; }
.measure-guide { max-width: 1280px; padding: 0 20px 86px; margin: 0 auto; }
.measure-guide > h2 { margin: 0 0 16px; font-family: Georgia, serif; font-size: 30px; }
.axis-guide-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.axis-guide-grid article { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 20px; }
.axis-guide-grid h3 { margin: 14px 0 6px; font-size: 18px; }
.axis-guide-grid p { color: var(--muted); line-height: 1.45; margin: 0; }
@media (max-width: 980px) { .axis-inputs, .axis-guide-grid { grid-template-columns: 1fr; } .axis-field { min-height: 0; } }
@media (max-width: 600px) { .topbar-right { gap: 6px; } .top-nav { gap: 0; } .nav-link { padding: 0 7px; font-size: 12px; } .top-actions .button.dark { padding: 0 10px; } .axis-inputs { gap: 10px; } .axis-field { padding: 15px; } .measure-guide { padding: 0 12px 70px; } }

.side-visual { margin: 4px 0 18px; }
.side-visual-title { display: flex; align-items: center; gap: 9px; }
.side-visual-title .step { width: 27px; height: 27px; font-size: 10px; background: #41443b; color: #f2f0e9; }
.side-visual-title h2 { color: white; font-size: 16px; }
.dimension-visual { min-height: 198px; margin-top: 10px; border: 1px solid #4b4d46; border-radius: 10px; background: linear-gradient(140deg, #f8f6ee 0%, #e8e4d6 100%); overflow: hidden; }
.dimension-visual svg { display: block; width: 100%; max-height: 215px; }
.box-front { fill: #f6cf67; stroke: #8b6200; stroke-width: 2; transition: all .22s ease; }
.box-top { fill: #ffe5a0; stroke: #8b6200; stroke-width: 2; transition: all .22s ease; }
.box-side { fill: #dfaf36; stroke: #8b6200; stroke-width: 2; transition: all .22s ease; }
.diagram-axis { fill: none; stroke-width: 2.5; stroke-linecap: round; transition: all .22s ease; }
.axis-x-line { stroke: #c73838; }
.axis-y-line { stroke: #18794e; }
.axis-z-line { stroke: #3247a8; }
.diagram-label { font: 800 12px/1.1 "Trebuchet MS", "Segoe UI", sans-serif; transition: all .22s ease; }
.axis-x-text { fill: #a61d24; }
.axis-y-text { fill: #14653f; }
.axis-z-text { fill: #283b90; }
.diagram-empty { fill: var(--muted); font: 800 14px/1.2 "Trebuchet MS", "Segoe UI", sans-serif; }
@media (max-width: 600px) { .visual-panel { min-height: 0; } .dimension-visual { min-height: 250px; } }

