:root {
  --ink: #252721;
  --muted: #76796f;
  --paper: #f4f1e9;
  --panel: #fbfaf6;
  --line: #d9d6cb;
  --forest: #34483a;
  --forest-dark: #26362c;
  --clay: #a75f3e;
  --amber: #d8a447;
  --danger: #984b41;
  --shadow: 0 16px 50px rgba(38, 39, 33, 0.12);
  --radius-sm: 0.5rem;
  --radius-md: 0.85rem;
  --radius-lg: 1.25rem;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body { overflow: hidden; background: var(--paper); color: var(--ink); font-family: "DM Sans", sans-serif; font-size: 0.875rem; }
button, input, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(216, 164, 71, 0.45); outline-offset: 2px; }
label { display: block; margin-bottom: 0.35rem; color: var(--muted); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
input, select { width: 100%; min-height: 2.55rem; padding: 0.62rem 0.72rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; color: var(--ink); }
input[type="color"] { padding: 0.25rem; }
h1, h2 { font-family: "Fraunces", serif; font-weight: 650; letter-spacing: -0.025em; }
h2 { font-size: 1.2rem; }
.hidden { display: none; }
.eyebrow { color: var(--clay); font-size: 0.63rem; font-weight: 800; letter-spacing: 0.17em; text-transform: uppercase; }
.hint { margin-bottom: 1.1rem; color: var(--muted); font-size: 0.78rem; line-height: 1.55; }
.stack-md > * + * { margin-top: 0.85rem; }
.stack-lg > * + * { margin-top: 1.1rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }
.button-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }

.brand-mark { display: grid; grid-template-columns: repeat(3, 0.65rem); gap: 0.16rem; width: max-content; height: 2.7rem; align-items: end; transform: skewY(-10deg); }
.brand-mark span { display: block; height: 100%; border-radius: 0.15rem; background: var(--forest); }
.brand-mark span:nth-child(2) { height: 78%; background: var(--clay); }
.brand-mark span:nth-child(3) { height: 56%; background: var(--amber); }
.brand-mark.compact { grid-template-columns: repeat(3, 0.38rem); height: 1.8rem; }

.primary-button, .secondary-button, .danger-button, .icon-button { border: 0; border-radius: var(--radius-sm); cursor: pointer; font-weight: 700; transition: transform 140ms ease, background 140ms ease, box-shadow 140ms ease; }
.primary-button { min-height: 2.65rem; padding: 0.65rem 1rem; background: var(--forest); color: #fff; box-shadow: 0 6px 18px rgba(52, 72, 58, 0.18); }
.primary-button:hover { background: var(--forest-dark); transform: translateY(-1px); }
.primary-button:disabled, .secondary-button:disabled, .danger-button:disabled { opacity: .48; cursor: not-allowed; transform: none; box-shadow: none; }
.secondary-button, .danger-button { min-height: 2.55rem; padding: 0.6rem 0.85rem; border: 1px solid var(--line); background: #fff; }
.secondary-button:hover { border-color: #aaa99f; background: #f7f5ef; }
.danger-button { color: var(--danger); }
.icon-button { width: 2.5rem; height: 2.5rem; background: transparent; font-size: 1.2rem; }
.icon-button:hover { background: rgba(37, 39, 33, 0.06); }
.full-button { width: 100%; }

.login-shell { display: grid; min-height: 100vh; place-items: center; overflow: hidden; background-color: #d9d1c2; background-image: linear-gradient(115deg, rgba(255,255,255,.28) 1px, transparent 1px), linear-gradient(25deg, rgba(73,61,46,.09) 1px, transparent 1px); background-size: 31px 31px, 47px 47px; }
.login-shell::before { content: ""; position: fixed; inset: 7% 10%; border: 1px solid rgba(52,72,58,.25); transform: rotate(-2deg); pointer-events: none; }
.login-card { position: relative; width: min(90vw, 27rem); padding: 3.2rem; border: 1px solid rgba(52,72,58,.18); border-radius: 0.2rem 2.2rem 0.2rem 2.2rem; background: rgba(251,250,246,.94); box-shadow: var(--shadow); }
.login-card h1 { margin: 0.45rem 0 0.8rem; font-size: 2.4rem; }
.login-card .brand-mark { margin-bottom: 2rem; }
.login-copy { margin-bottom: 2rem; color: var(--muted); line-height: 1.6; }
.form-error { min-height: 1.2rem; color: var(--danger); font-size: 0.78rem; }

.app-shell { display: grid; grid-template-rows: 4.55rem 3.15rem 1fr; height: 100vh; }
.topbar { position: relative; z-index: 10; display: grid; grid-template-columns: 10.6rem minmax(25rem, 1fr) auto; align-items: center; gap: .7rem; padding: 0 .8rem; border-bottom: 1px solid var(--line); background: rgba(251,250,246,.97); box-shadow: 0 5px 20px rgba(37,39,33,.05); }
.brand-lockup { display: flex; align-items: center; gap: 0.8rem; }
.brand-lockup h1 { font-size: 1.32rem; line-height: 1; }
.project-meta { display: flex; align-items: flex-end; gap: 0.55rem; }
.project-meta > div:first-child { width: min(15rem, 27vw); }
.project-meta input { min-height: 2.2rem; padding: 0.45rem 0.62rem; background: #f7f5ef; }
.shape-field { width: 6.5rem; }
.shape-field select { min-height: 2.2rem; padding: 0.45rem 0.55rem; background: #f7f5ef; }
.measure-field { position: relative; width: 5.6rem; }
.measure-field.shape-hidden { display: none; }
.measure-field input { padding-right: 1.9rem; }
.measure-field span { position: absolute; right: 0.55rem; bottom: 0.52rem; color: var(--muted); font-size: 0.7rem; }
.account-actions, .toolbar-actions { display: flex; min-width: 0; align-items: center; justify-content: flex-end; gap: 0.22rem; }
.account-actions > .secondary-button, .toolbar-actions > .secondary-button, .toolbar-actions > .primary-button, .top-link { min-height: 2.35rem; padding: .5rem .68rem; font-size: .7rem; white-space: nowrap; }
.top-link { text-decoration: none; }
.locale-control { display: grid; grid-template-columns: auto 3.2rem; align-items: center; gap: .35rem; margin: 0 .15rem; }
.locale-control span { color: var(--muted); font-size: .58rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.locale-control select { min-height: 2.3rem; padding: .42rem .5rem; border-radius: 2rem; font-size: .64rem; font-weight: 800; }
.admin-button { border-color: rgba(169,80,45,.28); color: #8d4d31; }
.account-chip { display: grid; min-width: 3.8rem; padding: .32rem .45rem; border-left: 1px solid var(--line); color: inherit; line-height: 1.05; text-decoration: none; }
.account-chip strong { max-width: 4.6rem; overflow: hidden; font-size: .58rem; text-overflow: ellipsis; white-space: nowrap; }
.account-chip small { margin-top: .16rem; color: var(--muted); font-size: .5rem; text-transform: uppercase; }
.logout-button { color: var(--muted); }
.login-language { position: absolute; top: 1rem; right: 1rem; display: flex; gap: .2rem; }
.login-language a { padding: .28rem .42rem; border-radius: 1rem; color: var(--muted); font-size: .58rem; font-weight: 800; text-decoration: none; }
.login-language a.active { background: var(--forest); color: #fff; }
.login-card { position: relative; }
.zoom-control { display: grid; grid-template-columns: auto 4rem 2.25rem; align-items: center; gap: 0.3rem; margin-right: 0.2rem; }
.zoom-control label { margin: 0; }
.zoom-control input { min-height: auto; padding: 0; }
.zoom-control output { color: var(--muted); font-size: 0.68rem; }

.workspace { position: relative; display: grid; grid-template-columns: minmax(24rem, 1fr) 20rem; min-height: 0; }
.tool-panel, .properties-panel { background: var(--panel); }
.tool-panel { position: absolute; z-index: 9; top: 0.65rem; left: 0.8rem; width: min(23.5rem, calc(100% - 1.6rem)); max-height: min(36rem, calc(100% - 1.3rem)); overflow-y: auto; border: 1px solid rgba(52,72,58,.2); border-radius: 1rem; background: rgba(251,250,246,.94); box-shadow: 0 24px 64px rgba(31,38,31,.2); backdrop-filter: blur(18px) saturate(1.15); opacity: 0; pointer-events: none; transform: translateY(-0.55rem) scale(.985); transform-origin: top left; transition: opacity .16s ease, transform .16s ease; }
.tool-panel.open { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }
.properties-panel { overflow-y: auto; padding: 1.2rem; border-left: 1px solid var(--line); }
.tool-tabs { position: relative; z-index: 9; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1rem; overflow-x: auto; padding: 0.38rem 1rem; border-bottom: 1px solid var(--line); background: rgba(247,245,239,.88); box-shadow: 0 5px 16px rgba(37,39,33,.04); backdrop-filter: blur(16px) saturate(1.15); scrollbar-width: thin; }
.tool-section-links { display: flex; min-width: max-content; align-items: center; justify-content: center; gap: .28rem; }
.toolbar-actions { min-width: max-content; padding-left: .75rem; border-left: 1px solid rgba(80,80,72,.12); }
.tool-menu-label { margin-right: 0.4rem; color: var(--muted); font-size: 0.59rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; }
.tool-tab { display: inline-flex; align-items: center; gap: 0.42rem; min-height: 2.25rem; padding: 0.48rem 0.76rem; border: 1px solid transparent; border-radius: 2rem; background: transparent; color: var(--muted); cursor: pointer; font-size: 0.68rem; font-weight: 750; transition: background .14s ease, border-color .14s ease, color .14s ease, transform .14s ease; }
.tool-tab::before { display: grid; width: 1.28rem; height: 1.28rem; place-items: center; border-radius: 50%; background: rgba(52,72,58,.08); color: var(--forest); font-family: "Fraunces", serif; font-size: .7rem; }
.tool-tab[data-tab="patterns"]::before { content: "⌗"; }
.tool-tab[data-tab="alignment"]::before { content: "◎"; }
.tool-tab[data-tab="wood"]::before { content: "◉"; }
.tool-tab[data-tab="decoration"]::before { content: "✿"; }
.tool-tab[data-tab="text"]::before { content: "T"; }
.tool-tab[data-tab="frame"]::before { content: "□"; }
.tool-tab[data-tab="library"]::before { content: "▤"; }
.tool-tab:hover { border-color: rgba(52,72,58,.16); background: #fff; color: var(--ink); transform: translateY(-1px); }
.tool-tab.active { border-color: rgba(169,95,62,.26); background: #fff4ec; color: #8d4d31; box-shadow: 0 3px 10px rgba(90,57,38,.08); }
.tool-tab.active::before { background: var(--clay); color: #fff; }
.tab-panel { display: none; padding: 1.2rem; }
.tab-panel.active { display: block; animation: panel-in 220ms ease both; }
.panel-heading { margin-bottom: 1.15rem; }
.panel-heading h2 { margin-top: 0.18rem; }
.panel-heading.small { margin-bottom: 0.8rem; }

.pattern-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.pattern-card { display: grid; gap: 0.24rem; min-height: 7.1rem; padding: 0.65rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; text-align: left; cursor: pointer; }
.pattern-card:hover, .pattern-card.active { border-color: var(--clay); box-shadow: 0 4px 16px rgba(91,65,49,.1); }
.pattern-card strong { font-size: 0.76rem; }
.pattern-card small { color: var(--muted); font-size: 0.61rem; line-height: 1.3; }
.pattern-preview { display: block; height: 2.7rem; border-radius: 0.4rem; background-color: #ddd0b8; overflow: hidden; }
.herringbone-preview { background-image: linear-gradient(45deg, transparent 42%, #80573d 43% 55%, transparent 56%), linear-gradient(-45deg, transparent 42%, #cbb58e 43% 55%, transparent 56%); background-size: 1.8rem 1.8rem; }
.cube-preview { background: conic-gradient(from 30deg at 50% 60%, #e0ca9f 0 33%, #86583f 0 66%, #b78b5d 0); }
.star-preview { background: conic-gradient(from 0deg, #d9c39c, #d9c39c 12.5%, #785039 12.5% 25%, #ad7a50 25% 37.5%, #e9d9ba 37.5% 50%, #785039 50% 62.5%, #d9c39c 62.5% 75%, #ad7a50 75% 87.5%, #e9d9ba 87.5%); }
.chevron-preview { background-image: linear-gradient(135deg, transparent 40%, #7f553c 41% 55%, transparent 56%), linear-gradient(225deg, transparent 40%, #c5a97d 41% 55%, transparent 56%); background-size: 2.2rem 2.2rem; }
.fluted-preview { background: repeating-linear-gradient(90deg, #dac7a5 0 8px, #9d7a55 9px 11px); }
.control-section { margin: 1rem 0; padding: 0.85rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: #f7f5ef; }
.control-section .field-row + .field-row, .control-section > div + div { margin-top: 0.65rem; }
.manual-builder, .dimension-builder { display: grid; gap: 0.7rem; margin-top: 1rem; }
.manual-builder h3, .dimension-builder h3 { font-family: "Fraunces", serif; font-size: 1rem; }
.manual-builder small { color: var(--muted); line-height: 1.45; }
.snap-choice { display: flex; align-items: center; gap: 0.55rem; min-height: 2.55rem; margin: 1.06rem 0 0; padding: 0.45rem 0.55rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; letter-spacing: 0; text-transform: none; }
.snap-choice input { width: auto; min-height: auto; accent-color: var(--forest); }
.snap-choice strong, .snap-choice small { display: block; }
.snap-choice strong { color: var(--ink); font-size: 0.68rem; }
.snap-choice small { margin-top: 0.05rem; font-size: 0.57rem; font-weight: 500; }
.property-reset { justify-self: start; padding: 0.15rem 0; }
.guide-builder { margin: 0.9rem 0; padding: 0.85rem; border: 1px solid rgba(45,127,134,.28); border-radius: var(--radius-md); background: linear-gradient(145deg, rgba(227,241,240,.8), rgba(255,255,255,.9)); }
.guide-heading { display: flex; align-items: start; justify-content: space-between; gap: 0.5rem; }
.guide-heading h3 { margin-top: 0.12rem; font-family: "Fraunces", serif; font-size: 1rem; }
.guide-builder > p { margin: 0.55rem 0 0.7rem; color: var(--muted); font-size: 0.64rem; line-height: 1.45; }
.center-chip { padding: 0.3rem 0.42rem; border-radius: 2rem; background: #d8ecea; color: #256b71; font-size: 0.56rem; font-weight: 800; white-space: nowrap; }
.guide-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; }
.guide-buttons .secondary-button { min-height: 2.2rem; padding: 0.45rem; color: #256b71; font-size: 0.64rem; }
.area-center-button { display: grid; grid-template-columns: 2rem 1fr; column-gap: 0.65rem; width: 100%; margin-top: 0.55rem; padding: 0.7rem 0.75rem; border: 1px solid rgba(45,127,134,.4); border-radius: var(--radius-sm); background: linear-gradient(135deg, rgba(45,127,134,.12), rgba(255,255,255,.9)); color: var(--ink); text-align: left; cursor: crosshair; }
.area-center-button > span { grid-row: 1 / 3; align-self: center; color: #2d7f86; font-family: "Fraunces", serif; font-size: 1.45rem; text-align: center; }
.area-center-button strong, .area-center-button small { display: block; }
.area-center-button strong { font-size: 0.72rem; }
.area-center-button small { margin-top: 0.12rem; color: var(--muted); font-size: 0.58rem; }
.area-center-button:hover { border-color: #2d7f86; background: linear-gradient(135deg, rgba(45,127,134,.18), #fff); }
.area-center-button.active { border-color: #a9502d; background: #fff5ef; box-shadow: inset 0 0 0 1px rgba(169,80,45,.18); }
.guide-builder > .text-button { margin-top: 0.55rem; color: var(--danger); }
.guide-status { display: block; margin-top: 0.45rem; color: #256b71; font-size: 0.6rem; font-weight: 700; line-height: 1.4; }
.blank-board-card { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.8rem; margin-bottom: 0.85rem; padding: 0.9rem; border: 1px solid rgba(52,72,58,.22); border-radius: var(--radius-md); background: linear-gradient(135deg, #edf0e7, #f8f4e9); }
.blank-board-card strong, .blank-board-card small { display: block; }
.blank-board-card strong { font-family: "Fraunces", serif; font-size: 0.95rem; }
.blank-board-card small { margin-top: 0.2rem; color: var(--muted); font-size: 0.63rem; line-height: 1.4; }
.library-save-card { margin: 0.9rem 0; padding: 0.85rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; }
.library-save-row { display: grid; grid-template-columns: 1fr auto; gap: 0.45rem; }
.library-save-row .primary-button { white-space: nowrap; }
.library-heading { display: flex; align-items: center; justify-content: space-between; margin: 1.1rem 0 0.55rem; }
.text-button { border: 0; background: transparent; color: var(--clay); cursor: pointer; font-size: 0.65rem; font-weight: 700; }
.design-library { display: grid; gap: 0.55rem; }
.library-empty { display: grid; gap: 0.22rem; padding: 1rem; border: 1px dashed #c9c5b9; border-radius: var(--radius-md); background: rgba(255,255,255,.58); }
.library-empty strong { font-family: "Fraunces", serif; }
.library-empty span { color: var(--muted); font-size: 0.66rem; line-height: 1.45; }
.library-card { display: grid; grid-template-columns: 4rem 1fr; gap: 0.65rem; padding: 0.55rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; box-shadow: 0 3px 12px rgba(50,42,34,.05); }
.library-card img, .library-preview-empty { width: 4rem; height: 3.5rem; border-radius: 0.42rem; background: #e9e2d5; object-fit: cover; }
.library-preview-empty { display: grid; place-items: center; padding: 0.3rem; color: var(--muted); font-size: 0.56rem; text-align: center; }
.library-card > div:nth-child(2) { min-width: 0; align-self: center; }
.library-card strong, .library-card small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.library-card strong { font-size: 0.72rem; }
.library-card small { margin-top: 0.18rem; color: var(--muted); font-size: 0.6rem; }
.library-actions { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto; gap: 0.45rem; }
.library-actions .secondary-button { min-height: 2rem; padding: 0.35rem 0.6rem; font-size: 0.66rem; }
.library-delete { padding: 0.35rem 0.5rem; border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: 0.62rem; font-weight: 700; }
.starter-details { margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.starter-details summary { cursor: pointer; color: var(--muted); font-size: 0.7rem; font-weight: 700; }
.starter-details[open] summary { margin-bottom: 0.7rem; color: var(--ink); }
.starter-details .hint { margin-bottom: 0.75rem; }
.property-group { display: grid; gap: 0.65rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.group-selection-card { display: grid; gap: 0.7rem; padding: 0.85rem; border: 1px solid rgba(45,127,134,.34); border-radius: var(--radius-md); background: linear-gradient(145deg, rgba(226,240,238,.92), rgba(255,255,255,.96)); box-shadow: 0 8px 22px rgba(43,71,65,.08); }
.group-selection-card.hidden { display: none; }
.group-selection-heading { display: grid; grid-template-columns: 2.35rem 1fr; align-items: center; gap: 0.65rem; }
.group-selection-heading .eyebrow { margin-bottom: 0.12rem; }
.group-selection-heading strong { font-family: "Fraunces", serif; font-size: 1rem; }
.group-selection-icon { display: grid; width: 2.35rem; height: 2.35rem; place-items: center; border-radius: 50%; background: #2d7f86; color: #fff; font-family: "Fraunces", serif; font-size: 1rem; box-shadow: inset 0 0 0 4px rgba(255,255,255,.17); }
.group-selection-card > p { margin: 0; color: var(--muted); font-size: 0.61rem; line-height: 1.45; }
.group-selection-card kbd { display: inline-block; min-width: 1.35rem; padding: 0.08rem 0.28rem; border: 1px solid rgba(45,127,134,.28); border-bottom-width: 2px; border-radius: 0.3rem; background: #fff; color: #256b71; font: 700 0.56rem "DM Sans", sans-serif; text-align: center; }
.group-selection-card button:disabled { opacity: .42; cursor: not-allowed; transform: none; }
.property-note { color: var(--muted); font-size: 0.68rem; }
.edge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.55rem; }
.swatch-grid { display: grid; gap: 0.55rem; }
.wood-swatch { display: grid; grid-template-columns: 2.2rem 1fr; align-items: center; gap: 0.7rem; padding: 0.58rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; text-align: left; }
.wood-swatch span { width: 2.2rem; height: 2.2rem; border: 1px solid rgba(0,0,0,.13); border-radius: 50%; box-shadow: inset 0 0 0 4px rgba(255,255,255,.15); }
.wood-preset-field { margin: 0.8rem 0 0.7rem; }
.field-label { display: block; margin-bottom: 0.45rem; color: var(--muted); font-size: 0.6rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.wood-preset-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.45rem; }
.wood-preset-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.36rem; }
.wood-preset-button { position: relative; display: grid; grid-template-columns: 1.65rem minmax(0, 1fr); align-items: center; gap: 0.48rem; min-width: 0; min-height: 2.55rem; padding: 0.38rem 0.48rem; overflow: hidden; border: 1px solid var(--line); border-radius: 0.62rem; background: rgba(255,255,255,.92); color: var(--ink); cursor: pointer; text-align: left; transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.wood-preset-grid.compact .wood-preset-button { grid-template-columns: 1.35rem minmax(0, 1fr); gap: 0.32rem; min-height: 2.2rem; padding: 0.3rem 0.34rem; }
.wood-preset-button:hover { z-index: 1; border-color: #a9502d; box-shadow: 0 5px 14px rgba(80,49,29,.12); transform: translateY(-1px); }
.wood-preset-button.active { border-color: #2d7f86; box-shadow: 0 0 0 2px rgba(45,127,134,.18); }
.wood-preset-chip { width: 1.65rem; height: 1.65rem; border: 1px solid rgba(44,35,27,.2); border-radius: 50%; box-shadow: inset 0 0 0 3px rgba(255,255,255,.15), 0 1px 3px rgba(40,30,20,.12); }
.wood-preset-grid.compact .wood-preset-chip { width: 1.35rem; height: 1.35rem; }
.wood-preset-copy { min-width: 0; }
.wood-preset-copy strong, .wood-preset-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wood-preset-copy strong { font-size: 0.64rem; line-height: 1.15; }
.wood-preset-copy small { margin-top: 0.12rem; color: var(--muted); font-family: ui-monospace, monospace; font-size: 0.49rem; letter-spacing: 0.02em; text-transform: uppercase; }
.wood-preset-grid.compact .wood-preset-copy strong { font-size: 0.56rem; }
.wood-preset-grid.compact .wood-preset-copy small { display: none; }
.wood-preset-drawer { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: linear-gradient(145deg, rgba(255,255,255,.94), rgba(244,239,229,.72)); }
.wood-preset-drawer summary { display: flex; align-items: center; justify-content: space-between; gap: 0.65rem; padding: 0.68rem 0.78rem; cursor: pointer; list-style: none; color: var(--muted); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.wood-preset-drawer summary::-webkit-details-marker { display: none; }
.wood-preset-drawer summary::after { content: "⌄"; color: var(--clay); font-size: 0.9rem; transition: transform .16s ease; }
.wood-preset-drawer[open] summary::after { transform: rotate(180deg); }
.wood-preset-drawer summary strong { margin-left: auto; overflow: hidden; color: var(--ink); font-size: 0.62rem; letter-spacing: 0; text-overflow: ellipsis; text-transform: none; white-space: nowrap; }
.wood-preset-drawer .wood-preset-grid { padding: 0 0.6rem 0.65rem; }
.wood-color-note { display: block; margin-top: 0.48rem; color: var(--muted); font-size: 0.55rem; line-height: 1.4; }
.alignment-tool { display: grid; gap: 0.6rem; padding: 0.72rem; border: 1px solid rgba(45,127,134,.26); border-radius: var(--radius-sm); background: rgba(255,255,255,.74); }
.alignment-tool-heading { display: grid; grid-template-columns: 2rem 1fr; align-items: center; gap: 0.55rem; }
.alignment-tool-heading > span { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; background: #e2f0ee; color: #26757c; font-size: 1rem; }
.alignment-tool-heading strong, .alignment-tool-heading small { display: block; }
.alignment-tool-heading strong { font-family: "Fraunces", serif; font-size: 0.82rem; }
.alignment-tool-heading small { margin-top: 0.08rem; color: var(--muted); font-size: 0.58rem; }
.selection-arrange-tool { display: grid; gap: 0.55rem; margin-top: 0.6rem; padding: 0.72rem; border: 1px solid rgba(45,127,134,.32); border-radius: var(--radius-sm); background: linear-gradient(145deg, rgba(255,255,255,.94), rgba(226,240,238,.58)); }
.arrange-button-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.38rem; }
.arrange-button-grid button, .layer-order-buttons button { display: flex; min-width: 0; align-items: center; justify-content: center; gap: 0.25rem; min-height: 2.35rem; padding: 0.42rem 0.3rem; font-size: 0.57rem; white-space: nowrap; }
.arrange-button-grid button span, .layer-order-buttons button span { color: #26757c; font-size: 0.88rem; line-height: 1; }
.arrange-label { margin-top: 0.08rem; color: var(--muted); font-size: 0.53rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.layer-order-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 0.38rem; }
.compact-row { align-items: end; }
.compact-row .secondary-button { min-height: 2.55rem; padding: 0.5rem 0.7rem; }
.symmetry-tool { overflow: hidden; border: 1px solid rgba(169,80,45,.28); border-radius: var(--radius-sm); background: linear-gradient(145deg, rgba(255,255,255,.9), rgba(245,235,226,.72)); }
.symmetry-tool summary { display: grid; grid-template-columns: 2rem 1fr auto; align-items: center; gap: 0.55rem; padding: 0.72rem; cursor: pointer; list-style: none; }
.symmetry-tool summary::-webkit-details-marker { display: none; }
.symmetry-tool summary > span { display: grid; width: 2rem; height: 2rem; place-items: center; border-radius: 50%; background: #f0dfd3; color: #a9502d; font-size: 1rem; }
.symmetry-tool summary strong, .symmetry-tool summary small { display: block; }
.symmetry-tool summary strong { font-family: "Fraunces", serif; font-size: 0.82rem; }
.symmetry-tool summary small { color: var(--muted); font-size: 0.56rem; }
.symmetry-tool summary::after { content: "⌄"; grid-column: 3; grid-row: 1; color: var(--clay); transition: transform .16s ease; }
.symmetry-tool[open] summary::after { transform: rotate(180deg); }
.symmetry-tool-body { display: grid; gap: 0.62rem; padding: 0 0.72rem 0.75rem; border-top: 1px solid rgba(169,80,45,.14); }
.symmetry-tool-body > label:first-child { margin-top: 0.65rem; }
.mirror-replace-choice { padding: 0.58rem; }
.symmetry-note { color: var(--muted); font-size: 0.56rem; line-height: 1.45; }
.decoration-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.decoration-card { display: grid; min-height: 7rem; padding: 0.75rem; place-items: center; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; cursor: pointer; }
.decoration-card:hover { border-color: var(--clay); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(91,65,49,.1); }
.decoration-card strong { font-size: 0.72rem; }
.decoration-icon { display: grid; width: 3.4rem; height: 3.4rem; place-items: center; border-radius: 50%; background: #edf0e7; color: var(--forest); font-family: "Fraunces", serif; font-size: 2rem; }
.leaf-icon { color: #708064; transform: rotate(-28deg); }
.sprig-icon { color: #61745e; font-size: 2.8rem; transform: rotate(35deg); }
.bloom-icon { background: #f0e1d6; color: var(--clay); }
.choice-card { display: flex; align-items: center; gap: 0.7rem; padding: 0.75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; cursor: pointer; letter-spacing: 0; text-transform: none; }
.choice-card input { width: auto; min-height: auto; }
.choice-card strong, .choice-card small { display: block; }
.choice-card strong { color: var(--ink); font-size: 0.76rem; }
.choice-card small { margin-top: 0.16rem; color: var(--muted); font-size: 0.64rem; font-weight: 500; }

.canvas-area { display: grid; grid-template-rows: 2.65rem 1fr; min-width: 0; min-height: 0; background-color: #dfddd5; background-image: radial-gradient(rgba(72,72,64,.12) 1px, transparent 1px); background-size: 18px 18px; }
.canvas-toolbar { display: flex; justify-content: space-between; align-items: center; padding: 0 1rem; border-bottom: 1px solid rgba(80,80,72,.16); background: rgba(244,241,233,.8); color: var(--muted); font-size: 0.68rem; font-weight: 600; }
.status-dot::before { content: ""; display: inline-block; width: 0.42rem; height: 0.42rem; margin-right: 0.4rem; border-radius: 50%; background: #718a6d; }
#canvas-scroll { display: grid; min-height: 0; overflow: auto; padding: 3rem; place-items: start center; }
#canvas-container { box-shadow: 0 25px 60px rgba(41,39,31,.22), 0 0 0 1px rgba(41,39,31,.14); background: #f4efe6; }

.properties-panel section + section { margin-top: 1.3rem; padding-top: 1.3rem; border-top: 1px solid var(--line); }
.empty-state { padding: 1rem; border: 1px dashed #c9c5b9; border-radius: var(--radius-md); color: var(--muted); font-size: 0.76rem; line-height: 1.5; text-align: center; }
.section-title-row { display: flex; justify-content: space-between; align-items: end; margin-bottom: 0.9rem; }
.section-title-row h2 { margin-top: 0.18rem; }
.toggle-label { display: flex; align-items: center; gap: 0.35rem; margin: 0; text-transform: none; letter-spacing: 0; }
.toggle-label input { width: auto; min-height: auto; }
.cutlist-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; margin-bottom: 0.8rem; }
.cutlist-summary div { padding: 0.75rem; border-radius: var(--radius-sm); background: var(--forest); color: #fff; }
.cutlist-summary strong { display: block; font-family: "Fraunces", serif; font-size: 1.45rem; }
.cutlist-summary span { color: rgba(255,255,255,.7); font-size: 0.65rem; }
.table-wrap { max-height: 18rem; margin-bottom: 0.7rem; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; background: #fff; font-size: 0.64rem; }
th { position: sticky; top: 0; padding: 0.55rem; background: #efede5; color: var(--muted); text-align: left; }
td { padding: 0.52rem; border-top: 1px solid #ebe8de; }
.table-empty { padding: 1.4rem; color: var(--muted); text-align: center; }

dialog { width: min(92vw, 44rem); max-height: 80vh; margin: auto; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(32,36,31,.48); backdrop-filter: blur(3px); }
.dialog-header { display: flex; justify-content: space-between; align-items: center; padding: 1.2rem 1.4rem; border-bottom: 1px solid var(--line); }
.project-list, .export-grid { padding: 1.2rem; }
.project-list { display: grid; gap: 0.65rem; }
.project-row { display: grid; grid-template-columns: 4rem 1fr auto; align-items: center; gap: 0.8rem; padding: 0.65rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; }
.project-row img, .project-thumb-placeholder { width: 4rem; height: 3rem; border-radius: 0.35rem; background: #ded4c2; object-fit: cover; }
.project-row small { display: block; margin-top: 0.2rem; color: var(--muted); }
.export-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.8rem; }
.export-card { min-height: 9rem; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; cursor: pointer; text-align: left; }
.export-card:hover { border-color: var(--clay); transform: translateY(-2px); box-shadow: 0 10px 25px rgba(50,42,34,.1); }
.export-card strong { display: block; margin-bottom: 0.35rem; font-family: "Fraunces", serif; font-size: 1.05rem; }
.export-card span { color: var(--muted); font-size: 0.72rem; }
.admin-dialog { width: min(72rem, calc(100vw - 2rem)); max-width: none; height: min(48rem, calc(100vh - 2rem)); padding: 0; overflow: hidden; border: 1px solid rgba(52,72,58,.2); border-radius: 1.25rem; background: #f5f2ea; box-shadow: 0 30px 90px rgba(25,31,26,.28); }
.admin-dialog::backdrop { background: rgba(25,30,26,.42); backdrop-filter: blur(8px); }
.admin-dialog-header { padding: 1.1rem 1.25rem; background: #fffdf8; }
.admin-shell { display: grid; gap: 1rem; height: calc(100% - 5rem); padding: 1.1rem 1.25rem 1.5rem; overflow-y: auto; }
.admin-stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: .7rem; }
.admin-stats div { position: relative; overflow: hidden; padding: 1rem; border-radius: .9rem; background: var(--forest); color: #fff; box-shadow: 0 10px 24px rgba(41,61,47,.13); }
.admin-stats div::after { content: ""; position: absolute; right: -1rem; bottom: -1.8rem; width: 5rem; height: 5rem; border: 1px solid rgba(255,255,255,.16); border-radius: 50%; }
.admin-stats strong, .admin-stats span { display: block; }
.admin-stats strong { font-family: "Fraunces", serif; font-size: 1.8rem; }
.admin-stats span { margin-top: .18rem; color: rgba(255,255,255,.7); font-size: .64rem; }
.admin-create-card { display: grid; grid-template-columns: 10rem 1fr; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 1rem; background: #fffdf8; }
.admin-create-card h3, .admin-section-heading h3 { margin-top: .15rem; font-family: "Fraunces", serif; font-size: 1.1rem; }
.admin-user-form { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)) auto; align-items: end; gap: .55rem; }
.admin-user-form .primary-button { min-height: 2.55rem; white-space: nowrap; }
.admin-message { color: #2d7f86; font-size: .62rem; font-weight: 700; }
.admin-create-card > .admin-message { grid-column: 2; }
.admin-section-heading { display: flex; align-items: end; justify-content: space-between; margin: .4rem 0 .7rem; }
.admin-user-list { display: grid; gap: .65rem; }
.admin-user-card { display: grid; grid-template-columns: 13rem 1fr auto; align-items: center; gap: .8rem; padding: .8rem; border: 1px solid var(--line); border-radius: .85rem; background: #fff; }
.admin-user-identity { display: grid; grid-template-columns: 2.6rem 1fr; align-items: center; gap: .65rem; min-width: 0; }
.admin-user-identity > span { display: grid; width: 2.6rem; height: 2.6rem; place-items: center; border-radius: 50%; background: #e3ece4; color: var(--forest); font-family: "Fraunces", serif; font-size: 1.1rem; font-weight: 650; }
.admin-user-identity strong, .admin-user-identity small { display: block; overflow: hidden; text-overflow: ellipsis; }
.admin-user-identity small { margin-top: .18rem; color: var(--muted); font-size: .54rem; line-height: 1.35; }
.admin-user-controls { display: grid; grid-template-columns: 1fr 1.15fr .7fr .7fr 1.1fr; gap: .45rem; }
.admin-user-controls label > span { display: block; margin-bottom: .22rem; color: var(--muted); font-size: .52rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.admin-user-controls input, .admin-user-controls select { min-height: 2.2rem; padding: .4rem .5rem; font-size: .62rem; }
.admin-user-actions { display: grid; justify-items: end; gap: .35rem; min-width: 8rem; }
.admin-active-toggle { display: flex; align-items: center; gap: .35rem; color: var(--muted); font-size: .6rem; font-weight: 700; text-transform: none; letter-spacing: 0; }
.admin-active-toggle input { width: auto; min-height: auto; accent-color: var(--forest); }
.admin-user-actions .secondary-button { min-height: 2.2rem; padding: .45rem .65rem; font-size: .62rem; }
.admin-delete-user { border: 0; background: transparent; color: var(--danger); cursor: pointer; font-size: .52rem; font-weight: 700; }
.toast-region { position: fixed; right: 1rem; bottom: 1rem; z-index: 40; display: grid; gap: 0.5rem; }
.toast { max-width: 22rem; padding: 0.8rem 1rem; border-radius: var(--radius-sm); background: var(--ink); color: #fff; box-shadow: var(--shadow); animation: toast-in 220ms ease both; }
.toast.error { background: var(--danger); }

@keyframes panel-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1700px) {
  .topbar { grid-template-columns: 9.5rem minmax(0, 1fr) auto; }
  .project-meta > div:first-child { width: min(18rem, 26vw); }
  .tool-tabs { gap: .55rem; padding-inline: .65rem; }
  .tool-tab { padding-inline: .58rem; }
  .toolbar-actions { padding-left: .45rem; }
}

@media (max-width: 1120px) {
  .workspace { grid-template-columns: minmax(22rem, 1fr) 17rem; }
  .topbar { grid-template-columns: 8.5rem minmax(0, 1fr) auto; }
  .toolbar-actions .zoom-control { display: none; }
  .tool-menu-label { display: none; }
  .locale-control span { display: none; }
  .locale-control { grid-template-columns: 3rem; }
  .admin-user-form { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .admin-user-card { grid-template-columns: 1fr; }
  .admin-user-controls { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .admin-user-actions { grid-template-columns: auto 1fr auto; align-items: center; justify-items: start; }
}
