:root {
  --ink: #0b1830;
  --muted: #5c6b80;
  --paper: #f8fafc;
  --sheet: #fffdf7;
  --line: #d9e0e8;
  --blue: #0f3f82;
  --blue-deep: #082b5e;
  --blue-soft: #dce9f7;
  --cut: #e4552d;
  --crease: #2678c9;
  --board: #f3e4bd;
  --green: #65d69e;
  --shadow: 0 24px 70px rgba(5, 28, 62, .18);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #cdd8e5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.34) 25%, transparent 25%) 0 0/22px 22px,
    #cdd8e5;
}

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

.app-shell {
  width: min(1540px, calc(100% - 36px));
  margin: 18px auto;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.topbar {
  height: 68px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(248,250,252,.95);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: var(--ink);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: .12em;
}

.brand-mark { display: flex; gap: 2px; align-items: flex-end; height: 22px; }
.brand-mark i { width: 5px; background: var(--cut); display: block; transform: skewY(-28deg); }
.brand-mark i:nth-child(1) { height: 13px; }
.brand-mark i:nth-child(2) { height: 22px; }
.brand-mark i:nth-child(3) { height: 17px; }

.status-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font: 700 12px/1 "SFMono-Regular", Consolas, monospace;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(101,214,158,.18); }
.quiet-button { justify-self: end; border: 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 650; padding: 10px 0 10px 16px; }
.quiet-button:hover { color: var(--blue); }
.topbar-actions { justify-self: end; display: flex; align-items: center; gap: 14px; }
.font-switcher { display: flex; padding: 2px; background: #e1e7ed; }
.font-switcher button { min-width: 34px; border: 0; padding: 7px 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 750; }
.font-switcher button.active { background: white; color: var(--blue); box-shadow: 0 1px 5px rgba(17,49,87,.12); }
.font-switcher button:focus-visible { outline: 2px solid var(--cut); outline-offset: 1px; }

.workspace { display: grid; grid-template-columns: 370px minmax(0, 1fr); min-height: 690px; }

.control-panel {
  padding: 34px 30px 28px;
  background: #f3f6f9;
  border-right: 1px solid var(--line);
  overflow: auto;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font: 800 12px/1.2 "SFMono-Regular", Consolas, monospace;
  letter-spacing: .14em;
  text-transform: uppercase;
}

h1 { margin: 0; font-size: clamp(28px, 2.1vw, 39px); line-height: 1.12; letter-spacing: -.045em; font-weight: 760; }
.intro { color: var(--muted); font-size: 15px; line-height: 1.7; margin: 15px 0 28px; }

fieldset { border: 0; padding: 20px 0; margin: 0; border-top: 1px solid var(--line); }
legend { width: 100%; padding: 0 0 13px; font-weight: 730; font-size: 15px; }
legend small { float: right; color: var(--muted); font: 600 12px/1 monospace; letter-spacing: .1em; }

.box-type-grid { display: grid; gap: 8px; }
.box-type-option { position: relative; min-height: 68px; display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; background: white; border: 1px solid var(--line); }
.box-type-option.active { border-color: var(--blue); box-shadow: inset 3px 0 0 var(--blue); }
.box-type-option input { position: absolute; opacity: 0; }
.box-type-option:has(input:focus-visible) { outline: 2px solid var(--cut); outline-offset: 2px; }
.box-type-option.disabled { opacity: .58; }
.box-type-sketch { height: 42px; display: flex; align-items: center; justify-content: center; }
.box-type-sketch i { display: block; width: 12px; height: 25px; border: 1px solid var(--blue); border-right: 0; background: var(--blue-soft); }
.box-type-sketch i:first-child, .box-type-sketch i:nth-child(3) { width: 17px; }
.box-type-sketch i:last-child { border-right: 1px solid var(--blue); }
.box-type-sketch.compact i { width: 14px; height: 22px; }
.box-type-copy b, .box-type-copy small { display: block; }
.box-type-copy b { font: 800 16px/1.2 "SFMono-Regular", Consolas, monospace; }
.box-type-copy small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.box-type-option em { color: var(--blue); font: normal 800 11px/1 monospace; }
.box-type-option.disabled em { color: var(--muted); }

.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 3px; background: #e1e7ed; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; text-align: center; padding: 10px; color: var(--muted); font-size: 14px; font-weight: 700; transition: .18s ease; }
.segmented input:checked + span { background: white; color: var(--blue); box-shadow: 0 2px 8px rgba(17,49,87,.1); }
.segmented input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 1px; }
.field-note { margin: 9px 0 0; color: #66758a; font-size: 12px; line-height: 1.5; }

.dimensions-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.dimensions-grid label { display: block; background: white; border: 1px solid var(--line); padding: 9px 10px 7px; }
.dimensions-grid label:focus-within { border-color: var(--blue); box-shadow: 0 0 0 2px rgba(15,63,130,.1); }
.dimensions-grid span { display: flex; align-items: baseline; gap: 5px; color: var(--muted); font-size: 12px; }
.dimensions-grid b { color: var(--cut); font: 800 15px/1 monospace; }
.dimensions-grid input { width: 100%; border: 0; outline: 0; padding: 4px 0 0; background: transparent; color: var(--ink); font: 700 19px/1.2 "SFMono-Regular", Consolas, monospace; }
.error-message { color: #b83522; font-size: 13px; min-height: 16px; margin: 7px 0 0; }
.area-card { display: grid; grid-template-columns: 1fr auto; gap: 5px 12px; margin-top: 6px; padding: 13px 14px; background: var(--ink); color: white; }
.area-card > span { align-self: center; font-size: 13px; font-weight: 700; }
.area-card > strong { color: var(--green); font: 800 21px/1 "SFMono-Regular", Consolas, monospace; }
.area-card > code { grid-column: 1 / -1; color: #b9d7f3; font-size: 11px; line-height: 1.5; }
.area-card > small { grid-column: 1 / -1; color: #93a7be; font-size: 10px; line-height: 1.45; }
.adjustment-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; padding: 10px 12px; background: white; border: 1px solid var(--line); }
.adjustment-field > span:first-child { color: var(--muted); font-size: 12px; }
.adjustment-field b { margin-right: 4px; color: var(--cut); font-family: monospace; }
.adjustment-input { display: flex; align-items: center; gap: 5px; }
.adjustment-input input { width: 68px; border: 0; border-bottom: 1px solid var(--line); outline: 0; color: var(--ink); text-align: right; font: 750 15px/1.2 monospace; }
.adjustment-input input:focus { border-color: var(--blue); }
.adjustment-input i { color: var(--muted); font: normal 11px/1 monospace; }

.material-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.material-option input { position: absolute; opacity: 0; }
.material-option span { display: grid; place-items: center; height: 46px; background: white; border: 1px solid var(--line); font: 750 15px/1 monospace; transition: .16s ease; }
.material-option input:checked + span { border-color: var(--blue); color: white; background: var(--blue); }
.material-option input:focus-visible + span { outline: 2px solid var(--cut); outline-offset: 2px; }
.material-readout { display: flex; justify-content: space-between; margin-top: 10px; color: var(--muted); font-size: 12px; }
.material-readout strong { color: var(--ink); font-family: monospace; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.upload-button { display: grid; grid-template-columns: 34px 1fr; column-gap: 10px; padding: 11px; border: 1px dashed #b8c1cc; border-radius: 10px; background: #fafbfc; cursor: pointer; }
.upload-button:hover { border-color: var(--blue); background: #f5f9ff; }
.upload-button > span { grid-row: 1 / 3; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); font-size: 21px; }
.upload-button strong { align-self: end; font-size: 12px; }
.upload-button small { align-self: start; margin-top: 2px; color: var(--muted); font-size: 9px; }
.artwork-list { display: grid; gap: 6px; margin-top: 8px; }
.artwork-item { display: grid; grid-template-columns: 34px minmax(0,1fr) 26px; align-items: center; gap: 8px; padding: 5px 6px; border: 1px solid var(--line); border-radius: 8px; }
.artwork-item img { width: 34px; height: 28px; object-fit: contain; background: #f1f2f4; border-radius: 4px; }
.artwork-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #4b5058; font-size: 10px; }
.artwork-item button { width: 24px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: #8b9097; font-size: 16px; }
.artwork-item button:hover { background: #fff0f0; color: #d63c42; }

.assumption-card { display: flex; gap: 13px; margin-top: 12px; padding: 14px; background: var(--blue-soft); border-left: 3px solid var(--blue); }
.assumption-icon { flex: 0 0 28px; width: 28px; height: 28px; display: grid; place-items: center; background: var(--blue); color: white; font: 700 15px/1 Georgia, serif; }
.assumption-card strong { display: block; font-size: 13px; }
.assumption-card code { display: block; margin: 6px 0; color: var(--blue); font-size: 13px; }
.assumption-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }

.drawing-stage { min-width: 0; display: grid; grid-template-rows: auto minmax(470px, 1fr) auto; background: var(--blue-deep); }
.drawing-toolbar { min-height: 92px; padding: 20px 24px; display: flex; justify-content: space-between; align-items: center; gap: 20px; color: white; }
.drawing-toolbar .eyebrow { color: #7eb6ef; margin-bottom: 6px; }
.drawing-toolbar h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.toolbar-actions { display: flex; gap: 8px; }
.tool-button { border: 1px solid rgba(255,255,255,.23); background: transparent; color: #d8e8fa; padding: 10px 13px; font-size: 13px; font-weight: 700; }
.tool-button:hover { border-color: white; color: white; }
.tool-button.primary { color: var(--blue-deep); background: white; border-color: white; }

.canvas-wrap { position: relative; overflow: hidden; margin: 0 24px; background: #092754; border: 1px solid rgba(255,255,255,.1); touch-action: none; }
.canvas-grid { position: absolute; inset: 0; opacity: .3; background-image: linear-gradient(rgba(104,169,234,.16) 1px, transparent 1px), linear-gradient(90deg, rgba(104,169,234,.16) 1px, transparent 1px); background-size: 24px 24px; }
#drawing { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
#viewport { transform-origin: 0 0; }
.sheet-face { fill: var(--board); fill-opacity: .95; }
.sheet-face.alt { fill: #f7eccf; }
.cut-line { fill: none; stroke: var(--cut); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linecap: square; stroke-linejoin: miter; }
.crease-line { fill: none; stroke: var(--crease); stroke-width: 1.5; stroke-dasharray: 8 5; vector-effect: non-scaling-stroke; }
.face-label { fill: #132c4c; font: 700 16px/1 "SFMono-Regular", Consolas, monospace; text-anchor: middle; dominant-baseline: middle; pointer-events: none; }
.face-label.sub { fill: #53657b; font-size: 11px; letter-spacing: .06em; }
.dimension-line { stroke: #8ca8c7; stroke-width: 1; vector-effect: non-scaling-stroke; }
.dimension-text { fill: #d8e9f9; font: 700 13px/1 monospace; text-anchor: middle; }
.panel-dimension { fill: none; stroke: #163e6d; stroke-width: 1.25; vector-effect: non-scaling-stroke; marker-start: url(#arrowStart); marker-end: url(#arrowEnd); }
.panel-dimension-text { fill: #102e52; paint-order: stroke; stroke: var(--board); stroke-width: 5px; stroke-linejoin: round; font: 800 13px/1 "SFMono-Regular", Consolas, monospace; text-anchor: middle; dominant-baseline: middle; }
.total-dimension { marker-start: url(#arrowStartLight); marker-end: url(#arrowEndLight); }
.zoom-readout { position: absolute; right: 12px; bottom: 12px; color: #b9d7f3; background: rgba(5,29,62,.78); border: 1px solid rgba(255,255,255,.13); padding: 7px 9px; font: 700 12px/1 monospace; }

.drawing-footer { min-height: 65px; padding: 15px 24px; display: flex; justify-content: space-between; align-items: center; gap: 18px; color: #b9d0e7; }
.legend, .metrics { display: flex; flex-wrap: wrap; gap: 18px; font: 650 12px/1.2 monospace; letter-spacing: .03em; }
.legend span { display: flex; align-items: center; gap: 7px; }
.legend i { display: block; width: 22px; }
.cut-swatch { border-top: 2px solid var(--cut); }
.crease-swatch { border-top: 2px dashed #5fa7ee; }
.face-swatch { height: 9px; background: var(--board); }
.metrics strong { color: white; margin-left: 5px; }

.lead-strip { display: flex; align-items: center; justify-content: space-between; gap: 30px; padding: 30px 38px; background: var(--cut); color: white; }
.lead-strip .eyebrow { color: #5c1e0e; }
.lead-strip h2 { margin: 0 0 7px; font-size: 22px; letter-spacing: -.03em; }
.lead-strip p:not(.eyebrow) { margin: 0; color: #ffe1d9; font-size: 14px; }
.lead-button { flex: 0 0 auto; border: 0; background: var(--ink); color: white; padding: 15px 18px; font-weight: 750; font-size: 14px; }
.lead-button span { margin-left: 20px; }

.toast { position: fixed; z-index: 5; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 13px 17px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 14px; transition: .2s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* User-selectable reading size. Geometry coordinates and physical dimensions do not change. */
body[data-font-size="small"] .control-panel,
body[data-font-size="small"] .drawing-toolbar,
body[data-font-size="small"] .drawing-footer,
body[data-font-size="small"] .lead-strip { font-size: 13px; }
body[data-font-size="small"] .intro { font-size: 13px; }
body[data-font-size="small"] legend { font-size: 13px; }
body[data-font-size="small"] .field-note,
body[data-font-size="small"] .assumption-card p,
body[data-font-size="small"] .material-readout { font-size: 10px; }

body[data-font-size="large"] .control-panel,
body[data-font-size="large"] .drawing-toolbar,
body[data-font-size="large"] .drawing-footer,
body[data-font-size="large"] .lead-strip { font-size: 18px; }
body[data-font-size="large"] .intro { font-size: 18px; }
body[data-font-size="large"] legend { font-size: 18px; }
body[data-font-size="large"] .field-note,
body[data-font-size="large"] .assumption-card p,
body[data-font-size="large"] .material-readout { font-size: 15px; }
body[data-font-size="large"] .segmented span,
body[data-font-size="large"] .tool-button,
body[data-font-size="large"] .lead-button { font-size: 16px; }
body[data-font-size="large"] .box-type-copy small,
body[data-font-size="large"] .area-card > span { font-size: 15px; }
body[data-font-size="large"] .area-card > code { font-size: 13px; }
body[data-font-size="large"] .area-card > small { font-size: 12px; }
body[data-font-size="large"] .adjustment-field > span:first-child { font-size: 15px; }

@media (max-width: 940px) {
  .app-shell { width: 100%; margin: 0; }
  .workspace { grid-template-columns: 1fr; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .drawing-stage { min-height: 670px; }
  .topbar { grid-template-columns: 1fr auto; }
  .status-strip { display: none; }
}

@media (max-width: 620px) {
  .topbar { padding: 0 18px; }
  .font-switcher button { min-width: 28px; padding: 7px 5px; }
  .quiet-button { display: none; }
  .control-panel { padding: 28px 20px; }
  .drawing-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; overflow-x: auto; }
  .tool-button { white-space: nowrap; }
  .canvas-wrap { margin: 0 12px; }
  .drawing-footer { align-items: flex-start; flex-direction: column; }
  .lead-strip { align-items: stretch; flex-direction: column; padding: 28px 22px; }
  .lead-button { width: 100%; }
}

@media print {
  body { background: white; }
  .app-shell { width: 100%; margin: 0; box-shadow: none; }
  .topbar, .control-panel, .drawing-toolbar, .lead-strip, .zoom-readout { display: none !important; }
  .workspace { display: block; }
  .drawing-stage { display: block; background: white; }
  .canvas-wrap { margin: 0; height: 180mm; background: white; border: 0; }
  .canvas-grid { display: none; }
  .drawing-footer { color: var(--ink); }
  .metrics strong { color: var(--ink); }
  .dimension-text { fill: var(--ink); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

/* ─────────────────────────────────────────────────────────────
   Light drafting workbench
   The interface borrows the clarity of packaging CAD tools while
   keeping ZWPACK's own inputs, calculation cards and conversion flow.
   ───────────────────────────────────────────────────────────── */
:root {
  --ink: #171a20;
  --muted: #6e737c;
  --paper: #f1f2f4;
  --sheet: #ffffff;
  --line: #e6e7e9;
  --blue: #0878ff;
  --blue-deep: #17214f;
  --blue-soft: #eaf3ff;
  --cut: #182052;
  --crease: #ff535a;
  --board: #ffffff;
  --green: #31bd35;
  --shadow: 0 10px 32px rgba(19, 25, 38, .09);
}

body { background: #eceeef; overflow: hidden; }
.app-shell { width: 100%; height: 100vh; margin: 0; background: #eceeef; box-shadow: none; overflow: hidden; }
.topbar { height: 58px; grid-template-columns: 1fr auto 1fr; padding: 0 24px; border: 0; background: rgba(255,255,255,.94); }
.brand { font-size: 15px; }
.status-strip { color: #717780; }
.topbar-actions { gap: 10px; }
.font-switcher { border: 1px solid #e1e3e6; border-radius: 8px; background: #f3f4f6; }
.font-switcher button { border-radius: 6px; }
.quiet-button { font-size: 12px; }

.workspace { height: calc(100vh - 58px); min-height: 0; grid-template-columns: 360px minmax(0,1fr); gap: 14px; padding: 12px; }
.control-panel { position: relative; z-index: 3; padding: 24px 22px 36px; border: 0; border-radius: 18px; background: white; box-shadow: var(--shadow); scrollbar-width: thin; }
.panel-heading { padding-bottom: 10px; }
.panel-heading .eyebrow { margin-bottom: 7px; color: var(--blue); }
h1 { font-size: 21px; line-height: 1.25; letter-spacing: -.025em; }
.intro { margin: 7px 0 10px; font-size: 13px; line-height: 1.5; }
fieldset { padding: 17px 0; }
legend { padding-bottom: 11px; font-size: 14px; }

.box-type-grid { gap: 6px; }
.box-type-option { min-height: 58px; grid-template-columns: 48px 1fr auto; border-radius: 10px; padding: 8px 10px; }
.box-type-option.active { border: 1.5px solid var(--blue); box-shadow: none; }
.box-type-sketch { height: 34px; }
.box-type-sketch i { height: 20px; }
.box-type-copy b { font-size: 14px; }
.box-type-copy small { font-size: 11px; }
.box-type-option.disabled { display: none; }
.box-type-option:has(input:checked) { border: 1.5px solid var(--blue); box-shadow: none; }
.box-type-option:has(input:checked) em { color: var(--blue); }
.flip-sketch { position: relative; gap: 2px; }
.flip-sketch i { width: 11px !important; height: 22px !important; border: 1px solid var(--blue) !important; background: #f2f7ff; }
.flip-sketch i:nth-child(2) { height: 31px !important; border-radius: 7px 7px 0 0; }
body[data-box-type="double-lock-inner"] .field-0201-only { display: none !important; }

.segmented { border-radius: 8px; background: #f0f1f3; }
.segmented span { border-radius: 6px; padding: 8px; font-size: 13px; }
.dimensions-grid { gap: 8px; }
.dimensions-grid label { border-color: #cfd2d6; border-radius: 9px; padding: 8px 11px; }
.dimensions-grid input { font-size: 17px; }
.field-note { font-size: 11px; }
.area-card { border-radius: 10px; background: #f5f8fb; color: var(--ink); border: 1px solid #e2e8ef; }
.area-card > strong { color: var(--blue); font-size: 19px; }
.area-card > code { color: #50657b; }
.area-card > small { color: #87919d; }
.adjustment-field { border-radius: 9px; }
.adjustment-field { min-height: 34px; margin-top: 7px; padding: 5px 9px; }
.adjustment-field > span:first-child { font-size: 11px; }
.adjustment-input input { width: 56px; font-size: 13px; }
.adjustment-input i { font-size: 10px; }
.material-option span { height: 40px; border-radius: 8px; }
.material-option input:checked + span { border-color: var(--blue); background: var(--blue); }
.assumption-card { border: 1px solid #dbe8f7; border-left: 3px solid var(--blue); border-radius: 9px; background: #f5f9ff; }
.assumption-icon { border-radius: 6px; background: var(--blue); }

.drawing-stage { position: relative; display: block; min-width: 0; min-height: 0; border-radius: 18px; background: #f1f2f3; overflow: hidden; }
.drawing-toolbar { position: absolute; inset: 0 0 auto 0; z-index: 4; min-height: 96px; padding: 20px 24px; color: var(--ink); pointer-events: none; }
.drawing-toolbar > div:first-child { pointer-events: auto; }
.canvas-legend { display: flex; align-items: center; gap: 22px; color: #646a73; font-size: 12px; }
.canvas-legend span { display: inline-flex; align-items: center; gap: 7px; }
.canvas-legend i { display: block; width: 28px; border-top: 2px solid; }
.canvas-legend .legend-cut { border-color: var(--cut); }
.canvas-legend .legend-crease { border-color: var(--crease); border-top-style: dashed; }
.canvas-legend .legend-dimension { border-color: var(--blue); }
.canvas-meta-label { margin: 13px 0 3px; color: #8a8f96; font-size: 11px; }
.canvas-meta-value { color: #3c4148; font: 700 12px/1.3 "SFMono-Regular", Consolas, monospace; }

.canvas-wrap { position: absolute; inset: 0; margin: 0; border: 0; background: transparent; }
.canvas-grid { display: none; }
.sheet-face, .sheet-face.alt { fill: white; fill-opacity: 1; }
.cut-line { stroke: var(--cut); stroke-width: 1.8; }
.crease-line { stroke: var(--crease); stroke-width: 1.45; stroke-dasharray: 4 3; }
.panel-dimension { stroke: var(--blue); stroke-width: 1.5; }
.panel-dimension-text { fill: var(--blue); stroke: white; stroke-width: 6px; font-size: 13px; }
.dimension-line { stroke: #858990; stroke-width: 1; }
.dimension-text { fill: #4f5359; font-size: 12px; stroke: #f1f2f3; stroke-width: 5px; paint-order: stroke; }
.panel-dimension-text, .dimension-text, .face-label { vector-effect: non-scaling-stroke; }
.face-label { display: none; fill: #566273; font-size: 13px; }
.face-label.sub { font-size: 9px; }
.artwork-image { pointer-events: all; cursor: grab; }
.artwork-image.dragging { cursor: grabbing; opacity: .86; }
.artwork-selection { fill: none; stroke: var(--blue); stroke-width: 1.4; stroke-dasharray: 5 3; vector-effect: non-scaling-stroke; pointer-events: none; }
.slot-line { stroke-linecap: round; stroke-linejoin: round; }
#viewport.show-face-names .face-label { display: block; }
#viewport.hide-overall-dimensions .total-dimension,
#viewport.hide-overall-dimensions .dimension-text { display: none; }
#viewport.hide-basic-dimensions .panel-dimension,
#viewport.hide-basic-dimensions .panel-dimension-text { display: none; }

.toolbar-actions { position: fixed; z-index: 7; left: calc(360px + (100vw - 384px) / 2); bottom: 22px; transform: translateX(-50%); display: flex; align-items: center; gap: 4px; padding: 7px; border-radius: 12px; background: white; box-shadow: 0 7px 25px rgba(29,34,45,.14); pointer-events: auto; }
.tool-button, .tool-button.primary { min-width: 42px; height: 36px; border: 0; border-radius: 8px; padding: 0 10px; background: white; color: #282c32; font-size: 12px; }
.tool-button:hover, .tool-button.primary:hover { background: #f0f2f4; color: var(--blue); }
.icon-tool { font-size: 19px; }
.toolbar-separator { width: 1px; height: 22px; margin: 0 3px; background: #e3e4e6; }
.zoom-readout { right: 18px; bottom: 18px; border: 0; border-radius: 8px; background: white; color: #61666e; box-shadow: var(--shadow); font-size: 11px; }
.display-settings { position: absolute; z-index: 8; right: 28px; bottom: 78px; width: 176px; padding: 12px; border-radius: 12px; background: white; box-shadow: 0 8px 28px rgba(25,31,42,.16); }
.display-settings[hidden] { display: none; }
.display-settings label { display: flex; align-items: center; gap: 9px; padding: 8px 4px; color: #42464d; font-size: 12px; }
.display-settings input { position: absolute; opacity: 0; }
.display-settings label span { position: relative; width: 27px; height: 16px; border-radius: 99px; background: #c9cdd2; transition: .15s ease; }
.display-settings label span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%; background: white; transition: .15s ease; }
.display-settings input:checked + span { background: var(--blue); }
.display-settings input:checked + span::after { transform: translateX(11px); }
.display-settings input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

.drawing-footer { position: absolute; z-index: 3; right: 22px; top: 20px; display: block; min-height: 0; padding: 0; color: var(--muted); pointer-events: none; }
.drawing-footer .legend { display: none; }
.metrics { display: grid; gap: 5px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,.84); box-shadow: 0 3px 12px rgba(30,35,45,.06); font-size: 11px; }
.metrics strong { color: var(--ink); }
.lead-strip { display: none; }
.toast { border-radius: 9px; background: #242931; }

@media (max-width: 920px) {
  body { overflow: auto; }
  .app-shell { height: auto; min-height: 100vh; }
  .workspace { height: auto; grid-template-columns: 1fr; padding: 8px; }
  .control-panel { max-height: none; }
  .drawing-stage { height: 620px; }
  .toolbar-actions { position: absolute; left: 50%; }
}

@media (max-width: 620px) {
  .topbar { padding: 0 14px; }
  .workspace { gap: 8px; }
  .control-panel { padding: 20px 17px 28px; border-radius: 14px; }
  .drawing-stage { height: 520px; border-radius: 14px; }
  .drawing-toolbar { padding: 16px; }
  .drawing-footer { top: auto; right: 14px; bottom: 66px; }
  .display-settings { right: 14px; bottom: 68px; }
}

@media print {
  body, .app-shell, .drawing-stage, .canvas-wrap { background: white !important; overflow: visible; }
  .app-shell { width: 100%; height: auto; }
  .topbar, .control-panel, .drawing-toolbar, .drawing-footer, .lead-strip,
  .zoom-readout, .display-settings, .toolbar-actions { display: none !important; }
  .workspace { display: block; height: auto; padding: 0; }
  .drawing-stage { display: block; height: 190mm; border-radius: 0; }
  .canvas-wrap { position: relative; inset: auto; width: 100%; height: 190mm; }
  .dimension-text { stroke: white; }
}
