:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #60707c;
  --panel: #f7f9fb;
  --line: #d8e0e6;
  --accent: #0f7b72;
  --accent-2: #d14d2f;
  --paper: #ffffff;
  --grid: #e8eef2;
  --grid-strong: #ced9e1;
  --shadow: 0 12px 30px rgba(23, 32, 38, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #dfe8ed;
}

button,
input,
select {
  font: inherit;
}

#backgroundPlanInput {
  border: 1px solid rgba(15, 123, 114, 0.38);
  border-radius: 8px;
  background: #edf9f3;
  color: var(--ink);
}

#backgroundPlanInput::file-selector-button {
  margin-right: 12px;
  border: 0;
  border-right: 1px solid rgba(15, 123, 114, 0.24);
  padding: 10px 14px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

select.finish-super {
  border-color: rgba(79, 70, 229, 0.28);
  background: #eef1ff;
}

select.finish-white,
select.finish-translucent {
  border-color: rgba(148, 163, 184, 0.25);
  background: #fbfcfd;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

button:hover {
  border-color: #9fb0bb;
}

button:active {
  transform: translateY(1px);
}

.accent-action {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.accent-action:hover {
  border-color: #0a5e57;
  background: #0a5e57;
}

.app-shell {
  display: flex;
  gap: 14px;
  height: 100vh;
  overflow: hidden;
  background: #eaf0f3;
}

.panel {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  grid-template-rows: auto minmax(0, 1fr);
  width: clamp(336px, 32vw, 430px);
  min-width: 336px;
  max-width: 640px;
  height: 100vh;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(23, 32, 38, 0.08);
  transition: padding 0.22s ease, box-shadow 0.22s ease;
  z-index: 2;
}

.panel-resize-handle {
  position: absolute;
  top: 50vh;
  right: -18px;
  bottom: auto;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  cursor: col-resize;
  touch-action: none;
  transform: translateY(-50%);
}

.panel-resize-handle span {
  display: block;
  width: 8px;
  height: 132px;
  border-radius: 999px;
  background:
    linear-gradient(to bottom,
      rgba(23, 32, 38, 0.22) 0 10px,
      transparent 10px 16px,
      rgba(23, 32, 38, 0.22) 16px 26px,
      transparent 26px 32px,
      rgba(23, 32, 38, 0.22) 32px 42px,
      transparent 42px 48px,
      rgba(23, 32, 38, 0.22) 48px 58px,
      transparent 58px 64px,
      rgba(23, 32, 38, 0.22) 64px 74px,
      transparent 74px 80px,
      rgba(23, 32, 38, 0.22) 80px 90px,
      transparent 90px 96px,
      rgba(23, 32, 38, 0.22) 96px 106px);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.92);
}

.panel-resize-handle:hover span,
.panel-resize-handle:active span {
  background: var(--accent);
}

.panel-collapse-toggle {
  flex: 0 0 auto;
  width: 36px;
  min-height: 36px;
  padding: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 14px rgba(23, 32, 38, 0.12);
}

.panel-collapse-toggle span {
  display: inline-block;
  font-size: 16px;
  transition: transform 0.22s ease;
}

.panel.tools-collapsed .panel-collapse-toggle span {
  transform: rotate(180deg);
}

.sticky-top {
  display: grid;
  gap: 18px;
  position: relative;
  z-index: 5;
  isolation: isolate;
  padding: 18px 20px 12px 150px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 10px 18px rgba(23, 32, 38, 0.08);
}

.panel-scroll {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 20px 22px 150px;
}

.panel.tools-collapsed .sticky-top {
  padding-left: 20px;
}

.panel.tools-collapsed .panel-scroll {
  display: none;
}

.panel.tools-collapsed .panel-resize-handle {
  opacity: 0;
  pointer-events: none;
}

.panel.tools-collapsed {
  width: 108px !important;
  min-width: 108px;
  max-width: 108px;
}

.panel.tools-collapsed .sticky-top {
  gap: 10px;
  padding: 16px 12px 12px;
}

.panel.tools-collapsed .brand {
  grid-template-columns: 1fr;
  justify-items: center;
}

.panel.tools-collapsed .brand-logo {
  position: static;
  width: 54px;
  margin-bottom: 4px;
}

.panel.tools-collapsed .brand-title-row h1,
.panel.tools-collapsed .brand-subline,
.panel.tools-collapsed .top-project-title,
.panel.tools-collapsed .brand-status-stack .status,
.panel.tools-collapsed .brand-status-stack .connection-badge,
.panel.tools-collapsed .brand-status-stack .customer-login-toggle,
.panel.tools-collapsed .brand-status-stack .admin-state-badge,
.panel.tools-collapsed .tool-group-topline,
.panel.tools-collapsed .actions {
  display: none !important;
}

.panel.tools-collapsed .panel-collapse-toggle {
  width: 40px;
  min-height: 40px;
}

.panel.tools-collapsed .brand-title-row {
  justify-content: center;
}

.brand {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.brand-title-block {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.brand-logo {
  position: absolute;
  left: -118px;
  top: -2px;
  display: block;
  width: 56px;
  height: auto;
  object-fit: contain;
}

.brand-title-row {
  position: relative;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-right: 48px;
  min-height: 40px;
}

.brand-title-row .panel-collapse-toggle {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
}

h1,
h2,
p,
dl,
ol {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.08;
  letter-spacing: 0;
  white-space: nowrap;
}

.brand p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.28;
}

.brand-subline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  margin-top: 8px;
}

.brand-measure-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.customer-header-info {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid rgba(15, 123, 114, 0.18);
  border-radius: 999px;
  color: #0f655e;
  background: #eef8f7;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.top-project-title {
  display: block;
  margin-top: 7px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.status {
  flex: 0 0 auto;
  max-width: 184px;
  min-width: 120px;
  padding: 6px 10px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.brand-status-stack {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.admin-mini-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.connection-badge,
.admin-state-badge {
  min-height: 24px;
  padding: 4px 7px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #51616c;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.connection-badge.online {
  color: #0f655e;
  border-color: rgba(15, 123, 114, 0.22);
  background: #eef8f7;
}

.connection-badge.offline {
  color: #7a4b00;
  border-color: rgba(191, 122, 0, 0.25);
  background: #fff7e8;
}

.admin-state-badge.active {
  color: #0f655e;
  border-color: rgba(15, 123, 114, 0.22);
  background: #eef8f7;
}

.admin-login-toggle {
  width: 28px;
  min-height: 28px;
  padding: 0;
  border-radius: 999px;
  color: #5f6f79;
  background: rgba(255, 255, 255, 0.92);
}

.admin-login-toggle.active {
  color: #ffffff;
  border-color: #0b5f58;
  background: #0b5f58;
}

.admin-mini-panel {
  position: fixed;
  top: 72px;
  right: 18px;
  z-index: 60;
  display: grid;
  gap: 10px;
  width: min(280px, calc(100vw - 36px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(247, 249, 251, 0.98);
  box-shadow: 0 18px 38px rgba(23, 32, 38, 0.18);
  backdrop-filter: blur(8px);
}

.admin-settings-link {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 62;
  display: grid;
  place-items: center;
  width: 46px;
  min-height: 46px;
  border: 1px solid rgba(23, 32, 38, 0.14);
  border-radius: 14px;
  color: #42525d;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 28px rgba(23, 32, 38, 0.18);
  text-decoration: none;
  font-size: 22px;
}

.admin-settings-link:hover {
  color: #0f7b72;
  border-color: rgba(15, 123, 114, 0.28);
  background: #f6fbfa;
}

.app-version-badge {
  position: fixed;
  left: 72px;
  bottom: 28px;
  z-index: 62;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(23, 32, 38, 0.12);
  box-shadow: 0 10px 24px rgba(23, 32, 38, 0.12);
  color: #5f6e78;
  font-size: 12px;
  font-weight: 700;
}

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

.tool-group {
  display: grid;
  gap: 10px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 18px;
  scroll-margin-top: 10px;
}

.tool-group.is-collapsed {
  gap: 0;
  padding-bottom: 10px;
}

.tool-group h2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #33414a;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  cursor: pointer;
  user-select: none;
}

.tool-group h2::after {
  content: "−";
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}

.sticky-top .tool-group h2 {
  cursor: default;
}

.sticky-top .tool-group h2::after {
  content: "";
}

.sticky-top .tool-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.sticky-top .tool-group > h2,
.sticky-top .tool-group > .quick-stats,
.sticky-top .tool-group > .shape-tool-panel,
.sticky-top .tool-group > .template-drawer,
.sticky-top .tool-group > .actions,
.sticky-top .tool-group > .tool-group-topline {
  grid-column: 1;
}

.tool-group-topline {
  display: block;
}

.tool-info-box {
  min-height: 54px;
  display: flex;
  align-items: center;
}

.sticky-top .tool-group > .segmented {
  position: absolute;
  left: 14px;
  top: 96px;
  z-index: 40;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  max-height: calc(100vh - 126px);
  overflow-y: auto;
  overflow-x: hidden;
  padding: 5px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 8px 18px rgba(23, 32, 38, 0.10);
  scrollbar-width: thin;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

.sticky-top .tool-group > .segmented button {
  width: 52px;
  min-height: 52px;
  padding: 3px;
  font-size: 20px;
}

.panel.tools-collapsed .sticky-top .tool-group > .segmented {
  opacity: 0;
  transform: translateX(-140%);
  pointer-events: none;
}

.tool-group.is-collapsed h2::after {
  content: "+";
}

.segmented {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(42px, 1fr));
  gap: 6px;
}

.segmented button {
  display: grid;
  place-items: center;
  min-height: 42px;
  font-size: 20px;
}

.quick-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.quick-stats span {
  display: grid;
  gap: 2px;
  padding: 7px 6px;
  border: 1px solid rgba(15, 123, 114, 0.18);
  border-radius: 8px;
  background: #f4fbf7;
  text-align: center;
}

.quick-stats strong {
  color: #0f7b72;
  font-size: 13px;
}

.quick-stats small {
  color: var(--muted);
  font-size: 10px;
}

.segmented button.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.shape-tool-panel {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.template-drawer {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.template-drawer strong {
  font-size: 14px;
}

.shape-tool-panel[hidden] {
  display: none;
}

.shape-tool-panel strong {
  font-size: 14px;
}

.shape-tool-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.shape-tool-fields .field {
  min-width: 0;
}

.shape-tool-fields .input-row select {
  width: 100%;
  border: 0;
  background: transparent;
  font: inherit;
  outline: none;
}

.shape-tool-fields .corner-select-field .input-row {
  border-color: #0f7b72;
  background: #0f7b72;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.shape-tool-fields .corner-select-field .input-row select {
  color: #fff;
  font-weight: 800;
}

.shape-tool-fields .corner-select-field .input-row select option {
  background: #0f7b72;
  color: #fff;
}

.shape-tool-fields .corner-select-field .input-row span {
  color: #fff;
}

.shape-tool-sketch {
  grid-column: 1 / -1;
  min-height: 110px;
  padding: 8px;
  border: 1px solid rgba(15, 123, 114, 0.18);
  border-radius: 8px;
  background: #fff;
}

.shape-tool-sketch svg {
  display: block;
  width: 100%;
  height: 118px;
}

.shape-tool-sketch text {
  fill: #21313a;
  font-size: 15px;
  font-weight: 800;
}

.shape-tool-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  margin-top: 2px;
}

.shape-tool-actions button {
  flex: 1;
  min-height: 38px;
  font-weight: 800;
}

.shape-tool-actions button[data-shape-panel-apply] {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.shape-tool-actions button[data-shape-panel-apply]:hover {
  border-color: #0a5e57;
  background: #0a5e57;
}

.template-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.template-buttons button {
  display: grid;
  place-items: center;
  gap: 2px;
  min-height: 74px;
  padding: 8px;
  font-size: 22px;
}

.template-buttons small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
}

.template-room-buttons {
  margin-top: 4px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.room-template-item {
  position: relative;
  display: block;
}

.room-template-item > button:first-child {
  display: grid;
  grid-template-columns: 1fr;
  min-height: 76px;
  place-items: start;
  align-content: start;
  text-align: left;
  gap: 3px;
  padding: 5px;
  font-size: 11px;
}

.room-template-delete {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 30px;
  min-height: 30px;
  padding: 0;
  color: #9f3b2b;
  background: rgba(255, 255, 255, 0.92);
}

.room-template-delete span {
  font-size: 15px;
}

.room-template-thumb,
.room-template-fallback {
  display: block;
  width: 100%;
  height: 36px;
  border: 1px solid rgba(15, 123, 114, 0.16);
  border-radius: 8px;
  background: #f8fbfd;
  object-fit: contain;
}

.room-template-fallback {
  display: grid;
  place-items: center;
  font-size: 22px;
  color: #5d6b73;
}

.room-template-meta {
  display: grid;
  gap: 2px;
  width: 100%;
}

.room-template-meta strong {
  font-size: 12px;
  line-height: 1.2;
}

.room-template-meta small {
  font-size: 10px;
  line-height: 1.2;
}

.inline-subgroup {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.inline-subgroup h3 {
  margin: 0 0 10px;
  color: #23323a;
  font-size: 18px;
  font-weight: 800;
}

.measure-assist-toggle {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(15, 123, 114, 0.24);
  border-radius: 999px;
  color: #0f655e;
  background: #eef8f7;
  font-size: 12px;
  font-weight: 800;
}

.brand-measure-row .measure-assist-toggle {
  min-width: 154px;
}

.measure-assist-toggle.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.workspace-floating-controls {
  position: absolute;
  top: 92px;
  left: 24px;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.workspace-floating-controls .measure-assist-toggle {
  min-width: 158px;
  min-height: 42px;
  font-size: 14px;
  box-shadow: 0 10px 24px rgba(23, 32, 38, 0.12);
  pointer-events: auto;
}

.workspace-icon-toggle {
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  padding: 0;
  font-size: 18px;
  box-shadow: 0 10px 24px rgba(23, 32, 38, 0.12);
  pointer-events: auto;
}

.ui-tooltip {
  position: fixed;
  z-index: 999999;
  max-width: 260px;
  padding: 10px 12px;
  border-radius: 12px;
  background: rgba(241, 244, 247, 0.98);
  color: #172026;
  border: 1px solid rgba(23, 32, 38, 0.14);
  box-shadow: 0 14px 32px rgba(23, 32, 38, 0.16);
  font-size: 13px;
  line-height: 1.35;
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 120ms ease, transform 120ms ease;
}

.ui-tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.ui-tooltip strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

.ui-tooltip span {
  display: block;
}

.cutout-precision-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.cutout-precision-actions button {
  min-height: 48px;
  font-size: 14px;
}

#resetRoom.tool-start-primary {
  background: #dcecff;
  border-color: #99bee8;
  color: #14508d;
}

#resetRoom.tool-start-primary.active,
#resetRoom.tool-start-primary:hover {
  background: #cde3ff;
}

.room-template-meta {
  display: grid;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.room-template-meta strong {
  color: var(--ink);
  font-size: 11px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.room-template-meta small {
  color: var(--muted);
  font-size: 9px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(42px, 1fr));
  gap: 6px;
}

.segmented-separator,
.actions-separator {
  grid-column: 1 / -1;
  display: block;
  height: 1px;
  margin: 2px 0 4px;
  background: linear-gradient(90deg, transparent 0%, rgba(23, 32, 38, 0.18) 14%, rgba(23, 32, 38, 0.18) 86%, transparent 100%);
}

.actions button {
  display: grid;
  place-items: center;
  min-height: 42px;
  padding: 7px;
  font-size: 18px;
}

.actions .strong-icon {
  font-size: 28px;
  font-weight: 1000;
}

.actions .customer-action {
  display: grid;
  align-items: center;
  justify-content: center;
  color: #fff;
  background: #0f7b72;
  border-color: #0f7b72;
  font-size: 20px;
  font-weight: 900;
}

.actions .calc-action {
  background: #1f2937;
  border-color: #1f2937;
}

.workspace-quick-stats {
  display: flex;
  align-items: stretch;
  gap: 8px;
  min-width: 294px;
}

.workspace-quick-stats span {
  min-height: 48px;
  padding: 6px 10px;
  background: rgba(244, 251, 247, 0.96);
}

.workspace-quick-stats strong {
  font-size: 12px;
}

.workspace-quick-stats small {
  font-size: 10px;
}

.actions button.active,
.project-actions button.active,
.mobile-tool-strip button.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.actions button,
.wide,
.view-actions button {
  font-size: 14px;
}

.button-with-icon {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  text-align: left;
  padding: 10px 14px;
}

.button-with-icon > span:first-child {
  flex: 0 0 auto;
  width: 18px;
  text-align: center;
  font-size: 17px;
}

.button-with-icon > span:last-child {
  flex: 1 1 auto;
}

.button-upload {
  position: relative;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
}

.button-upload input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.admin-page {
  background: #eef3f6;
}

.admin-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.admin-sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  display: grid;
  gap: 18px;
  height: 100vh;
  padding: 24px 18px;
  background: #f8fbfc;
  border-right: 1px solid var(--line);
}

.admin-brand {
  display: grid;
  gap: 8px;
}

.admin-brand h1 {
  font-size: 28px;
}

.admin-brand p {
  color: var(--muted);
}

.admin-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  min-height: 38px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
}

.admin-nav {
  display: grid;
  gap: 8px;
}

.admin-nav a {
  min-height: 40px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  text-decoration: none;
}

.admin-content {
  min-width: 0;
  padding: 24px;
}

.admin-header-card,
.admin-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(23, 32, 38, 0.05);
}

.admin-header-card {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin-bottom: 18px;
}

.admin-header-card small,
.admin-card small,
.admin-card .hint {
  color: var(--muted);
}

.admin-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-content #adminPageWrap {
  display: grid;
  gap: 18px;
}

.admin-grid {
  display: grid;
  gap: 14px;
}

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

.admin-grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.admin-role-table {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 80px 110px;
  gap: 8px 10px;
  align-items: center;
}

.admin-role-head {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-palette-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(116px, 1fr));
  gap: 8px;
}

.admin-swatch-chip {
  display: grid;
  gap: 4px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f9fbfc;
}

.admin-swatch-dot {
  width: 100%;
  height: 16px;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 999px;
}

.admin-queue-card {
  grid-template-columns: 54px minmax(0, 1fr);
}

.admin-analytics-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-analytics-card,
.admin-analytics-item {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f9fbfc;
}

.admin-analytics-card strong {
  font-size: 28px;
  line-height: 1.05;
}

.admin-analytics-card span {
  color: var(--muted);
}

.admin-analytics-list {
  display: grid;
  gap: 10px;
}

.admin-analytics-item strong {
  font-size: 15px;
}

.admin-analytics-item small {
  color: var(--muted);
}

.admin-queue-fields {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.admin-access-card {
  max-width: 520px;
}

@media (max-width: 920px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .admin-grid-2,
  .admin-grid-3,
  .admin-queue-fields,
  .admin-analytics-cards {
    grid-template-columns: 1fr;
  }

  .admin-header-card {
    grid-template-columns: 1fr;
  }
}

.library-actions {
  display: grid;
  gap: 8px;
}

.library-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.library-tabs,
.library-subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.library-tabs button,
.library-subtabs button {
  min-height: 36px;
  padding: 8px 12px;
}

.library-tabs button.active,
.library-subtabs button.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  max-height: min(72vh, 820px);
  overflow-y: auto;
  padding-right: 6px;
}

.library-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.library-card img {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border-radius: 8px;
  background: #eef3f5;
}

.library-card button {
  min-height: 38px;
  padding: 8px;
  font-size: 13px;
  font-weight: 700;
}

.modal-box-library {
  width: min(1560px, calc(100vw - 28px));
  max-height: calc(100vh - 36px);
  overflow: hidden;
}

.modal-box-start,
.modal-box-customer {
  width: min(720px, calc(100vw - 28px));
}

.start-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.start-choice-card {
  display: grid;
  gap: 6px;
  justify-items: start;
  text-align: left;
  min-height: 116px;
  padding: 16px;
}

.start-choice-card.primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.start-choice-card.primary span[aria-hidden="true"],
.start-choice-card.primary strong,
.start-choice-card.primary small {
  color: #fff;
}

.start-choice-card.is-disabled {
  opacity: 0.58;
}

.start-choice-card span[aria-hidden="true"] {
  font-size: 24px;
}

.start-choice-card strong {
  font-size: 18px;
  line-height: 1.2;
}

.start-choice-card small {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.motif-thumb {
  width: 54px;
  height: 40px;
  flex: 0 0 auto;
  border: 1px solid rgba(23, 32, 38, 0.12);
  border-radius: 6px;
  object-fit: cover;
  background: #eef3f5;
}

.cutout-name-text {
  display: inline-grid;
  gap: 2px;
}

.cutout-name-text strong {
  font-size: 13px;
  line-height: 1.3;
}

.cutout-name-text small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.project-toolbar {
  margin-bottom: 18px;
}

.customer-mode .admin-only-action,
.customer-mode .admin-only-field {
  display: none !important;
}

.customer-login-toggle {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(15, 123, 114, 0.22);
  border-radius: 999px;
  color: #0f655e;
  background: #eef8f7;
  font-size: 12px;
  font-weight: 800;
}

.customer-login-toggle.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.needs-attention {
  animation: customerPulse 1.6s ease-in-out 4;
}

@keyframes customerPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(15, 123, 114, 0);
    background-color: inherit;
  }
  50% {
    box-shadow: 0 0 0 4px rgba(15, 123, 114, 0.10);
    background-color: rgba(15, 123, 114, 0.08);
  }
}

.menu-divider {
  display: flex;
  align-items: center;
  min-height: 36px;
  margin: 16px 0 12px;
  padding: 8px 10px 8px 12px;
  border-left: 7px solid var(--accent);
  border-radius: 7px;
  color: #23323a;
  background: linear-gradient(90deg, rgba(15, 123, 114, 0.18), rgba(255, 255, 255, 0.7));
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.menu-divider-plan { order: 10; }
.menu-project { order: 11; }
.menu-view { order: 12; }
.menu-cutout { order: 13; }
.menu-background { order: 14; }
.menu-comments { order: 15; }
.menu-divider-light { order: 20; }
.menu-led { order: 21; }
.menu-spots { order: 22; }
.menu-lightbox { order: 23; }
.menu-divider-openings { order: 30; }
.menu-door { order: 31; }
.menu-window { order: 32; }
.menu-furniture { order: 33; }
.menu-divider-measure { order: 40; }
.menu-scale { order: 41; }
.menu-measurements { order: 42; }
.menu-divider-output { order: 50; }
.menu-output { order: 51; }
.menu-wall-measures { order: 52; }
.menu-diagonals { order: 53; }
.menu-angles { order: 54; }

.icon-save {
  position: relative;
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid currentColor;
  border-radius: 4px;
  background: linear-gradient(180deg, transparent 0 42%, currentColor 42% 52%, transparent 52%);
}

.icon-save::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 3px;
  width: 10px;
  height: 5px;
  border: 1.5px solid currentColor;
  border-top: 0;
  border-radius: 0 0 2px 2px;
}

.icon-save::after {
  content: "";
  position: absolute;
  left: 4px;
  bottom: 3px;
  width: 9px;
  height: 6px;
  border: 1.5px solid currentColor;
  border-radius: 2px;
  background: var(--paper);
}

.icon-save > span {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 3px;
  height: 5px;
  border-radius: 1px;
  background: currentColor;
}

.project-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.view-actions {
  display: grid;
  grid-template-columns: 44px 1fr 44px 1fr;
  align-items: center;
  gap: 6px;
}

.view-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.view-switch button.active,
.workspace-tools button.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

#zoomValue {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  font-size: 14px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}

input,
select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.pipeline-status {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  line-height: 1.35;
}

.pipeline-status.ok {
  border-color: rgba(15, 123, 114, 0.35);
  color: #0f655e;
  background: #eef8f7;
}

.pipeline-status.warn {
  border-color: rgba(191, 122, 0, 0.35);
  color: #7a4b00;
  background: #fff7e8;
}

.pipeline-status.error {
  border-color: rgba(209, 77, 47, 0.35);
  color: #9b321e;
  background: #fff0ed;
}

.pipeline-status.status-fixed {
  position: fixed;
  left: 50%;
  top: 18px;
  bottom: auto;
  z-index: 90;
  width: min(460px, calc(100vw - 24px));
  box-shadow: 0 16px 28px rgba(23, 32, 38, 0.18);
  transform: translateX(-50%);
  pointer-events: none;
}

.queue-info {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 10px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.3;
  cursor: pointer;
}

.queue-info.warn {
  color: #7a4b00;
  border-color: rgba(191, 122, 0, 0.35);
  background: #fff7e8;
}

.customer-drawings-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.customer-drawings-panel[hidden] {
  display: none;
}

.customer-auth-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.customer-auth-tabs {
  margin-top: -4px;
}

.customer-auth-form {
  display: grid;
  gap: 10px;
}

.modal-box-customer {
  width: min(520px, 100%);
}

.customer-account-box {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f7faf9;
}

.customer-account-box small {
  color: var(--muted);
}

.customer-support-form textarea {
  width: 100%;
  min-height: 7.2rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font: inherit;
}

.drawing-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 10px;
  align-items: start;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.drawing-card img {
  width: 88px;
  height: 64px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7f8;
}

.drawing-card .customer-project-preview {
  width: 88px;
  height: 64px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7f8;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  padding: 6px;
}

.queue-card-icon {
  display: grid;
  place-items: center;
  width: 88px;
  height: 64px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f4f7f8;
  color: var(--accent);
  font-size: 24px;
  font-weight: 800;
}

.drawing-card strong {
  display: block;
  margin-bottom: 3px;
  font-size: 13px;
}

.drawing-card small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}

.drawing-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.drawing-card-actions a,
.drawing-card-actions button {
  min-height: 30px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.drawing-card-actions a {
  color: #fff;
  background: #2f6f68;
  text-decoration: none;
}

.drawing-card-actions button {
  color: #fff;
  background: #c43d2a;
  border: 0;
  cursor: pointer;
}

.drawing-card-actions button.drawing-edit {
  background: #0f7b72;
}

.drawing-card-actions button.drawing-delete {
  background: #c43d2a;
}

@media (max-width: 760px) {
  .tool-group-topline {
    grid-template-columns: 1fr;
  }

  .compact-stats {
    width: 100%;
    justify-self: stretch;
  }

  .pipeline-status.status-fixed {
    top: 12px;
    bottom: auto;
  }
}

.color-input {
  height: 42px;
  padding: 4px;
}

.swatch-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.wall-swatch {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 2px;
  min-height: 54px;
  padding: 6px;
  border-color: #cfd8df;
  background: var(--swatch);
  color: #172026;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.85);
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}

.wall-swatch-film {
  background-image:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.74) 100%),
    var(--swatch-image);
}

.wall-swatch-code {
  font-size: 10px;
  font-weight: 900;
}

.wall-swatch-width {
  font-size: 8px;
  font-weight: 800;
  opacity: 0.8;
}

.wall-swatch.active {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent);
}

.photo-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.photo-slot {
  min-height: 34px;
  font-size: 12px;
}

.photo-slot.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

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

.check-field {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.check-field input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  flex: 0 0 18px;
  border-radius: 4px;
}

.cutout-list {
  display: grid;
  gap: 6px;
  padding-left: 0;
  margin: 0;
  list-style: none;
}

.cutout-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.cutout-list li.is-selected {
  margin-inline: -6px;
  padding-inline: 6px;
  border-radius: 7px;
  background: rgba(15, 123, 114, 0.12);
  outline: 1px solid rgba(15, 123, 114, 0.24);
}

.cutout-list input {
  width: auto;
  min-height: auto;
}

.cutout-list button {
  min-height: 30px;
  padding: 4px 8px;
  border-color: #c8d2da;
  color: #8a2f20;
  font-size: 13px;
}

.cutout-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-weight: 700;
}

.cutout-name[data-cutout-select],
.cutout-name[data-led-select],
.cutout-name[data-spot-select],
.cutout-name[data-furniture-select],
.cutout-name[data-lightbox-select],
.cutout-name[data-window-select],
.cutout-name[data-door-select] {
  cursor: pointer;
}

.cutout-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.stats {
  display: grid;
  gap: 8px;
}

.stats div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.stats dt {
  color: var(--muted);
  font-size: 13px;
}

.stats dd {
  margin: 0;
  font-weight: 700;
}

.side-list {
  padding-bottom: 20px;
}

#edgeList,
#diagonalList,
#angleList {
  display: grid;
  gap: 8px;
  padding-left: 0;
  color: var(--muted);
  font-size: 13px;
  list-style: none;
}

#diagonalList,
#angleList {
  gap: 10px;
}

.diagonal-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.diagonal-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  color: #26343c;
  background: #eef5f5;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.diagonal-group summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.diagonal-group-list {
  display: grid;
  gap: 0;
  padding: 0 10px 8px;
  margin: 0;
  list-style: none;
}

#edgeList li,
#diagonalList li,
#angleList li,
.diagonal-group-list li {
  display: grid;
  grid-template-columns: minmax(74px, auto) 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

#edgeList li.edge-pending {
  padding: 8px;
  border: 1px solid rgba(47, 128, 201, 0.28);
  border-radius: 8px;
  background: #eef7ff;
}

.measure-label {
  color: var(--ink);
  font-weight: 700;
}

.measure-input {
  min-height: 34px;
  padding: 6px 8px;
}

.measure-unit {
  color: var(--muted);
}

.measure-warning {
  grid-column: 1 / -1;
  margin-top: -4px;
  color: #d14d2f;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.3;
}

.measure-pending {
  grid-column: 1 / -1;
  margin-top: -4px;
  color: #2f80c9;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.25;
}

.angle-source {
  grid-column: 1 / -1;
  margin-top: -4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
}

.hint {
  grid-column: 1 / -1;
  color: var(--muted);
  line-height: 1.35;
}

.hint.ok {
  color: #0f655e;
}

.hint.warn {
  color: #7a4b00;
}

.hint.error {
  color: #9b321e;
}

.background-derive-actions {
  display: grid;
  gap: 6px;
}

.measure-input.is-derived-background {
  border-color: rgba(47, 128, 201, 0.38);
  background: #f3f9ff;
}

.workspace {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 100vh;
  padding: 18px 18px 18px 0;
  overflow: hidden;
  position: relative;
  z-index: 1;
}

.motif-adjust-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.workspace-tools {
  position: absolute;
  z-index: 4;
  top: 18px;
  right: 18px;
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(23, 32, 38, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(23, 32, 38, 0.12);
}

.workspace-tools button {
  min-height: 48px;
  min-width: 48px;
  font-weight: 900;
  flex: 0 0 auto;
}

#workspace2d,
#workspace3d {
  min-width: 64px;
}

.mobile-tool-strip {
  display: none;
}

#planCanvas,
#roomCanvas3d,
#roomCanvasThree {
  display: block;
  width: 100%;
  height: calc(100vh - 40px);
  border: 1px solid #b9c8d1;
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
  touch-action: none;
}

#planCanvas {
  cursor: default;
}

#roomCanvas3d,
#roomCanvasThree {
  background: #101820;
  cursor: default;
}

#roomCanvas3d:active,
#roomCanvasThree:active {
  cursor: default;
}

.view-3d-hint {
  position: absolute;
  left: 34px;
  bottom: 34px;
  z-index: 4;
  max-width: min(420px, calc(100% - 68px));
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 7px;
  color: #f5f9fb;
  background: rgba(16, 24, 32, 0.72);
  font-size: 13px;
  box-shadow: 0 8px 18px rgba(23, 32, 38, 0.2);
}

.walk-controls {
  position: absolute;
  right: 30px;
  bottom: 34px;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(2, 92px);
  gap: 8px;
  padding: 6px;
  border: 1px solid rgba(23, 32, 38, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(23, 32, 38, 0.16);
}

.walk-controls-wide {
  grid-column: 1 / -1;
}

.walk-controls button {
  min-height: 38px;
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.workspace-quick-panel {
  position: absolute;
  left: 28px;
  top: 92px;
  z-index: 6;
  width: min(320px, calc(100% - 56px));
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(23, 32, 38, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 24px rgba(23, 32, 38, 0.14);
}

.workspace-quick-panel strong {
  font-size: 14px;
}

.workspace-quick-panel small {
  color: var(--muted);
  line-height: 1.35;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(23, 32, 38, 0.28);
}

.modal[hidden] {
  display: none;
}

.modal-box {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.shape-dialog-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.shape-dialog-fields .field {
  min-width: 0;
}

.modal-box h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.modal-actions button:last-child {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
    height: auto;
    min-height: 100vh;
    overflow: visible;
    background: transparent;
  }

  .panel {
    width: auto;
    min-width: 0;
    max-width: none;
    height: auto;
    min-height: auto;
    resize: none;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    transform: none;
    box-shadow: none;
  }

  .panel-resize-handle {
    display: none;
  }

  .sticky-top {
    padding: 16px;
  }

  .brand {
    grid-template-columns: 1fr;
  }

  .status {
    max-width: none;
  }

  .panel-collapse-toggle {
    display: none;
  }

  .sticky-top .tool-group > .segmented {
    display: none;
  }

  .panel-scroll {
    max-height: none;
    padding: 18px 22px 22px;
  }

  .workspace {
    position: relative;
    min-height: 82svh;
    padding: 12px 12px 66px;
  }

  .motif-adjust-grid {
    grid-template-columns: 1fr;
  }

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

  .mobile-tool-strip {
    position: fixed;
    left: 10px;
    right: 10px;
    bottom: 10px;
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(34px, 1fr));
    gap: 6px;
    padding: 6px;
    border: 1px solid rgba(23, 32, 38, 0.14);
    border-radius: 12px;
    background: rgba(247, 249, 251, 0.96);
    box-shadow: 0 8px 18px rgba(23, 32, 38, 0.12);
  }

  .mobile-tool-strip button {
    min-height: 38px;
    padding: 4px;
    font-size: 16px;
  }

  .workspace-tools {
    top: 24px;
    right: 24px;
    left: 24px;
    grid-template-columns: 38px 38px 38px 48px 48px;
    width: max-content;
  }

  .walk-controls {
    right: 24px;
    bottom: 26px;
  }

  #planCanvas,
  #roomCanvas3d,
  #roomCanvasThree {
    height: 78svh;
  }
}

@media (min-width: 1380px) {
  .library-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1120px) and (min-width: 821px) {
  .library-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 820px) and (orientation: portrait) {
  .workspace {
    min-height: 88svh;
  }

  #planCanvas,
  #roomCanvas3d,
  #roomCanvasThree {
    height: 84svh;
  }
}
