:root {
  color-scheme: light;
  --ink: #142322;
  --ink-soft: #435451;
  --muted: #73817e;
  --paper: #fffdf9;
  --panel: #ffffff;
  --wash: #eef1eb;
  --line: #dbe1db;
  --line-strong: #c6d0c8;
  --teal: #0b756d;
  --teal-dark: #075a54;
  --teal-pale: #dff1ed;
  --coral: #ee6c4d;
  --coral-pale: #fff0ea;
  --blueprint: #295e88;
  --shadow: 0 18px 50px rgba(20, 35, 34, 0.09);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--wash);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid rgba(11, 117, 109, 0.28);
  outline-offset: 2px;
}

.is-hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.topbar {
  height: 72px;
  padding: 0 28px;
  background: #102725;
  color: white;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid rgba(255,255,255,.2); border-radius: 11px; background: rgba(255,255,255,.07); }
.brand-mark svg { width: 24px; fill: none; stroke: #74d6c8; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.brand strong { display: block; font-size: 16px; letter-spacing: -.01em; }
.brand small { display: block; margin-top: 2px; color: #a9bfbb; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; }
.topbar-meta { display: flex; align-items: center; gap: 20px; }
.privacy-chip { display: inline-flex; align-items: center; gap: 8px; padding: 7px 11px; color: #c7dbd8; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; font-size: 12px; }
.privacy-chip i { width: 7px; height: 7px; border-radius: 50%; background: #58c9a9; box-shadow: 0 0 0 4px rgba(88,201,169,.12); }
.text-link { color: #c7dbd8; text-decoration: none; font-size: 12px; }
.text-link:hover { color: white; }

.app-shell { min-height: calc(100vh - 72px); display: grid; grid-template-columns: 330px minmax(0, 1fr); }
.control-panel { padding: 30px 24px 22px; background: var(--paper); border-right: 1px solid var(--line); overflow-y: auto; }
.panel-heading h1 { margin: 7px 0 8px; font-size: 25px; line-height: 1.1; letter-spacing: -.035em; }
.panel-heading p { margin: 0 0 22px; color: var(--muted); line-height: 1.55; }
.eyebrow { display: block; color: var(--teal); font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }

.dropzone {
  width: 100%;
  min-height: 188px;
  padding: 20px;
  border: 1.5px dashed #abc0b8;
  border-radius: var(--radius-md);
  background: #f8faf6;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .2s;
}
.dropzone:hover, .dropzone.is-dragging { border-color: var(--teal); background: var(--teal-pale); transform: translateY(-1px); }
.drop-icon { width: 45px; height: 45px; margin-bottom: 12px; display: grid; place-items: center; color: var(--teal); background: white; border: 1px solid #cde0da; border-radius: 13px; box-shadow: 0 7px 18px rgba(11,117,109,.08); }
.drop-icon svg { width: 23px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.dropzone strong { font-size: 14px; }
.dropzone > span:not(.drop-icon) { margin-top: 4px; color: var(--muted); font-size: 12px; }
.dropzone small { margin-top: 15px; color: #96a19e; font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }

.file-card { margin-top: 12px; padding: 11px; display: grid; grid-template-columns: 42px minmax(0, 1fr) 28px; align-items: center; gap: 10px; background: #f5f8f3; border: 1px solid var(--line); border-radius: 11px; }
.file-icon { width: 42px; height: 42px; display: grid; place-items: center; color: #a43b28; background: var(--coral-pale); border-radius: 8px; font-size: 10px; font-weight: 900; }
.file-copy { min-width: 0; }
.file-copy strong, .file-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-copy strong { font-size: 12px; }
.file-copy small { margin-top: 4px; color: var(--muted); font-size: 10px; }
.icon-button { width: 28px; height: 28px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; line-height: 1; }
.icon-button:hover { color: var(--ink); background: white; }

.settings-block { margin-top: 20px; }
.settings-block label, .section-label { display: block; margin-bottom: 8px; color: var(--ink-soft); font-size: 11px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 12px; top: 9px; color: var(--muted); pointer-events: none; }
.select-wrap select { width: 100%; height: 40px; padding: 0 34px 0 12px; appearance: none; color: var(--ink); background: white; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); }
.settings-block p { margin: 7px 0 0; color: var(--muted); font-size: 10px; line-height: 1.4; }

.primary-button, .secondary-button, .tertiary-button, .small-button { border: 0; cursor: pointer; font-weight: 750; }
.primary-button { width: 100%; height: 46px; margin-top: 18px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; color: white; background: var(--teal); border-radius: 11px; box-shadow: 0 9px 20px rgba(11,117,109,.2); transition: background .2s, transform .2s, opacity .2s; }
.primary-button:hover:not(:disabled) { background: var(--teal-dark); transform: translateY(-1px); }
.primary-button:disabled { cursor: not-allowed; opacity: .42; box-shadow: none; }
.primary-button svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.analysis-options, .export-block { margin-top: 25px; padding-top: 20px; border-top: 1px solid var(--line); }
.toggle-row { min-height: 38px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; }
.toggle-row > span { display: inline-flex; align-items: center; gap: 9px; color: var(--ink-soft); font-size: 12px; }
.legend-dot { width: 9px; height: 9px; border-radius: 3px; }
.line-dot { background: var(--blueprint); }
.text-dot { background: var(--coral); }
.bounds-dot { border: 1px dashed var(--teal); background: transparent; }
.toggle-row input { position: absolute; opacity: 0; }
.switch { position: relative; width: 34px; height: 19px; background: #ccd4cf; border-radius: 999px; transition: background .2s; }
.switch::after { content: ""; position: absolute; width: 15px; height: 15px; top: 2px; left: 2px; background: white; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,.22); transition: transform .2s; }
.toggle-row input:checked + .switch { background: var(--teal); }
.toggle-row input:checked + .switch::after { transform: translateX(15px); }
.button-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.secondary-button { min-height: 39px; color: var(--teal-dark); background: var(--teal-pale); border: 1px solid #c6e1da; border-radius: var(--radius-sm); font-size: 11px; }
.secondary-button:hover { background: #d2ebe5; }
.privacy-note { margin-top: 25px; padding: 13px; display: flex; gap: 10px; color: var(--muted); background: #f5f7f2; border-radius: 10px; }
.privacy-note svg { flex: 0 0 18px; width: 18px; fill: none; stroke: var(--teal); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.privacy-note p { margin: 0; font-size: 10px; line-height: 1.5; }
.privacy-note strong { color: var(--ink-soft); }

.workspace { min-width: 0; padding: 30px; overflow: hidden; }
.welcome-state { min-height: calc(100vh - 132px); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.welcome-visual { width: min(560px, 80%); margin-bottom: 8px; color: #9fb6b0; }
.welcome-visual svg { width: 100%; overflow: visible; }
.plan-lines, .scan-corners { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.plan-lines { opacity: .6; }
.scan-corners { color: var(--teal); stroke-width: 3; }
.scan-line { fill: none; stroke: var(--coral); stroke-width: 2; stroke-dasharray: 8 7; opacity: .8; animation: scan 3.5s ease-in-out infinite; }
@keyframes scan { 0%,100% { transform: translateY(-75px); opacity: .2; } 50% { transform: translateY(78px); opacity: .9; } }
.welcome-state h2 { max-width: 670px; margin: 10px 0 12px; font-size: clamp(28px, 4vw, 44px); line-height: 1.08; letter-spacing: -.045em; }
.welcome-state > p { max-width: 600px; margin: 0; color: var(--muted); font-size: 15px; line-height: 1.65; }
.feature-row { margin-top: 28px; display: flex; align-items: center; gap: 18px; color: var(--ink-soft); font-size: 11px; font-weight: 750; letter-spacing: .05em; text-transform: uppercase; }
.feature-row span { display: flex; align-items: center; gap: 7px; }
.feature-row i { color: var(--teal); font-style: normal; font-family: var(--mono); }
.feature-row b { width: 42px; height: 1px; background: var(--line-strong); }

.result-state { max-width: 1500px; margin: 0 auto; }
.result-header { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 20px; }
.result-header h2 { margin: 6px 0 0; max-width: 65vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 28px; letter-spacing: -.035em; }
.tertiary-button { padding: 9px 13px; color: var(--ink-soft); background: transparent; border: 1px solid var(--line-strong); border-radius: 9px; font-size: 11px; }
.tertiary-button:hover { background: white; }
.result-actions { display: flex; align-items: center; gap: 8px; }
.geometry-button { height: 36px; padding: 0 13px; display: inline-flex; align-items: center; gap: 7px; color: white; background: var(--teal); border: 0; border-radius: 9px; cursor: pointer; font-size: 11px; font-weight: 800; box-shadow: 0 7px 16px rgba(11,117,109,.16); }
.geometry-button:hover { background: var(--teal-dark); }
.geometry-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.warning-banner { margin-bottom: 14px; padding: 11px 14px; color: #7a4c17; background: #fff4db; border: 1px solid #efdcae; border-radius: 10px; font-size: 12px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stat-grid article { padding: 15px 17px; background: rgba(255,255,255,.8); border: 1px solid var(--line); border-radius: 13px; }
.stat-grid span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.stat-grid strong { display: block; margin: 6px 0 2px; font-size: 25px; letter-spacing: -.04em; }
.stat-grid small { color: #98a39f; font-size: 10px; }

.workbench { height: calc(100vh - 274px); min-height: 550px; display: grid; grid-template-columns: minmax(0, 1fr) 350px; gap: 14px; }
.drawing-card, .inspector-card { min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.drawing-card { display: grid; grid-template-rows: 52px minmax(0, 1fr) 33px; }
.viewer-toolbar { padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.page-control, .zoom-control { display: flex; align-items: center; gap: 6px; }
.page-control label { color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; }
.page-control select { height: 30px; padding: 0 24px 0 9px; background: #f7f9f6; border: 1px solid var(--line); border-radius: 7px; font-size: 11px; }
.page-control > span { color: var(--muted); font-size: 10px; }
.tool-button, .zoom-label { height: 30px; min-width: 30px; padding: 0; display: grid; place-items: center; background: transparent; border: 1px solid transparent; border-radius: 7px; cursor: pointer; }
.tool-button { font-size: 18px; }
.tool-button:hover, .zoom-label:hover { background: #f3f6f2; border-color: var(--line); }
.tool-button:disabled { opacity: .3; cursor: not-allowed; }
.zoom-label { min-width: 55px; color: var(--ink-soft); font-family: var(--mono); font-size: 10px; }
.viewer-viewport { position: relative; min-height: 0; padding: 30px; overflow: auto; background-color: #dfe5df; background-image: linear-gradient(rgba(20,35,34,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(20,35,34,.035) 1px, transparent 1px); background-size: 18px 18px; }
.page-shadow { margin: auto; width: max-content; min-width: 1px; min-height: 1px; background: white; box-shadow: 0 8px 30px rgba(20,35,34,.18), 0 0 0 1px rgba(20,35,34,.08); transform-origin: top left; }
#drawing-svg { display: block; background: white; overflow: visible; }
.drawing-object { cursor: pointer; transition: opacity .15s; }
.drawing-object:hover { opacity: .7; }
.drawing-object.vector path, .drawing-object.vector line, .drawing-object.vector rect, .drawing-object.vector polygon { vector-effect: non-scaling-stroke; }
.drawing-object.text .text-box { fill: rgba(238,108,77,.07); stroke: rgba(238,108,77,.38); stroke-width: .6; vector-effect: non-scaling-stroke; }
.drawing-object.text text { pointer-events: none; }
.drawing-object.is-selected .select-outline { display: block; }
.select-outline { display: none; fill: rgba(238,108,77,.08); stroke: var(--coral); stroke-width: 2; stroke-dasharray: 7 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.object-bound { fill: none; stroke: var(--teal); stroke-width: .75; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; opacity: .75; }
.viewer-footer { padding: 0 14px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--line); font-size: 9px; letter-spacing: .02em; }

.inspector-card { display: grid; grid-template-rows: 52px minmax(0, 1fr); }
.tab-list { padding: 0 12px; display: flex; align-items: end; gap: 6px; border-bottom: 1px solid var(--line); }
.tab { height: 42px; padding: 0 12px; color: var(--muted); background: transparent; border: 0; border-bottom: 2px solid transparent; cursor: pointer; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.tab.is-active { color: var(--teal); border-bottom-color: var(--teal); }
.tab-panel { min-height: 0; overflow: auto; }
#objects-panel { padding: 14px; }
.search-box { height: 38px; padding: 0 11px; display: flex; align-items: center; gap: 8px; color: var(--muted); background: #f6f8f5; border: 1px solid var(--line); border-radius: 9px; }
.search-box svg { width: 17px; flex: 0 0 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 11px; }
.filter-chips { margin: 10px 0; display: flex; gap: 6px; }
.filter-chip { padding: 6px 9px; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-size: 10px; }
.filter-chip.is-active { color: var(--teal-dark); background: var(--teal-pale); border-color: #bfddd6; font-weight: 750; }
.object-summary { margin: 12px 2px 7px; display: flex; justify-content: space-between; color: var(--ink-soft); font-size: 10px; font-weight: 750; }
.object-summary small { color: var(--muted); font-weight: 500; }
.object-list { max-height: 205px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.object-list:empty::after { content: "No matching objects"; min-height: 75px; display: grid; place-items: center; color: var(--muted); font-size: 11px; }
.object-item { width: 100%; padding: 10px; display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 9px; align-items: center; text-align: left; background: white; border: 0; border-bottom: 1px solid #edf0ec; cursor: pointer; }
.object-item:last-child { border-bottom: 0; }
.object-item:hover, .object-item.is-selected { background: #f3f8f5; }
.object-item.is-selected { box-shadow: inset 3px 0 var(--teal); }
.object-type-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 7px; font-family: var(--mono); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.object-type-icon.line { color: var(--blueprint); background: #e8f1f7; }
.object-type-icon.text { color: #a84c36; background: var(--coral-pale); }
.object-item-copy { min-width: 0; }
.object-item-copy strong, .object-item-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.object-item-copy strong { font-size: 10px; }
.object-item-copy small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.confidence-mini { color: var(--teal); font-family: var(--mono); font-size: 9px; }
.object-detail { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.detail-placeholder { min-height: 115px; display: grid; place-items: center; align-content: center; color: var(--muted); text-align: center; }
.detail-placeholder span { font-size: 22px; color: #aeb9b5; }
.detail-placeholder p { max-width: 210px; margin: 8px 0 0; font-size: 10px; line-height: 1.5; }
.detail-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; }
.detail-head h3 { margin: 3px 0 0; font-size: 13px; overflow-wrap: anywhere; }
.type-pill { display: inline-block; padding: 4px 7px; color: var(--teal-dark); background: var(--teal-pale); border-radius: 999px; font-size: 8px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.confidence { min-width: 47px; color: var(--teal); text-align: right; font-family: var(--mono); font-size: 11px; font-weight: 800; }
.detail-grid { margin-top: 11px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.detail-grid div { padding: 7px; background: #f7f9f6; border-radius: 7px; }
.detail-grid span { display: block; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.detail-grid strong { display: block; margin-top: 3px; font-family: var(--mono); font-size: 9px; }
.detail-section { margin-top: 11px; }
.detail-section > span { color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.detail-section pre { max-height: 145px; margin: 6px 0 0; padding: 9px; overflow: auto; color: #344844; background: #f3f6f2; border-radius: 7px; font: 8.5px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

#json-panel { display: flex; flex-direction: column; }
.json-actions { height: 50px; padding: 0 14px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.json-actions span { color: var(--muted); font-size: 10px; font-weight: 750; }
.small-button { padding: 6px 9px; color: var(--teal-dark); background: var(--teal-pale); border-radius: 7px; font-size: 9px; }
#json-preview { flex: 1; min-height: 0; margin: 0; padding: 15px; overflow: auto; color: #d9ece7; background: #132825; font: 9px/1.55 var(--mono); white-space: pre; }

.loading-overlay { position: fixed; inset: 72px 0 0; z-index: 20; display: grid; place-items: center; background: rgba(238,241,235,.84); backdrop-filter: blur(6px); }
.loading-card { width: min(360px, calc(100vw - 40px)); padding: 30px; text-align: center; background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); }
.loader-mark { height: 42px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.loader-mark i { width: 7px; height: 24px; background: var(--teal); border-radius: 999px; animation: pulse 1s ease-in-out infinite; }
.loader-mark i:nth-child(2) { height: 36px; animation-delay: .12s; background: var(--coral); }
.loader-mark i:nth-child(3) { animation-delay: .24s; }
@keyframes pulse { 0%,100% { transform: scaleY(.55); opacity: .5; } 50% { transform: scaleY(1); opacity: 1; } }
.loading-card strong { display: block; margin-top: 12px; font-size: 16px; }
.loading-card p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 30; max-width: 360px; padding: 11px 14px; color: white; background: #173c37; border-radius: 10px; box-shadow: 0 12px 30px rgba(20,35,34,.24); font-size: 11px; animation: toast-in .2s ease-out; }
.toast.is-error { background: #923f30; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

body.geometry-is-open { overflow: hidden; }
.geometry-screen { position: fixed; inset: 0; z-index: 18; display: grid; grid-template-rows: 78px minmax(0, 1fr); background: #e9eee9; }
.geometry-header { padding: 0 22px; display: flex; align-items: center; justify-content: space-between; color: white; background: #102725; border-bottom: 1px solid rgba(255,255,255,.1); }
.geometry-title-group { display: flex; align-items: center; gap: 12px; }
.geometry-title-group .eyebrow { color: #74d6c8; }
.geometry-title-group h2 { margin: 3px 0 0; font-size: 19px; letter-spacing: -.02em; }
.geometry-back { height: 38px; padding: 0 12px 0 9px; display: inline-flex; align-items: center; gap: 7px; color: white; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); border-radius: 10px; cursor: pointer; font-size: 11px; font-weight: 800; }
.geometry-back:hover { background: rgba(255,255,255,.14); }
.geometry-back svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.geometry-mark { width: 39px; height: 39px; display: grid; place-items: center; color: var(--coral); background: rgba(255,255,255,.06); border-radius: 10px; }
.geometry-mark svg { width: 25px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.geometry-document { max-width: 40vw; text-align: right; }
.geometry-document strong, .geometry-document span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.geometry-document strong { font-size: 12px; }
.geometry-document span { margin-top: 4px; color: #a9bfbb; font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.geometry-body { min-height: 0; padding: 14px; display: grid; grid-template-columns: 280px minmax(0, 1fr) 285px; gap: 12px; }
.geometry-controls, .geometry-viewer, .geometry-inspector { min-height: 0; background: white; border: 1px solid var(--line); border-radius: 17px; box-shadow: var(--shadow); overflow: hidden; }
.geometry-controls { padding: 20px; overflow-y: auto; }
.geometry-controls h3 { margin: 6px 0 7px; font-size: 19px; letter-spacing: -.025em; }
.geometry-controls > div:first-child > p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.55; }
.geometry-stat-grid { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.geometry-stat-grid article { padding: 11px; background: #f4f7f3; border-radius: 9px; }
.geometry-stat-grid span { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.geometry-stat-grid strong { display: block; margin-top: 4px; font-size: 18px; }
.geometry-control-section { margin-top: 20px; padding-top: 17px; border-top: 1px solid var(--line); }
.geometry-line-dot { background: #173b39; }
.geometry-plane-dot { background: rgba(11,117,109,.2); border: 1px solid var(--teal); }
.geometry-pattern-dot { background: var(--coral-pale); border: 1px dashed var(--coral); }
.geometry-detail-dot { background: #d9dfdc; border: 1px dotted #73817e; }
.geometry-legend > div:not(.section-label) { margin: 11px 0; display: flex; align-items: center; gap: 10px; }
.geometry-legend span strong, .geometry-legend span small { display: block; }
.geometry-legend span strong { font-size: 10px; }
.geometry-legend span small { margin-top: 2px; color: var(--muted); font-size: 8px; }
.geometry-legend > p { margin: 13px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.pattern-swatch { width: 30px; height: 22px; flex: 0 0 30px; border: 1px solid #c5d1cb; border-radius: 4px; background-color: #f4f8f5; }
.pattern-swatch.diagonal { background-image: repeating-linear-gradient(135deg, transparent 0 5px, rgba(238,108,77,.7) 5px 6px); }
.pattern-swatch.stipple { background-image: radial-gradient(rgba(11,117,109,.8) 1px, transparent 1px); background-size: 5px 5px; }
.geometry-viewer { display: grid; grid-template-rows: 50px minmax(0, 1fr) 31px; }
.geometry-toolbar { padding: 0 13px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.geometry-viewport { min-height: 0; padding: 30px; overflow: auto; background-color: #dfe5df; background-image: linear-gradient(rgba(20,35,34,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(20,35,34,.035) 1px, transparent 1px); background-size: 18px 18px; }
.geometry-page-shadow { margin: auto; width: max-content; min-width: 1px; min-height: 1px; background: white; box-shadow: 0 8px 30px rgba(20,35,34,.18), 0 0 0 1px rgba(20,35,34,.08); }
#geometry-svg { display: block; background: white; overflow: visible; }
.geometry-shape { cursor: pointer; transition: opacity .15s; }
.geometry-shape:hover { opacity: .72; }
.geometry-shape.is-selected { filter: drop-shadow(0 0 3px rgba(238,108,77,.9)); }
.geometry-polyline { fill: none; stroke: #173b39; stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.geometry-plane { stroke: var(--teal); stroke-width: 1.15; vector-effect: non-scaling-stroke; }
.geometry-plane.inferred { stroke: var(--coral); stroke-dasharray: 7 4; }
.geometry-plane.boundary-face { stroke: #087f71; stroke-width: 1.65; }
.boundary-callout { background: #e9f7f3; border-color: #abdcd3; }
.geometry-viewer-footer { padding: 0 13px; display: flex; align-items: center; justify-content: space-between; color: var(--muted); border-top: 1px solid var(--line); font-size: 8px; }
.geometry-inspector { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.geometry-inspector-header { padding: 18px; border-bottom: 1px solid var(--line); }
.geometry-inspector-header h3 { margin: 5px 0 0; font-size: 16px; }
.geometry-detail { padding: 17px; overflow-y: auto; }
.geometry-detail .detail-placeholder { min-height: 240px; }
.geometry-detail .detail-placeholder span { color: var(--teal); }
.geometry-detail .detail-grid { grid-template-columns: 1fr 1fr; }
.material-callout { margin: 15px 0; padding: 13px; background: var(--coral-pale); border: 1px solid #f4cbbf; border-radius: 10px; }
.material-callout strong { display: block; color: #9c3f2b; font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.material-callout p { margin: 6px 0 4px; color: var(--ink); font-size: 11px; line-height: 1.5; }
.material-callout blockquote { margin: 8px 0; padding: 7px 9px; color: var(--ink-soft); background: rgba(255,255,255,.65); border-left: 2px solid var(--coral); border-radius: 0 6px 6px 0; font-size: 9px; line-height: 1.45; }
.material-callout small { color: var(--muted); font-size: 8px; line-height: 1.4; }
.material-callout { margin-top: 12px; padding: 11px; color: #7e432e; background: var(--coral-pale); border: 1px solid #f2cdbf; border-radius: 8px; font-size: 9px; line-height: 1.5; }
.material-callout strong { display: block; margin-bottom: 3px; font-size: 9px; text-transform: uppercase; }

@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 285px minmax(0, 1fr); }
  .workspace { padding: 22px; }
  .workbench { grid-template-columns: minmax(0, 1fr) 315px; }
  .geometry-body { grid-template-columns: 230px minmax(0, 1fr); }
  .geometry-inspector { display: none; }
}

@media (max-width: 850px) {
  .topbar { padding: 0 18px; }
  .topbar-meta .text-link { display: none; }
  .app-shell { display: block; }
  .control-panel { border-right: 0; border-bottom: 1px solid var(--line); }
  .panel-heading { max-width: 600px; }
  .dropzone { min-height: 150px; }
  .workspace { overflow: visible; }
  .welcome-state { min-height: 620px; }
  .workbench { height: auto; grid-template-columns: 1fr; }
  .drawing-card { height: 620px; }
  .inspector-card { height: 580px; }
  .geometry-screen { position: fixed; }
  .geometry-body { grid-template-columns: 1fr; overflow-y: auto; }
  .geometry-controls { max-height: none; }
  .geometry-viewer { height: 640px; }
}

@media (max-width: 560px) {
  .brand small, .privacy-chip { display: none; }
  .workspace, .control-panel { padding: 20px 14px; }
  .stat-grid { grid-template-columns: 1fr 1fr; }
  .feature-row { gap: 8px; }
  .feature-row b { width: 18px; }
  .viewer-toolbar { padding: 0 8px; }
  .viewer-viewport { padding: 18px; }
  .drawing-card { height: 520px; }
  .result-header { align-items: flex-start; }
  .result-actions { flex-direction: column; align-items: stretch; }
  .geometry-document { display: none; }
  .geometry-header { padding: 0 12px; }
  .geometry-mark { display: none; }
  .geometry-body { padding: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
