/**
 * style.css — BrandStacker  |  Author: SkdSam
 * Companion site to ColorStacker — intentionally shares the same
 * design tokens so both sites feel like one cohesive product.
 */

/* ── GOOGLE FONTS ──────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ── RESET ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── DESIGN TOKENS (mirrors ColorStacker exactly) ──── */
:root {
  /* Surfaces — light */
  --bg:          #f0f2f8;
  --bg-card:     #ffffff;
  --bg-sidebar:  #ffffff;
  --bg-topbar:   #ffffff;
  --bg-input:    #f4f5fb;

  /* Text */
  --text-primary:#1a1d2e;
  --text-muted:  #8b90a8;
  --text-light:  #b5b9cc;

  /* Accent — same violet as ColorStacker */
  --accent:      #7c6ef7;
  --accent-soft: #ede9fe;

  /* Border */
  --border:      #e8eaf2;

  /* Shadows */
  --shadow-sm:   0 1px 3px rgba(0,0,0,.06);
  --shadow-md:   0 4px 20px rgba(0,0,0,.10);
  --shadow-lg:   0 12px 48px rgba(0,0,0,.18);

  /* Radii */
  --radius-card: 16px;
  --radius-sm:   8px;

  /* Layout */
  --topbar-h:    60px;
  --panel-w:     268px;
  --thumb-h:     88px;

  /* Transitions */
  --transition:  .18s cubic-bezier(.4,0,.2,1);
}

/* ── DARK MODE (mirrors ColorStacker .theme-dark) ──── */
:root.theme-dark {
  color-scheme: dark;
  --bg:          #11131a;
  --bg-card:     #1a1d27;
  --bg-sidebar:  #171a23;
  --bg-topbar:   rgba(24,27,36,.92);
  --bg-input:    #1e2130;

  --text-primary:#f4f6fb;
  --text-muted:  #a9afc1;
  --text-light:  #737b90;

  --accent:      #a79cff;
  --accent-soft: rgba(124,110,247,.18);

  --border:      #2b3040;

  --shadow-sm:   0 1px 3px rgba(0,0,0,.28);
  --shadow-md:   0 6px 24px rgba(0,0,0,.34);
  --shadow-lg:   0 18px 54px rgba(0,0,0,.45);
}

/* ── BASE ──────────────────────────────────────────── */
html {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg);
  scroll-behavior: smooth;
}
body { min-height: 100vh; overflow: hidden; }
img, svg { display: block; }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }
input, textarea, select { font: inherit; color: var(--text-primary); }
a { color: inherit; text-decoration: none; }

/* ── SCROLLBAR (same style as ColorStacker) ─────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--text-light);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: padding-box;
  min-height: 80px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--accent); border: 2px solid transparent; }

/* ── TOPBAR ─────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--bg-topbar);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
  padding: 0 20px;
  z-index: 200;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.topbar-logo {
  display: flex; align-items: center; gap: 12px;
  cursor: pointer; user-select: none; -webkit-user-select: none; flex-shrink: 0;
  overflow: visible; /* allow SVG animations to breathe outside bounds */
}

/* ── LOGO SVG ANIMATIONS ──────────────────────────── */

/* Base: spring hover on the whole icon */
.logo-svg-animated {
  overflow: visible;
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.logo-svg-animated:hover {
  transform: scale(1.20) rotate(9deg);
}
.topbar-logo:hover .logo-svg-animated {
  transform: scale(1.20) rotate(9deg);
}

/* Palette body: slow breathe/wobble */
@keyframes logo-palette-breathe {
  0%,100% { transform: rotate(-1.5deg) scale(1);    }
  50%     { transform: rotate(1.8deg)  scale(1.025); }
}
.logo-palette-group {
  transform-box: fill-box;
  transform-origin: center;
  animation: logo-palette-breathe 5.5s ease-in-out infinite;
}

/* Float keyframes — 4 independent paths */
@keyframes logo-float-1 {
  0%,100% { transform: translate(0px,   0px);   }
  25%     { transform: translate(0.7px,-1.3px);  }
  50%     { transform: translate(-0.5px, 0.7px); }
  75%     { transform: translate(0.9px, -0.5px); }
}
@keyframes logo-float-2 {
  0%,100% { transform: translate(0px,   0px);   }
  30%     { transform: translate(-1.1px, 0.6px); }
  60%     { transform: translate(0.7px,  1.2px); }
  80%     { transform: translate(-0.5px,-0.7px); }
}
@keyframes logo-float-3 {
  0%,100% { transform: translate(0px,   0px);   }
  20%     { transform: translate(0.9px,  0.6px); }
  55%     { transform: translate(-0.7px,-1.3px); }
  75%     { transform: translate(0.3px,  0.8px); }
}
@keyframes logo-float-4 {
  0%,100% { transform: translate(0px,   0px);   }
  35%     { transform: translate(-0.8px, 1.1px); }
  65%     { transform: translate(1.1px, -0.7px); }
  90%     { transform: translate(0.4px,  0.5px); }
}

/* Shared pulse keyframe — delays differentiate each dot */
@keyframes logo-dot-pulse {
  0%,100% { transform: scale(1);    }
  50%     { transform: scale(1.28); }
}

/* Shimmer flash */
@keyframes logo-shim-pulse {
  0%,55%,100% { opacity: 0;   }
  28%         { opacity: 0.8; }
}

/* Apply float (outer <g>) — transform-box keeps origin on the element */
.logo-float   { transform-box: fill-box; transform-origin: center; }
.logo-float-1 { animation: logo-float-1 4.1s ease-in-out infinite; }
.logo-float-2 { animation: logo-float-2 5.2s ease-in-out infinite 0.9s; }
.logo-float-3 { animation: logo-float-3 3.8s ease-in-out infinite 1.6s; }
.logo-float-4 { animation: logo-float-4 4.7s ease-in-out infinite 2.3s; }

/* Apply pulse (inner <g>) — composes cleanly with float above it */
.logo-pulse   { transform-box: fill-box; transform-origin: center; }
.logo-pulse-1 { animation: logo-dot-pulse 3.5s ease-in-out infinite 0.3s; }
.logo-pulse-2 { animation: logo-dot-pulse 4.8s ease-in-out infinite 1.4s; }
.logo-pulse-3 { animation: logo-dot-pulse 5.3s ease-in-out infinite 0.7s; }
.logo-pulse-4 { animation: logo-dot-pulse 4.1s ease-in-out infinite 2.1s; }

/* Shimmer overlay */
.logo-shim {
  animation: logo-shim-pulse 11s ease-in-out infinite 5s;
  pointer-events: none;
}

/* On hover: speed all dot animations up ~4× */
.topbar-logo:hover .logo-float-1 { animation-duration: 1.0s; }
.topbar-logo:hover .logo-float-2 { animation-duration: 1.3s; }
.topbar-logo:hover .logo-float-3 { animation-duration: 0.9s; }
.topbar-logo:hover .logo-float-4 { animation-duration: 1.2s; }
.topbar-logo:hover .logo-pulse-1 { animation-duration: 0.7s; }
.topbar-logo:hover .logo-pulse-2 { animation-duration: 0.9s; }
.topbar-logo:hover .logo-pulse-3 { animation-duration: 0.8s; }
.topbar-logo:hover .logo-pulse-4 { animation-duration: 0.75s; }

.loading-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  z-index: 99999;
  background: linear-gradient(90deg, #FF6B6B, #7C6EF7, #4ECDC4, #FFE66D, #FF6B6B);
  background-size: 200% 100%;
  animation: loadingGlow 1.2s linear infinite;
  transition: opacity 0.4s ease, transform 0.4s ease;
  transform-origin: left;
}
.loading-bar.hidden {
  opacity: 0;
  transform: scaleX(0);
  pointer-events: none;
}
@keyframes loadingGlow {
  0% { background-position: 0% 50%; }
  100% { background-position: 200% 50%; }
}

.logo-text {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.5px;
  background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.topbar-sep {
  width: 1px; height: 22px;
  background: var(--border);
  flex-shrink: 0;
}

/* Back-link to ColorStacker */
.btn-back-link {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px;
  padding: 0 13px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
  text-decoration: none;
}
.btn-back-link:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn-back-link svg { width: 14px; height: 14px; }

/* Palette preview strip (now lives in canvas toolbar) */
.topbar-palette-strip {
  display: flex; align-items: center; gap: 3px;
  flex-shrink: 0;
}

.topbar-swatch {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition);
  flex-shrink: 0;
}
.topbar-swatch:hover { transform: scale(1.3); }

.topbar-spacer {
  flex: 1;
}

.topbar-actions {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}

/* ── SHARED BUTTON STYLES ───────────────────────────── */
.btn-accent {
  background: var(--accent); color: #fff;
  border: none; border-radius: 99px;
  padding: 8px 18px; font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  white-space: nowrap;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn-accent:hover { opacity: .88; transform: translateY(-1px); }
.btn-accent:active { transform: translateY(0); }
.btn-accent svg { width: 15px; height: 15px; }

.btn-outline {
  height: 34px;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 0 13px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px; font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform var(--transition), border-color var(--transition), color var(--transition);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn-outline svg { width: 15px; height: 15px; }

.btn-icon-circle {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), color var(--transition);
}
.btn-icon-circle:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.btn-icon-circle svg { width: 16px; height: 16px; }

/* Random / Surprise btn — fun hover */
.btn-random {
  height: 34px;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 14px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-random:hover {
  background: linear-gradient(135deg, var(--accent), #4ecdc4);
  border-color: transparent;
  color: #fff;
  transform: rotate(-4deg) scale(1.04);
  box-shadow: 0 4px 18px rgba(124,110,247,.35);
}
.btn-random svg { width: 14px; height: 14px; }

/* ── APP LAYOUT ─────────────────────────────────────── */
.app-layout {
  display: flex;
  height: 100vh;
  padding-top: calc(var(--topbar-h) + 90px);
}

/* ── LEFT PANEL ─────────────────────────────────────── */
.brand-creator-showcase {
  position: fixed;
  top: calc(var(--topbar-h) + 10px);
  left: 18px;
  right: 18px;
  z-index: 20;
  height: 70px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.brand-creator-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 10px 16px;
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(42,35,88,.16);
  overflow: hidden;
  transition: transform var(--transition), box-shadow var(--transition);
}
.brand-creator-card:hover {
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 11px 25px rgba(42,35,88,.23);
}
.brand-creator-card-skdsam { background: linear-gradient(135deg, #6658e8, #8f6df4); }
.brand-creator-card-mrsteve { background: linear-gradient(135deg, #176b87, #22a699); }
.brand-creator-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.22);
  font-size: 14px;
  font-weight: 900;
}
.brand-creator-copy { display: flex; flex-direction: column; min-width: 0; }
.brand-creator-copy small {
  color: rgba(255,255,255,.72);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
}
.brand-creator-copy strong { font-size: 15px; line-height: 1.3; }
.brand-creator-cta {
  color: rgba(255,255,255,.9);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .brand-creator-cta { display: none; }
}
@media (max-width: 480px) {
  .brand-creator-showcase { left: 10px; right: 10px; gap: 8px; }
  .brand-creator-card { gap: 8px; padding: 9px 10px; }
  .brand-creator-mark { width: 34px; height: 34px; border-radius: 10px; }
  .brand-creator-copy small { display: none; }
  .brand-creator-copy strong { font-size: 12px; }
}
.left-panel {
  width: var(--panel-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  z-index: 10;
}

.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.panel-tab {
  flex: 1;
  padding: 11px 4px;
  font-size: 11.5px;
  font-weight: 700;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
  cursor: pointer;
}
.panel-tab:hover { color: var(--text-primary); }
.panel-tab.active { color: var(--accent); border-bottom-color: var(--accent); }

.panel-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px 14px 24px;
}

/* Panel sections toggled by JS */
.panel-section { display: none; flex-direction: column; gap: 18px; }
.panel-section.active { display: flex; animation: fadeIn .2s ease; }

@keyframes fadeIn { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:translateY(0); } }

/* Section label inside panel */
.section-heading {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-light);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ── PALETTE PANEL ─────────────────────────────────── */
.swatch-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.swatch-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  cursor: pointer;
  transition: transform .15s cubic-bezier(.34,1.56,.64,1);
  border: 1.5px solid var(--border);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
  min-height: 48px;
}
.swatch-item:hover { transform: scale(1.1); }
.swatch-item.active {
  border-color: var(--bg-card);
  box-shadow:
    inset 0 0 0 1px rgba(0,0,0,.08),
    0 0 0 2px var(--accent);
}

.swatch-remove {
  position: absolute; top: -5px; right: -5px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #1a1d2e; color: #fff;
  font-size: 9px;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
  box-shadow: 0 1px 4px rgba(0,0,0,.5);
}
.swatch-item:hover .swatch-remove { opacity: 1; pointer-events: all; }

.swatch-add {
  aspect-ratio: 1;
  border-radius: 9px;
  border: 2px dashed var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light);
  font-size: 20px; font-weight: 300;
  transition: all var(--transition);
  cursor: pointer;
}
.swatch-add:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.hex-tags {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 2px;
}

.hex-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px;
  border-radius: 99px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-size: 11.5px;
  font-family: 'Courier New', monospace;
  font-weight: 700;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}
.hex-tag:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: 0 4px 12px rgba(124,110,247,.18); }

.hex-tag-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,.1);
  flex-shrink: 0;
}

/* Paste zone */
.paste-zone {
  width: 100%;
  padding: 10px 12px;
  border-radius: 9px;
  border: 1.5px dashed var(--border);
  background: var(--bg-input);
  font-size: 12px;
  color: var(--text-muted);
  resize: none;
  min-height: 54px;
  line-height: 1.6;
  transition: border-color var(--transition);
}
.paste-zone::placeholder { color: var(--text-light); }
.paste-zone:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.btn-row { display: flex; gap: 6px; }

.btn-sm {
  flex: 1;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px; font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }
.btn-sm.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-sm.primary:hover { opacity: .88; }

/* Colour role assignments */
.role-list { display: flex; flex-direction: column; gap: 5px; }

.role-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  cursor: pointer;
  transition: border-color var(--transition), box-shadow var(--transition);
  min-height: 48px;
}
.role-row:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(124,110,247,.12); }

.role-swatch { width: 28px; height: 28px; border-radius: 7px; border: 1.5px solid rgba(0,0,0,.1); flex-shrink: 0; }
.role-select {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  color: var(--text-primary);
  background:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%) right 10px center / 4.5px 4.5px no-repeat,
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%) right 6.5px center / 4.5px 4.5px no-repeat,
    transparent;
  border: 1.5px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
  padding: 4px 22px 4px 8px;
  appearance: none;
  -webkit-appearance: none;
  transition: all var(--transition);
}
.role-select:hover {
  background:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%) right 10px center / 4.5px 4.5px no-repeat,
    linear-gradient(135deg, var(--accent) 50%, transparent 50%) right 6.5px center / 4.5px 4.5px no-repeat,
    var(--accent-soft);
  color: var(--accent);
}
.role-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}
.role-hex { font-size: 11px; font-family: monospace; color: var(--text-light); font-weight: 600; }

/* ── BRAND PANEL ─────────────────────────────────────── */
.field-group { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }

.field-input {
  width: 100%;
  padding: 9px 12px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  font-size: 13px; font-weight: 500;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-input::placeholder { color: var(--text-light); }

/* Logo upload — no storage, text fallback only */
.logo-zone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 22px 16px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  position: relative;
}
.logo-zone:hover { border-color: var(--accent); background: var(--accent-soft); }
.logo-zone.drag-over { border-color: var(--accent); background: var(--accent-soft); }
.logo-zone input[type=file] { display: none; }

.logo-zone-icon { color: var(--text-light); }
.logo-zone-icon svg { width: 30px; height: 30px; }
.logo-zone-text { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.logo-zone-sub { font-size: 11px; color: var(--text-light); line-height: 1.4; }
.logo-zone-note {
  font-size: 10.5px;
  color: var(--text-light);
  padding: 6px 10px;
  background: var(--bg-input);
  border-radius: 6px;
  border: 1px solid var(--border);
  width: 100%;
  text-align: center;
}

.logo-preview-wrap {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: var(--bg-input);
  border-radius: 10px;
  border: 1.5px solid var(--border);
}
.logo-preview-img { max-width: 140px; max-height: 60px; object-fit: contain; }
.logo-clear-btn {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: rgba(26,29,46,.6);
  color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
  transition: background var(--transition);
}
.logo-clear-btn:hover { background: rgba(185,28,28,.8); }

/* No-storage note chip */
.no-storage-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 9px;
  border-radius: 99px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px; font-weight: 600;
  border: 1px solid rgba(124,110,247,.2);
}
.no-storage-chip svg { width: 12px; height: 12px; }

/* ── FONTS PANEL ─────────────────────────────────────── */
.font-search-wrap { position: relative; }
.font-search-input {
  width: 100%;
  padding: 8px 12px 8px 32px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  font-size: 12.5px;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.font-search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.font-search-icon { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--text-light); pointer-events: none; }
.font-search-icon svg { width: 14px; height: 14px; }

.device-font-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
}
.device-font-help {
  color: var(--text-muted);
  font-size: 11px;
  line-height: 1.45;
}
.device-font-status {
  min-height: 16px;
  color: var(--text-light);
  font-size: 10.5px;
  line-height: 1.4;
}
.device-font-status.is-error { color: #dc3545; }
.manual-font-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}
.manual-font-row .field-input { min-width: 0; }

.font-cats { display: flex; flex-wrap: wrap; gap: 5px; }
.font-cat-btn {
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  transition: all var(--transition);
  cursor: pointer;
}
.font-cat-btn:hover { border-color: var(--accent); color: var(--accent); }
.font-cat-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.font-list {
  display: flex; flex-direction: column; gap: 1px;
  max-height: 210px;
  overflow-y: auto;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.font-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 11px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.font-item:last-child { border-bottom: none; }
.font-item:hover { background: var(--bg-input); }
.font-item.selected { background: var(--accent-soft); }
.font-item-name { font-size: 12.5px; font-weight: 600; }
.font-item-meta { font-size: 11px; color: var(--text-light); }

.zone-assigns { display: flex; flex-direction: column; gap: 7px; }
.zone-assignment-help { margin: 7px 0 0; color: var(--text-light); font-size: 11px; line-height: 1.45; }
.zone-target-btn {
  width: 100%; min-width: 0; border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-input); color: var(--text-primary); padding: 8px 10px;
  display: grid; grid-template-columns: 58px minmax(0,1fr); align-items: center; gap: 8px;
  text-align: left; cursor: pointer; transition: border-color .16s, background .16s, box-shadow .16s;
}
.zone-target-btn span { color: var(--text-muted); font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; }
.zone-target-btn strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.zone-target-btn:hover { border-color: var(--accent); }
.zone-target-btn.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.zone-target-btn.active span { color: var(--accent); }
.zone-row { display: flex; align-items: center; gap: 8px; }
.zone-label { font-size: 11px; font-weight: 700; color: var(--text-muted); width: 66px; flex-shrink: 0; text-transform: uppercase; letter-spacing: .04em; }
.zone-select {
  flex: 1;
  padding: 6px 24px 6px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%) right 12px center / 5px 5px no-repeat,
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%) right 8px center / 5px 5px no-repeat,
    var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}
.zone-select:hover {
  border-color: var(--accent);
  background:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%) right 12px center / 5px 5px no-repeat,
    linear-gradient(135deg, var(--accent) 50%, transparent 50%) right 8px center / 5px 5px no-repeat,
    var(--bg-input);
}
.zone-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2.5px var(--accent-soft);
}
.zone-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

/* ── TYPOGRAPHY SETTINGS PANEL ───────────────────────── */
.typo-zone-block {
  padding: 16px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: var(--shadow-sm);
}
.typo-zone-name {
  font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .09em;
  color: var(--accent);
  padding-bottom: 10px;
  border-bottom: 2px solid var(--accent-soft);
  margin-bottom: 2px;
}

.ctrl-row { display: flex; flex-direction: column; gap: 6px; }
.ctrl-label {
  display: flex; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
}
.ctrl-label strong { font-weight: 800; color: var(--text-primary); font-size: 12px; }

.range-input {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 4px;
  border-radius: 2px;
  background: var(--border);
  outline: none; cursor: pointer;
}
.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  cursor: pointer;
  transition: transform var(--transition);
}
.range-input::-webkit-slider-thumb:hover { transform: scale(1.3); }

.ctrl-select {
  width: 100%;
  padding: 8px 24px 8px 12px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%) right 12px center / 5px 5px no-repeat,
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%) right 8px center / 5px 5px no-repeat,
    var(--bg-input);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color var(--transition), background var(--transition), box-shadow var(--transition), color var(--transition);
}
.ctrl-select:hover {
  border-color: var(--accent);
  background:
    linear-gradient(45deg, transparent 50%, var(--accent) 50%) right 12px center / 5px 5px no-repeat,
    linear-gradient(135deg, var(--accent) 50%, transparent 50%) right 8px center / 5px 5px no-repeat,
    var(--bg-input);
}
.ctrl-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.ctrl-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.btn-group { display: flex; gap: 5px; }
.btn-group-item {
  flex: 1;
  padding: 8px 5px;
  border-radius: 7px;
  font-size: 12px; font-weight: 700;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  text-align: center;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-group-item.active { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(124,110,247,.3); }
.btn-group-item:hover:not(.active) { border-color: var(--accent); color: var(--accent); }

/* ── CANVAS AREA ─────────────────────────────────────── */
.canvas-area {
  flex: 1;
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
}

/* Canvas toolbar */
.canvas-toolbar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-card);
  flex-shrink: 0;
}

.view-toggle {
  display: flex; gap: 3px;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
}
.view-btn {
  padding: 5px 11px;
  border-radius: 6px;
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  transition: all var(--transition);
  display: flex; align-items: center; gap: 5px;
  cursor: pointer;
}
.view-btn.active { background: var(--bg-card); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.view-btn svg { width: 13px; height: 13px; }

.inspector-btn {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all var(--transition);
}
.inspector-btn:hover { border-color: var(--accent); color: var(--accent); }
.inspector-btn.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 8px rgba(124,110,247,.3);
}
.inspector-btn svg { width: 14px; height: 14px; }

.toolbar-sep { width: 1px; height: 20px; background: var(--border); }

.zoom-group { display: flex; align-items: center; gap: 5px; }
.zoom-btn {
  width: 26px; height: 26px;
  border-radius: 7px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  font-size: 14px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  cursor: pointer;
  color: var(--text-muted);
}
.zoom-btn:hover { border-color: var(--accent); color: var(--accent); }
.zoom-label { font-size: 11.5px; font-weight: 700; color: var(--text-muted); width: 38px; text-align: center; }

.template-count-label { font-size: 12px; color: var(--text-muted); margin-left: auto; }

/* Canvas scroll */
.canvas-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 30px 40px;
  display: flex; flex-direction: column;
  align-items: center; gap: 22px;
  scroll-behavior: smooth;
}

/* Single-card view */
.canvas-scroll.view-single .tpl-wrap { display: none; }
.canvas-scroll.view-single .tpl-wrap.current { display: block; }

/* ── TEMPLATE WRAPPER ───────────────────────────────── */
.tpl-wrap {
  width: 100%;
  max-width: 1080px;
  flex-shrink: 0;
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  transform-origin: top center;
  position: relative;
  animation: tplEnter .4s cubic-bezier(.34,1.56,.64,1);
}
.tpl-wrap.template-excluded .brand-template {
  opacity: .38;
  filter: grayscale(.25);
}
.template-include-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 12;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 99px;
  background: rgba(18,20,30,.72);
  color: #fff;
  padding: 5px 10px;
  font: 700 10px/1 Inter, sans-serif;
  cursor: pointer;
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity var(--transition), background var(--transition);
}
.tpl-wrap:hover .template-include-btn,
.tpl-wrap.template-excluded .template-include-btn { opacity: 1; }
.tpl-wrap.template-excluded .template-include-btn { background: var(--accent); }
.thumb-item.template-excluded { opacity: .4; filter: grayscale(.4); }
.tpl-wrap:hover { box-shadow: 0 20px 60px rgba(0,0,0,.24); }

:root.theme-dark .tpl-wrap:hover { box-shadow: 0 20px 60px rgba(0,0,0,.55); }

@keyframes tplEnter { from { opacity:0; transform:scale(.97) translateY(10px); } to { opacity:1; transform:scale(1) translateY(0); } }

.tpl-badge {
  position: absolute; top: 12px; right: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  background: rgba(0,0,0,.3);
  backdrop-filter: blur(8px);
  color: rgba(255,255,255,.8);
  font-size: 10px; font-weight: 700;
  letter-spacing: .07em; text-transform: uppercase;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 10;
}
.tpl-wrap:hover .tpl-badge { opacity: 1; }

/* Inspector overlays are separate from template markup, so exports stay clean. */
.tpl-inspector-layer {
  position: absolute;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
}
.tpl-inspector-box {
  position: absolute;
  box-sizing: border-box;
  border: 1.5px solid #ff4d8d;
  background: rgba(255,77,141,.035);
}
.tpl-inspector-box::before {
  content: attr(data-tag);
  position: absolute;
  top: 0;
  left: 0;
  transform: translateY(-100%);
  padding: 2px 4px;
  border-radius: 3px 3px 0 0;
  background: #ff4d8d;
  color: #fff;
  font: 800 8px/1.25 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.tpl-inspector-box--h1,
.tpl-inspector-box--h2,
.tpl-inspector-box--h3,
.tpl-inspector-box--h4,
.tpl-inspector-box--h5,
.tpl-inspector-box--h6 { border-color: #7c6ef7; background: rgba(124,110,247,.045); }
.tpl-inspector-box--h1::before,
.tpl-inspector-box--h2::before,
.tpl-inspector-box--h3::before,
.tpl-inspector-box--h4::before,
.tpl-inspector-box--h5::before,
.tpl-inspector-box--h6::before { background: #7c6ef7; }
.tpl-inspector-box--section,
.tpl-inspector-box--article,
.tpl-inspector-box--header,
.tpl-inspector-box--nav,
.tpl-inspector-box--main,
.tpl-inspector-box--aside,
.tpl-inspector-box--footer { border-color: #18a999; background: rgba(24,169,153,.025); }
.tpl-inspector-box--section::before,
.tpl-inspector-box--article::before,
.tpl-inspector-box--header::before,
.tpl-inspector-box--nav::before,
.tpl-inspector-box--main::before,
.tpl-inspector-box--aside::before,
.tpl-inspector-box--footer::before { background: #18a999; }
.tpl-inspector-box[style*="top:0px"]::before { transform: none; border-radius: 0 0 3px 0; }
.inspector-active .template-include-btn,
.inspector-active .tpl-badge { opacity: 0 !important; }

/* ── BRAND TEMPLATES: base ──────────────────────────── */
.brand-template {
  width: 100%;
  aspect-ratio: 16/9;
  position: relative;
  overflow: hidden;
  font-family: var(--brand-font-heading, 'Inter', sans-serif);
  user-select: none;
}
.typo-level-picker { display:grid; grid-template-columns:repeat(3,1fr); gap:6px; margin-bottom:10px; }
.typo-level-btn { border:1px solid var(--border); background:var(--bg-input); color:var(--text-muted); border-radius:9px; padding:8px; font-size:11px; font-weight:800; cursor:pointer; }
.typo-level-btn:hover { border-color:var(--accent); }
.typo-level-btn.active { background:var(--accent); border-color:var(--accent); color:#fff; }

/* Semantic heading families are independently assignable in the Fonts panel. */
.brand-template h1 { font-family:var(--brand-font-h1,var(--brand-font-heading,'Inter')) !important; font-size:var(--typo-h1-size,64px) !important; font-weight:var(--typo-h1-weight,800) !important; line-height:var(--typo-h1-lh,1) !important; letter-spacing:var(--typo-h1-ls,-2px) !important; text-transform:var(--typo-h1-transform,none) !important; }
.brand-template h2 { font-family:var(--brand-font-h2,var(--brand-font-heading,'Inter')) !important; font-size:var(--typo-h2-size,40px) !important; font-weight:var(--typo-h2-weight,700) !important; line-height:var(--typo-h2-lh,1.1) !important; letter-spacing:var(--typo-h2-ls,-1px) !important; text-transform:var(--typo-h2-transform,none) !important; }
.brand-template h3 { font-family:var(--brand-font-h3,var(--brand-font-heading,'Inter')) !important; font-size:var(--typo-h3-size,26px) !important; font-weight:var(--typo-h3-weight,700) !important; line-height:var(--typo-h3-lh,1.2) !important; letter-spacing:var(--typo-h3-ls,0) !important; text-transform:var(--typo-h3-transform,none) !important; }
.brand-template .semantic-widget-heading { margin:0 !important; font-size:clamp(7px,calc(var(--typo-h2-size,40px) * .34),16px) !important; }
.brand-template h3.semantic-widget-heading { font-size:clamp(6px,calc(var(--typo-h3-size,26px) * .42),13px) !important; }
.brand-template h2.semantic-specimen-heading { font-size:clamp(15px,calc(var(--typo-h2-size,40px) * .8),42px) !important; }
.brand-template h3.semantic-specimen-heading { font-size:clamp(11px,calc(var(--typo-h3-size,26px) * .8),30px) !important; }
.brand-template h1.semantic-card-title { font-size:clamp(12px,calc(var(--typo-h1-size,64px) * .3),24px) !important; }

/* Semantic copy keeps every card connected to the Body and Caption controls. */
.brand-template .semantic-copy {
  font-family: var(--brand-font-body, 'Inter', sans-serif) !important;
  font-size: clamp(7px, calc(var(--typo-b-size,15px) * .8), var(--typo-b-size,15px)) !important;
  line-height: var(--typo-b-lh,1.7) !important;
  font-weight: var(--typo-b-weight,400) !important;
}
.brand-template .semantic-caption {
  font-family: var(--brand-font-caption, 'Inter', sans-serif) !important;
  font-size: clamp(5px, calc(var(--typo-c-size,11px) * .75), var(--typo-c-size,11px)) !important;
  line-height: 1.35 !important;
  letter-spacing: var(--typo-c-ls,.1em) !important;
}
.brand-template .semantic-display {
  font-family: var(--brand-font-display, 'Inter', sans-serif) !important;
  font-size: var(--typo-d-size,80px) !important;
  font-weight: var(--typo-d-weight,900) !important;
  letter-spacing: var(--typo-d-ls,-4px) !important;
}

/* ── TEMPLATE 01: COVER ─────────────────────────────── */
.tpl-cover {
  display: flex; align-items: flex-end;
  padding: 9% 8%;
}
.tpl-cover__bg { position: absolute; inset: 0; }
.tpl-cover__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(currentColor 1px, transparent 1px),
    linear-gradient(90deg, currentColor 1px, transparent 1px);
  background-size: 10% 10%;
  opacity: .07;
}
.tpl-cover__content { position: relative; z-index: 2; }
.tpl-cover__eyebrow {
  font-size: clamp(7px,1.1vw,13px); font-weight: 600;
  text-transform: uppercase; letter-spacing: .18em;
  opacity: .65; margin-bottom: .5em;
}
.tpl-cover__title {
  font-size: clamp(28px,6.5vw,88px); font-weight: 900;
  line-height: .95; letter-spacing: -.04em;
}
.tpl-cover__tagline {
  font-size: clamp(8px,1.1vw,14px); opacity: .6;
  margin-top: .7em;
}
.tpl-cover__corner {
  position: absolute; top: 8%; right: 8%;
  z-index: 2; text-align: right;
  font-size: clamp(6px,.9vw,11px); opacity: .5;
  line-height: 1.6;
}
.tpl-cover__arrow {
  position: absolute; bottom: 8%; right: 8%;
  z-index: 2; font-size: clamp(18px,3vw,40px);
  font-weight: 900; opacity: .3; letter-spacing: -.05em;
}

/* ── TEMPLATE 02: ABOUT ─────────────────────────────── */
.tpl-about {
  display: grid; grid-template-columns: 42% 58%;
}
.tpl-about__left {
  display: flex; flex-direction: column;
  padding: 8%; position: relative; overflow: hidden;
}
.tpl-about__right {
  padding: 8%;
  display: flex; flex-direction: column;
  justify-content: center; gap: 14px;
}
.tpl-about__num {
  position: absolute; bottom: 4%; left: 5%;
  font-size: clamp(50px,10vw,140px); font-weight: 900;
  line-height: 1; opacity: .12;
}
.tpl-about__section-num {
  font-size: clamp(22px,4.5vw,60px); font-weight: 900; line-height: 1; opacity: .15;
}
.tpl-about__eyebrow {
  font-size: clamp(6px,.85vw,11px); font-weight: 700;
  text-transform: uppercase; letter-spacing: .16em; opacity: .5;
}
.tpl-about__heading {
  font-size: clamp(14px,2.8vw,38px); font-weight: 800;
  line-height: 1.1; letter-spacing: -.02em;
}
.tpl-about__body {
  font-size: clamp(7px,.95vw,12px); line-height: 1.75; opacity: .65;
  font-family: var(--brand-font-body, 'Inter', sans-serif);
}
.tpl-about__logo-area {
  flex: 1; display: flex;
  align-items: center; justify-content: center;
}
.tpl-about__wordmark {
  font-size: clamp(14px,2.5vw,32px); font-weight: 800;
  letter-spacing: -.02em;
}
.tpl-about__divider {
  width: 40%; height: 2px; opacity: .25; border-radius: 2px;
}

/* ── TEMPLATE 03: LOGO GRID ─────────────────────────── */
.tpl-logo-grid {
  display: grid; grid-template-columns: 1fr 1fr;
}
.tpl-logo-grid__main {
  display: flex; align-items: center; justify-content: center;
  padding: 10%; position: relative;
}
.tpl-logo-grid__clearbox {
  width: 55%; height: 55%;
  border: 1px dashed currentColor;
  opacity: .3;
  display: flex; align-items: center; justify-content: center;
}
.tpl-logo-grid__inner {
  position: absolute; inset: 22%;
  display: flex; align-items: center; justify-content: center;
}
.tpl-logo-grid__wordmark { font-size: clamp(12px,2.5vw,32px); font-weight: 800; letter-spacing: -.02em; }
.tpl-logo-grid__info {
  padding: 8%; display: flex;
  flex-direction: column; justify-content: space-between;
}
.tpl-logo-grid__title { font-size: clamp(12px,2vw,26px); font-weight: 800; letter-spacing: -.02em; }
.tpl-logo-grid__rule {
  font-size: clamp(6px,.85vw,11px); opacity: .6;
  display: flex; align-items: flex-start; gap: 7px;
  padding: 7px 0;
  border-bottom: 1px solid currentColor;
  border-bottom-color: rgba(128,128,128,.18);
}
.tpl-logo-grid__dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }

/* ── TEMPLATE 04: LOGO SIGNATURES ───────────────────── */
.tpl-logos {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: 1fr 1fr;
}
.tpl-logo-cell {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 6%; position: relative; gap: 6px;
}
.tpl-logo-cell__label {
  position: absolute; bottom: 5%; left: 50%; transform: translateX(-50%);
  font-size: clamp(5px,.7vw,9px); font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; opacity: .35;
  white-space: nowrap;
}
.tpl-logo-cell__wordmark { font-weight: 800; letter-spacing: -.02em; font-size: clamp(10px,2vw,28px); }

/* ── TEMPLATE 05: COLOUR SYSTEM ─────────────────────── */
.tpl-colors {
  display: flex; flex-direction: column;
  padding: 7% 8%; gap: 5%;
}
.tpl-colors__header { display: flex; justify-content: space-between; align-items: flex-end; }
.tpl-colors__title { font-size: clamp(18px,3.5vw,48px); font-weight: 800; letter-spacing: -.02em; }
.tpl-colors__num { font-size: clamp(28px,5.5vw,76px); font-weight: 900; opacity: .1; line-height: 1; }
.tpl-colors__chips { display: flex; gap: 2%; flex: 1; align-items: stretch; min-height: 0; }

.color-chip {
  flex: 1;
  min-width: 0;
  border-radius: clamp(6px,.9vw,12px);
  display: flex; flex-direction: column;
  justify-content: flex-end; padding: clamp(8px, 1.2vw, 16px);
}
.color-chip__hex { font-size: clamp(6px,.85vw,11px); font-weight: 700; font-family: monospace; opacity: .8; }
.color-chip__name { font-size: clamp(7px,.95vw,12px); font-weight: 600; opacity: .55; margin-top: 2px; }
.color-chip__rgb { font-size: clamp(5px,.7vw,9px); font-family: monospace; opacity: .4; margin-top: 1px; }

/* ── TEMPLATE 06: TYPOGRAPHY ────────────────────────── */
.tpl-typography {
  display: grid; grid-template-columns: 1fr 1fr;
  padding: 8%; gap: 7%;
}
.tpl-typography__left { display: flex; flex-direction: column; gap: 14px; }
.tpl-typography__right { display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.typo-zone-label {
  font-size: clamp(6px,.8vw,10px); font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; opacity: .35; margin-bottom: 2px;
}
.typo-display { font-size: clamp(28px,5.5vw,72px); font-weight: 900; line-height: .9; letter-spacing: -.04em; font-family: var(--brand-font-heading,'Inter'); }
.typo-heading { font-size: clamp(14px,2.5vw,34px); font-weight: 700; font-family: var(--brand-font-heading,'Inter'); }
.typo-subhead { font-size: clamp(10px,1.5vw,20px); font-weight: 500; opacity: .65; font-family: var(--brand-font-body,'Inter'); }
.typo-body-sample { font-size: clamp(7px,1vw,13px); line-height: 1.8; opacity: .6; font-family: var(--brand-font-body,'Inter'); }
.typo-weights { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.typo-weight-item { font-size: clamp(8px,1.1vw,14px); opacity: .55; font-family: var(--brand-font-heading,'Inter'); }

/* ── TEMPLATE 07: PRINT MOCKUP ──────────────────────── */
.tpl-print {
  display: grid; grid-template-columns: 55% 45%;
  align-items: center; padding: 6%; gap: 5%;
}
.tpl-print__card {
  aspect-ratio: 1.75/1;
  border-radius: clamp(4px,.7vw,10px);
  padding: 7%;
  display: flex; flex-direction: column; justify-content: space-between;
  box-shadow: 0 8px 30px rgba(0,0,0,.22);
}
.tpl-print__card-name { font-size: clamp(10px,2vw,26px); font-weight: 800; letter-spacing: -.02em; }
.tpl-print__card-title { font-size: clamp(5px,.8vw,10px); text-transform: uppercase; letter-spacing: .12em; opacity: .5; }
.tpl-print__card-bottom { display: flex; justify-content: space-between; align-items: flex-end; }
.tpl-print__card-detail { font-size: clamp(5px,.7vw,9px); font-family: monospace; opacity: .5; }

.tpl-print__letter {
  border-radius: clamp(3px,.5vw,7px);
  padding: 6%; display: flex; flex-direction: column; gap: 6%;
  box-shadow: 0 4px 18px rgba(0,0,0,.12);
}
.tpl-print__letter-head { display: flex; justify-content: space-between; align-items: flex-start; padding-bottom: 5%; border-bottom: 2px solid currentColor; opacity: .6; }
.tpl-print__letter-name { font-size: clamp(9px,1.5vw,20px); font-weight: 800; letter-spacing: -.02em; }
.tpl-print__letter-line { height: clamp(3px,.45vw,6px); border-radius: 3px; opacity: .15; margin: 2px 0; }

/* ── TEMPLATE 08: DIGITAL MOCKUP ───────────────────── */
.tpl-digital { display: grid; grid-template-columns: 1fr .48fr; }
.tpl-digital__browser { display: flex; flex-direction: column; padding: 4%; }
.tpl-digital__bar {
  display: flex; align-items: center; gap: 4px;
  padding: 3% 5%;
  border-radius: clamp(4px,.6vw,8px) clamp(4px,.6vw,8px) 0 0;
}
.tpl-digital__dot { width: clamp(5px,.8vw,10px); height: clamp(5px,.8vw,10px); border-radius: 50%; opacity: .45; }
.tpl-digital__url { flex: 1; height: clamp(7px,1.1vw,14px); border-radius: 99px; opacity: .12; margin: 0 6%; }
.tpl-digital__body { flex: 1; border-radius: 0 0 clamp(4px,.6vw,8px) clamp(4px,.6vw,8px); padding: 5%; display: flex; flex-direction: column; gap: 4%; }
.tpl-digital__hero { border-radius: clamp(3px,.5vw,7px); height: 42%; display: flex; align-items: center; justify-content: center; padding: 5%; }
.tpl-digital__hero-text { font-size: clamp(8px,1.5vw,20px); font-weight: 800; letter-spacing: -.02em; }
.tpl-digital__cards { display: flex; gap: 4%; height: 28%; }
.tpl-digital__card-mini { flex: 1; border-radius: clamp(3px,.4vw,6px); opacity: .55; }

.tpl-digital__social { display: flex; flex-direction: column; justify-content: center; padding: 6%; gap: 6%; }
.tpl-digital__post { border-radius: clamp(4px,.6vw,8px); flex: 1; display: flex; align-items: flex-end; padding: 8%; }
.tpl-digital__post-text { font-size: clamp(7px,1vw,13px); font-weight: 700; line-height: 1.2; }

/* ── TEMPLATE 09: PATTERN ───────────────────────────── */
.tpl-pattern { position: relative; overflow: hidden; }
.tpl-pattern__canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.tpl-pattern__overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: flex-end; justify-content: flex-end;
  padding: 8%; gap: 4px;
}
.tpl-pattern__label { font-size: clamp(7px,1vw,12px); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; opacity: .6; }
.tpl-pattern__name { font-size: clamp(18px,3.5vw,48px); font-weight: 900; letter-spacing: -.02em; }

/* ── TEMPLATE 10: CONTACT ───────────────────────────── */
.tpl-contact { display: flex; flex-direction: column; overflow: hidden; }
.tpl-contact__body { flex: 1; display: flex; align-items: flex-start; justify-content: space-between; padding: 5% 8%; gap: 6%; min-height: 0; }
.tpl-contact__brand { font-size: clamp(24px,5vw,68px); font-weight: 900; letter-spacing: -.03em; line-height: .95; }
.tpl-contact__tagline { font-size: clamp(9px,1.2vw,16px); opacity: .5; max-width: 260px; line-height: 1.6; font-family: var(--brand-font-body,'Inter'); }
.tpl-contact__footer {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3% 8%;
  border-top: 1px solid rgba(255,255,255,.1);
  flex-shrink: 0;
}

/* ── THUMBNAIL STRIP ────────────────────────────────── */
.thumb-strip {
  height: var(--thumb-h);
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
  padding: 0 14px;
  overflow-x: auto; flex-shrink: 0;
  scrollbar-width: thin;
}

.thumb-item {
  flex-shrink: 0;
  width: calc((var(--thumb-h) - 22px) * 1.777);
  height: calc(var(--thumb-h) - 22px);
  border-radius: 7px;
  overflow: hidden; cursor: pointer;
  border: 2px solid transparent;
  transition: all var(--transition);
  position: relative;
}
.thumb-item:hover { border-color: var(--border); transform: translateY(-2px); }
.thumb-item.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.thumb-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(4px);
  font-size: 9px; font-weight: 700;
  text-align: center; padding: 3px;
  color: rgba(255,255,255,.8);
  opacity: 0; transition: opacity var(--transition);
}
.thumb-item:hover .thumb-label,
.thumb-item.active .thumb-label { opacity: 1; }

/* ── TOAST (same pattern as ColorStacker) ───────────── */
.toast {
  position: fixed; bottom: 22px; left: 50%;
  transform: translateX(-50%) translateY(70px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 99px;
  padding: 9px 20px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1);
  pointer-events: none;
  display: flex; align-items: center; gap: 8px;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── MODAL ──────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  z-index: 800;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  width: 90%; max-width: 460px;
  box-shadow: var(--shadow-lg);
  transform: translateY(16px) scale(.97);
  transition: transform .28s cubic-bezier(.34,1.56,.64,1);
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }

.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-title { font-size: 15px; font-weight: 800; }
.modal-close {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-input); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: var(--text-muted);
  transition: all var(--transition);
}
.modal-close:hover { background: var(--bg); color: var(--text-primary); }

/* Export grid */
.export-scope {
  margin-bottom: 14px;
  padding: 12px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: var(--bg-input);
}
.export-scope-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 9px;
}
.export-scope-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}
.export-scope-options label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.export-scope-options input { accent-color: var(--accent); }
.export-range-row {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.export-range-row.active { display: grid; }
.export-range-row label {
  display: grid;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}
.export-range-row input {
  width: 100%;
  padding: 8px 9px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  font-size: 12px;
}
.export-scope-hint {
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.35;
}
.export-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.export-card {
  padding: 14px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  cursor: pointer; text-align: center;
  transition: all var(--transition);
}
.export-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.export-card-icon { font-size: 24px; margin-bottom: 5px; }
.export-card-label { font-size: 12.5px; font-weight: 700; }
.export-card-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.export-pdf-options {
  display: none;
  margin-top: 10px;
  padding: 12px;
  border: 1.5px solid var(--accent);
  border-radius: 10px;
  background: var(--accent-soft);
}
.export-pdf-options.active { display: block; }
.export-pdf-options button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}
.export-pdf-options button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Link share input */
.share-input-wrap { position: relative; }
.share-input {
  width: 100%;
  padding: 9px 44px 9px 12px;
  border-radius: 9px;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  font-size: 11.5px; font-family: monospace;
  color: var(--text-muted);
}
.share-copy-btn {
  position: absolute; right: 6px; top: 50%;
  transform: translateY(-50%);
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700;
  transition: opacity var(--transition);
}
.share-copy-btn:hover { opacity: .85; }

/* ── UTILITY MENU POPOVER (exact ColorStacker) ──────── */
.utility-menu { position: relative; }

.utility-menu-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), color var(--transition);
}
.utility-menu-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}
.utility-menu-btn svg { width: 18px; height: 18px; }

.utility-menu-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 230px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-card);
  box-shadow: 0 14px 36px rgba(17,24,39,.12);
  z-index: 2000;
}
.utility-menu-popover.hidden { display: none; }

.utility-menu-popover button {
  width: 100%;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-primary);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  padding: 10px 11px;
  cursor: pointer;
}
.utility-menu-popover button:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

/* The pill toggle — identical to ColorStacker's dark-mode switch */
.utility-menu-popover button.utility-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.utility-menu-popover button.utility-menu-toggle::after {
  content: "";
  width: 34px;
  height: 18px;
  border-radius: 99px;
  background: #eef0f6;
  border: 1px solid #c9cfdd;
  box-shadow: inset -16px 0 0 1px #ffffff, 0 1px 2px rgba(26,29,46,.12);
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
  flex-shrink: 0;
}
.utility-menu-popover button.utility-menu-toggle[aria-pressed="true"]::after {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: inset 16px 0 0 2px var(--bg-card), inset 0 0 0 2px var(--accent);
}

/* ── UTILITY ────────────────────────────────────────── */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Loading spinner */
@keyframes spin { to { transform: rotate(360deg); } }
.spin { animation: spin .7s linear infinite; }

/* ── CUSTOM DROPDOWN SELECTS ────────────────────────── */
.custom-select {
  position: relative;
  display: inline-block;
  vertical-align: middle;
}
.custom-select.custom-select-replaced {
  width: 100%;
}
.custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 9px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  border: 1.5px solid var(--border);
  background: var(--bg-input);
  color: var(--text-primary);
  transition: border-color var(--transition), background-color var(--transition), box-shadow var(--transition);
}
.ctrl-select-replaced .custom-select-trigger {
  padding: 8px 12px;
  font-size: 12.5px;
}
.zone-select-replaced .custom-select-trigger {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}
.custom-select-trigger:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}
.custom-select.open .custom-select-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.custom-select-arrow-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color var(--transition);
}
.custom-select-trigger:hover .custom-select-arrow-wrap {
  color: var(--accent);
}
.custom-select-arrow {
  width: 11px;
  height: 11px;
  stroke-width: 2.5;
  transition: transform var(--transition);
}
.custom-select.open .custom-select-arrow {
  transform: rotate(180deg);
}

.custom-select-options {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 10px 25px rgba(26,29,46,.12);
  z-index: 1000;
  max-height: 220px;
  overflow-y: auto;
  padding: 5px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.custom-select.open-up .custom-select-options {
  top: auto;
  bottom: calc(100% + 4px);
  box-shadow: 0 -10px 25px rgba(26,29,46,.12);
}
.custom-select-options.hidden {
  display: none !important;
}

.custom-select-option {
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
}
.custom-select-option:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}
.custom-select-option.selected {
  background: var(--accent);
  color: #ffffff !important;
}

/* Overrides for swatch role rows */
.role-row .custom-select {
  flex: 1;
}
.role-row .custom-select-trigger {
  border: 1.5px solid transparent;
  background: transparent;
  padding: 6px 10px;
}
.role-row .custom-select-trigger:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.role-row .custom-select.open .custom-select-trigger {
  border-color: var(--accent-soft);
  box-shadow: none;
}

/* ── MOBILE ─────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --panel-w: 100%; --thumb-h: 72px; }
  .app-layout { flex-direction: column; }
  .left-panel { width: 100%; height: 42vh; border-right: none; border-bottom: 1px solid var(--border); }
  .canvas-scroll { padding: 16px; }

  /* Topbar — prevent button overlap on narrow screens */
  .topbar { gap: 6px; padding: 0 10px; max-width: 100vw; overflow: visible; }

  /* Hide text labels — keep icons only for action buttons */
  .btn-label { display: none; }

  /* Make icon-only buttons square and compact */
  .btn-random { width: 34px; min-width: 34px; padding: 0; justify-content: center; }
  .btn-outline { width: 34px; min-width: 34px; padding: 0; justify-content: center; }
  .btn-accent  { width: 34px; min-width: 34px; height: 34px; padding: 0; justify-content: center; }

  /* Tighten action button group */
  .topbar-spacer { min-width: 0; }
  .topbar-actions { gap: 5px; min-width: 0; }
  .utility-menu { flex-shrink: 0; }
  .utility-menu-btn { width: 34px; height: 34px; }
  .utility-menu-popover { right: 0; width: min(230px, calc(100vw - 20px)); }

  /* Hide separator between logo and back-link to save space */
  .topbar-sep:first-of-type { display: none; }

  /* Hide back-link text */
  .btn-back-link {
    width: 34px;
    min-width: 34px;
    padding: 0;
    justify-content: center;
  }
  .btn-back-link span { display: none; }
}

/* ── EXPORT LOADER OVERLAY ──────────────────────────── */
.export-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 19, 26, 0.85);
  backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.export-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.export-overlay-content {
  text-align: center;
  color: #ffffff;
  min-width: min(360px, calc(100vw - 48px));
}
.export-spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--brand-color-1, #7c6ef7);
  border-radius: 50%;
  margin: 0 auto 20px;
  animation: spin 1s linear infinite;
}
.export-overlay.progress-mode .export-spinner { display: none; }
@keyframes spin {
  to { transform: rotate(360deg); }
}
.export-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
  font-family: var(--brand-font-heading, 'Inter');
}
.export-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--brand-font-body, 'Inter');
}
.export-progress {
  display: none;
  width: 100%;
  height: 10px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}
.export-overlay.progress-mode .export-progress { display: block; }
.export-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--brand-color-1, #7c6ef7);
  transition: width 0.2s ease;
}

/* Clear LocalStorage danger option */
.utility-menu-warning {
  margin: 7px 8px 5px;
  color: #b91c1c;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.35;
}
.utility-menu-popover button.utility-menu-danger {
  color: #b91c1c;
  font-weight: 800;
}
.utility-menu-popover button.utility-menu-danger:hover {
  background: #fee2e2;
  color: #991b1b;
}
:root.theme-dark .utility-menu-warning,
:root.theme-dark .utility-menu-popover button.utility-menu-danger {
  color: #fca5a5;
}
:root.theme-dark .utility-menu-popover button.utility-menu-danger:hover {
  background: rgba(248, 113, 113, 0.14);
  color: #fecaca;
}

#clear-storage-confirm:hover {
  background: #bd2130 !important;
  border-color: #bd2130 !important;
}
