/* Reset and base styles */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Warm palette */
  --color-primary: #2b7a6f;
  --color-primary-dark: #1f5e56;
  --color-primary-light: rgba(43, 122, 111, 0.08);
  --color-secondary: #8b7355;
  --color-background: #f0ede8;
  --color-surface: #ffffff;
  --color-text: #2d2a26;
  --color-text-light: #6b6560;
  --color-border: #ddd8d1;
  --color-success: #4caf50;
  --color-warning: #e8960c;
  --color-error: #d4412a;
  --color-warning-bg: #fff7ec;
  --color-warning-border: #ffe0b2;
  --color-warning-text: #b34700;

  /* Typography scale */
  --text-xs: 0.6875rem; /* 11px */
  --text-sm: 0.8125rem; /* 13px */
  --text-base: 0.875rem; /* 14px */
  --text-lg: 1rem; /* 16px */
  --text-xl: 1.25rem; /* 20px */
  --text-2xl: 1.5rem; /* 24px */

  --sidebar-width: 300px;
  --toolbar-width: 52px;
  --header-height: 60px;
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.15);
}

html,
body {
  height: 100%;
  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text);
  background: var(--color-background);
  overflow: hidden;
}

/* App container */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
.app-header {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--spacing-lg);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  gap: var(--spacing-md);
}

.app-header h1 {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text);
}

.header-spacer {
  flex: 1;
}

/* Main layout */
.app-main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left sidebar (toolbar) */
.sidebar-left {
  width: var(--toolbar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border);
  flex-shrink: 0;
}

/* Right sidebar */
.sidebar-right {
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-left: 1px solid var(--color-border);
  flex-shrink: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* Sidebar tabs */
.sidebar-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface);
}

.sidebar-tab {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-light);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition:
    color 0.2s,
    border-color 0.2s;
}

.sidebar-tab:hover {
  color: var(--color-text);
}

.sidebar-tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

/* Canvas section */
.canvas-section {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--color-background);
}

.canvas-container {
  width: 100%;
  height: 100%;
  position: relative;
  cursor: crosshair;
}

.canvas-static,
.canvas-interactive {
  display: block;
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-direction: column;
  padding: var(--spacing-sm);
  height: 100%;
}

.toolbar-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.toolbar-divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--spacing-sm) 0;
}

.toolbar-spacer {
  flex: 1;
}

.toolbar-button {
  width: auto;
  min-height: 36px;
  min-width: 36px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  padding: 4px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text);
  transition:
    background-color 0.2s,
    color 0.2s;
}

.toolbar-button:hover:not(:disabled) {
  background: var(--color-border);
}

.toolbar-button.active {
  background: var(--color-primary);
  color: white;
}

.toolbar-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.toolbar-icon {
  font-size: 1.25rem;
  width: 1.2em;
  text-align: center;
  flex-shrink: 0;
}

.toolbar-button:focus:not(:focus-visible) {
  outline: none;
}

.keyboard-hints {
  font-size: var(--text-xs);
  color: var(--color-text-light);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* Header status indicator */
.header-status {
  display: flex;
  align-items: center;
  padding: 4px 8px;
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

.header-status i {
  margin-right: 6px;
}

.status-saving {
  color: var(--color-primary);
}

.ph-spin {
  animation: ph-spin 1s linear infinite;
}

@keyframes ph-spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.status-saved {
  color: var(--color-success);
}

.status-unsaved {
  color: var(--color-warning);
}

.status-error {
  color: var(--color-error);
}

/* Header project name */
.header-project-name {
  font-weight: 500;
  font-size: var(--text-sm);
  color: var(--color-text);
  cursor: pointer;
  padding: 4px 8px;
}

.header-project-name:hover {
  text-decoration: underline;
}

/* Material selector */
.material-selector {
  border-bottom: 1px solid var(--color-border);
}

.material-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
}

.material-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
}

.expand-icon {
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

.material-content {
  padding: 0 var(--spacing-md) var(--spacing-md);
}

.material-section {
  margin-bottom: var(--spacing-md);
}

.material-section label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-light);
  margin-bottom: var(--spacing-xs);
  text-transform: uppercase;
}

.material-section select {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: var(--text-base);
  cursor: pointer;
}

.material-section select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Gap settings */
.gap-row {
  display: flex;
  gap: var(--spacing-md);
}
.gap-row .material-section {
  flex: 1;
}

.gap-input-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.gap-input-row input[type="number"] {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: var(--text-base);
  text-align: right;
}

.gap-input-row input[type="number"]:focus {
  outline: none;
  border-color: var(--color-primary);
}

.gap-unit {
  font-size: var(--text-xs);
  color: var(--color-text-light);
}

/* Product details */
.product-details {
  background: var(--color-background);
  border-radius: var(--radius-sm);
  padding: var(--spacing-md);
  margin-bottom: var(--spacing-md);
}

.product-description {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  margin-bottom: var(--spacing-sm);
}

.product-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-xs) var(--spacing-md);
}

.spec {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
}

.spec-label {
  color: var(--color-text-light);
}

.spec-value {
  font-weight: 500;
}

/* Color grid */
.color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-sm);
}

.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  transition:
    transform 0.2s,
    border-color 0.2s;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  border-color: var(--color-primary);
}

.color-swatch .checkmark {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  font-weight: bold;
}

.color-name {
  font-size: var(--text-sm);
  color: var(--color-text);
  text-align: center;
}

.spacing-note {
  font-size: var(--text-xs);
  color: var(--color-text-light);
  margin-top: var(--spacing-xs);
}

/* Summary panel */
.summary-panel {
}

.summary-panel h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin-bottom: var(--spacing-md);
}

.summary-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-md);
}

.summary-header h3 {
  margin-bottom: 0;
}

.export-pdf-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.export-pdf-btn:hover:not(:disabled) {
  opacity: 0.85;
}

.export-pdf-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.summary-section {
  margin-bottom: var(--spacing-md);
  padding: 0 var(--spacing-md) var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
}

.summary-section:last-of-type {
  border-bottom: none;
}

.summary-section h4 {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-light);
  text-transform: uppercase;
  margin-bottom: var(--spacing-sm);
}

.summary-value {
  font-size: var(--text-lg);
  font-weight: 600;
}

.computed-output {
  background: var(--color-background);
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: var(--text-sm);
  color: var(--color-text-light);
  display: flex;
  gap: var(--spacing-xs);
}

.summary-note {
  font-size: var(--text-xs);
  color: var(--color-text-light);
  font-style: italic;
  margin-top: var(--spacing-xs);
}

.summary-warning {
  background: var(--color-warning-bg);
  border: 1px solid var(--color-warning-border);
  border-radius: var(--radius-sm);
  padding: var(--spacing-md);
  margin: 0 var(--spacing-md);
  color: var(--color-warning-text);
  font-size: var(--text-base);
}

.summary-warning-inline {
  font-size: var(--text-sm);
  color: var(--color-warning);
  margin-top: var(--spacing-xs);
}

/* Product summary */
.product-summary {
  background: var(--color-background);
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm) var(--spacing-md);
}

.product-name {
  font-weight: 500;
}

.product-color {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: var(--text-sm);
  color: var(--color-text-light);
  margin-top: var(--spacing-xs);
}

.color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
}

/* BOM table */
.bom-table {
  width: 100%;
  font-size: var(--text-base);
}

.bom-table td {
  padding: var(--spacing-xs) 0;
}

.bom-table td.value {
  text-align: right;
  font-weight: 500;
  font-feature-settings: "tnum";
  white-space: nowrap;
}

.bom-sub-row td:first-child {
  padding-left: 1.2em;
}

.bom-table.cut-list td {
  width: 75%;
}

.bom-table.cut-list td.value {
  white-space: normal;
  width: 25%;
}

.cut-list-row {
  cursor: pointer;
  transition: background-color 0.15s;
}

.cut-list-row:hover {
  background-color: rgba(33, 150, 243, 0.08);
}

/* Buttons */
.summary-actions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-lg);
  padding: 0 var(--spacing-md);
}

.btn-secondary {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-secondary:hover:not(:disabled) {
  background: var(--color-background);
}

.btn-secondary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Settings Panel */
.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.settings-panel {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
}

.settings-header h2 {
  font-size: var(--text-xl);
  font-weight: 600;
  margin: 0;
}

.settings-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-light);
  font-size: 1.25rem;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.settings-close:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.settings-content {
  padding: var(--spacing-lg);
  overflow-y: auto;
}

.settings-section {
  margin-bottom: var(--spacing-lg);
}

.settings-section:last-child {
  margin-bottom: 0;
}

.settings-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-light);
  text-transform: uppercase;
  margin-bottom: var(--spacing-sm);
}

.settings-toggle-group {
  display: flex;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.settings-toggle {
  flex: 1;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  background: var(--color-surface);
  font-size: var(--text-base);
  cursor: pointer;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.settings-toggle:not(:last-child) {
  border-right: 1px solid var(--color-border);
}

.settings-toggle:hover:not(.active) {
  background: var(--color-background);
}

.settings-toggle.active {
  background: var(--color-primary);
  color: white;
}

.settings-select {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  font-size: var(--text-base);
  cursor: pointer;
}

.settings-select:focus {
  outline: none;
  border-color: var(--color-primary);
}

/* Primary button */
.btn-primary {
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  background: var(--color-primary);
  color: white;
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--color-primary-dark);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary.has-changes {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.8;
  }
}

/* Project name in toolbar */
.project-name {
  font-size: var(--text-xs);
  color: var(--color-text);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  padding: var(--spacing-xs);
}

.dirty-indicator {
  color: var(--color-warning);
  font-weight: bold;
}

/* Dialog styles */
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.dialog {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  max-height: 80vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
}

.dialog-header h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
}

.dialog-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text-light);
  font-size: 1.25rem;
  transition:
    background-color 0.2s,
    color 0.2s;
}

.dialog-close:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.dialog-content {
  padding: var(--spacing-md);
  overflow-y: auto;
  flex: 1;
}

.dialog-empty {
  text-align: center;
  color: var(--color-text-light);
  padding: var(--spacing-lg);
}

/* Project list */
.project-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.project-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--spacing-sm);
  transition:
    background-color 0.2s,
    border-color 0.2s;
}

.project-item:hover {
  background: var(--color-background);
  border-color: var(--color-primary);
}

.project-item-content {
  flex: 1;
  cursor: pointer;
}

.project-item-name {
  font-weight: 500;
  margin-bottom: var(--spacing-xs);
}

.project-item-details {
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

.project-item-delete {
  padding: 8px;
  border: none;
  background: transparent;
  color: var(--color-text-light);
  cursor: pointer;
  border-radius: var(--radius-sm);
  opacity: 0;
  transition:
    opacity 0.2s,
    color 0.2s,
    background-color 0.2s;
}

.project-item:hover .project-item-delete {
  opacity: 1;
}

.project-item-delete:hover {
  color: var(--color-error);
  background: rgba(244, 67, 54, 0.1);
}

/* Pricing table */
.pricing-table .total-row td {
  border-top: 1px solid var(--color-border);
  padding-top: var(--spacing-sm);
}

/* Bottom canvas controls (zoom + undo/redo + toggles) */
.canvas-bottom-controls {
  position: absolute;
  bottom: 0.8rem;
  left: 0.8rem;
  right: 0.8rem;
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
  justify-content: space-between;
}

.canvas-bottom-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.zoom-controls {
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  pointer-events: auto;
  user-select: none;
}

.undo-controls {
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  pointer-events: auto;
  user-select: none;
}

.undo-controls .zoom-btn {
  font-size: var(--text-sm);
}

.undo-controls .zoom-btn:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.undo-controls .zoom-btn:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.undo-controls .zoom-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.zoom-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--color-text);
  transition: background-color 0.15s;
}

.zoom-btn:hover {
  background: var(--color-background);
}

.zoom-btn:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.zoom-btn:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.zoom-percent {
  width: 60px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  background: transparent;
  cursor: pointer;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text);
  transition: background-color 0.15s;
}

.zoom-percent:hover {
  background: var(--color-background);
}

.zoom-btn:focus:not(:focus-visible),
.zoom-percent:focus:not(:focus-visible) {
  outline: none;
}

/* Canvas empty state */
.canvas-empty-state {
  position: absolute;
  top: var(--spacing-lg);
  left: var(--spacing-lg);
  pointer-events: none;
  z-index: 5;
}

.canvas-empty-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-md) var(--spacing-lg);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--spacing-md);
  pointer-events: auto;
}

.canvas-empty-icon {
  font-size: 2.5rem;
  color: var(--color-primary);
  opacity: 0.5;
}

.canvas-empty-title {
  font-size: var(--text-xl);
  color: var(--color-text);
  max-width: 420px;
  line-height: 1.6;
}

.canvas-empty-title strong {
  color: var(--color-primary);
  opacity: 1;
}

.canvas-empty-hints {
  display: flex;
  gap: var(--spacing-lg);
  font-size: var(--text-base);
  color: var(--color-text-light);
}

.canvas-empty-hints kbd {
  display: inline-block;
  padding: 2px 7px;
  font-family: inherit;
  font-size: var(--text-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  margin-right: 4px;
  box-shadow: 0 1px 0 var(--color-border);
}

.canvas-empty-tool-link {
  display: inline;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: bold;
  color: var(--color-primary);
  text-decoration: none;
  cursor: pointer;
}

.canvas-empty-tool-link:hover {
  color: var(--color-primary-dark);
}

.canvas-empty-tool-link:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

.starter-shapes-grid {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-sm);
}

.starter-shapes-row {
  display: flex;
  flex-direction: row;
  gap: var(--spacing-md);
}

.canvas-empty-divider {
  width: 100%;
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0;
}

.starter-shape-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  cursor: pointer;
  color: var(--color-text-light);
  font-size: var(--text-sm);
  transition:
    border-color 0.15s,
    color 0.15s;
}

.starter-shape-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.starter-shape-btn:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

/* Fit to view button */
.fit-view-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md) !important;
  pointer-events: auto;
  font-size: var(--text-sm);
}

.fit-view-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.toggle-separator {
  display: none;
}

/* Canvas toggle bar (right side of bottom controls) */
.canvas-toggle-bar {
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  pointer-events: auto;
  user-select: none;
}

.toggle-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 36px;
  padding: 0 10px;
  border: none;
  background: transparent;
  border-radius: 0;
  cursor: pointer;
  color: var(--color-text);
  font-size: var(--text-sm);
  white-space: nowrap;
  transition:
    background-color 0.15s,
    color 0.15s,
    box-shadow 0.15s;
  line-height: 1;
}

.toggle-chip:first-child {
  border-radius: var(--radius-md) 0 0 var(--radius-md);
}

.toggle-chip:not(:last-child) {
  border-right: 1px solid var(--color-border);
}

.toggle-chip:last-child {
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
}

.toggle-chip:hover {
  background: var(--color-background);
}

.toggle-chip.active {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.toggle-chip.active:hover {
  background: var(--color-primary-light);
  filter: brightness(0.95);
}

.toggle-chip-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toggle-chip-label {
  font-weight: 500;
}

.toggle-chip:focus:not(:focus-visible) {
  outline: none;
}

/* Dimension edit input */
.dimension-edit-input {
  width: 80px;
  padding: 2px 4px;
  font:
    12px system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    sans-serif;
  text-align: center;
  border: 2px solid var(--color-primary);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.95);
  outline: none;
  z-index: 10;
}

.dimension-edit-input.invalid {
  border-color: var(--color-error);
}

/* Edge boards section */
.edge-boards-section .edge-board-toggle--all {
  margin-bottom: 10px;
}

.edge-board-toggle--all {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--spacing-xs);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  cursor: pointer;
  padding: 5px 12px;
  border-radius: 4px;
  border: 1px dashed var(--color-border);
  background: transparent;
  color: var(--color-text-light);
  transition: all 0.15s;
  user-select: none;
  width: 100%;
}

.edge-board-toggle--all:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.edge-board-toggle--all.active {
  background: rgba(43, 122, 111, 0.08);
  border-style: solid;
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.edge-board-toggle--all input[type="checkbox"] {
  display: none;
}

.edge-toggle-chips {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: var(--spacing-xs);
  margin-top: var(--spacing-sm);
}

.edge-chip {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-background);
  color: var(--color-text-light);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.edge-chip:hover,
.edge-chip.hovered {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(43, 122, 111, 0.08);
}

.edge-chip.active {
  border-style: solid;
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: white;
}

.edge-chip.active:hover,
.edge-chip.active.hovered {
  background: var(--color-primary-dark);
  border-color: var(--color-primary-dark);
}

/* Keyboard Shortcuts Modal */
.shortcuts-dialog {
  max-width: 420px;
}

.shortcuts-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--spacing-md) var(--spacing-lg);
}

.shortcuts-group h4 {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-text-light);
  margin-bottom: var(--spacing-sm);
}

.shortcut-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-xs);
  font-size: var(--text-sm);
}

.shortcut-row kbd {
  display: inline-block;
  min-width: 24px;
  padding: 2px 6px;
  font-family: inherit;
  font-size: var(--text-xs);
  text-align: center;
  background: var(--color-background);
  border: 1px solid var(--color-border);
  border-radius: 3px;
  color: var(--color-text);
  white-space: nowrap;
}

/* Desktop-only notice */
.desktop-only-notice {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--color-surface);
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--spacing-xl);
  flex-direction: column;
  gap: var(--spacing-md);
}

.desktop-only-notice i {
  font-size: 2.5rem;
  color: var(--color-primary);
}

.desktop-only-notice p {
  font-size: 1.1rem;
  color: var(--color-text);
  max-width: 320px;
  line-height: 1.6;
}

.desktop-only-notice .notice-hint {
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

@media (max-width: 767px) {
  .desktop-only-notice {
    display: flex;
  }
  .app-container {
    display: none;
  }
}

/* Color swatch grid */
.color-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 44px);
  gap: 4px;
}

.color-swatch {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  border: 2px solid var(--color-border);
  cursor: pointer;
  padding: 0;
  transition:
    border-color 0.15s,
    box-shadow 0.15s;
}

.color-swatch:hover {
  border-color: var(--color-text-light);
}

.color-swatch--selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary);
}

.color-swatch-name {
  display: block;
  margin-top: 4px;
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .sidebar-right {
    width: 280px;
  }

  .toggle-chip-label {
    display: none;
  }
}

@media (max-width: 768px) {
  .app-main {
    flex-direction: column;
  }

  .sidebar-left {
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }

  .toolbar {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: visible;
  }

  .toolbar-section {
    display: flex;
    flex-direction: row;
    grid-template-columns: unset;
  }

  .toolbar-divider {
    width: 1px;
    height: 40px;
    margin: 0 var(--spacing-sm);
  }

  .toolbar-button {
    width: auto;
    min-width: 40px;
  }

  .sidebar-right {
    width: 100%;
    height: 300px;
    border-left: none;
    border-top: 1px solid var(--color-border);
  }
}

/* Dev toolbar (only on /dev route) */
.dev-toolbar {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.dev-import-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--color-warning, #e67e22);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.dev-import-btn:hover {
  opacity: 0.85;
}

.dev-status {
  font-size: 11px;
  color: var(--color-text-secondary);
}
