/* ============================================================
   Painter — Apple-Style Refined UI
   Premium, generous whitespace, warm neutrals
   ============================================================ */

:root {
  /* Warm neutral palette */
  --bg:             #f5f5f7;
  --bg-card:        #ffffff;
  --bg-elevated:    #fafafa;
  --bg-inset:       #f0f0f2;
  --text:           #1d1d1f;
  --text-secondary: #6e6e73;
  --text-muted:     #aeaeb2;
  --border:         rgba(0,0,0,0.06);
  --border-strong:  rgba(0,0,0,0.10);

  /* Accent — teal, used sparingly */
  --accent:         #0d9488;
  --accent-hover:   #0f766e;
  --accent-light:   #ccfbf1;
  --accent-soft:    rgba(13,148,136,0.08);
  --accent-medium:  rgba(13,148,136,0.15);

  --danger:         #ff3b30;
  --success:        #34c759;

  --radius:         10px;
  --radius-lg:      16px;
  --radius-xl:      20px;

  --shadow-sm:      0 1px 2px rgba(0,0,0,0.04);
  --shadow:         0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg:      0 8px 30px rgba(0,0,0,0.10);
  --shadow-xl:      0 20px 60px rgba(0,0,0,0.15);

  --transition:     0.2s cubic-bezier(0.25, 0.1, 0.25, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

[hidden] { display: none !important; }

/* ============================================================
   APP SHELL & LAYOUT
   ============================================================ */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.editor {
  flex: 1;
  display: grid;
  grid-template-columns: 280px 1fr;
  overflow: hidden;
}

.main-area {
  display: grid;
  grid-template-columns: 1fr 320px;
  overflow: hidden;
}

/* Responsive */
@media (max-width: 1100px) {
  .main-area {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
}

@media (max-width: 800px) {
  .editor {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: none;
  }
}
/* ============================================================
   HEADER — Frosted glass, refined
   ============================================================ */
.header {
  overflow: visible;
  overflow: visible;
  height: 52px;
  overflow: visible;
  overflow: visible;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-brand { display: flex; align-items: center; gap: 12px; }

.logo-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.header-title {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.header-subtitle {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 400;
  letter-spacing: 0.01em;
}

.header-nav { display: flex; align-items: center; gap: 6px; }

.nav-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  transition: all var(--transition);
}
.nav-link:hover { background: var(--bg-inset); color: var(--text); }

.user-menu { position: relative; }

.user-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  transition: all var(--transition);
  font-family: inherit;
}
.user-btn:hover { background: var(--bg); border-color: var(--border-strong); }

.user-avatar {
  width: 26px;
  height: 26px;
  background: var(--accent);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
}

.user-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 6px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  min-width: 160px;
  z-index: 200;
  overflow: hidden;
}
.user-dropdown.show { display: block; background: #fff !important; border: 2px solid red !important; box-shadow: 0 8px 30px rgba(0,0,0,0.3) !important; z-index: 9999 !important; min-width: 200px !important; padding: 8px 0 !important; }

.dropdown-item {
  display: block;
  padding: 10px 14px;
  font-size: 0.82rem;
  color: var(--text);
  text-decoration: none;
  transition: background var(--transition);
}
.dropdown-item:hover { background: var(--bg-inset); }

.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 0; }

/* ============================================================
   LEFT SIDEBAR — Clean, visual, Apple-inspired
   ============================================================ */
.sidebar {
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 16px 20px 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: opacity var(--transition);
}
.back-link:hover { opacity: 0.7; }
.back-link svg { width: 14px; height: 14px; }

/* Project Info */
.project-info {
  padding: 16px 20px 0;
}
.project-info h1 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 2px;
}
.project-info p {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
}

.project-info-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

/* Side section divider */
.side-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 20px;
}

/* Images Panel */
.images-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px 8px;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.add-btn:hover { background: var(--accent-medium); }

.images-list {
  overflow-y: auto;
  padding: 0 12px 4px;
}

.empty-text {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* Image Card */
.img-thumb-wrap {
  position: relative;
}

.img-thumb {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: all var(--transition);
  position: relative;
}
.img-thumb:hover { background: var(--bg-inset); }
.img-thumb-wrap.active .img-thumb {
  background: var(--accent-soft);
}
.img-thumb-wrap.active .img-thumb::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 24px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}

.img-thumb img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
}

.img-meta { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.img-type {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.img-count {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 1px;
}

/* Image delete button — hover reveal */
.img-delete-form {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  opacity: 0;
  transition: opacity var(--transition);
}
.img-thumb-wrap:hover .img-delete-form { opacity: 1; }

.img-delete-btn {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  border: none;
  background: rgba(255,59,48,0.08);
  color: var(--danger);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  transition: all var(--transition);
}
.img-delete-btn:hover { background: rgba(255,59,48,0.15); }

/* Results Panel */
.results-panel {
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
}
.results-panel .panel-head { padding: 12px 20px 8px; }

.pill {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg-inset);
  padding: 2px 8px;
  border-radius: 10px;
}

.results-list {
  overflow-y: auto;
  padding: 0 12px 12px;
}

/* Result Card */
.result-row {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 0;
  margin-bottom: 4px;
}

.result-item {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: none;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: all var(--transition);
}
.result-item:hover { background: var(--bg-inset); }
.result-item.disabled { opacity: 0.45; cursor: not-allowed; }

.result-thumb {
  width: 80px;
  height: 60px;
  border-radius: 8px;
  background: var(--bg-inset);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.result-thumb img { width: 100%; height: 100%; object-fit: cover; }
.result-thumb-fallback { color: var(--text-muted); font-weight: 700; font-size: 0.75rem; }

.result-meta { min-width: 0; flex: 1; }
.result-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  margin-bottom: 1px;
}
.result-sub {
  font-size: 0.68rem;
  color: var(--text-muted);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: lowercase;
}
.status-chip.complete, .status-chip.completed {
  background: rgba(52,199,89,0.10);
  color: #15803d;
}
.status-chip.error {
  background: rgba(255,59,48,0.10);
  color: #b91c1c;
}
.status-chip.pending, .status-chip.processing {
  background: rgba(110,110,115,0.10);
  color: var(--text-secondary);
}

/* Result delete — hover reveal */
.result-delete-form { display: flex; opacity: 0; transition: opacity var(--transition); }
.result-row:hover .result-delete-form { opacity: 1; }

.result-delete-btn {
  width: 28px;
  border-radius: 8px;
  border: none;
  background: rgba(255,59,48,0.08);
  color: var(--danger);
  font-weight: 800;
  font-size: 0.7rem;
  cursor: pointer;
  transition: all var(--transition);
}
.result-delete-btn:hover { background: rgba(255,59,48,0.15); }

/* ============================================================
   PREVIEW AREA
   ============================================================ */
.preview {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

.preview-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
}

/* Segmented Tabs — Apple style */
.view-tabs {
  display: flex;
  background: var(--bg-inset);
  border-radius: 8px;
  padding: 2px;
}

.view-tab {
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.view-tab:hover { color: var(--text); }
.view-tab.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-weight: 600;
}

.preview-btns { display: flex; gap: 4px; }

.icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
}
.icon-btn:hover {
  background: var(--bg-inset);
  color: var(--text);
  border-color: var(--border-strong);
}
.icon-btn.danger { color: var(--danger); border-color: rgba(255,59,48,0.15); }
.icon-btn.danger:hover { background: rgba(255,59,48,0.06); border-color: rgba(255,59,48,0.3); }

/* Canvas */
.preview-canvas {
  flex: 1;
  padding: 16px;
  overflow: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

/* ============================================================
   SLIDER COMPARE VIEW
   ============================================================ */
.view-compare {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compare-wrap {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  line-height: 0;
  user-select: none;
  -webkit-user-select: none;
  cursor: col-resize;
  box-shadow: var(--shadow);
}

.compare-img { display: block; width: 100%; height: auto; transition: opacity 0.3s ease; }

.compare-over {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  clip-path: inset(0 0 0 50%);
  z-index: 2;
}

.compare-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-muted);
  text-align: center;
  padding: 60px 30px;
  min-height: 300px;
}
.compare-empty svg { opacity: 0.4; }
.compare-empty span { font-size: 0.8rem; }

.compare-label {
  position: absolute;
  top: 14px;
  padding: 5px 12px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  border-radius: 6px;
  pointer-events: none;
  z-index: 4;
}
.compare-label--left {
  left: 14px;
  background: rgba(0,0,0,0.55);
  color: #fff;
  backdrop-filter: blur(8px);
}
.compare-label--right {
  right: 14px;
  background: rgba(13,148,136,0.7);
  color: #fff;
  backdrop-filter: blur(8px);
}

.compare-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 0;
  z-index: 5;
  pointer-events: none;
}

.compare-handle__line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -1px;
  width: 2px;
  background: #fff;
  box-shadow: 0 0 8px rgba(0,0,0,0.2);
}

.compare-handle__grip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  pointer-events: auto;
  cursor: col-resize;
  transition: all var(--transition);
}
.compare-handle__grip:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  transform: translate(-50%, -50%) scale(1.08);
}
.compare-handle__grip:active,
.compare-wrap.is-dragging .compare-handle__grip {
  box-shadow: 0 2px 20px rgba(13,148,136,0.35);
  transform: translate(-50%, -50%) scale(1.12);
  color: var(--accent);
}

/* Single Views */
.view-single {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.view-single img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* ============================================================
   RIGHT CONTROLS PANEL — Refined, breathable
   ============================================================ */
.controls {
  background: var(--bg-card);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  /* Whole sidebar scrolls as one unit; the footer below uses position:sticky
     to stay anchored to the visible bottom while content scrolls behind it. */
  overflow-y: auto;
}

@media (max-width: 1100px) {
  .controls {
    border-left: none;
    border-top: 1px solid var(--border);
    max-height: 50vh;
  }
}

.controls-scroll {
  /* Natural height — content sits flush below the last section. */
  padding: 20px;
}

.controls-footer {
  /* Sticky to the bottom of the scrolling sidebar so Ready to Paint
     is always visible, mirroring the mobile behaviour. The shadow + opaque
     background keep it readable when content scrolls underneath. */
  position: sticky;
  bottom: 0;
  z-index: 5;
  padding: 16px 20px;
  border-top: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 -4px 12px rgba(15, 23, 42, 0.04);
}

/* Sections */
.section { margin-bottom: 24px; }
.section:last-child { margin-bottom: 0; }

.section-title {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 12px;
}

/* ============================================================
   COLOUR SCHEME PRESETS
   ============================================================ */

.preset-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ============================================================
   ACTIVE SCHEME CARD — pinned above trigger cards in Colour Presets
   ============================================================ */
.active-scheme-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--accent, #14B8A6);
  border-radius: 10px;
  background: linear-gradient(180deg, rgba(20,184,166,0.06), rgba(20,184,166,0.02));
  position: relative;
  margin-bottom: 4px;
}
.active-scheme-card .asc-text {
  flex: 1;
  min-width: 0;
}
.active-scheme-card .asc-eyebrow {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent, #14B8A6);
  line-height: 1;
}
.active-scheme-card .asc-name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.active-scheme-card .asc-colors {
  font-size: 0.66rem;
  color: var(--text-muted);
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.active-scheme-card .asc-swatches {
  display: flex;
  flex-direction: column;
  gap: 3px;
  flex-shrink: 0;
}
.active-scheme-card .asc-swatch {
  display: block;
  width: 28px;
  height: 8px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.1);
}
.active-scheme-card .asc-clear {
  width: 22px;
  height: 22px;
  border: none;
  background: rgba(0,0,0,0.06);
  color: var(--text-muted);
  border-radius: 50%;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  transition: all 0.15s;
}
.active-scheme-card .asc-clear:hover {
  background: rgba(0,0,0,0.12);
  color: var(--text);
}

/* Synthesised palette section shown inside the colour-picker modal
   when an active scheme is restricting the available colours. */
.palette-section.active-scheme-only label {
  color: var(--accent, #14B8A6);
  font-weight: 700;
}


.preset-card {
  display: flex;
  flex-direction: column;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.15s;
  background: var(--bg-card);
}


.preset-card:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 6px rgba(20,184,166,0.12);
}


.preset-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(20,184,166,0.15);
}


.preset-swatches {
  display: flex;
  height: 24px;
}

.preset-swatches .walls-swatch { flex: 2; }
.preset-swatches .trim-swatch { flex: 1; border-left: 2px solid white; }


.preset-name {
  padding: 3px 6px 0;
  font-size: 0.64rem;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.preset-colors-label {
  padding: 0 6px 4px;
  font-size: 0.54rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@keyframes chipFlash {
  0% { transform: scale(1); }
  40% { transform: scale(1.3); box-shadow: 0 0 0 4px rgba(20,184,166,0.15), 0 1px 3px rgba(0,0,0,0.12); }
  100% { transform: scale(1); }
}

.color-chip.flash {
  animation: chipFlash 0.4s ease;
}

/* ============================================================
   BUCKETS (Paint Areas)
   ============================================================ */
.bucket {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 10px;
  overflow: hidden;
  transition: all var(--transition);
}
.bucket:hover { border-color: var(--border-strong); }
.bucket.disabled { opacity: 0.45; }

.bucket-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  gap: 12px;
}

.bucket-info { flex: 1; min-width: 0; }
.bucket-name {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.88rem;
  font-weight: 700;
  display: block;
  color: var(--text);
}
.bucket-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  display: block;
  margin-top: 2px;
}

.bucket-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Colour Chip — larger, premium paint-drop feel */
.color-chip {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.9);
  background: var(--chip-bg, #e2e8f0);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(0,0,0,0.06);
  transition: all var(--transition);
}
.color-chip:hover {
  transform: scale(1.12);
  box-shadow: 0 2px 8px rgba(0,0,0,0.18), inset 0 0 0 1px rgba(0,0,0,0.08);
}

/* Toggle Switch — iOS style */
.toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  cursor: pointer;
  z-index: 2;
  margin: 0;
}
.toggle-slider {
  position: absolute;
  inset: 0;
  background: #d1d5db;
  border-radius: 999px;
  transition: background var(--transition);
}
.toggle-slider::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Bucket Children */
.bucket-children {
  border-top: 1px solid var(--border);
  padding: 8px 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bucket-children:empty { display: none; }
.bucket.collapsed .bucket-children { display: none; }
.bucket-header { cursor: pointer; }
.bucket-header::after { content: ""; display: inline-block; width: 8px; height: 8px; border-right: 2px solid var(--text-secondary); border-bottom: 2px solid var(--text-secondary); transform: rotate(45deg); transition: transform 0.2s ease; margin-left: 8px; flex-shrink: 0; }
.bucket.collapsed .bucket-header::after { transform: rotate(-45deg); }

/* Bucket collapse */
.bucket.collapsed .bucket-children { display: none; }
.bucket-header { cursor: pointer; }
.bucket-header::after {
  content: "";
  width: 8px; height: 8px;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease;
  flex-shrink: 0;
  margin-left: 4px;
}
.bucket.collapsed .bucket-header::after {
  transform: rotate(-45deg);
}

.child-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  transition: background var(--transition);
}
.child-row:hover { background: rgba(0,0,0,0.02); }

.child-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.child-label {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.child-color {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.9);
  background: var(--chip-bg, transparent);
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1), inset 0 0 0 1px rgba(0,0,0,0.05);
  transition: all var(--transition);
}
.child-color:hover { transform: scale(1.1); }

.no-children {
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 4px 0;
  font-style: italic;
}

.hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 6px;
  text-align: center;
}

/* ============================================================
   OPTIONS ROW
   ============================================================ */
.option-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.option label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.select {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.82rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%236e6e73' stroke-width='2'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  transition: all var(--transition);
}
.select:hover { border-color: var(--border-strong); }
.select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 0.82rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: vertical;
  transition: all var(--transition);
}
.textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.textarea::placeholder { color: var(--text-muted); }

/* ============================================================
   GENERATE BUTTON
   ============================================================ */
.generate-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 0.92rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #0d9488, #0f766e);
  border: none;
  border-radius: var(--radius-lg);
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(13,148,136,0.3);
  transition: all var(--transition);
  letter-spacing: -0.01em;
}
.generate-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(13,148,136,0.4);
}
.generate-btn:active { transform: translateY(0); }
.generate-btn svg { width: 18px; height: 18px; }
.generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.status {
  margin-top: 8px;
  font-size: 0.75rem;
  text-align: center;
  color: var(--text-muted);
  min-height: 18px;
}

/* ============================================================
   COLOUR PICKER MODAL — Premium overlay
   ============================================================ */
.modal { z-index: 998; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 999;
  animation: fadeIn 0.2s ease;
}

.modal-content {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(440px, calc(100vw - 40px));
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  z-index: 1000;
  animation: modalIn 0.25s cubic-bezier(0.25, 0.1, 0.25, 1);
  overflow: hidden;
}

@keyframes fadeIn { from { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -48%); } }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-head h3 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

/* Click-to-edit element name inside the colour modal title.
   The "Colour for ..." prefix stays as plain text; the element name is a
   clickable span that swaps to an input on click. */
.cm-title-name {
  display: inline-block;
  cursor: text;
  padding: 1px 4px;
  margin: 0 -4px;
  border-radius: 4px;
  border: 1px dashed transparent;
  transition: background 0.12s, border-color 0.12s;
}
.cm-title-name:hover,
.cm-title-name:focus-visible {
  background: rgba(15, 23, 42, 0.04);
  border-color: rgba(15, 23, 42, 0.18);
  outline: none;
}
.cm-title-name-input {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 1px 6px;
  margin: 0 -6px;
  background: var(--bg-card);
  border: 1px solid var(--accent, #14b8a6);
  border-radius: 4px;
  outline: none;
  min-width: 120px;
  max-width: 360px;
  width: auto;
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: var(--bg-inset);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body { padding: 20px 24px; }

.color-input-row {
  margin-bottom: 20px;
}
.color-input-row label {
  display: block;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.color-input-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
}

.color-text-input {
  flex: 1;
  padding: 12px 14px;
  font-size: 0.88rem;
  font-family: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.color-text-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.color-text-input::placeholder { color: var(--text-muted); }

.color-preview-swatch {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(0,0,0,0.06);
  background: #e2e8f0;
  flex-shrink: 0;
  transition: background var(--transition);
}

/* Reset Colour button — sits in the colour modal footer, left-aligned via
   margin-right:auto so Cancel/Apply stay on the right. Visual style mirrors
   the sidebar's "Reset Selections" button. */
.color-reset-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  background: transparent;
  border: 1px solid rgba(15,23,42,.15);
  border-radius: 10px;
  color: rgba(15,23,42,.6);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  flex-shrink: 0;
  margin-right: auto; /* push Cancel/Apply to the right */
  transition: all 0.2s;
}
.color-reset-btn:hover {
  background: rgba(239,68,68,.06);
  border-color: rgba(239,68,68,.3);
  color: #dc2626;
}
.color-reset-btn:focus-visible {
  outline: none;
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(239,68,68,.15);
}
.color-reset-btn svg { flex-shrink: 0; }

.palette-section { margin-bottom: 16px; }
.palette-section:last-child { margin-bottom: 0; }
.palette-section label {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.swatch {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid white;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(0,0,0,0.06);
  transition: all var(--transition);
}
.swatch:hover { transform: scale(1.15); }
.swatch.selected {
  box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0,0,0,0.15);
  transform: scale(1.1);
}

/* Custom colour picker swatch — rainbow wheel */
.swatch-picker {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid white;
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,0.12), inset 0 0 0 1px rgba(0,0,0,0.06);
  transition: all var(--transition);
  background: conic-gradient(#f44 0deg, #fc0 60deg, #4f0 120deg, #0cf 180deg, #44f 240deg, #f4f 300deg, #f44 360deg);
  position: relative;
  overflow: hidden;
  display: inline-flex;
}
.swatch-picker:hover { transform: scale(1.15); }
.swatch-picker input[type="color"] {
  position: absolute;
  inset: -8px;
  width: calc(100% + 16px);
  height: calc(100% + 16px);
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0;
}
.swatch-picker.has-color {
  background: var(--picked-color);
  box-shadow: 0 0 0 2px var(--accent), 0 2px 8px rgba(0,0,0,0.15);
  transform: scale(1.1);
}

/* Buttons */
.modal-foot {
  display: flex;
  gap: 10px;
  padding: 0 24px 20px;
  justify-content: flex-end;
}

.btn-secondary {
  padding: 10px 20px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.btn-secondary:hover { background: var(--bg); border-color: var(--border-strong); }

.btn-primary {
  padding: 10px 24px;
  font-size: 0.82rem;
  font-weight: 600;
  color: white;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.btn-primary:hover { background: var(--accent-hover); }

/* ============================================================
   EMPTY STATE
   ============================================================ */
.empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--text-muted);
  padding: 40px;
}
.empty-state h2 {
  font-family: 'Plus Jakarta Sans', sans-serif;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
}
.empty-state p { font-size: 0.85rem; }

.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.88rem;
  font-weight: 600;
  color: white;
  background: var(--accent);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--transition);
  margin-top: 8px;
}
.upload-btn:hover { background: var(--accent-hover); }

/* ============================================================
   SCROLLBAR
   ============================================================ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.2); }

/* Optional: soften preview while images load */
.img-loading {
  filter: blur(0px);
  opacity: 1;
  transition: filter .15s, opacity .15s;
}

/* ========================================
   Dashboard & Auth (keep existing)
   ======================================== */
.dashboard { max-width: 900px; margin: 0 auto; padding: 30px 20px; }
.dashboard-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 30px; }
.page-title { font-size: 1.4rem; font-weight: 700; }
.page-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

.projects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.project-card:hover { border-color: var(--accent); box-shadow: var(--shadow); }

.project-thumb {
  height: 100px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
}

.project-card-info { padding: 14px; }
.project-card-name { font-weight: 600; margin-bottom: 4px; }
.project-card-meta { font-size: 0.75rem; color: var(--text-muted); }

/* Auth */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 30px;
  box-shadow: var(--shadow-lg);
}

.auth-header { text-align: center; margin-bottom: 24px; }
.auth-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: inherit;
  font-weight: 700;
  margin-bottom: 16px;
}
.auth-title { font-size: 1.2rem; margin-bottom: 4px; }
.auth-subtitle { color: var(--text-muted); font-size: 0.85rem; }

.auth-form { display: flex; flex-direction: column; gap: 14px; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label { font-size: 0.8rem; font-weight: 500; }
.form-input {
  padding: 10px 12px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.form-input:focus { outline: none; border-color: var(--accent); }

.auth-footer {
  text-align: center;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}
.auth-footer a { color: var(--accent); text-decoration: none; font-weight: 500; }

.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.85rem;
  margin-bottom: 14px;
}
.alert-error { background: #fef2f2; color: var(--danger); border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: var(--success); border: 1px solid #bbf7d0; }

.btn { 
  display: inline-flex; 
  align-items: center; 
  justify-content: center;
  gap: 6px;
  padding: 10px 18px; 
  font-size: 0.85rem; 
  font-weight: 600; 
  border-radius: var(--radius); 
  border: none; 
  cursor: pointer; 
  text-decoration: none;
}
.btn-sm { padding: 6px 12px; font-size: 0.75rem; }

/* Account */
.account-page { padding: 30px 20px; }
.account-container { max-width: 550px; margin: 0 auto; }
.settings-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}
.settings-section h2 {
  font-size: 0.95rem;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.settings-form { display: flex; flex-direction: column; gap: 14px; }
.form-hint { font-size: 0.7rem; color: var(--text-muted); margin-top: 4px; }

/* Modal for dashboard */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-form { padding: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  border: 0;
}
/* ========================================
   Trash / Delete icons (project + image)
   ======================================== */

/* Dashboard: delete project icon button */
.project-card-wrap { position: relative; }
.project-card-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
}

/* unify "danger icon button" look */
.icon-btn.danger,
.project-delete-form .icon-btn.danger {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;

  color: var(--danger);
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(239, 68, 68, 0.25);
  box-shadow: 0 1px 2px rgba(0,0,0,0.08);

  cursor: pointer;
  transition: transform 0.12s, background 0.12s, border-color 0.12s, box-shadow 0.12s, color 0.12s;
}

.icon-btn.danger:hover,
.project-delete-form .icon-btn.danger:hover {
  background: #fff;
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.12);
  transform: translateY(-1px);
}

.icon-btn.danger:active,
.project-delete-form .icon-btn.danger:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.10);
}

.icon-btn.danger svg,
.project-delete-form .icon-btn.danger svg {
  width: 18px;
  height: 18px;
}

/* Keyboard accessibility */
.icon-btn.danger:focus-visible,
.project-delete-form .icon-btn.danger:focus-visible,
.img-delete-btn:focus-visible {
  outline: 3px solid rgba(13, 148, 136, 0.25); /* accent */
  outline-offset: 2px;
}

/* Project page: delete image small X button */
.img-thumb-wrap { position: relative; }

.img-delete-form {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
}

/* style the "✕" delete button */
.img-delete-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid rgba(239, 68, 68, 0.22);
  background: rgba(255,255,255,0.90);
  color: var(--danger);

  display: inline-flex;
  align-items: center;
  justify-content: center;

  font-size: 16px;
  line-height: 1;
  cursor: pointer;

  opacity: 0;               /* hidden until hover/focus */
  transform: scale(0.96);
  transition: opacity 0.12s, transform 0.12s, background 0.12s, border-color 0.12s, box-shadow 0.12s;
}

/* show on hover of the image row */
.img-thumb-wrap:hover .img-delete-btn,
.img-delete-btn:focus-visible {
  opacity: 1;
  transform: scale(1);
}

.img-delete-btn:hover {
  background: #fff;
  border-color: rgba(239, 68, 68, 0.45);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.12);
}

/* Always visible for the currently active image */
.img-thumb-wrap.active .img-delete-btn {
  opacity: 1;
  transform: scale(1);
}

/* Mobile: always visible (no hover) */
@media (max-width: 800px) {
  .img-delete-btn { opacity: 1; transform: scale(1); }
}

/* Match result-item width to image thumb rows */
.results-list {
  padding-left: 10px;
  padding-right: 10px;
}

.result-row {
  justify-content: flex-start;
}

/* This is the key line */
.result-item {
  flex: 0 0 auto;
  width: 100%;
  max-width: 100%;
}

/* Sidebar is 220px wide, minus padding */
.sidebar .result-item {
  max-width: calc(220px - 20px); /* same visual width as .img-thumb-wrap */
}
/* ========================================
   Dashboard — Redesigned
   ======================================== */

/* --- Layout --- */
.dash {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 24px 72px;
}

/* --- Alerts --- */
.dash-alert {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 20px;
  animation: dashFadeDown 0.3s ease-out;
}
.dash-alert--error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}
.dash-alert--success {
  background: #f0fdf4;
  color: #15803d;
  border: 1px solid #bbf7d0;
}

/* --- Welcome Bar --- */
.dash-welcome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}
.dash-welcome__text h1 {
  font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
  font-size: 1.55rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  line-height: 1.2;
}
.dash-welcome__text p {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

/* --- Stats Strip --- */
.dash-stats {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 0;
  margin-bottom: 28px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
}
.dash-stat {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.dash-stat__value {
  font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
}
.dash-stat__label {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.dash-stat__divider {
  width: 1px;
  height: 32px;
  background: var(--border);
  flex-shrink: 0;
}

/* --- Buttons --- */
.dash-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}
.dash-btn--primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 1px 3px rgba(13,148,136,0.25);
}
.dash-btn--primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 4px 12px rgba(13,148,136,0.3);
  transform: translateY(-1px);
}
.dash-btn--primary:active {
  transform: translateY(0);
}
.dash-btn--ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.dash-btn--ghost:hover {
  background: var(--bg);
  color: var(--text);
  border-color: var(--text-muted);
}
.dash-btn--lg {
  padding: 13px 28px;
  font-size: 0.9rem;
}

/* --- Project Grid --- */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 900px) {
  .dash-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 540px) {
  .dash-grid { grid-template-columns: 1fr; }
}

/* --- Card Wrapper (for delete overlay) --- */
.dash-card-wrap {
  position: relative;
}

/* --- Project Card --- */
.dash-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  height: 100%;
}
.dash-card:hover {
  border-color: rgba(13,148,136,0.35);
  box-shadow: 0 8px 28px rgba(0,0,0,0.08), 0 0 0 1px rgba(13,148,136,0.08);
  transform: translateY(-2px);
}

/* Thumbnail */
.dash-card__thumb {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}
.dash-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.dash-card:hover .dash-card__thumb img {
  transform: scale(1.03);
}
.dash-card__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}
.dash-card__placeholder-icon {
  color: var(--text-muted);
  opacity: 0.4;
}

/* Sparkle pip for cards with results */
.dash-card__result-pip {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(13,148,136,0.35);
  border: 2px solid #fff;
}

/* Body */
.dash-card__body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.dash-card__title {
  font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
  /* clamp to 2 lines */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.dash-card__address {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dash-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
}
.dash-card__counts {
  display: flex;
  align-items: center;
  gap: 10px;
}
.dash-card__count {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}
.dash-card__count svg { opacity: 0.55; }
.dash-card__count--accent {
  color: var(--accent);
}
.dash-card__count--accent svg { opacity: 0.8; }
.dash-card__date {
  font-size: 0.7rem;
  color: var(--text-muted);
  opacity: 0.7;
}

/* Delete overlay */
.dash-card__delete {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 5;
  opacity: 0;
  transform: scale(0.92);
  transition: opacity 0.15s, transform 0.15s;
}
.dash-card-wrap:hover .dash-card__delete,
.dash-card__delete:focus-within {
  opacity: 1;
  transform: scale(1);
}
.dash-card__delete-btn {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  border: none;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(4px);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.dash-card__delete-btn:hover {
  color: var(--danger);
  background: #fff;
  box-shadow: 0 4px 12px rgba(239,68,68,0.15);
}

/* New Project Card */
.dash-card--new {
  border: 2px dashed var(--border);
  background: transparent;
  cursor: pointer;
  min-height: 200px;
  transition: border-color 0.2s, background 0.2s;
}
.dash-card--new:hover {
  border-color: var(--accent);
  background: rgba(13,148,136,0.03);
  transform: none;
  box-shadow: none;
}
.dash-card--new__inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 100%;
  color: var(--text-muted);
  transition: color 0.2s;
}
.dash-card--new:hover .dash-card--new__inner {
  color: var(--accent);
}
.dash-card--new__inner span {
  font-size: 0.85rem;
  font-weight: 600;
}

/* --- Empty State --- */
.dash-empty {
  text-align: center;
  padding: 60px 20px 80px;
}
.dash-empty__icon {
  width: 100px;
  height: 100px;
  margin: 0 auto 24px;
  border-radius: 24px;
  background: linear-gradient(135deg, #f0fdfa 0%, #ecfdf5 50%, #f0f9ff 100%);
  border: 1px solid rgba(13,148,136,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}
.dash-empty h2 {
  font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.dash-empty p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  max-width: 400px;
  margin: 0 auto 28px;
  line-height: 1.6;
}
.dash-empty__steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  margin-top: 40px;
}
.dash-empty__step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-weight: 500;
}
.dash-empty__step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

/* --- Modal --- */
.dash-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: dashFadeIn 0.15s ease-out;
}
.dash-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15,23,42,0.45);
  backdrop-filter: blur(3px);
}
.dash-modal__card {
  position: relative;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
  width: 100%;
  max-width: 460px;
  animation: dashSlideUp 0.2s ease-out;
}
.dash-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}
.dash-modal__head h2 {
  font-family: 'Plus Jakarta Sans', 'DM Sans', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
}
.dash-modal__close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.dash-modal__close:hover {
  background: #e2e8f0;
  color: var(--text);
}
.dash-modal__form {
  padding: 20px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.dash-modal__actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 4px;
}

/* --- Form Fields --- */
.dash-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dash-field__label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
}
.dash-field__opt {
  font-weight: 400;
  color: var(--text-muted);
}
.dash-field__input {
  padding: 10px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.dash-field__input::placeholder {
  color: var(--text-muted);
}
.dash-field__input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(13,148,136,0.1);
  background: #fff;
}
.dash-field__hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --- Animations --- */
@keyframes dashFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes dashSlideUp {
  from { opacity: 0; transform: translateY(12px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes dashFadeDown {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* --- Responsive --- */
@media (max-width: 640px) {
  .dash { padding: 20px 16px 60px; }
  .dash-welcome { flex-direction: column; align-items: flex-start; gap: 14px; }
  .dash-welcome__text h1 { font-size: 1.3rem; }
  .dash-btn--primary { width: 100%; }
  .dash-grid { grid-template-columns: 1fr; }
  .dash-stats { border-radius: 10px; padding: 12px 0; }
  .dash-stat__value { font-size: 1.1rem; }
  .dash-empty__steps { flex-direction: column; gap: 14px; align-items: flex-start; padding-left: 20px; }
  .dash-card__delete { opacity: 1; transform: scale(1); }
  .dash-card--new { min-height: 140px; }
}

@media (max-width: 400px) {
  .dash-modal__card { border-radius: 12px; }
  .dash-modal__form { padding: 16px 18px 20px; }
  .dash-modal__head { padding: 16px 18px 0; }
}


/* Preset Sections */
.preset-section { margin-bottom: 12px; }
.preset-section-header { margin-bottom: 6px; }
.preset-section-label {
  font-size: 0.7rem; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.3px;
}
.preset-grid-inner {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px;
}
.preset-show-more {
  display: block; width: 100%; margin-top: 6px; padding: 5px 0;
  border: 1px dashed var(--border); border-radius: 8px;
  background: none; cursor: pointer; font-size: 0.68rem;
  font-weight: 500; color: var(--accent); font-family: inherit;
  transition: all 0.15s; text-align: center;
}
.preset-show-more:hover { background: rgba(20,184,166,0.05); border-color: var(--accent); }
.preset-swatches--tri { height: 24px; }
.preset-swatches--tri .walls-swatch { flex: 2; }
.preset-swatches--tri .trim-swatch { flex: 1; border-left: 1.5px solid white; }
.preset-swatches--tri .features-swatch { flex: 1; border-left: 1.5px solid white; }

/* Reset Selections Button */
.reset-btn {
  width: 100%;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: transparent;
  border: 1px solid rgba(15,23,42,.15);
  border-radius: 10px;
  color: rgba(15,23,42,.6);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.reset-btn:hover {
  background: rgba(239,68,68,.06);
  border-color: rgba(239,68,68,.3);
  color: #dc2626;
}

/* Swatch W/T/F labels */
.preset-swatches .walls-swatch,
.preset-swatches .trim-swatch,
.preset-swatches .features-swatch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.swatch-label {
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: rgba(255,255,255,.85);
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
  pointer-events: none;
  letter-spacing: 0.3px;
}

/* Dark text for light-coloured swatches */
.swatch-label--dark {
  color: rgba(0,0,0,.55);
  text-shadow: none;
}

/* Render Usage Bar */
.render-usage-bar {
  padding: 8px 0;
  margin-bottom: 4px;
}
.render-usage-text {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: rgba(15,23,42,.55);
  margin-bottom: 4px;
}
.render-usage-remaining {
  font-weight: 600;
}
.render-usage-track {
  height: 5px;
  background: rgba(15,23,42,.08);
  border-radius: 3px;
  overflow: hidden;
}
.render-usage-fill {
  height: 100%;
  border-radius: 3px;
  background: #0d9488;
  transition: width 0.5s ease;
}
.render-usage-fill.warning { background: #f59e0b; }
.render-usage-fill.danger { background: #ef4444; }

/* Render Limit Modal */
.render-limit-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.render-limit-modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.render-limit-modal h3 {
  margin: 0 0 8px;
  font-size: 18px;
  color: #ef4444;
}
.render-limit-modal p {
  margin: 0 0 20px;
  font-size: 14px;
  color: rgba(15,23,42,.65);
  line-height: 1.5;
}
.render-limit-modal button {
  padding: 10px 28px;
  border: none;
  border-radius: 10px;
  background: #0f172a;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Per-bucket reset button */
.bucket-reset-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid rgba(15,23,42,.1);
  border-radius: 50%;
  background: transparent;
  color: rgba(15,23,42,.35);
  font-size: 13px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.bucket-reset-btn:hover {
  background: rgba(239,68,68,.08);
  border-color: rgba(239,68,68,.3);
  color: #dc2626;
}

@media (max-width: 800px) {
  .mobile-results-strip {
    display: block;
    padding: 8px 12px 12px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
  }
  .mobile-results-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
  }
  .mobile-results-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.06em;
  }
  .mobile-results-scroll {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }
  .mobile-result-thumb {
    flex-shrink: 0;
    width: 100px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-card);
    padding: 0;
    cursor: pointer;
  }
  .mobile-result-thumb img {
    width: 100px;
    height: 68px;
    object-fit: cover;
    display: block;
  }
  .mobile-result-title {
    display: block;
    font-size: 0.6rem;
    color: var(--text-secondary);
    padding: 3px 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Lasso popup buttons */
.lasso-popup-btn{flex:1;padding:12px;border-radius:10px;font-family:'DM Sans',sans-serif;font-size:0.9rem;font-weight:600;cursor:pointer;position:relative;overflow:hidden;border:none;transition:background 0.15s}
.lasso-popup-btn--add{background:#1a1a1a;color:#fff}
.lasso-popup-btn--add::after{content:'';position:absolute;bottom:0;left:0;right:0;height:3px;background:linear-gradient(90deg,#2255A4,#E87A1E,#F7941D,#FF4136)}
.lasso-popup-btn--add:hover{background:#333}
.lasso-popup-btn--cancel{background:transparent;color:#8a8578;border:1.5px solid #e2ddd4}
.lasso-popup-btn--cancel:hover{background:#fafaf8}
.lasso-toggle-btn{padding:6px 10px;background:none;border:1px solid transparent;border-radius:6px;cursor:pointer;color:#6e6e73;transition:all 0.15s;display:flex;align-items:center}
.lasso-toggle-btn:hover{background:rgba(0,0,0,0.04);color:#1d1d1f}
.lasso-toggle-btn.lasso-active{background:rgba(232,122,30,0.1);border-color:rgba(232,122,30,0.3);color:#E87A1E}

/* ============================================================
   COLOUR PRESET — TRIGGER CARDS (collapsed view)
   ============================================================ */

.preset-trigger-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  font: inherit;
  color: inherit;
}

.preset-trigger-card:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 6px rgba(20,184,166,0.12);
}

.preset-trigger-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.preset-trigger-text {
  flex: 1;
  min-width: 0;
}

.preset-trigger-title {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--text);
  line-height: 1.2;
}

.preset-trigger-sub {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.preset-trigger-preview {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.preset-trigger-mini {
  display: flex;
  gap: 2px;
}

.ptm-swatch {
  width: 14px;
  height: 6px;
  border-radius: 2px;
  border: 1px solid rgba(0,0,0,0.08);
}

.preset-trigger-chevron {
  font-size: 1.4rem;
  color: var(--text-muted);
  line-height: 1;
  flex-shrink: 0;
}

/* ============================================================
   COLOUR PRESET — MODAL PICKER
   ============================================================ */

#presetModal .preset-modal-content {
  max-width: 760px;
  width: calc(100% - 24px);
}

#presetModal .preset-modal-body {
  max-height: 70vh;
  overflow-y: auto;
}

.preset-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

@media (min-width: 640px) {
  .preset-modal-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 900px) {
  .preset-modal-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* ============================================================
   COLOUR SCHEMES — PASS 1 UI
   ============================================================ */

/* Loading + error states inside the modal grid */
.preset-loading,
.preset-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.preset-retry {
  margin-left: 8px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg-card);
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
}
.preset-retry:hover { border-color: var(--accent); }

/* Scheme card hover: reveal edit pencil */
.preset-card { position: relative; }
.preset-card .preset-card-edit {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255,255,255,0.92);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
  color: var(--text);
}
.preset-card:hover .preset-card-edit,
.preset-card:focus-within .preset-card-edit {
  opacity: 1;
}
.preset-card .preset-card-edit:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.preset-card-body {
  cursor: pointer;
  outline: none;
}
.preset-card-body:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

/* + New scheme card */
.preset-card-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 92px;
  padding: 12px;
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  color: var(--text-muted);
  font: inherit;
  transition: all 0.15s;
}
.preset-card-add:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(20,184,166,0.04);
}
.preset-add-plus {
  font-size: 1.6rem;
  line-height: 1;
  font-weight: 300;
}
.preset-add-label {
  font-size: 0.75rem;
  font-weight: 600;
}

/* ============================================================
   EDIT SUB-VIEW
   ============================================================ */

.preset-edit-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.preset-edit-back {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  cursor: pointer;
  font: inherit;
  font-size: 0.8rem;
  color: var(--text);
}
.preset-edit-back:hover { border-color: var(--accent); }
.preset-edit-header h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

/* Live preview block at top of edit view */
.preset-edit-preview {
  display: flex;
  height: 72px;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
  border: 1px solid var(--border);
}
.scheme-preview-block {
  flex: 1;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 8px 10px;
  min-width: 0;
}
.scheme-preview-block.walls-preview { flex: 2; }
.scheme-preview-block + .scheme-preview-block {
  border-left: 2px solid white;
}
.sp-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 2px rgba(0,0,0,0.35);
  text-transform: uppercase;
}
.sp-label--dark {
  color: rgba(0,0,0,0.75);
  text-shadow: none;
}

/* Role selector rows */
.preset-edit-roles {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}
.scheme-role-row {
  display: grid;
  grid-template-columns: 18px 70px 1fr 14px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: all 0.12s;
}
.scheme-role-row:hover {
  border-color: var(--accent);
}
.scheme-role-row.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(20,184,166,0.12);
  background: rgba(20,184,166,0.03);
}
.role-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.role-name {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--text);
}
.role-value {
  font-size: 0.78rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role-hex {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-left: 4px;
}
.role-chev {
  text-align: right;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Palette picker (only for the active role) */
.preset-edit-palette {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-card);
  margin-bottom: 14px;
  max-height: 44vh;
  overflow-y: auto;
}
.palette-group {
  margin-bottom: 10px;
}
.palette-group:last-of-type {
  margin-bottom: 0;
}
.palette-group-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.palette-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.palette-swatch {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.1);
  cursor: pointer;
  padding: 0;
  background-clip: padding-box;
  transition: transform 0.1s, border-color 0.1s;
}
.palette-swatch:hover {
  transform: scale(1.15);
  border-color: var(--accent);
}
.palette-swatch.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px white, 0 0 0 4px var(--accent);
}

/* Custom hex input row */
.palette-custom {
  display: grid;
  grid-template-columns: auto 110px 1fr auto;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.palette-custom-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
}
.palette-custom-input,
.palette-custom-name {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.8rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.palette-custom-name {
  font-family: inherit;
}
.palette-custom-input.invalid {
  border-color: #dc2626;
  background: rgba(220,38,38,0.05);
}
.palette-custom-apply {
  padding: 5px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
}
.palette-custom-apply:hover { border-color: var(--accent); color: var(--accent); }

/* Name input */
.preset-edit-name-wrap {
  margin-bottom: 16px;
}
.preset-edit-name-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.preset-edit-name-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  font-size: 0.85rem;
}
.preset-edit-name-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(20,184,166,0.15);
}
.preset-edit-name-hint {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 4px;
  font-style: italic;
}

/* Edit actions */
.preset-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* Responsive tweaks */
@media (max-width: 640px) {
  .preset-edit-preview { height: 60px; }
  .scheme-role-row {
    grid-template-columns: 16px 60px 1fr 14px;
    gap: 8px;
    padding: 7px 8px;
  }
  .palette-custom {
    grid-template-columns: 1fr 1fr auto;
  }
  .palette-custom-label { grid-column: 1 / -1; }
}

/* ============================================================
   EDIT SUB-VIEW — STICKY BOTTOM LAYOUT (no-scroll fix)
   Make Save/Cancel buttons always visible at the bottom.
   Only the palette picker scrolls internally.
   ============================================================ */

/* Modal content becomes a flex column, body takes available height */
#presetModal .preset-modal-content {
  display: flex;
  flex-direction: column;
  max-height: 92vh;
}

#presetModal .modal-head { flex-shrink: 0; }
#presetModal .modal-foot { flex-shrink: 0; }

#presetModal .preset-modal-body {
  flex: 1 1 auto;
  min-height: 0;          /* allow flex children to shrink */
  display: flex;
  flex-direction: column;
  overflow: hidden;        /* children handle their own overflow */
  padding: 14px 20px;
}

/* Grid view keeps its existing scroll behaviour */
#presetModalGridView {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* EDIT VIEW — flex column with sticky Save at bottom */
#presetModalEditView {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Fixed-size top sections */
#presetModalEditView .preset-edit-header,
#presetModalEditView .preset-edit-preview,
#presetModalEditView .preset-edit-roles,
#presetModalEditView .preset-edit-name-wrap {
  flex-shrink: 0;
}

/* Palette is the flexible one — takes whatever space remains, scrolls if needed */
#presetModalEditView .preset-edit-palette {
  flex: 1 1 auto;
  min-height: 140px;       /* never so squished as to be unusable */
  max-height: none;        /* overrides earlier 44vh rule */
  overflow-y: auto;
  margin-bottom: 0;
}

/* Action bar stays glued to the bottom */
#presetModalEditView .preset-edit-actions {
  flex-shrink: 0;
  margin-top: auto;        /* pushes to bottom even if content is short */
  padding-top: 10px;
  background: var(--bg-card, #fff);
  position: sticky;
  bottom: 0;
}

/* Tight preview so more room for palette */
#presetModalEditView .preset-edit-preview {
  height: 56px;
  margin-bottom: 0;
}

/* Tighter roles */
#presetModalEditView .preset-edit-roles {
  gap: 3px;
  margin-bottom: 0;
}

/* Tighter name-wrap margin */
#presetModalEditView .preset-edit-name-wrap {
  margin-bottom: 0;
}

/* Hide the redundant modal-foot when edit view is open (Save is in edit-actions) */
#presetModal:has(#presetModalEditView:not([hidden])) .modal-foot {
  display: none;
}

/* ============================================================
   PASS 2a POLISH — PILL SWATCHES + ICONS + ARCHIVE TWEAK
   Appended after existing rules so it wins via source order.
   ============================================================ */

/* Swatch area gets a little vertical breathing room */
.preset-card .preset-swatches {
  display: flex;
  gap: 4px;
  height: 28px;
  padding: 4px 4px 0;
  /* kill the solid-white separator from old look */
}

/* Kill the old separator borders between swatches */
.preset-card .preset-swatches .walls-swatch,
.preset-card .preset-swatches .trim-swatch,
.preset-card .preset-swatches .features-swatch {
  border-left: none !important;
}

/* Individual pill swatches */
.preset-card .preset-swatches > div {
  border-radius: 999px;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.08),
    0 2px 6px rgba(0,0,0,0.06),
    inset 0 0 0 1px rgba(0,0,0,0.04);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  transition: transform 0.15s, box-shadow 0.15s;
}

/* Walls dominant */
.preset-card .preset-swatches .walls-swatch    { flex: 2; }
.preset-card .preset-swatches .trim-swatch     { flex: 1; }
.preset-card .preset-swatches .features-swatch { flex: 1; }

/* Subtle lift on card hover */
.preset-card:hover .preset-swatches > div {
  box-shadow:
    0 1px 2px rgba(0,0,0,0.1),
    0 3px 8px rgba(0,0,0,0.08),
    inset 0 0 0 1px rgba(0,0,0,0.05);
}

/* Hide the old text labels — we use SVG icons now */
.preset-card .preset-swatches .swatch-label {
  display: none;
}

/* SVG icon inside each pill */
.preset-card .preset-swatches .swatch-icon {
  width: 14px;
  height: 14px;
  color: rgba(255,255,255,0.9);
  filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25));
  flex-shrink: 0;
}
/* Dark icon variant — for pale pills where white would be invisible */
.preset-card .preset-swatches .swatch-icon--dark {
  color: rgba(0,0,0,0.65);
  filter: none;
}

/* Tighten pills on smaller card widths (tri schemes squeeze icons) */
.preset-card .preset-swatches--tri .swatch-icon {
  width: 12px;
  height: 12px;
}

/* ============================================================
   ARCHIVE BUTTON — match the edit pencil (teal hover, not orange)
   ============================================================ */
.preset-card-archive:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ============================================================
   PASS 2a — RESTORED MISSING STYLES
   These didn't make it into styles.css on the first append.
   ============================================================ */

/* Hover actions container */
.preset-card-actions {
  position: absolute;
  top: 4px;
  right: 4px;
  display: flex;
  gap: 3px;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
  pointer-events: none;
}
.preset-card:hover .preset-card-actions,
.preset-card:focus-within .preset-card-actions {
  opacity: 1;
  pointer-events: auto;
}

/* Individual action buttons (edit, archive) */
.preset-card-action {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(255,255,255,0.95);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.preset-card-action:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Archived link below grid */
.preset-archived-link-wrap {
  margin-top: 12px;
  text-align: center;
}
.preset-archived-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 6px;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.preset-archived-link:hover { color: var(--accent); }

/* Archived sub-view */
#presetModalArchivedView {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#presetModalArchivedView .preset-edit-header { flex-shrink: 0; }

.preset-archived-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 2px;
}
.preset-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.preset-archived-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.archived-swatches {
  display: flex;
  gap: 0;
  height: 32px;
  width: 72px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.06);
}
.archived-swatches > div { flex: 1; }
.archived-swatches .walls-swatch { flex: 2; }
.archived-swatches > div + div { border-left: 2px solid white; }

.archived-meta { min-width: 0; }
.archived-name {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.archived-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.archive-badge {
  font-size: 0.6rem;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.archive-badge--custom {
  background: rgba(20,184,166,0.12);
  color: #0d8a7d;
}
.archive-badge--default {
  background: rgba(100,100,120,0.12);
  color: #555;
}
.archived-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.archived-actions .btn-secondary,
.archived-actions .btn-destructive {
  padding: 5px 10px;
  font-size: 0.75rem;
}

/* Destructive button variant */
.btn-destructive {
  background: #dc2626;
  color: white;
  border: 1px solid #dc2626;
  border-radius: 6px;
  padding: 6px 14px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-destructive:hover { background: #b91c1c; border-color: #b91c1c; }
.btn-destructive:focus-visible { outline: 2px solid #dc2626; outline-offset: 2px; }

/* Toast */
.preset-toast {
  position: absolute;
  left: 50%;
  bottom: 72px;
  transform: translate(-50%, 16px);
  display: flex;
  align-items: center;
  gap: 16px;
  background: #1f2937;
  color: white;
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  box-shadow: 0 6px 20px rgba(0,0,0,0.25);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 5;
  max-width: 92%;
  white-space: nowrap;
}
.preset-toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}
.preset-toast-msg { overflow: hidden; text-overflow: ellipsis; }
.preset-toast-action {
  background: transparent;
  border: none;
  color: #5eead4;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0 4px;
}
.preset-toast-action:hover { color: #2dd4bf; }

/* Confirm dialog */
#presetConfirmModal { z-index: 1000; }
.preset-confirm-content {
  max-width: 400px;
  width: calc(100% - 24px);
}
.preset-confirm-message {
  margin: 0;
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.45;
}

/* ============================================================
   FURTHER POLISH — shrink icons a touch, tighten cards
   ============================================================ */

/* Icons a bit smaller & softer */
.preset-card .preset-swatches .swatch-icon {
  width: 11px;
  height: 11px;
}
.preset-card .preset-swatches--tri .swatch-icon {
  width: 10px;
  height: 10px;
}

/* Tighter height now that there's no subtitle */
.preset-card .preset-swatches {
  height: 24px;
  padding: 4px 4px 0;
}

/* Hide the colors-label subtitle (now redundant with scheme name) */
.preset-card .preset-colors-label {
  display: none;
}

/* Name takes the breathing room */
.preset-card .preset-name {
  padding: 6px 8px 8px;
}

@media (max-width: 640px) {
  .preset-archived-row {
    grid-template-columns: auto 1fr;
    grid-template-areas:
      "sw meta"
      "actions actions";
    gap: 8px;
  }
  .archived-swatches { grid-area: sw; }
  .archived-meta { grid-area: meta; }
  .archived-actions {
    grid-area: actions;
    justify-content: flex-end;
    padding-top: 4px;
  }
  .preset-toast { font-size: 0.78rem; padding: 8px 12px; bottom: 60px; }
}

/* ============================================================
   SWATCH REDESIGN — one connected strip, rounded outside,
   custom hover tooltip (Walls / Trim / Features)
   ============================================================ */

/* The strip itself — soft shadow, rounded, overflow hidden so
   the child sections flush up against each other visually. */
.preset-card .preset-swatches {
  display: flex;
  gap: 0;
  height: 28px;
  padding: 0;
  margin: 8px 8px 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.08),
    0 2px 6px rgba(0,0,0,0.06),
    inset 0 0 0 1px rgba(0,0,0,0.04);
}

/* Kill ALL per-section styling from earlier polish passes */
.preset-card .preset-swatches > div {
  border-radius: 0 !important;
  box-shadow: none !important;
  border-left: none !important;
}

/* Sections touch directly — no gap, no separator */
.preset-card .preset-swatches .walls-swatch    { flex: 2; position: relative; }
.preset-card .preset-swatches .trim-swatch     { flex: 1; position: relative; }
.preset-card .preset-swatches .features-swatch { flex: 1; position: relative; }

/* Icons are gone — tooltip replaces them */
.preset-card .preset-swatches .swatch-icon {
  display: none;
}

/* Subtle lift on card hover for the whole strip */
.preset-card:hover .preset-swatches {
  box-shadow:
    0 1px 2px rgba(0,0,0,0.1),
    0 3px 8px rgba(0,0,0,0.08),
    inset 0 0 0 1px rgba(0,0,0,0.05);
}

/* Hover cursor on each section so it's obviously interactive-ish */
.preset-card .preset-swatches > div { cursor: inherit; }

/* ---- Tooltip ---- */
/* Each section gets ::after as a tooltip bubble */
.preset-card .preset-swatches > div::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: #1f2937;
  color: #fff;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 8px;
  border-radius: 5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
/* Little arrow below the tooltip bubble */
.preset-card .preset-swatches > div::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  border: 4px solid transparent;
  border-top-color: #1f2937;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s;
  z-index: 10;
}
/* Reveal on hover of each section */
.preset-card .preset-swatches > div:hover::after,
.preset-card .preset-swatches > div:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   FIXES — unclip tooltips + split edit/archive to opposite sides
   ============================================================ */

/* 1. Stop clipping tooltips — use per-child rounding instead */
.preset-card .preset-swatches {
  overflow: visible !important;
}
.preset-card .preset-swatches .walls-swatch {
  border-top-left-radius: 8px;
  border-bottom-left-radius: 8px;
}
/* Last child gets right corners rounded (works whether dual or tri) */
.preset-card .preset-swatches > div:last-child {
  border-top-right-radius: 8px;
  border-bottom-right-radius: 8px;
}

/* Tooltip needs to sit above the strip cleanly */
.preset-card .preset-swatches > div::after,
.preset-card .preset-swatches > div::before {
  z-index: 20;
}

/* 2. Put edit on the LEFT, archive on the RIGHT */
.preset-card-actions {
  display: contents;  /* drop the flex wrapper so we can position children independently */
}
.preset-card-edit {
  position: absolute;
  top: 4px;
  left: 4px;
  right: auto;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 3;
}
.preset-card-archive {
  position: absolute;
  top: 4px;
  right: 4px;
  left: auto;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 3;
}
.preset-card:hover .preset-card-edit,
.preset-card:hover .preset-card-archive,
.preset-card:focus-within .preset-card-edit,
.preset-card:focus-within .preset-card-archive {
  opacity: 1;
}

/* ============================================================
   FIX ROUND 2 — swap edit/archive sides + in-swatch label
   ============================================================ */

/* 1. Swap: edit on RIGHT, archive on LEFT */
.preset-card-edit {
  left: auto !important;
  right: 4px !important;
}
.preset-card-archive {
  right: auto !important;
  left: 4px !important;
}

/* 2. Kill the dark tooltip bubble entirely */
.preset-card .preset-swatches > div::after,
.preset-card .preset-swatches > div::before {
  display: none !important;
}

/* 3. In-swatch label — visible only on hover, centered, auto-contrasting */
.preset-card .preset-swatches > div {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Re-show the old swatch-label spans (we hid them earlier) */
.preset-card .preset-swatches .swatch-label {
  display: flex !important;
  align-items: center;
  justify-content: center;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.95);
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  user-select: none;
}

/* Dark text variant for light-coloured swatches */
.preset-card .preset-swatches .swatch-label--dark {
  color: rgba(0,0,0,0.72);
  text-shadow: none;
}

/* Reveal on hover of that specific swatch section */
.preset-card .preset-swatches > div:hover .swatch-label {
  opacity: 1;
}

/* ============================================================
   STEP A — Icon+label overlap fix, header instruction
   ============================================================ */

/* Hide ✎/⇣ when hovering a swatch section
   (user is reading the role name, not about to click icons) */
.preset-card .preset-swatches:hover ~ .preset-card-actions .preset-card-action,
.preset-card .preset-swatches:hover + * .preset-card-action {
  opacity: 0 !important;
  pointer-events: none !important;
}
/* Simpler, more reliable: dim both icons when any swatch inside is hovered */
.preset-card:has(.preset-swatches > div:hover) .preset-card-edit,
.preset-card:has(.preset-swatches > div:hover) .preset-card-archive {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Modal header — instruction line under the title */
.preset-modal-instruction {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.4;
  font-weight: 400;
}
#presetModal .modal-head {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding-bottom: 10px;
}
#presetModal .modal-head h3 { width: 100%; display: flex; justify-content: space-between; }
#presetModal .modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
}

/* ============================================================
   STEP B — Restore buttons footer layout
   ============================================================ */

#presetModal .modal-foot {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}
#presetModal #presetModalCancel { margin-left: auto; }

.btn-restore {
  padding: 6px 12px;
  font-size: 0.78rem;
}
.btn-restore:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn-restore:not(:disabled):hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 640px) {
  #presetModal .modal-foot { flex-wrap: wrap; }
  .btn-restore { font-size: 0.72rem; padding: 5px 10px; }
}
