:root {
  color-scheme: light;
  --ink: #202821;
  --muted: #788078;
  --line: #e8ebe6;
  --paper: #f7f8f6;
  --white: #fff;
  --green: #2d754e;
  --green-dark: #235d3d;
  --green-soft: #edf5ee;
  --mint: #d6efca;
  --orange: #e99b67;
  --shadow: 0 18px 55px rgba(34, 50, 37, .1);
  font-family: "DM Sans", "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 760px; min-height: 100vh; background: var(--paper); }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid #9bcba3; outline-offset: 2px; }
.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  z-index: 4; height: 66px; padding: 0 22px; display: flex; align-items: center;
  justify-content: space-between; gap: 20px; background: rgba(255,255,255,.94);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 190px; text-decoration: none; color: var(--ink); font-family: Manrope, sans-serif; font-size: 19px; font-weight: 800; letter-spacing: -1px; }
.brand-mark { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 11px 11px 11px 4px; background: var(--green); color: white; font-family: Georgia, serif; font-size: 24px; font-weight: 700; font-style: italic; line-height: 1; }
.brand-light { color: #828980; font-weight: 500; }
.project-name-wrap { min-width: 160px; display: flex; align-items: center; gap: 14px; }
.project-name { width: 180px; padding: 7px 8px; border: 1px solid transparent; border-radius: 7px; color: #374139; font-size: 13px; font-weight: 600; background: transparent; }
.project-name:hover, .project-name:focus { border-color: var(--line); background: white; outline: none; }
.save-state { white-space: nowrap; color: #858b83; font-size: 11px; }
.save-dot { width: 6px; height: 6px; display: inline-block; margin-right: 6px; border-radius: 50%; background: #71ac7b; vertical-align: 1px; }
.save-dot.unsaved { background: var(--orange); }
.top-actions { display: flex; align-items: center; gap: 9px; }
.icon-button, .zoom-button { width: 33px; height: 33px; border: 0; border-radius: 8px; background: transparent; color: #59645b; font-size: 22px; line-height: 1; cursor: pointer; }
.icon-button:hover, .zoom-button:hover { background: #f0f3ef; }
.icon-button:disabled { opacity: .35; cursor: default; }
.top-divider { width: 1px; height: 24px; margin: 0 5px; background: var(--line); }
.button { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 13px; border: 1px solid transparent; border-radius: 8px; font-size: 12px; font-weight: 650; cursor: pointer; transition: background .16s, transform .16s; }
.button:active { transform: translateY(1px); }
.button-quiet { border-color: #e4e9e3; background: white; color: #48534a; }
.button-quiet:hover { background: #f5f8f4; }
.button-primary { background: var(--green); color: white; box-shadow: 0 3px 7px rgba(36,101,63,.15); }
.button-primary:hover { background: var(--green-dark); }

.editor-layout { min-height: 0; flex: 1; display: grid; grid-template-columns: 276px minmax(360px, 1fr) 258px; }
.left-sidebar { min-height: calc(100vh - 66px); display: grid; grid-template-columns: 70px 1fr; background: white; border-right: 1px solid var(--line); }
.tool-rail { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 16px 7px; border-right: 1px solid #f0f1ee; }
.rail-tool { width: 55px; min-height: 57px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; border: 0; border-radius: 10px; background: transparent; color: #788078; font-size: 9px; font-weight: 600; cursor: pointer; }
.rail-tool:hover { background: #f7f8f6; color: var(--green); }
.rail-tool.active { background: var(--green-soft); color: var(--green-dark); }
.rail-icon { height: 23px; display: grid; place-items: center; font-family: Manrope, sans-serif; font-size: 21px; font-weight: 600; }
.tool-panel { min-width: 0; padding: 20px 14px 22px; overflow: auto; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin: 0 0 5px; font-family: Manrope, sans-serif; font-size: 15px; font-weight: 750; letter-spacing: -.3px; }
.panel-subtitle { margin: 0 0 17px; color: var(--muted); font-size: 11px; line-height: 1.55; }
.search-box { width: 100%; height: 35px; margin-bottom: 15px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfa; color: #566057; font-size: 11px; }
.template-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.template-card { min-width: 0; padding: 0; border: 1px solid #e8ebe6; border-radius: 9px; overflow: hidden; background: white; text-align: left; cursor: pointer; transition: transform .18s, box-shadow .18s; }
.template-card:hover { transform: translateY(-2px); box-shadow: 0 6px 14px rgba(36,54,39,.1); }
.template-art { aspect-ratio: 4 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px; text-align: center; overflow: hidden; }
.template-art strong { font-family: Georgia, serif; font-size: clamp(11px, 1vw, 15px); line-height: 1.08; }
.template-art small { font-size: 6px; letter-spacing: 1.5px; text-transform: uppercase; }
.template-caption { display: block; padding: 7px 8px; color: #59635a; font-size: 9px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-section-label { margin: 20px 0 9px; color: #858c84; font-size: 9px; font-weight: 750; letter-spacing: 1px; text-transform: uppercase; }
.wide-action { width: 100%; min-height: 38px; margin: 0 0 9px; border: 1px solid #e8ece6; border-radius: 8px; background: white; color: #46534a; font-size: 11px; font-weight: 600; cursor: pointer; }
.wide-action:hover { border-color: #bed4c1; background: #f8fbf7; }
.upload-drop { min-height: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 18px 12px; border: 1px dashed #cbd6ca; border-radius: 10px; background: #fafcf9; color: #5c675e; text-align: center; cursor: pointer; }
.upload-drop:hover, .upload-drop.drag-active { border-color: #78a981; background: #f0f8ef; }
.upload-cloud { color: var(--green); font-size: 24px; }
.upload-drop b { font-size: 11px; }
.upload-drop small { color: #8a928a; font-size: 9px; }
.upload-list { display: grid; gap: 7px; margin-top: 15px; }
.upload-item { width: 100%; display: flex; align-items: center; gap: 8px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: white; color: #535e55; text-align: left; cursor: pointer; }
.upload-item img { width: 38px; height: 38px; border-radius: 5px; object-fit: cover; background: #f0f2ed; }
.upload-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.text-preset { width: 100%; margin-bottom: 8px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: white; text-align: left; cursor: pointer; }
.text-preset:hover { border-color: #b6d2b8; background: #f9fcf8; }
.text-preset b { display: block; color: #303b32; font-family: Manrope, sans-serif; font-size: 15px; }
.text-preset small { color: #8a918a; font-size: 9px; }
.font-combo { display: flex; gap: 7px; margin-top: 7px; }
.font-combo button { flex: 1; min-height: 53px; border: 1px solid var(--line); border-radius: 8px; background: white; color: #535d54; font-size: 17px; cursor: pointer; }
.font-combo button span { display: block; margin-top: 2px; color: #899087; font-family: "DM Sans", sans-serif; font-size: 8px; }
.typography-styles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; margin: 8px 0 15px; }
.typography-style { min-height: 61px; display: flex; flex-direction: column; justify-content: center; gap: 5px; overflow: hidden; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: white; text-align: left; cursor: pointer; }
.typography-style:hover { border-color: #b6d2b8; background: #f9fcf8; }
.typography-style > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.15; }
.typography-style small { color: #899087; font-size: 8px; }
.element-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; }
.element-button { min-height: 68px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); border-radius: 9px; background: white; color: #59655c; font-size: 9px; cursor: pointer; }
.element-button:hover { border-color: #bed4c1; background: #f8fbf7; }
.element-symbol { color: var(--green); font-size: 22px; line-height: 1; }
.shape-categories { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 15px; }
.shape-category { min-height: 28px; padding: 0 9px; border: 1px solid #e6eae4; border-radius: 999px; background: #fff; color: #69736a; font-size: 9px; font-weight: 650; cursor: pointer; }
.shape-category:hover, .shape-category.active { border-color: #b7d2bb; background: #edf5ee; color: var(--green-dark); }
.shape-category-heading { margin: 0 0 8px; color: #505b51; font-size: 10px; font-weight: 750; }
.element-button small { color: #8a928a; font-size: 8px; }
.shape-outline-width { margin-top: 9px; }
.shape-no-fill { display: flex; align-items: center; gap: 7px; margin-top: 10px; color: #687269; font-size: 10px; }
.shape-no-fill input { accent-color: var(--green); }
.draw-tool { width: 100%; display: flex; align-items: center; gap: 11px; margin: 0 0 14px; padding: 11px; border: 1px solid #e6eae4; border-radius: 9px; background: #fff; color: #536056; text-align: left; cursor: pointer; }
.vector-tools { display: grid; gap: 0; margin-bottom: 12px; }
.vector-tools .draw-tool { margin-bottom: 7px; }
.draw-tool > span:first-child { color: var(--green); font-size: 22px; }
.draw-tool b, .draw-tool small { display: block; }
.draw-tool b { font-size: 10px; }
.draw-tool small { margin-top: 3px; color: #879087; font-size: 8px; }
.draw-tool:hover, .draw-tool.active { border-color: #b7d2bb; background: #f3f8f2; color: var(--green-dark); }
.shape-brush-settings { margin: 2px 0 15px; padding: 10px; border: 1px solid #e8ece6; border-radius: 8px; background: #fafcf9; }
.shape-brush-settings label { display: flex; justify-content: space-between; margin: 0 0 4px; color: #6b756c; font-size: 9px; font-weight: 650; }
.shape-brush-settings label span { color: #899087; font-weight: 500; }
.shape-brush-settings input { width: 100%; height: 3px; margin: 2px 0 10px; accent-color: var(--green); }
.shape-brush-settings input:last-child { margin-bottom: 0; }
#design-canvas.draw-cursor { cursor: crosshair; }
#design-canvas.node-cursor { cursor: default; }
#design-canvas.brush-cursor { cursor: crosshair; }
#design-canvas.lasso-cursor { cursor: crosshair; }
.swatch-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 8px; }
.swatch { width: 100%; aspect-ratio: 1; border: 1px solid rgba(0,0,0,.08); border-radius: 7px; cursor: pointer; }
.swatch:hover { outline: 2px solid #789880; outline-offset: 2px; }
.custom-color { display: flex; align-items: center; justify-content: space-between; margin-top: 16px; color: #59635a; font-size: 10px; }
.custom-color input { width: 40px; height: 29px; padding: 2px; border: 1px solid var(--line); border-radius: 6px; background: white; cursor: pointer; }
.panel-hint { margin: 14px 0 0; color: #899087; font-size: 9px; line-height: 1.6; }

.workspace { min-width: 0; min-height: calc(100vh - 66px); display: flex; flex-direction: column; background: #f4f5f2; }
.workspace-toolbar { height: 51px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 22px; border-bottom: 1px solid #e9ebe7; background: #fafbf9; }
.page-label { display: flex; align-items: center; gap: 8px; color: #586258; font-size: 11px; font-weight: 600; }
.page-icon { color: #8b948b; font-size: 14px; }
.workspace-actions { display: flex; align-items: center; gap: 13px; }
.toolbar-button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 0; border: 0; background: none; color: #687269; font-size: 11px; cursor: pointer; }
.toolbar-button:hover { color: var(--green); }
.stage-scroll { min-height: 0; flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; padding: 30px; }
.stage-inner { position: relative; flex: 0 0 auto; display: grid; place-items: center; }
.canvas-wrap { position: relative; z-index: 1; box-shadow: 0 10px 34px rgba(41,52,43,.16), 0 2px 6px rgba(41,52,43,.09); line-height: 0; }
#design-canvas { display: block; max-width: none; touch-action: none; }
.empty-hint { position: absolute; z-index: 2; top: calc(100% + 17px); display: flex; align-items: center; gap: 7px; color: #828a81; font-size: 10px; white-space: nowrap; pointer-events: none; }
.empty-hint[hidden] { display: none; }
.hint-sparkle { color: #72a778; font-size: 14px; }
.workspace-footer { min-height: 45px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 17px; border-top: 1px solid #e8ebe6; background: #fafbf9; color: #7d867d; font-size: 10px; }
.footer-left { display: flex; align-items: center; gap: 7px; }
.status-pip { width: 6px; height: 6px; border-radius: 50%; background: #79ad7d; }
.footer-separator { color: #c1c6bf; }
.zoom-control { display: flex; align-items: center; gap: 6px; }
.zoom-button { width: 23px; height: 24px; font-size: 16px; }
.zoom-control input { width: 78px; height: 3px; accent-color: var(--green); cursor: pointer; }
.zoom-value { width: 31px; text-align: right; font-size: 9px; }

.right-sidebar { min-height: calc(100vh - 66px); display: flex; flex-direction: column; border-left: 1px solid var(--line); background: white; }
.inspector-heading { height: 51px; flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; border-bottom: 1px solid var(--line); font-family: Manrope, sans-serif; font-size: 13px; font-weight: 750; }
.text-button { padding: 4px; border: 0; background: transparent; color: #718074; font-size: 9px; cursor: pointer; }
.text-button:hover { color: var(--green); }
.inspector-content { max-height: 48vh; min-height: 130px; overflow: auto; padding: 14px 15px 16px; }
.inspector-empty { display: flex; min-height: 105px; flex-direction: column; align-items: center; justify-content: center; gap: 7px; color: #879087; text-align: center; }
.inspector-empty span { font-size: 21px; color: #a5b4a5; }
.inspector-empty small { max-width: 160px; font-size: 9px; line-height: 1.55; }
.inspector-label { display: block; margin-bottom: 7px; color: #6b756c; font-size: 9px; font-weight: 700; letter-spacing: .2px; }
.inspector-block { margin-bottom: 15px; }
.control-row { display: flex; align-items: center; gap: 7px; }
.control-row + .control-row { margin-top: 7px; }
.small-field { min-width: 0; flex: 1; }
.small-field label { display: block; margin: 0 0 4px; color: #899087; font-size: 8px; }
.small-field input, .small-field select, .inspector-content textarea { width: 100%; min-height: 30px; padding: 5px 7px; border: 1px solid #e6e9e4; border-radius: 6px; background: #fbfcfa; color: #465148; font-size: 10px; }
.inspector-content textarea { min-height: 58px; resize: vertical; line-height: 1.45; }
.inspector-content input[type="range"] { width: 100%; height: 3px; accent-color: var(--green); }
.inspector-content input[type="color"] { width: 100%; height: 30px; padding: 2px; border: 1px solid #e6e9e4; border-radius: 6px; background: white; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; margin: 9px 0 0; color: #69736b; font-size: 9px; }
.toggle-row input { accent-color: var(--green); }
.inspector-buttons { display: flex; gap: 6px; }
.inspector-buttons button { flex: 1; min-height: 28px; border: 1px solid #e7ebe5; border-radius: 6px; background: white; color: #647064; font-size: 9px; cursor: pointer; }
.inspector-buttons button:hover { border-color: #b9d1bc; color: var(--green); }
.filter-presets { display: grid; grid-template-columns: repeat(4,1fr); gap: 5px; }
.filter-preset { padding: 0; border: 1px solid #e6e9e4; border-radius: 6px; overflow: hidden; background: white; color: #687168; font-size: 8px; cursor: pointer; }
.filter-preset .filter-sample { display: block; height: 27px; margin-bottom: 3px; background: linear-gradient(140deg,#e8ba97,#6e8d68 55%,#d1d49b); }
.filter-preset:hover { border-color: #9fbea4; }
.tool-note { margin: 7px 0 0; color: #899087; font-size: 8px; line-height: 1.5; }
.retouch-card { display: grid; gap: 7px; }
.retouch-card .panel-section-label { margin: 11px 0 2px; }
.retouch-tool { width: 100%; display: flex; align-items: flex-start; gap: 10px; padding: 10px; border: 1px solid #e6e2d9; border-radius: 8px; background: #fdfcf8; color: #696c62; text-align: left; cursor: pointer; }
.retouch-tool > span:first-child { width: 24px; flex: 0 0 auto; color: #967254; font-size: 17px; text-align: center; }
.retouch-tool b, .retouch-tool small { display: block; }
.retouch-tool b { margin: 1px 0 3px; color: #424a40; font-size: 10px; }
.retouch-tool small { color: #81857b; font-size: 9px; line-height: 1.45; }
.image-selection-actions { margin-top: 3px; }
.image-selection-actions .wide-action { margin-bottom: 6px; }
.image-selection-actions .text-button { display: block; margin: 0 auto; }
.retouch-tool:hover, .retouch-tool.selected { border-color: #bda58c; background: #f4ede5; }
.retouch-tool.selected { box-shadow: inset 3px 0 #a87755; }
.retouch-settings { margin: 15px 0; padding: 11px 10px; border: 1px solid #e6e2d9; border-radius: 8px; background: #fdfcf8; }
.retouch-settings .inspector-label { display: flex; justify-content: space-between; margin: 0 0 5px; }
.retouch-settings input[type="range"] { margin: 2px 0 12px; }
.retouch-settings input[type="range"]:last-child { margin-bottom: 0; }
.retouch-notice { margin: 12px 0; padding: 11px; border-left: 3px solid #b9926d; border-radius: 4px; background: #f3efe7; }
.retouch-notice b { color: #66503a; font-size: 9px; }
.retouch-notice p { margin: 5px 0 0; color: #77766d; font-size: 9px; line-height: 1.55; }
#design-canvas.retouch-cursor { cursor: crosshair; touch-action: none; }
.layers-section { min-height: 0; flex: 1; display: flex; flex-direction: column; border-top: 1px solid var(--line); }
.section-title-row { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 13px 15px 10px; }
.section-title-row h2 { margin: 0; font-family: Manrope, sans-serif; font-size: 11px; font-weight: 750; }
.count-badge { min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 5px; border-radius: 10px; background: #f1f3f0; color: #788078; font-size: 8px; }
.layer-list { min-height: 0; flex: 1; overflow: auto; padding: 0 9px 10px; }
.layer-row { display: flex; align-items: center; gap: 6px; min-height: 36px; margin-bottom: 3px; padding: 3px 5px; border: 1px solid transparent; border-radius: 7px; color: #59635a; cursor: pointer; }
.layer-row:hover { background: #f7f8f6; }
.layer-row.selected { border-color: #d4e5d4; background: #f1f7f0; }
.layer-row.drag-over { border-top: 2px solid var(--green); }
.layer-grip { color: #b2b9b1; font-size: 12px; cursor: grab; }
.layer-thumb { width: 25px; height: 25px; display: grid; flex: 0 0 auto; place-items: center; overflow: hidden; border: 1px solid #ebeee9; border-radius: 5px; background: #f5f6f3; color: #7a897b; font-size: 12px; }
.layer-thumb img { width: 100%; height: 100%; object-fit: cover; }
.layer-name { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 9px; }
.layer-action { width: 20px; height: 23px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 4px; background: transparent; color: #899189; font-size: 10px; cursor: pointer; }
.layer-action:hover { background: white; color: var(--green); }
.layer-delete-action:hover { background: #fae9e5; color: #b74736; }
.layers-empty { padding: 13px 8px; color: #929990; font-size: 9px; line-height: 1.5; text-align: center; }
.side-footer { min-height: 34px; flex: 0 0 auto; padding: 10px 13px; border-top: 1px solid #f0f1ee; color: #899087; font-size: 8px; }
.local-badge { margin-right: 5px; color: #7cad81; font-size: 8px; }

.modal { width: min(440px, calc(100vw - 32px)); max-width: none; padding: 0; border: 0; border-radius: 15px; background: transparent; box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(31,40,33,.35); backdrop-filter: blur(3px); }
.modal-card { padding: 23px; border: 1px solid rgba(255,255,255,.7); border-radius: 15px; background: white; }
.modal-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; }
.modal-heading h2 { margin: 0; font-family: Manrope, sans-serif; font-size: 21px; letter-spacing: -.7px; }
.eyebrow { margin: 0 0 5px; color: #7aa07b; font-size: 8px; font-weight: 800; letter-spacing: 1.2px; }
.close-button { width: 27px; height: 27px; border: 0; border-radius: 7px; background: #f5f6f3; color: #707970; font-size: 20px; cursor: pointer; }
.modal-copy { margin: 9px 0 17px; color: #778078; font-size: 11px; line-height: 1.55; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; }
.field-grid label { position: relative; color: #737d74; font-size: 9px; font-weight: 600; }
.field-grid label span { float: right; color: #a0a69e; font-weight: 400; }
.field-grid input { width: 100%; height: 35px; display: block; margin-top: 6px; padding: 0 9px; border: 1px solid #e5e9e3; border-radius: 7px; background: #fbfcfa; color: #414b42; font-size: 11px; }
.modal-divider { height: 1px; margin: 19px 0 14px; background: #eef0ec; }
.modal-subheading { margin-bottom: 11px; color: #48534a; font-size: 10px; font-weight: 700; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 19px; }
.export-options { display: grid; gap: 7px; }
.export-option { width: 100%; display: flex; align-items: center; gap: 11px; padding: 10px; border: 1px solid #e8ebe6; border-radius: 8px; background: white; text-align: left; cursor: pointer; }
.export-option.selected { border-color: #83b28a; background: #f6fbf5; }
.format-icon { width: 37px; height: 31px; display: grid; place-items: center; border-radius: 5px; background: #edf3ec; color: #55845a; font-size: 9px; font-weight: 800; }
.export-option b, .export-option small { display: block; }
.export-option b { color: #465048; font-size: 10px; }
.export-option small { margin-top: 3px; color: #899189; font-size: 8px; }
.export-option i { margin-left: auto; color: var(--green); font-size: 14px; font-style: normal; }
.quality-label { display: block; margin-top: 15px; color: #657066; font-size: 9px; }
.quality-label span { float: right; color: #7c887e; }
.quality-label input { width: 100%; margin-top: 9px; accent-color: var(--green); }
.button-wide { width: 100%; min-height: 40px; }
.toast-region { position: fixed; z-index: 10; right: 20px; bottom: 60px; display: grid; gap: 8px; pointer-events: none; }
.toast { max-width: 320px; padding: 11px 14px; border: 1px solid #e4e9e2; border-radius: 9px; background: white; box-shadow: 0 8px 25px rgba(40,54,41,.12); color: #4a574d; font-size: 11px; animation: toast-in .18s ease-out; }
.toast.error { border-color: #f0c9bd; color: #9e4f37; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 1080px) {
  .editor-layout { grid-template-columns: 250px minmax(320px,1fr) 225px; }
  .left-sidebar { grid-template-columns: 63px 1fr; }
  .rail-tool { width: 50px; }
  .tool-panel { padding-right: 11px; padding-left: 11px; }
  .topbar { padding: 0 15px; }
  .brand { min-width: 160px; }
}
@media (max-width: 840px) {
  body { min-width: 620px; }
  .editor-layout { grid-template-columns: 218px minmax(300px,1fr); grid-template-rows: minmax(500px, calc(100vh - 66px)) 280px; }
  .right-sidebar { min-height: 280px; display: grid; grid-column: 1 / -1; grid-row: 2; grid-template-columns: minmax(0,1fr) minmax(0,1fr); grid-template-rows: 51px minmax(0,1fr); }
  .inspector-heading { grid-column: 1 / -1; grid-row: 1; }
  .inspector-content { grid-column: 1; grid-row: 2; max-height: none; }
  .layers-section { grid-column: 2; grid-row: 2; border-top: 0; border-left: 1px solid var(--line); }
  .side-footer { display: none; }
  .brand { min-width: 132px; }
  .project-name-wrap { min-width: 130px; }
  .project-name { width: 125px; }
  .stage-scroll { padding: 20px; }
}
@media (max-width: 640px) {
  body { min-width: 0; }
  .topbar { gap: 7px; padding: 0 10px; }
  .brand { min-width: 95px; gap: 6px; font-size: 16px; }
  .brand-mark { width: 27px; height: 27px; font-size: 21px; }
  .brand-light { display: none; }
  .project-name-wrap { min-width: 0; flex: 1; }
  .project-name { width: 100%; padding-right: 2px; padding-left: 4px; font-size: 11px; }
  .save-state, .top-divider { display: none; }
  .top-actions { gap: 2px; }
  .top-actions .icon-button { width: 28px; }
  .top-actions .button-primary { min-height: 32px; padding: 0 8px; }
  .editor-layout { grid-template-columns: 198px minmax(0, 1fr); }
  .left-sidebar { grid-template-columns: 54px 1fr; }
  .tool-rail { padding-right: 3px; padding-left: 3px; }
  .rail-tool { width: 47px; }
  .workspace-toolbar { padding: 0 10px; }
  .workspace-actions { gap: 7px; }
  .toolbar-button { font-size: 9px; }
  .stage-scroll { padding: 12px; }
  .workspace-footer { padding: 0 8px; }
  .footer-left { gap: 4px; font-size: 8px; }
  .zoom-control { gap: 3px; }
  .zoom-control input { width: 46px; }
}
@media (max-width: 420px) {
  .top-actions .button-quiet { display: none; }
}

:root {
  --ink: #262d28;
  --muted: #7f8077;
  --line: #dedbd1;
  --paper: #eeece5;
  --green: #52695a;
  --green-dark: #36493d;
  --green-soft: #e7ece5;
  --orange: #bf825b;
  --shadow: 0 22px 65px rgba(34, 36, 31, .18);
}

body { background: #eae8e0; }
.topbar {
  background: #272e29;
  border-bottom-color: #3b433d;
  color: #f3f0e7;
}
.brand { color: #f3f0e7; }
.brand-mark { background: #b97e58; color: #fffaf1; }
.brand-light { color: #a9ada5; }
.project-name { color: #f1eee5; }
.project-name:hover, .project-name:focus { border-color: #51594f; background: #313832; }
.save-state { color: #b4baaf; }
.top-divider { background: #485047; }
.icon-button { color: #d3d5cb; }
.icon-button:hover, .zoom-button:hover { background: #3a423b; color: white; }
.button-quiet { border-color: #50584f; background: #313832; color: #eeeae0; }
.button-quiet:hover { background: #414a42; }
.button-primary { background: #a86e4c; box-shadow: 0 3px 8px rgba(10,16,12,.2); }
.button-primary:hover { background: #925b3e; }
.left-sidebar { background: #f6f4ed; border-right-color: #dcd9cf; }
.tool-rail { background: #303832; border-right-color: #424a42; }
.rail-tool { color: #c1c6bb; }
.rail-tool:hover { background: #414a42; color: #f6e8d9; }
.rail-tool.active { background: #49564a; color: #f4e8d9; box-shadow: inset 2px 0 #c08a64; }
.rail-icon { color: inherit; }
.tool-panel { background: #f6f4ed; }
.workspace { background: #e8e6de; }
.workspace-toolbar, .workspace-footer { background: #f8f6f0; border-color: #dddad0; }
.page-label { color: #41473f; }
.stage-scroll {
  background-color: #e8e6de;
  background-image: radial-gradient(circle, rgba(91, 94, 82, .15) .8px, transparent .9px);
  background-size: 19px 19px;
}
.stage-scroll.grid-on {
  background-image: linear-gradient(rgba(99, 101, 88, .11) 1px, transparent 1px), linear-gradient(90deg, rgba(99, 101, 88, .11) 1px, transparent 1px), linear-gradient(rgba(99, 101, 88, .045) 1px, transparent 1px), linear-gradient(90deg, rgba(99, 101, 88, .045) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 12px 12px, 12px 12px;
}
.canvas-wrap { box-shadow: 0 24px 58px rgba(40, 42, 34, .2), 0 4px 12px rgba(40, 42, 34, .12); }
.toolbar-button { color: #65685e; }
.toolbar-button.active, .toolbar-button:hover { color: #9a6344; }
.right-sidebar { background: #f8f6f0; border-left-color: #dcd9cf; }
.inspector-heading, .layers-section { border-color: #e4e0d6; }
.section-title-row h2, .inspector-heading { color: #333a34; }
.section-title-row { padding-top: 16px; }
.inspector-label { color: #565b52; letter-spacing: .45px; text-transform: uppercase; }
.small-field input, .small-field select, .inspector-content textarea { background: #fdfcf8; }
.layer-row.selected { border-color: #d9c2ad; background: #f4ede5; }
.layer-row.selected .layer-thumb { border-color: #ddc5af; color: #94674b; }
.layer-row:hover { background: #f1efe8; }
.inspector-buttons button:hover, .wide-action:hover { border-color: #cbb29c; color: #8d5e40; }
.template-card { border-color: #e1ddd2; }
.template-card:hover { box-shadow: 0 8px 18px rgba(50, 50, 41, .14); }
.panel-heading { font-family: "DM Sans", "Segoe UI", sans-serif; font-size: 14px; letter-spacing: .1px; }
.panel-section-label { letter-spacing: 1.3px; }
.status-pip { background: #b67a55; }
.local-badge { color: #a87755; }
.arrange-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.arrange-grid button { min-height: 28px; border: 1px solid #e6e2d9; border-radius: 6px; background: #fdfcf8; color: #61665d; font-size: 14px; cursor: pointer; }
.arrange-grid button:hover { border-color: #c7a68b; background: #f6eee7; color: #925f41; }
.inspector-block { margin-bottom: 13px; }
.inspector-content { max-height: 53vh; }

@media (max-width: 840px) {
  .right-sidebar { background: #f8f6f0; }
  .workspace-actions { gap: 8px; }
  .workspace-actions .toolbar-button span { display: none; }
  .workspace-actions .toolbar-button { min-width: 24px; justify-content: center; }
}

@media (max-width: 640px) {
  html { scroll-padding-top: 58px; }
  body { min-width: 0; overflow-x: hidden; }
  .app-shell { min-height: 100svh; }
  .topbar {
    position: sticky;
    top: 0;
    height: 58px;
    flex: 0 0 58px;
    gap: 7px;
    padding: 0 10px;
  }
  .brand { min-width: 0; flex: 0 0 auto; gap: 6px; font-size: 15px; }
  .brand-mark { width: 27px; height: 27px; font-size: 21px; }
  .brand-light { display: none; }
  .project-name-wrap { min-width: 0; flex: 1 1 auto; }
  .project-name { min-width: 0; width: 100%; padding: 7px 5px; font-size: 11px; }
  .save-state, .top-divider, #save-project-btn { display: none; }
  .top-actions { flex: 0 0 auto; gap: 1px; }
  .top-actions .icon-button { width: 27px; height: 32px; font-size: 19px; }
  .top-actions .button-primary { min-height: 33px; gap: 4px; padding: 0 8px; font-size: 10px; }

  .editor-layout {
    min-height: calc(100svh - 58px);
    display: flex;
    flex: 1 0 auto;
    flex-direction: column;
    overflow: visible;
  }
  .workspace {
    order: 1;
    width: 100%;
    height: 58svh;
    min-height: 350px;
    flex: 0 0 auto;
  }
  .workspace-toolbar { height: 46px; padding: 0 9px; }
  .page-label { min-width: 0; max-width: 34%; overflow: hidden; font-size: 10px; }
  .page-label > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .workspace-actions { min-width: 0; gap: 2px; }
  .workspace-actions .toolbar-button { min-width: 27px; height: 34px; padding: 0 3px; font-size: 12px; }
  .workspace-actions #clear-page { display: none; }
  .stage-scroll { min-height: 0; padding: 12px; overflow-x: hidden; overflow-y: auto; }
  .workspace-footer { min-height: 43px; padding: 0 8px; }
  .footer-left { min-width: 0; gap: 4px; overflow: hidden; font-size: 8px; white-space: nowrap; }
  .footer-left #selection-label { overflow: hidden; text-overflow: ellipsis; }
  .zoom-control { flex: 0 0 auto; gap: 2px; }
  .zoom-control input { width: 42px; }
  .zoom-value { width: 27px; font-size: 8px; }

  .left-sidebar {
    order: 2;
    display: flex;
    min-height: 0;
    flex: 0 0 auto;
    flex-direction: column;
    border-right: 0;
    border-bottom: 1px solid #dcd9cf;
  }
  .tool-rail {
    order: 2;
    width: 100%;
    min-height: 66px;
    flex: 0 0 66px;
    flex-direction: row;
    justify-content: space-around;
    gap: 3px;
    padding: 5px 7px;
    border-top: 1px solid #454c44;
    border-right: 0;
  }
  .rail-tool {
    width: auto;
    min-width: 52px;
    min-height: 53px;
    flex: 1 1 0;
    gap: 2px;
    border-radius: 9px;
    font-size: 9px;
  }
  .rail-icon { height: 21px; font-size: 19px; }
  .tool-panel {
    order: 1;
    display: none;
    width: 100%;
    max-height: 43svh;
    padding: 14px 14px 18px;
    overflow: auto;
    overscroll-behavior: contain;
  }
  .left-sidebar.panel-open .tool-panel { display: block; }
  .tool-panel-close {
    width: 100%;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: -4px 0 12px;
    padding: 0 2px;
    border: 0;
    background: transparent;
    color: #77786f;
    font-size: 10px;
    font-weight: 650;
    cursor: pointer;
  }
  .tool-panel-close span { font-size: 19px; }
  .template-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .template-art { aspect-ratio: 1 / 1.08; padding: 6px; }
  .template-art strong { font-size: clamp(10px, 3.2vw, 14px); }
  .template-art small { font-size: 6px; letter-spacing: 1px; }
  .template-caption { padding: 7px 6px; font-size: 9px; }
  .panel-heading { font-size: 15px; }
  .panel-subtitle { margin-bottom: 13px; font-size: 11px; }
  .search-box { min-height: 40px; font-size: 13px; }
  .text-preset { min-height: 55px; }
  .element-button { min-height: 70px; font-size: 10px; }
  .wide-action { min-height: 42px; font-size: 12px; }

  .right-sidebar {
    order: 3;
    display: flex;
    width: 100%;
    min-height: 0;
    flex: 0 0 auto;
    flex-direction: column;
    border-top: 0;
    border-left: 0;
  }
  .inspector-heading { height: 48px; min-height: 48px; padding: 0 14px; }
  .inspector-content { max-height: none; min-height: 110px; padding: 14px; overflow: visible; }
  .layers-section { min-height: 140px; max-height: 260px; border-top: 1px solid #e4e0d6; border-left: 0; }
  .layer-list { max-height: 205px; }
  .side-footer { display: block; }

  .modal { width: min(440px, calc(100vw - 24px)); }
  .modal-card { padding: 19px; }
  .field-grid input { min-height: 40px; font-size: 14px; }
  .button { min-height: 42px; }
  .toast-region { right: 12px; bottom: 14px; left: 12px; }
  .toast { max-width: none; }
}

@media (max-width: 360px) {
  .topbar { gap: 4px; padding: 0 7px; }
  .brand { font-size: 14px; }
  .top-actions .icon-button { width: 23px; }
  .top-actions .button-primary { padding: 0 6px; }
  .page-label { max-width: 28%; }
  .workspace-actions .toolbar-button { min-width: 24px; }
  .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tool-rail { gap: 1px; padding-right: 3px; padding-left: 3px; }
  .rail-tool { min-width: 0; font-size: 8px; }
  .rail-icon { font-size: 17px; }
}
