:root {
  --paper: #f6f3ec;
  --white: #ffffff;
  --ink: #2b2419;
  --muted: #746b5e;
  --line: #ded5c6;
  --primary: #402b09;
  --sage: #f5ead1;
  --wood: #c58a33;
  --brand-brown: #402b09;
  --brand-gold: #c58a33;
  --brand-gold-light: #f0c55f;
}

body {
  background: var(--paper);
}

body.shared-view .topbar nav,
body.shared-view .top-actions,
body.shared-view .workbench-toolbar,
body.shared-view .left-panel,
body.shared-view .right-panel,
body.shared-view .stage-top,
body.shared-view .stage-bottom,
body.shared-view .view-tools,
body.shared-view .direct-editor,
body.shared-view .move-step,
body.shared-view .panel-edge-toggle,
body.shared-view #ground-warning,
body.shared-view #selection-quick,
body.shared-view .precision-points,
body.shared-view dialog:not(#crafter-imprint) {
  display: none !important;
}

body.shared-view .topbar {
  height: 64px;
  justify-content: flex-start;
  gap: 16px;
}

body.shared-view .topbar .brand,
body.shared-view .topbar .brand-mark {
  display: flex;
}

body.shared-view .brand > div,
body.shared-view .brand small {
  display: block !important;
}

body.shared-view .stage-title {
  display: none;
}

.shared-project-heading {
  display: grid;
  min-width: 0;
  margin-right: auto;
}

.shared-project-heading strong,
.shared-project-heading small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shared-project-heading strong {
  font-size: 16px;
}

.shared-project-heading small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.shared-fit-toggle[aria-pressed="true"] {
  border-color: var(--brand-gold);
  background: #fff4d9;
  box-shadow: inset 0 -3px var(--brand-gold);
}

@media(max-width:600px) {
  body.shared-view .topbar { gap: 6px; padding: 0 8px; }
  body.shared-view .brand { min-width: 0; gap: 6px; font-size: 12px; }
  body.shared-view .brand small { display: none !important; }
  .shared-project-heading { flex: 1 1 auto; overflow: hidden; }
  .shared-project-heading strong { font-size: 12px; }
  .shared-project-heading small { margin-top: 1px; font-size: 8px; }
  .shared-fit-toggle { flex: 0 0 72px; min-height: 38px; padding: 5px 4px; font-size: 9px; line-height: 1.15; white-space: normal; }
}

@media(max-width:420px) {
  body.shared-view .brand > div { display: none !important; }
  body.shared-view .brand { flex: 0 0 auto; }
  body.shared-view .topbar .brand-mark.has-custom-logo { max-width: 52px; }
}

body.shared-view .workspace {
  display: block !important;
  height: calc(100dvh - 101px) !important;
}

body.shared-view footer {
  display: flex !important;
  justify-content: flex-end;
}

body.shared-view footer > div:not(.footer-brand) {
  display: none;
}

body.shared-view .stage {
  width: 100%;
  height: 100%;
}

.footer-brand {
  align-items: baseline;
}

#crafter-imprint-button {
  min-height: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 700;
  line-height: inherit;
}

body.shared-error #scene,
body.shared-error .stage-title,
body.shared-error .axis-widget,
body.shared-error .toast {
  display: none;
}

.toast {
  background: #fffef8;
  color: var(--brand-brown);
  border: 1px solid #c8bca5;
  box-shadow: 0 5px 25px #402b091f;
}

body.shared-error #critical-error {
  display: block;
  max-width: 620px;
  margin: 15vh auto;
  padding: 24px;
  border-left: 4px solid var(--brand-gold);
  background: #fff;
  color: var(--brand-brown);
  font-weight: 700;
}

.project-thumb canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.project-library-tabs button.active {
  border-color: var(--brand-gold);
  color: var(--brand-brown);
}

.project-library-card,
.project-card-actions,
#admin-project-overview {
  box-sizing: border-box;
  width: 100%;
  border-color: #d8cdb8;
  background: #faf7f0;
}

#production-admin-content #admin-area-overview {
  padding-inline: 0;
}

#admin-login-form {
  margin-bottom: 14px;
}

body #workspace-settings-dialog {
  font-size: 9px;
}

body #workspace-settings-dialog label,
body #workspace-settings-dialog select,
body #workspace-settings-dialog input,
body #workspace-settings-dialog .workspace-panel-row,
body #workspace-settings-dialog .crafter-check {
  font-size: 9px;
}

body #workspace-settings-dialog select,
body #workspace-settings-dialog input[type="number"] {
  min-height: 30px;
  margin-top: 4px;
  padding: 6px 8px;
}

body #workspace-settings-dialog label:has(#workspace-insert-mode) {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 0;
  padding-block: 4px;
}

body #workspace-settings-dialog #workspace-insert-mode {
  margin-top: 0;
}

body #workspace-settings-dialog label:has(#workspace-generator-previews),
body #workspace-settings-dialog label:has(#workspace-ground-correction),
body #workspace-settings-dialog label:has(#workspace-camera-inside),
body #workspace-settings-dialog label:has(#workspace-drag-drop-insert),
body #workspace-settings-dialog label:has(#workspace-negative-hints) {
  padding-block: 4px;
}

body #workspace-settings-dialog .workspace-panel-row {
  gap: 10px;
  padding-block: 6px;
}

.topbar .top-actions {
  overflow-x: visible;
}

#admin-ai-model-config {
  margin: 14px 0;
  padding: 10px 0;
  border-block: 1px solid var(--line, #ccd4cf);
}

#admin-ai-model-config > summary {
  cursor: pointer;
  font-weight: 700;
}

.admin-ai-model-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.admin-ai-model-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--line, #ccd4cf);
}

.admin-ai-model-list > div > div {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.admin-ai-model-list span,
.admin-ai-model-test-output {
  overflow-wrap: anywhere;
  font-size: 12px;
}

.admin-ai-model-test-actions {
  margin: 8px 0;
}

.admin-ai-model-test-output {
  margin: 8px 0 14px;
  padding: 10px;
  white-space: pre-wrap;
  border: 1px solid var(--line, #ccd4cf);
  background: #f7f4ed;
}

.project-card-copy strong {
  color: var(--brand-brown);
}

.project-library-card.is-current {
  border-color: var(--brand-gold);
  box-shadow: inset 0 3px var(--brand-gold), 0 5px 18px #402b0912;
}

.project-card-actions {
  flex-wrap: wrap;
}

.project-card-actions select {
  flex: 1 0 100%;
  width: 100%;
  margin-left: 0;
}

button {
  border-color: #d8c9ad;
  background: #fff;
  color: var(--brand-brown);
  font-weight: 650;
  box-shadow: 0 1px 2px #402b0912;
}

button:hover:not(:disabled) {
  border-color: var(--brand-gold);
  background: #fbf4e4;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--brand-gold);
  outline-offset: 2px;
}

.brand-mark {
  border-color: var(--brand-gold);
  color: var(--brand-brown);
  box-shadow: inset 0 0 0 1px #f6dfac;
}

.brand-mark span {
  color: var(--brand-gold);
}

.workbench-toolbar .direct-modes {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(100%, 324px);
  gap: 3px;
  padding: 3px;
  border: 1px solid #d8c9ad;
  border-radius: 8px;
  background: #f3eee3;
  box-shadow: inset 0 1px 2px #402b0912;
}

.workbench-toolbar .direct-modes button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  min-width: 0;
  height: 42px;
  min-height: 42px;
  padding: 0 10px;
  border: 0;
  border-right: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--brand-brown);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  box-shadow: none;
}

.workbench-toolbar .direct-modes button:last-child {
  border-right: 0;
}

dialog::backdrop {
  background: rgba(30, 27, 23, .38);
}

.direct-modes .mode-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: #8a6424;
  font-size: 17px;
  line-height: 1;
}

.workbench-toolbar .direct-modes button:hover:not(:disabled) {
  background: #fffaf0;
  color: #402b09;
}

.workbench-toolbar .direct-modes button.active,
.workbench-toolbar .direct-modes button[aria-pressed="true"] {
  border-right-color: transparent;
  background: var(--brand-brown);
  color: #fffdf7;
  box-shadow: 0 2px 7px #402b0938;
}

.workbench-toolbar .direct-modes button.active .mode-icon,
.workbench-toolbar .direct-modes button[aria-pressed="true"] .mode-icon {
  color: var(--brand-gold-light);
}

.toolbar-icon-groups {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid #d8c9ad;
  border-radius: 7px;
  background: #fffdf7;
}

.toolbar-icon-groups .crafter-icon-tools,
.toolbar-quick-tools {
  display: flex;
  align-items: center;
  gap: 3px;
}

.toolbar-quick-tools {
  padding-left: 0;
  border-left: 0;
}

.toolbar-icon-groups .crafter-icon-tools button,
.toolbar-icon-groups .toolbar-quick-tools button {
  display: grid;
  place-items: center;
  flex: 0 0 40px;
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  color: var(--brand-brown);
  font-size: 18px;
  line-height: 1;
  background: transparent;
  border-color: transparent;
  border-radius: 5px;
}

.toolbar-icon-groups .crafter-icon-tools button:disabled,
.toolbar-icon-groups .toolbar-quick-tools button:disabled {
  color: #8d8679;
  opacity: .68;
}

.toolbar-icon-groups .crafter-icon-tools button:hover:not(:disabled),
.toolbar-icon-groups .toolbar-quick-tools button:hover:not(:disabled) {
  background: var(--sage);
  border-color: #d8c39a;
}

.toolbar-icon-groups .crafter-icon-tools button:focus-visible,
.toolbar-icon-groups .toolbar-quick-tools button:focus-visible {
  outline: 2px solid var(--brand-gold);
  outline-offset: 1px;
}

.toolbar-icon-groups button[data-tool-tone] {
  --tool-accent: #567084;
  --tool-wash: #5670840a;
  --tool-line: #5670841f;
  --tool-glow: #56708424;
  color: var(--tool-accent);
  background: var(--tool-wash);
  border-color: transparent;
  box-shadow: inset 0 0 0 1px var(--tool-line), 0 0 8px transparent;
  transition: background-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.toolbar-icon-groups button[data-tool-tone="align"] { --tool-accent:#33766f;--tool-wash:#33766f0b;--tool-line:#33766f20;--tool-glow:#2b8d7f2b; }
.toolbar-icon-groups button[data-tool-tone="polarity"] { --tool-accent:#95631c;--tool-wash:#b47b190c;--tool-line:#95631c22;--tool-glow:#c38a252d; }
.toolbar-icon-groups button[data-tool-tone="combine"] { --tool-accent:#8a5b18;--tool-wash:#c58a3314;--tool-line:#c58a3345;--tool-glow:#c58a3340; }
.toolbar-icon-groups .crafter-icon-tools #merge-button {
  color: #2f210c;
  background: var(--brand-gold);
  border-color: #9f6b22;
  box-shadow: 0 2px 7px #8d5d2438;
}

.toolbar-icon-groups .crafter-icon-tools #merge-button:hover:not(:disabled) {
  color: #2f210c;
  background: var(--brand-gold-light);
  border-color: var(--brand-gold);
  box-shadow: 0 3px 10px #8d5d2447;
}

.toolbar-icon-groups .crafter-icon-tools #merge-button:disabled {
  color: #745424;
  background: #ead7b2;
  border-color: #d5b77d;
  opacity: .72;
}

.toolbar-icon-groups button[data-tool-tone="release"] { --tool-accent:#497348;--tool-wash:#4d854c0b;--tool-line:#49734820;--tool-glow:#5b98592b; }
.toolbar-icon-groups button[data-tool-tone="history"] { --tool-accent:#536c92;--tool-wash:#5579a40a;--tool-line:#536c9220;--tool-glow:#6687b52a; }
.toolbar-icon-groups button[data-tool-tone="duplicate"] { --tool-accent:#876d2f;--tool-wash:#aa84240b;--tool-line:#876d2f20;--tool-glow:#bd92322a; }
.toolbar-icon-groups button[data-tool-tone="delete"] { --tool-accent:#9a4b45;--tool-wash:#b6534a0a;--tool-line:#9a4b4520;--tool-glow:#c95d5328; }
.toolbar-icon-groups button[data-tool-tone="text"] { --tool-accent:#51698d;--tool-wash:#5979a00a;--tool-line:#51698d20;--tool-glow:#6687af28; }
.toolbar-icon-groups button[data-tool-tone="shape"] { --tool-accent:#687746;--tool-wash:#7c914a0a;--tool-line:#68774620;--tool-glow:#819b4e28; }

.toolbar-icon-groups .crafter-icon-tools button[data-tool-tone]:hover:not(:disabled),
.toolbar-icon-groups .toolbar-quick-tools button[data-tool-tone]:hover:not(:disabled),
.toolbar-icon-groups button[data-tool-tone].active,
.toolbar-icon-groups button[data-tool-tone][aria-pressed="true"] {
  color: var(--tool-accent);
  background: var(--tool-wash);
  border-color: transparent;
  box-shadow: inset 0 0 0 1px var(--tool-line), 0 0 11px var(--tool-glow);
  transform: translateY(-1px);
}

.toolbar-icon-groups button[data-tool-tone]:disabled {
  color: #8d8679;
  background: transparent;
  box-shadow: none;
  transform: none;
}

.workbench-toolbar .direct-modes button[data-object-mode="move"] { --mode-accent:#6f5432;--mode-wash:#8b6a3612;--mode-glow:#8b6a3628; }
.workbench-toolbar .direct-modes button[data-object-mode="rotate"] { --mode-accent:#8a6424;--mode-wash:#a77c2912;--mode-glow:#b389352c; }
.workbench-toolbar .direct-modes button[data-object-mode="scale"] { --mode-accent:#5f4b34;--mode-wash:#725b3d12;--mode-glow:#725b3d28; }
.workbench-toolbar .direct-modes button[data-object-mode]:hover:not(:disabled) { color:var(--mode-accent);background:var(--mode-wash);box-shadow:inset 0 0 0 1px var(--mode-accent),0 0 10px var(--mode-glow); }
.workbench-toolbar .direct-modes button[data-object-mode].active,
.workbench-toolbar .direct-modes button[data-object-mode][aria-pressed="true"] { background:var(--mode-accent);box-shadow:0 2px 7px #402b0924,0 0 12px var(--mode-glow); }

body[data-toolbar-style="plain"] .toolbar-icon-groups button[data-tool-tone] { --tool-accent:var(--brand-brown);--tool-wash:transparent;--tool-line:transparent;--tool-glow:transparent; }
body[data-toolbar-style="plain"] .toolbar-icon-groups button[data-tool-tone]:hover:not(:disabled),
body[data-toolbar-style="plain"] .toolbar-icon-groups button[data-tool-tone].active,
body[data-toolbar-style="plain"] .toolbar-icon-groups button[data-tool-tone][aria-pressed="true"] { background:var(--sage);box-shadow:inset 0 0 0 1px #d8c39a; }
body[data-toolbar-style="plain"] .workbench-toolbar .direct-modes button[data-object-mode] { --mode-accent:var(--brand-brown);--mode-wash:#fffaf0;--mode-glow:transparent; }

.toolbar-symbol {
  position: relative;
  display: block;
  width: 19px;
  height: 19px;
  margin: 0;
  box-sizing: border-box;
}

.toolbar-symbol::before,
.toolbar-symbol::after {
  position: absolute;
  box-sizing: border-box;
  content: "";
}

.toolbar-symbol-select-all {
  border: 2px solid currentColor;
}

.toolbar-symbol-select-all::before {
  inset: 4px;
  border: 2px solid currentColor;
}

.toolbar-symbol-select-clear {
  border: 2px dashed currentColor;
}

.toolbar-symbol-select-clear::after {
  left: 8px;
  top: -2px;
  width: 2px;
  height: 21px;
  background: currentColor;
  transform: rotate(45deg);
}

.toolbar-symbol-align::before {
  left: 1px;
  top: 3px;
  width: 17px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 6px currentColor, 0 12px currentColor;
}

.toolbar-symbol-align::after {
  left: 8px;
  top: 0;
  width: 2px;
  height: 19px;
  background: currentColor;
}

.toolbar-symbol-polarity::before {
  left: 2px;
  top: 4px;
  width: 15px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 9px currentColor;
}

.toolbar-symbol-polarity::after {
  left: 8px;
  top: 0;
  width: 2px;
  height: 10px;
  background: currentColor;
}

.toolbar-symbol-subtract::before,
.toolbar-symbol-subtract::after {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.toolbar-symbol-subtract::before {
  left: 1px;
  top: 1px;
}

.toolbar-symbol-subtract::after {
  right: 1px;
  bottom: 1px;
  background: linear-gradient(135deg, transparent 48%, currentColor 49% 62%, transparent 63%);
}

.toolbar-symbol-release-cuts::before,
.toolbar-symbol-release-cuts::after {
  width: 10px;
  height: 13px;
  border: 2px solid currentColor;
  border-radius: 2px;
}

.toolbar-symbol-release-cuts::before {
  left: 0;
  top: 1px;
}

.toolbar-symbol-release-cuts::after {
  right: 0;
  bottom: 1px;
  border-color: currentColor;
}

.toolbar-symbol-text::before {
  left: 3px;
  top: 0;
  width: 13px;
  height: 2px;
  background: currentColor;
  box-shadow: 0 15px currentColor;
}

.toolbar-symbol-text::after {
  left: 8px;
  top: 0;
  width: 2px;
  height: 17px;
  background: currentColor;
}

.toolbar-symbol-attach {
  border-left: 2px solid currentColor;
}

.toolbar-symbol-attach::before {
  left: 4px;
  top: 8px;
  width: 13px;
  height: 2px;
  background: currentColor;
}

.toolbar-symbol-attach::after {
  right: 0;
  top: 5px;
  width: 7px;
  height: 7px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
}

.toolbar-symbol-mirror {
  border-left: 2px dashed currentColor;
  transform: translateX(8px);
}

.toolbar-symbol-mirror::before,
.toolbar-symbol-mirror::after {
  top: 4px;
  width: 7px;
  height: 11px;
  border: 2px solid currentColor;
}

.toolbar-symbol-mirror::before {
  right: 3px;
  border-right: 0;
}

.toolbar-symbol-mirror::after {
  left: 2px;
  border-left: 0;
}

.toolbar-symbol-delete::before {
  left: 4px;
  top: 6px;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 2px 2px;
}

.toolbar-symbol-delete::after {
  left: 3px;
  top: 3px;
  width: 14px;
  height: 2px;
  background: currentColor;
  box-shadow: 4px -3px 0 -1px currentColor;
}

.toolbar-symbol-round-all {
  border: 2px solid currentColor;
  border-radius: 7px;
}

.toolbar-symbol-round-edge {
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-bottom-left-radius: 11px;
}

.toolbar-symbol-round-edge::after {
  position: absolute;
  right: 0;
  top: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

#selection-quick {
  position: absolute;
  z-index: 24;
  top: 12px;
  left: 50%;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100% - 24px);
  padding: 7px;
  border: 1px solid #d8c39a;
  border-radius: 7px;
  background: #fffdf7f2;
  box-shadow: 0 5px 18px #402b0924;
  transform: translateX(-50%);
}

#selection-quick strong {
  max-width: 180px;
  padding: 0 5px;
  overflow: hidden;
  color: var(--brand-brown);
  text-overflow: ellipsis;
  white-space: nowrap;
}

#selection-quick button {
  min-height: 34px;
  padding: 6px 9px;
  white-space: nowrap;
}

.part-row-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(2, 36px);
  align-items: stretch;
  gap: 4px;
}

.part-row-wrap:not(:has(.part-edit)) {
  grid-template-columns: minmax(0, 1fr) 36px;
}

.part-row-wrap .part-row {
  width: 100%;
  min-width: 0;
}

.part-visibility,
.part-edit {
  display: grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  padding: 0;
  color: var(--brand-gold);
}

.part-edit {
  color: var(--brand-brown);
  font-size: 17px;
}

.part-row-wrap.is-hidden .part-row {
  opacity: .52;
}

.guide-row-wrap .part-row small {
  color: #8a6424;
  font-weight: 700;
}

.part-row.active,
.selection-marquee {
  border-color: var(--brand-gold);
}

.part-row.active {
  outline-color: var(--brand-gold);
}

.selection-marquee {
  background: rgba(197, 138, 51, .14);
}

.left-panel .sidebar-project-count,
#workspace-settings-dialog label,
#workspace-layout-hint {
  color: var(--muted);
}

.move-step small,
#footer-stock {
  color: var(--muted);
}

.hint-card {
  border-color: var(--line);
  background: #faf7f0;
}

.hint-card > span {
  color: var(--brand-gold);
}

.live-dot {
  background: var(--brand-gold);
}

.primary,
.tabs button.active,
.workflow-tabs button.active,
.segmented button.active {
  border-color: var(--brand-brown);
  background: var(--brand-brown);
  color: #fff;
  box-shadow: 0 2px 5px #10271f2b;
}

.primary:hover:not(:disabled) {
  border-color: #2d1d06;
  background: #2d1d06;
}

.workbench-toolbar .direct-modes button.active,
.direct-editor .direct-modes button.active,
.crafter-draw-tools > button.active,
.left-panel .sidebar-grid > button:active:not(:disabled),
.left-panel .sidebar-grid > button[aria-pressed="true"] {
  border-color: var(--brand-brown);
  background: var(--brand-brown);
  color: #fff;
}

.crafter-icon-tools button[aria-pressed="mixed"] {
  background: linear-gradient(135deg, var(--brand-brown) 50%, var(--brand-gold) 50%);
}

.toolbar-icon-groups .crafter-icon-tools #release-cuts.active:not(:disabled) {
  color: var(--brand-brown);
  background: #f3dfad;
  border-color: var(--brand-gold);
  box-shadow: inset 0 0 0 1px #fff8;
}

#left-text-tools summary {
  color: var(--brand-brown);
}

.left-panel .sidebar-grid > button:hover:not(:disabled) {
  border-color: var(--brand-gold);
  background: var(--sage);
}

.direct-heading:focus-visible,
.left-panel .sidebar-grid > button:focus-visible,
.left-panel .sidebar-details > summary:focus-visible {
  outline-color: var(--brand-gold);
}

.muted,
.micro,
.project-breadcrumb,
.project-title-edit {
  cursor: pointer;
}

.stage-title .project-title-edit {
  pointer-events: auto;
}

.project-title-edit:hover,
.project-title-edit:focus-visible {
  color: var(--brand-brown);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.project-breadcrumb,
.save-state {
  color: var(--muted);
}

.left-panel,
.right-panel,
.topbar,
.workbench-toolbar {
  background: #fff;
}

#scene canvas.edge-pick-active {
  cursor: crosshair;
}

#start-project-dialog {
  position: relative;
  width: min(460px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
}

#start-project-dialog .dialog-corner-close {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 38px;
  min-height: 38px;
  margin-top: 0;
  padding: 0;
  font-size: 21px;
  line-height: 1;
}

#save-project-details {
  width: min(520px, calc(100vw - 24px));
}

#save-project-details form {
  display: grid;
  gap: 10px;
}

.panel-heading {
  padding-bottom: 10px;
  border-bottom: 2px solid var(--brand-brown);
}

.section-label,
.compact-properties > summary,
.sidebar-section h3 {
  color: var(--brand-brown);
}

.left-panel .sidebar-section {
  border-bottom-color: #d8c9ad;
}

.left-panel .sidebar-section h3 {
  padding-left: 8px;
  border-left: 3px solid #b9661f;
  font-size: 11px;
  letter-spacing: 0;
}

.compact-properties {
  border-top-color: #d8c9ad;
}

.compact-properties > summary {
  position: relative;
  min-height: 42px;
  padding: 11px 24px 11px 0;
  font-weight: 750;
}

.compact-properties > summary::after {
  position: absolute;
  right: 3px;
  content: "+";
  color: var(--brand-brown);
  font-size: 18px;
  line-height: 1;
}

.compact-properties[open] > summary::after {
  content: "−";
}

.part-card,
.join-card,
.part-row,
.left-panel .sidebar-grid > button {
  border-color: #d8c9ad;
  background: #fff;
}

.part-card:hover,
.join-card:hover,
.part-row:hover,
.left-panel .sidebar-grid > button:hover:not(:disabled) {
  border-color: var(--brand-gold);
  background: var(--sage);
}

#edge-tools {
  padding-bottom: 16px;
  border-top: 2px solid var(--brand-brown);
}

.edge-pick-hint {
  display: grid;
  gap: 4px;
  margin: 2px 0 12px;
  padding: 10px 11px;
  border-left: 4px solid #e07821;
  background: #fff4e8;
  color: #49301b;
  font-size: 11px;
  line-height: 1.45;
}

.edge-presets {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.edge-presets button {
  min-height: 38px;
  padding: 7px 4px;
  font-size: 11px;
}

.edge-manual {
  margin: 8px 0 12px;
  border: 1px solid #d8c9ad;
  border-radius: 6px;
  background: #fffdf7;
}

.edge-manual > summary {
  padding: 10px;
  cursor: pointer;
  font-weight: 650;
}

#edge-list {
  display: grid;
  gap: 4px;
  max-height: 210px;
  padding: 0 8px 9px;
  overflow: auto;
}

#edge-list label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-height: 34px;
  margin: 0;
  padding: 5px 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: var(--brand-brown);
  font-size: 10px;
  line-height: 1.3;
}

#edge-list label:has(input:checked) {
  border-color: #d66f19;
  background: #fff0df;
  color: #432a14;
  font-weight: 700;
}

#edge-list input {
  width: 17px;
  height: 17px;
  margin: 0;
  accent-color: #c95f0a;
}

.edge-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.edge-size-control {
  display: grid;
  grid-template-columns: 70px minmax(80px, 1fr);
  align-items: center;
  gap: 5px 8px;
}

.edge-size-control > span {
  grid-column: 1 / -1;
}

.edge-size-control input {
  min-width: 0;
  margin: 0;
}

#edge-status {
  min-height: 34px;
  padding: 8px;
  border-radius: 5px;
  background: #faf7f0;
  color: var(--brand-brown);
  font-size: 11px;
  line-height: 1.4;
}

@media (max-width: 760px) {
  button {
    min-height: 40px;
  }

  #selection-quick {
    top: 58px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: calc(100% - 16px);
  }

  #selection-quick strong {
    display: none;
  }

  #selection-quick button {
    min-width: 0;
    padding: 5px 3px;
    font-size: 10px;
    line-height: 1.2;
    white-space: normal;
  }

  .edge-presets {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .edge-presets button {
    min-height: 42px;
  }

  .edge-settings {
    grid-template-columns: 1fr;
  }
}

@media (prefers-contrast: more) {
  :root {
    --line: #8f7f67;
    --muted: #554b3d;
  }

  button,
  input,
  select,
  textarea {
    border-width: 2px;
  }
}

.ai-project-type {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 10px;
}

.ai-project-type button {
  border-radius: 4px;
}

.ai-project-type button.active,
.ai-project-type button[aria-pressed="true"] {
  border-color: var(--brand-gold);
  background: #fff4d9;
  color: var(--brand-brown);
  box-shadow: inset 0 -3px var(--brand-gold);
  font-weight: 800;
}

@media (max-width: 600px) {
  body:not(.shared-view) > footer {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    height: auto;
    min-height: 64px;
    padding: 7px 10px;
    gap: 6px 12px;
    font-size: 9px;
    line-height: 1.35;
  }

  body:not(.shared-view) > footer > div:first-child {
    align-self: center;
    min-width: 0;
  }

  body:not(.shared-view) > footer > div:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding-top: 6px;
    border-top: 1px solid var(--line);
  }

  body:not(.shared-view) > footer .footer-divider {
    display: none;
  }

  body:not(.shared-view) > footer .footer-brand {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    gap: 7px;
    font-size: 9px;
  }

  dialog:modal {
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px) !important;
    overflow: auto;
    overscroll-behavior: contain;
  }

  dialog .dialog-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
  }

  dialog .dialog-actions > :is(button, .file-button) {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    margin: 0;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  dialog .dialog-actions > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}