/* ============================================================
   BEAD STUDIO — Global Stylesheet
   ============================================================ */

/* ── CSS Variables ────────────────────────────────────────── */
:root {
  /* Ink scale */
  --c-ink:     #0f172a;  /* headings, active nav, hero CTA */
  --c-ink-2:   #1e293b;  /* body text, nav logo */
  --c-ink-3:   #334155;
  --c-ink-4:   #475569;  /* secondary text */
  --c-ink-5:   #64748b;  /* muted text */
  --c-ink-6:   #94a3b8;  /* placeholders, very muted */

  /* Surfaces */
  --c-surface:   #ffffff;
  --c-surface-2: #f8fafc;
  --c-surface-3: #f1f5f9;
  --c-bg:        #f5f5f4;

  /* Borders */
  --c-border:   #e2e8f0;
  --c-border-2: #f1f5f9;

  /* Accent (violet) */
  --c-accent:       #7c3aed;
  --c-accent-hover: #6d28d9;

  /* Focus (blue — accessibility convention) */
  --c-focus: #3b82f6;

  /* Danger */
  --c-danger:       #ef4444;
  --c-danger-hover: #dc2626;

  /* Status */
  --c-success-bg:     #f0fdf4;
  --c-success-text:   #166534;
  --c-success-border: #bbf7d0;
  --c-error-bg:       #fef2f2;
  --c-error-text:     #b91c1c;
  --c-error-border:   #fecaca;

  /* Gradient */
  --gradient: linear-gradient(160deg, #fce7f3 0%, #ede9fe 45%, #dbeafe 100%);

  /* Border radii */
  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-2xl: 24px;

  /* Page gutter */
  --gutter: 6vw;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 6px 20px rgba(0,0,0,0.12);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.18);
}

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

/* ── Global focus style (WCAG 2.4.7 / 2.4.11) ───────────────── */
:focus-visible {
  outline: 3px solid var(--c-focus);
  outline-offset: 2px;
}

/* Screen-reader only utility */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

body {
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  background: var(--c-bg);
  color: var(--c-ink-2);
  min-height: 100vh;
}

/* ============================================================
   DESIGN APP STYLES
   ============================================================ */

/* ── Design app header (frosted glass) ───────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 20px;
  gap: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-left  { flex: 1; display: flex; align-items: center; gap: 8px; }
.header-right { flex: 1; display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.header-center { display: flex; align-items: center; gap: 10px; flex: 2; justify-content: center; }

.app-title    { font-size: 16px; font-weight: 600; color: var(--c-ink); letter-spacing: -0.01em; }
.design-label { font-size: 14px; font-weight: 500; color: var(--c-ink-5); }

.app-logo-link { text-decoration: none; color: inherit; display: flex; align-items: center; }
.app-logo-img  { height: 31px; width: auto; display: block; margin-top: 12px; }

.app-my-designs-link {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--c-ink-5);
  text-decoration: none;
  padding: 0.3rem 0.6rem;
  border-radius: var(--r-md);
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}
.app-my-designs-link:hover { background: var(--c-surface-3); color: var(--c-ink-2); }

/* ── Template / name inputs ───────────────────────────────── */
.template-select {
  padding: 7px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.template-select:focus {
  outline: none;
  border-color: var(--c-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.design-name-input {
  padding: 7px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-ink-2);
  font-size: 13px;
  width: 180px;
  transition: border-color 0.15s;
}
.design-name-input::placeholder { color: var(--c-ink-6); }
.design-name-input:focus {
  outline: none;
  border-color: var(--c-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* ── Mode toggle (segmented control) ─────────────────────── */
.mode-toggle {
  display: flex;
  background: #ddd6fe;
  border-radius: var(--r-md);
  padding: 3px;
  gap: 2px;
  position: relative;
}
.mode-toggle-btn {
  padding: 6px 14px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: var(--c-ink-3);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}
.mode-toggle-btn:hover { color: var(--c-ink-2); }
.mode-toggle-btn.active { color: var(--c-ink-2); }
.mode-toggle::before {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: calc(50% - 4px);
  height: calc(100% - 6px);
  background: var(--c-surface);
  border-radius: 6px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  z-index: 0;
}
.mode-toggle:has(.mode-toggle-btn:last-child.active)::before {
  transform: translateX(calc(100% + 2px));
}

/* ── Zoom controls ────────────────────────────────────────── */
.zoom-controls-header {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--c-surface-3);
  border-radius: var(--r-md);
  padding: 2px;
}
.zoom-btn {
  width: 28px; height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--c-ink-4);
  font-size: 14px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.zoom-btn:hover  { background: var(--c-border); }
.zoom-btn:active { transform: scale(0.92); }
.zoom-label-header {
  font-size: 12px;
  color: var(--c-ink-5);
  min-width: 36px;
  text-align: center;
  font-weight: 500;
}

/* ── Session expired banner ───────────────────────────────── */
.session-expired-banner {
  position: sticky;
  top: 0;
  z-index: 150;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #7f1d1d;
  color: #fef2f2;
  font-size: 13px;
  font-weight: 500;
}
.session-expired-banner a { color: #fca5a5; font-weight: 600; }
.session-expired-banner a:hover { color: #ffffff; }

/* ── Toast notification ───────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--c-ink-2);
  color: var(--c-surface);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
  z-index: 200;
  cursor: pointer;
}
.toast-enter-active { transition: all 0.3s cubic-bezier(0.4,0,0.2,1); }
.toast-leave-active { transition: all 0.2s ease-in; }
.toast-enter-from, .toast-leave-to {
  opacity: 0;
  transform: translateX(-50%) translateY(12px);
}

/* ── App layout ───────────────────────────────────────────── */
.app-body {
  display: flex;
  gap: 0;
  min-height: calc(100vh - 48px);
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--c-surface);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 1px 0 3px rgba(0,0,0,0.04);
  overflow-y: auto;
}
.sidebar-section  { display: flex; flex-direction: column; gap: 8px; }
.sidebar-divider  { height: 1px; background: var(--c-border); margin: 2px 0; }
.sidebar-title    { font-size: 12px; font-weight: 600; color: var(--c-ink-4); }
.sidebar-row      { display: flex; gap: 8px; }
.sidebar-row > *  { flex: 1; min-width: 0; }
.sidebar-label    { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--c-ink-4); }
.sidebar-input {
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-ink-2);
  font-size: 13px;
  width: 100%;
  transition: border-color 0.15s;
}
.sidebar-input:focus {
  outline: none;
  border-color: var(--c-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

/* ── Palette ──────────────────────────────────────────────── */
.palette-swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.swatch-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  position: relative;
}
.swatch {
  width: 44px; height: 44px;
  border-radius: 10px;
  cursor: pointer;
  border: 2px solid transparent;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.06);
  position: relative;
  transition: all 0.15s ease;
}
.swatch:hover  { box-shadow: 0 0 0 2px #cbd5e1, inset 0 1px 2px rgba(0,0,0,0.06); }
.swatch:active { transform: scale(0.93); }
.swatch.active {
  border-color: var(--c-focus);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.3), inset 0 1px 2px rgba(0,0,0,0.06);
}
.swatch.active::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 0 0 3px rgba(0,0,0,0.6);
  pointer-events: none;
}
.swatch-label {
  font-size: 9px;
  color: var(--c-ink-6);
  max-width: 48px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.swatch-delete {
  position: absolute;
  top: -4px; right: -4px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--c-danger);
  color: var(--c-surface);
  border: 2px solid var(--c-surface);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}
.swatch-delete:hover { background: var(--c-danger-hover); }
.swatch-wrap:hover .swatch-delete { display: flex; }

/* ── Color editor ─────────────────────────────────────────── */
.color-editor {
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.color-editor-title { font-size: 12px; font-weight: 500; color: var(--c-ink-3); }
.color-editor label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--c-ink-5); }
.color-editor input[type="color"] {
  width: 100%; height: 34px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  cursor: pointer;
  padding: 3px;
  background: var(--c-surface);
}
.color-editor input[type="text"] {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-ink-2);
  font-size: 13px;
  transition: border-color 0.15s;
}
.color-editor input[type="text"]:focus {
  outline: none;
  border-color: var(--c-focus);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.color-editor-actions { display: flex; gap: 6px; }

/* ── Background picker ────────────────────────────────────── */
.bg-picker { display: flex; align-items: center; gap: 6px; }
.bg-color-swatch {
  width: 28px; height: 28px;
  border: 1px solid var(--c-border);
  border-radius: 6px;
  cursor: pointer;
  padding: 2px;
  background: var(--c-surface);
  flex-shrink: 0;
}
.bg-color-hex { font-size: 11px; color: var(--c-ink-5); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  padding: 8px 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
  background: var(--c-surface-3);
  color: var(--c-ink-3);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn:hover    { background: var(--c-border); }
.btn:active   { transform: scale(0.96); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn:disabled:active { transform: none; }

.btn-primary { background: var(--c-accent); color: var(--c-surface); border-color: transparent; }
.btn-primary:hover:not(:disabled) { background: var(--c-accent-hover); }
.btn-secondary { background: var(--c-surface); color: var(--c-ink-3); border: 1px solid var(--c-border); }
.btn-secondary:hover:not(:disabled) { background: var(--c-surface-3); }

.btn-danger { background: var(--c-danger); color: var(--c-surface); border-color: transparent; }
.btn-danger:hover { background: var(--c-danger-hover); }

.btn-sm   { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; margin-top: 0.25rem; }
.btn-add-color { width: 100%; font-size: 13px; }

/* Copy link button */
.btn-copy-link { width: 100%; margin-top: 0.5rem; background: var(--c-accent); color: var(--c-surface); border-color: transparent; }
.btn-copy-link:hover { background: var(--c-accent-hover); }

/* Tool toggle buttons */
.tool-buttons { display: flex; gap: 6px; }
.btn-tool {
  flex: 1;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-ink-4);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.btn-tool:hover  { background: var(--c-border); }
.btn-tool:active { transform: scale(0.96); }
.btn-tool.active { background: var(--c-focus); color: var(--c-surface); border-color: var(--c-focus); }

/* ── Bead tool cursors ────────────────────────────────────── */
.bead.bead-tool-delete { cursor: crosshair; }
.bead.bead-tool-delete:hover { opacity: 0.5; }
.bead-add-slot {
  border: 1.5px dashed var(--c-ink-6);
  border-radius: var(--r-sm);
  cursor: pointer;
  pointer-events: auto !important;
  opacity: 0.4;
  transition: opacity 0.15s;
}
.bead-add-slot:hover { opacity: 0.8; background: rgba(59,130,246,0.1); }

/* ── Grid area ────────────────────────────────────────────── */
.grid-area {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 24px 16px;
  overflow: auto;
}
.no-template { color: var(--c-ink-6); font-size: 14px; padding-top: 60px; }
.grid-scaler { display: flex; flex-direction: column; align-items: center; transform-origin: top center; user-select: none; position: relative; }
.reference-overlay {
  position: absolute;
  top: 0; left: 0;
  transform-origin: top left;
  pointer-events: none;
  z-index: 10;
  max-width: none;
}
.reference-overlay-moveable {
  pointer-events: auto;
  cursor: grab;
}
.reference-overlay-moveable:active { cursor: grabbing; }
.overlay-slider {
  width: 100%;
  accent-color: var(--c-accent);
  margin-top: 0.2rem;
}
.overlay-hint {
  font-size: 0.72rem; color: var(--c-ink-5);
  margin: 0.35rem 0 0; line-height: 1.4;
}
.overlay-file-label { cursor: pointer; display: inline-block; }
/* Bead count */
.bead-count-list { display: flex; flex-direction: column; gap: 0.4rem; }
.bead-count-row {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.78rem;
}
.bead-count-swatch {
  width: 14px; height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.08);
}
.bead-count-label {
  flex: 1; color: var(--c-ink-4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bead-count-num {
  font-weight: 600; color: var(--c-ink-2);
  font-variant-numeric: tabular-nums;
}
.bead-count-empty { font-size: 0.75rem; color: var(--c-ink-5); margin: 0; }

.overlay-accordion { border: none; }
.overlay-accordion-summary {
  font-size: 0.75rem; font-weight: 600; color: var(--c-ink-4);
  text-transform: uppercase; letter-spacing: 0.04em;
  cursor: pointer; list-style: none; user-select: none;
}
.overlay-accordion-summary::-webkit-details-marker { display: none; }
.overlay-accordion-summary::before { content: '▶ '; font-size: 0.6rem; }
details[open] .overlay-accordion-summary::before { content: '▼ '; }
.overlay-accordion-body { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.5rem; }

/* ── Bead rows ────────────────────────────────────────────── */
.bead-row { display: flex; align-items: center; gap: 0; }
.bead-row .bead.dimmed       { opacity: 0.4; }
.bead-row .bead-spacer.dimmed { opacity: 0.4; }

.row-indicator {
  width: 22px;
  text-align: right;
  font-size: 9px;
  color: var(--c-ink-6);
  cursor: pointer;
  padding-right: 4px;
  user-select: none;
  flex-shrink: 0;
  transition: color 0.15s;
}
.row-indicator:hover { color: var(--c-focus); }

.bead-row.fringe-row-5 {
  border-bottom: 1px solid rgba(100,116,139,0.25);
  margin-bottom: 2px;
  padding-bottom: 2px;
}

.strand-number {
  width: 24px; height: 18px;
  margin: 1px;
  flex-shrink: 0;
  font-size: 9px;
  color: var(--c-ink-6);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  user-select: none;
  transition: color 0.15s;
}
.strand-number:hover  { color: var(--c-focus); }
.strand-number.active { color: var(--c-focus); font-weight: 600; }

.bead-row.row-offset .bead-row-cells { margin-left: 13px; }
.bead-row-cells { display: flex; flex-direction: row; }

.center-line { height: 2px; background: var(--c-ink-6); margin: 4px 0; border-radius: 1px; flex-shrink: 0; }

/* ── Beads ────────────────────────────────────────────────── */
.bead {
  width: 24px; height: 18px;
  border-radius: var(--r-sm);
  border: none;
  background: #ffffff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  margin: 1px;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s ease;
}
.bead-spacer {
  width: 24px; height: 18px;
  margin: 1px;
  flex-shrink: 0;
  background: transparent;
  pointer-events: none;
}
.done-mark {
  font-size: 10px;
  color: rgba(255,255,255,0.85);
  font-weight: bold;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

[v-cloak] { display: none !important; }

/* ── Modal ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: 24px;
  max-width: 340px;
  color: var(--c-ink-2);
  display: flex; flex-direction: column; gap: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.05);
}
.modal p { font-size: 14px; line-height: 1.6; color: var(--c-ink-4); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

.help-modal {
  max-width: 420px;
  width: calc(100vw - 40px);
  position: relative;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-close {
  position: absolute;
  top: 14px; right: 14px;
  background: none;
  border: none;
  font-size: 20px;
  line-height: 1;
  color: var(--c-ink-5);
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--r-sm);
}
.modal-close:hover { color: var(--c-ink-2); background: var(--c-surface-3); }
.help-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--c-ink-2);
  margin: 0 28px 0 0;
}
.help-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.help-list li {
  font-size: 13px;
  line-height: 1.55;
  color: var(--c-ink-4);
  padding-left: 14px;
  position: relative;
}
.help-list li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--c-accent);
  font-weight: 700;
}
.help-list strong { color: var(--c-ink-2); font-weight: 600; }

.sidebar-help-row {
  padding: 10px 14px 2px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.btn-help {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  color: var(--c-ink-4);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  padding: 5px 10px;
  width: 100%;
  transition: all 0.15s;
}
.btn-help:hover { background: var(--c-surface-3); color: var(--c-ink-2); }

/* ── Bookmark button ─────────────────────────────────────── */
.sidebar-bookmark {
  padding: 10px 14px;
}
.btn-bookmark {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1.5px solid #e2e8f0;
  background: white;
  color: var(--c-ink-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-bookmark:hover { background: #fff0f0; border-color: #fca5a5; color: #dc2626; }
.btn-bookmark-active { background: #fff0f0; border-color: #fca5a5; color: #dc2626; }
.btn-bookmark-nudge {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--c-ink-3);
  text-decoration: none;
  padding: 4px 0;
}
.btn-bookmark-nudge:hover { color: var(--c-accent); }

/* ── Sidebar toggle ───────────────────────────────────────── */
.sidebar-toggle {
  display: flex;
  width: 36px; height: 36px;
  border-radius: var(--r-md);
  border: none;
  background: transparent;
  color: var(--c-ink-4);
  cursor: pointer;
  align-items: center; justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.sidebar-toggle:hover  { background: var(--c-surface-3); }
.sidebar-toggle:active { transform: scale(0.92); }
.sidebar-backdrop { display: none; }

/* Auth nudge in bead mode header */
.auth-nudge { font-size: 0.8rem; color: var(--c-ink-6); }
.auth-nudge a { color: var(--c-accent); text-decoration: none; }
.auth-nudge a:hover { text-decoration: underline; }

/* ── Desktop sidebar collapse ────────────────────────────── */
@media (min-width: 769px) {
  .sidebar {
    transition: width 0.2s ease, opacity 0.15s ease, padding 0.2s ease;
    min-width: 0;
  }
  .sidebar:not(.open) {
    width: 0;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    box-shadow: none;
  }
}

/* ── Design app: responsive ───────────────────────────────── */
@media (max-width: 768px) {
  .sidebar-toggle { display: flex; }
  .app-header { flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .header-left  { flex: 0 0 auto; }
  .header-right { flex: 0 0 auto; gap: 8px; }
  .header-center { order: 3; flex: 1 1 100%; justify-content: stretch; gap: 8px; }
  .header-center .template-select,
  .header-center .design-name-input { flex: 1; width: auto; min-width: 0; }
  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    z-index: 80;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    box-shadow: none;
    padding-top: 16px;
  }
  .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,0.1); }
  .sidebar-backdrop {
    display: block;
    position: fixed; inset: 0;
    background: rgba(15,23,42,0.3);
    z-index: 79;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
  }
  .sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }
  .grid-area { padding: 16px 8px; }
}
@media (max-width: 480px) {
  .app-header { padding: 8px 10px; }
  .app-title  { font-size: 14px; }
  .zoom-controls-header { gap: 2px; }
  .zoom-btn   { width: 32px; height: 32px; }
  .zoom-label-header { min-width: 30px; font-size: 11px; }
  .mode-toggle-btn { padding: 6px 10px; font-size: 12px; }
  .header-center { flex-wrap: wrap; }
  .header-center .btn-primary { flex: 1 1 100%; }
  .palette-swatches { grid-template-columns: repeat(5, 1fr); gap: 6px; }
  .swatch { width: 38px; height: 38px; border-radius: var(--r-md); }
  .swatch-label { font-size: 8px; max-width: 38px; }
  .grid-area { padding: 12px 4px; }
  .toast { left: 12px; right: 12px; transform: none; text-align: center; }
  .toast-enter-from, .toast-leave-to { opacity: 0; transform: translateY(12px); }
}

/* ============================================================
   SITE-WIDE STYLES (non-app pages)
   ============================================================ */

body.site-page {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── Gradient pages (home, account, auth, admin) ──────────── */
body.gradient-page {
  background: var(--gradient);
  background-attachment: fixed;
}
body.gradient-page .site-nav {
  position: static;
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
}

/* ── Site nav ─────────────────────────────────────────────── */
.site-nav {
  height: 56px;
  background: rgba(255,255,255,0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
  position: sticky;
  top: 0;
  z-index: 100;
}
.site-nav-inner {
  padding: 0 var(--gutter);
  height: 100%;
  display: flex; align-items: center; justify-content: space-between;
}
.site-nav-logo {
  text-decoration: none;
  display: flex;
  align-items: center;
}
.site-nav-logo-img {
  height: 36px;
  width: auto;
  display: block;
  margin-top: 12px;
}
.site-nav-links { display: flex; align-items: center; gap: 0.5rem; }
.site-nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--c-ink-4);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--r-md);
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  background: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}
.site-nav-link:hover  { border-color: var(--c-ink); color: var(--c-ink); background: none; }
.site-nav-link.active { background: var(--c-ink); color: var(--c-surface); border-color: var(--c-ink); }
.site-nav-cta {
  background: var(--c-accent);
  color: var(--c-surface);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.9rem;
  border-radius: var(--r-md);
  text-decoration: none;
  border: 1px solid transparent;
  transition: background 0.15s;
}
.site-nav-cta:hover { background: #5b21b6; color: var(--c-surface); border-color: transparent; }

/* ── Hamburger button (hidden on desktop) ────────────────── */
.site-nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--r-sm);
}
.site-nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--c-ink);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.site-nav-hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-nav-hamburger.open span:nth-child(2) { opacity: 0; }
.site-nav-hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Mobile menu (hidden on desktop) ─────────────────────── */
.mobile-menu {
  border-top: 1px solid var(--c-border);
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.5rem 0 0.75rem;
  display: flex;
  flex-direction: column;
}
.mobile-menu[hidden] { display: none; }
.mobile-menu-link {
  display: block;
  padding: 0.7rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--c-ink-3);
  text-decoration: none;
  transition: background 0.12s, color 0.12s;
  border-radius: 0;
}
.mobile-menu-link:hover,
.mobile-menu-link:focus { background: var(--c-surface-2); color: var(--c-ink); }
.mobile-menu-link.active { color: var(--c-ink); font-weight: 700; }
.mobile-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  text-align: left;
}
.mobile-menu-cta {
  margin: 0.5rem 1rem 0;
  background: var(--c-accent);
  color: var(--c-surface) !important;
  border-radius: var(--r-md);
  text-align: center;
  padding: 0.6rem 1rem;
  font-weight: 600;
}
.mobile-menu-cta:hover { background: #5b21b6 !important; }

@media (max-width: 600px) {
  .site-nav-links     { display: none; }
  .site-nav-hamburger { display: flex; }
}

/* ── Site footer ──────────────────────────────────────────── */
.site-footer { margin-top: auto; }
.site-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 1.25rem var(--gutter);
  font-size: 0.78rem;
  color: var(--c-ink-5);
  border-top: 1px solid var(--c-border);
}
.footer-copy { margin: 0; }
.footer-nav { display: flex; gap: 1.25rem; }
@media (max-width: 480px) {
  .site-footer-inner { justify-content: center; text-align: center; }
  .footer-nav { justify-content: center; }
}
.footer-link { color: inherit; text-decoration: none; }
.footer-link:hover { text-decoration: underline; }

/* ── White panel (shared by account, admin, gallery) ─────── */
.site-panel {
  margin: 1.5rem var(--gutter) 4rem;
  padding: 2.5rem;
  background: var(--c-surface);
  border-radius: var(--r-2xl);
  flex: 1;
}

/* ── Auth pages ───────────────────────────────────────────── */
.auth-page {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1rem 3rem;
}
.auth-card {
  background: var(--c-surface);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-md);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}
.auth-card h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--c-ink);
}
.auth-intro { font-size: 0.9rem; color: var(--c-ink-5); margin-bottom: 1.25rem; }
.auth-card form { display: flex; flex-direction: column; gap: 0.85rem; }
.auth-card label {
  display: flex; flex-direction: column; gap: 0.3rem;
  font-size: 0.8rem; font-weight: 600; color: var(--c-ink-4);
}
.auth-card .input-hint {
  font-size: 0.72rem; font-weight: 400; color: var(--c-ink-4); opacity: 0.75;
}
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--c-ink-2);
  background: var(--c-surface-2);
  transition: border-color 0.15s;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--c-focus);
  background: var(--c-surface);
  box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.auth-error {
  background: var(--c-error-bg);
  color: var(--c-error-text);
  border: 1px solid var(--c-error-border);
  border-radius: var(--r-md);
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.auth-error-inline { color: var(--c-error-text); font-size: 0.9rem; margin-bottom: 1rem; }
.auth-success {
  background: var(--c-success-bg);
  color: var(--c-success-text);
  border: 1px solid var(--c-success-border);
  border-radius: var(--r-md);
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.auth-info {
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  border-radius: var(--r-md);
  padding: 0.6rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}
.auth-inline-btn {
  background: none;
  border: none;
  color: var(--c-accent);
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
  padding: 0;
  text-decoration: underline;
}
.auth-inline-btn:hover { color: #1d4ed8; }
.auth-links {
  margin-top: 1rem;
  display: flex; gap: 0.5rem; justify-content: center;
  font-size: 0.85rem;
  color: var(--c-ink-5);
}
.auth-links a { color: var(--c-accent); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

/* ── Account page ─────────────────────────────────────────── */
.account-page {
  margin: 1.5rem var(--gutter) 4rem;
  padding: 2.5rem;
  background: var(--c-surface);
  border-radius: var(--r-2xl);
  flex: 1;
}
.account-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.75rem;
}
.account-header-left { display: flex; align-items: baseline; gap: 0.6rem; }
.account-header h1   { font-size: 1.35rem; font-weight: 700; color: var(--c-ink); }
.account-design-count { font-size: 0.8rem; color: var(--c-ink-6); font-weight: 500; }

.account-empty {
  text-align: center;
  padding: 5rem 1rem 4rem;
  color: var(--c-ink-5);
  display: flex; flex-direction: column; align-items: center; gap: 0.75rem;
}
.account-empty-icon   { margin-bottom: 0.5rem; opacity: 0.7; }
.account-empty-title  { font-size: 1.1rem; font-weight: 600; color: var(--c-ink-3); }
.account-empty-sub    { font-size: 0.875rem; color: var(--c-ink-6); margin-bottom: 0.5rem; }

body.gradient-page .design-card { background: var(--c-surface); }

/* ── Gallery grid & design cards ──────────────────────────── */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1.25rem;
}
.design-card {
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--c-surface);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.15s, transform 0.15s;
  display: flex; flex-direction: column;
}
.design-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.design-card-thumb-wrap { position: relative; overflow: hidden; }
.design-card-thumb-wrap a { display: block; }
.design-card-thumb {
  width: 100%;
  aspect-ratio: 2/3;
  object-fit: contain;
  object-position: center;
  display: block;
  padding: 0.75rem 1rem;
  transition: opacity 0.2s;
}
.design-card-placeholder {
  background: linear-gradient(135deg, var(--c-border) 0%, #cbd5e1 100%);
}

/* Hover overlay (owned cards) */
.design-card-overlay {
  position: absolute; inset: 0;
  background: rgba(15,23,42,0.52);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  opacity: 0;
  transition: opacity 0.18s;
}
.design-card-thumb-wrap:hover .design-card-overlay { opacity: 1; }
.btn-overlay-edit { background: var(--c-surface); color: var(--c-ink-2); font-weight: 600; }
.btn-overlay-edit:hover { background: var(--c-surface-3); }

/* Inline delete confirmation */
.design-card-delete-confirm {
  position: absolute; inset: 0;
  background: rgba(15,23,42,0.78);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.75rem; padding: 1rem;
  color: var(--c-surface);
  font-size: 0.8rem; font-weight: 500; text-align: center;
}
.design-card-delete-confirm[hidden] { display: none; }
.delete-confirm-actions { display: flex; gap: 0.4rem; }

/* Card info */
.design-card-info {
  padding: 0.65rem 0.75rem 0.5rem;
  display: flex; flex-direction: column; gap: 0.2rem;
}
.design-card-name {
  font-size: 0.875rem; font-weight: 600; color: var(--c-ink-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.design-card-meta {
  font-size: 0.7rem; color: var(--c-ink-6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.design-card-link {
  display: flex; flex-direction: column;
  text-decoration: none; color: inherit;
  flex: 1;
}
.design-card-link:focus-visible { outline: 3px solid var(--c-focus); outline-offset: 2px; border-radius: var(--r-md); }
.design-card-link:hover ~ .design-card-author,
.design-card:hover .design-card-link { opacity: 0.95; }
.design-card-author {
  font-size: 0.72rem; color: var(--c-accent);
  text-decoration: none;
}
.design-card-author:hover { text-decoration: underline; }
.design-card-owned { text-decoration: none; }

/* Card footer — visibility toggle */
.design-card-footer {
  padding: 0.4rem 0.6rem 0.65rem;
  border-top: 1px solid var(--c-border-2);
  margin-top: auto;
}
.visibility-pills {
  display: flex;
  background: #ddd6fe;
  border-radius: 6px;
  padding: 2px; gap: 2px;
  position: relative;
}
/* Sliding indicator */
.visibility-pills::before {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: calc((100% - 8px) / 3);
  height: calc(100% - 4px);
  background: var(--c-surface);
  border-radius: 4px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.1);
  transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
  z-index: 0;
}
.visibility-pills[data-active="1"]::before { transform: translateX(calc(100% + 2px)); }
.visibility-pills[data-active="2"]::before { transform: translateX(calc(200% + 4px)); }

.vis-pill {
  flex: 1;
  border: none; background: transparent;
  border-radius: 4px;
  padding: 4px 0;
  font-size: 0.65rem; font-weight: 600;
  color: var(--c-ink-5);
  cursor: pointer;
  transition: color 0.2s;
  white-space: nowrap;
  position: relative; z-index: 1;
}
.vis-pill:hover { color: var(--c-accent); }
/* Active pill text colours */
.visibility-pills[data-active="0"] .vis-pill[data-value="private"]  { color: var(--c-ink-2); }
.visibility-pills[data-active="1"] .vis-pill[data-value="unlisted"] { color: #854d0e; }
.visibility-pills[data-active="2"] .vis-pill[data-value="public"]   { color: var(--c-success-text); }

/* Legacy visibility badge */
.visibility-badge {
  font-size: 0.7rem; font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
  text-transform: capitalize;
}
.visibility-public   { background: #dcfce7; color: var(--c-success-text); }
.visibility-unlisted { background: #fef9c3; color: #854d0e; }
.visibility-private  { background: var(--c-surface-3); color: var(--c-ink-4); }

/* Gallery grid responsive */
@media (max-width: 900px) { .gallery-grid { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 700px) { .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 480px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }

/* Account page: 4 columns to give cards more room for the visibility toggle */
.account-page .gallery-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 700px) { .account-page .gallery-grid { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 480px) { .account-page .gallery-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Settings page ────────────────────────────────────────── */
.settings-page {
  margin: 1.5rem var(--gutter) 4rem;
}
.settings-layout {
  display: grid;
  grid-template-columns: 5fr 3fr;
  gap: 2rem;
  align-items: start;
}
.settings-heading {
  font-size: 1.5rem; font-weight: 700; color: var(--c-ink-1);
  margin: 0 0 1.25rem;
}
.settings-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  position: sticky;
  top: 5rem;
}
.settings-sidebar-title {
  font-size: 0.85rem; font-weight: 600; color: var(--c-ink-4);
  text-transform: uppercase; letter-spacing: 0.05em;
  margin: 0 0 0.25rem;
}
.settings-stat-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 1.1rem 1.25rem;
  text-align: center;
}
.settings-stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--c-ink-2); line-height: 1; }
.settings-stat-card .stat-label { font-size: 0.75rem; color: var(--c-ink-5); margin-top: 0.35rem; }
.settings-sidebar-btn  { text-align: center; margin-top: 0.25rem; }
@media (max-width: 700px) {
  .settings-layout { grid-template-columns: 1fr; }
  .settings-sidebar { position: static; }
}
.settings-section {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}
.settings-section h2 {
  font-size: 1rem; font-weight: 600; color: var(--c-ink-1);
  margin: 0 0 1rem;
}
.settings-section label {
  display: flex; flex-direction: column; gap: 0.3rem;
  font-size: 0.8rem; font-weight: 600; color: var(--c-ink-4);
  margin-bottom: 0.75rem;
}
.settings-section input[type="text"],
.settings-section input[type="email"],
.settings-section input[type="password"] {
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--c-ink-2);
  background: var(--c-surface-2);
  transition: border-color 0.15s;
}
.settings-section input:focus {
  outline: none;
  border-color: var(--c-focus);
  background: var(--c-surface);
}
.settings-section .input-hint {
  font-size: 0.72rem; font-weight: 400; color: var(--c-ink-4); opacity: 0.75;
}
.settings-actions {
  margin-top: 0.25rem;
}
.settings-danger-wrap {
  border-color: #fca5a5;
  background: #fff5f5;
}
.danger-zone-summary {
  font-size: 0.95rem; font-weight: 600; color: #dc2626;
  cursor: pointer; list-style: none; padding: 0;
}
.danger-zone-summary::-webkit-details-marker { display: none; }
.danger-zone-summary::before { content: '▶ '; font-size: 0.7rem; }
details[open] .danger-zone-summary::before { content: '▼ '; }
.danger-zone-body {
  margin-top: 1rem;
}
.danger-zone-desc {
  font-size: 0.85rem; color: var(--c-ink-2); margin: 0 0 0.5rem;
}
.danger-zone-note {
  font-size: 0.8rem; color: var(--c-ink-4); margin: 0 0 1rem;
  font-style: italic;
}
.btn-danger {
  background: #dc2626; color: #fff; border: none;
  padding: 0.5rem 1rem; border-radius: var(--r-md);
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s;
}
.btn-danger:hover { background: #b91c1c; }

/* ── Admin page ───────────────────────────────────────────── */
.admin-page {
  margin: 1.5rem var(--gutter) 4rem;
  padding: 2.5rem;
  background: var(--c-surface);
  border-radius: var(--r-2xl);
  flex: 1;
}
.admin-header { margin-bottom: 1.75rem; }
.admin-header h1 { font-size: 1.35rem; font-weight: 700; color: var(--c-ink); }

.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2.5rem;
}
.stat-card {
  background: var(--c-surface-3);
  border-radius: var(--r-lg);
  padding: 1.25rem 1rem;
  text-align: center;
}
.stat-card.stat-warn { border-top: 3px solid #f59e0b; }
.stat-value { font-size: 2rem; font-weight: 700; color: var(--c-ink-2); line-height: 1; }
.stat-label { font-size: 0.75rem; color: var(--c-ink-5); margin-top: 0.35rem; }

.admin-section {
  background: var(--c-surface-3);
  border-radius: var(--r-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.admin-section h2 { font-size: 1rem; font-weight: 600; color: var(--c-ink-2); margin-bottom: 1rem; }
.admin-empty { color: var(--c-ink-6); font-size: 0.9rem; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.admin-table th {
  text-align: left; font-size: 0.75rem; font-weight: 600; color: var(--c-ink-5);
  padding: 0 0.75rem 0.6rem;
  border-bottom: 1px solid var(--c-border);
}
.admin-table td {
  padding: 0.6rem 0.75rem;
  vertical-align: middle;
  border-bottom: 1px solid var(--c-border-2);
}
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr.row-hidden td { opacity: 0.45; }

.admin-thumb {
  width: 36px; height: 60px;
  object-fit: contain;
  object-position: top center;
  border-radius: var(--r-sm);
  background: var(--c-surface-3);
  display: block;
}
.admin-thumb-placeholder { background: linear-gradient(135deg, var(--c-border), #cbd5e1); }
.admin-link { color: var(--c-accent); text-decoration: none; }
.admin-link:hover { text-decoration: underline; }
.admin-email { color: var(--c-ink-4); }
.admin-date  { color: var(--c-ink-6); white-space: nowrap; }
.admin-actions { white-space: nowrap; }

.badge {
  display: inline-block;
  font-size: 0.65rem; font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 20px;
  letter-spacing: 0.03em;
  text-transform: capitalize;
  margin-left: 0.3rem;
}
.badge-visible { background: #dcfce7; color: var(--c-success-text); }
.badge-hidden  { background: var(--c-error-bg); color: var(--c-error-text); }
.badge-blocked { background: var(--c-error-bg); color: var(--c-error-text); }
.badge-admin   { background: #eff6ff; color: #1d4ed8; }

/* ============================================================
   HOME PAGE
   ============================================================ */

/* Home-page card: frosted glass on gradient */
body.home-page .design-card {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

/* ── Coffee banner ────────────────────────────────────────── */
.coffee-banner {
  margin: 0 var(--gutter) 2rem;
}
.coffee-banner-inner {
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--c-ink-4);
}
.coffee-banner-heart { width: 14px; height: 14px; vertical-align: middle; margin: 0 1px; position: relative; top: -1px; }
.coffee-banner-link { color: var(--c-ink-3); text-decoration: none; }
.coffee-banner-link:hover { text-decoration: underline; }
.coffee-banner-cta { color: var(--c-accent); font-weight: 600; }

/* ── Static pages (contact, terms, privacy) ───────────────── */
.static-page {
  margin: 2rem var(--gutter) 4rem;
  display: flex;
  justify-content: center;
}
.static-wrap {
  width: 100%;
  max-width: 680px;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: 2.5rem 3rem;
}
.static-wrap h1 {
  font-size: 1.75rem; font-weight: 700; color: var(--c-ink-1);
  margin: 0 0 0.25rem;
}
.static-meta {
  font-size: 0.8rem; color: var(--c-ink-5); margin: 0 0 2rem;
}
.static-lead {
  font-size: 1rem; color: var(--c-ink-3); margin: 0 0 2rem; line-height: 1.6;
}
.static-wrap h2 {
  font-size: 1.05rem; font-weight: 600; color: var(--c-ink-2);
  margin: 2rem 0 0.5rem;
}
.static-wrap p {
  font-size: 0.9rem; color: var(--c-ink-4); line-height: 1.7; margin: 0 0 0.5rem;
}
.static-link { color: var(--c-accent); text-decoration: none; }
.static-link:hover { text-decoration: underline; }
.deftforms-wrap { margin-top: 1.5rem; }

/* About page */
.video-wrap { margin: 1.25rem 0 0.5rem; }
.video-link { text-decoration: none; display: block; }
.video-thumb {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: #000;
  aspect-ratio: 16/9;
}
.video-img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.85; transition: opacity 0.2s; }
.video-link:hover .video-img { opacity: 1; }
.video-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.video-caption {
  display: block;
  font-size: 0.8rem;
  color: var(--c-ink-5);
  margin-top: 0.5rem;
  text-align: center;
}
.about-coffee-btn { margin-top: 1rem; }

/* ── Hero ─────────────────────────────────────────────────── */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3rem;
  min-height: 500px;
  padding: 3rem var(--gutter) 4rem;
  overflow: hidden;
}
.hero-content {
  flex: 1; max-width: 520px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 1.25rem;
}
.hero-title {
  font-size: clamp(2.4rem, 5vw, 3.6rem);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.03em;
  color: var(--c-ink);
  margin: 0;
  text-transform: uppercase;
}
.hero-sub {
  font-size: 1rem; line-height: 1.7;
  color: var(--c-ink-4);
  margin: 0; max-width: 420px;
}
.hero-cta {
  margin-top: 0.5rem;
  padding: 0.75rem 2rem;
  font-size: 0.9rem; font-weight: 600;
  background: var(--c-ink);
  color: var(--c-surface);
  border-radius: var(--r-md);
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
}
.hero-cta:hover  { background: var(--c-ink-2); transform: translateY(-1px); }
.hero-cta:active { transform: translateY(0); }

.hero-image-wrap {
  flex: 0 0 auto;
  width: clamp(260px, 36vw, 460px);
  border-radius: var(--r-2xl);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}
.hero-img {
  width: 100%; height: 100%;
  object-fit: cover; display: block;
  aspect-ratio: 4/3;
}

/* ── Gallery section (home page) ─────────────────────────── */
.gallery-section {
  max-width: 1200px;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
}
body.home-page .gallery-section {
  max-width: none;
  margin: 0 var(--gutter) 1.5rem;
  padding: 3rem 2.5rem 5rem;
  background: var(--c-surface);
  border-radius: var(--r-2xl);
}
.gallery-header {
  display: flex; align-items: baseline; gap: 1rem;
  margin-bottom: 1.75rem;
}
.gallery-header h2 { font-size: 1.25rem; font-weight: 700; color: var(--c-ink-2); margin: 0; }
.gallery-empty { color: var(--c-ink-5); font-size: 0.95rem; }

/* ── Home page responsive ─────────────────────────────────── */
@media (max-width: 768px) {
  .hero {
    flex-direction: column; text-align: center;
    padding: 3rem 1.5rem; gap: 2rem; min-height: unset;
  }
  .hero-content { align-items: center; max-width: 100%; }
  .hero-sub     { max-width: 100%; }
  .hero-image-wrap { width: 100%; max-width: 380px; }
  .hero-title   { font-size: clamp(2rem, 8vw, 2.8rem); }
  body.home-page .gallery-section { margin: 0 1.5rem 1.5rem; padding: 2rem 1.5rem 3rem; }
  .account-page { margin: 1rem 1rem 2rem; padding: 1.5rem; }
  .admin-page   { margin: 1rem 1rem 2rem; padding: 1.5rem; }
}

/* ── Heart / Love button ─────────────────────────────────── */
.heart-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  background: rgba(255,255,255,0.88);
  border: none;
  border-radius: 50%;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1px;
  cursor: pointer;
  padding: 0;
  transition: background 0.15s, transform 0.12s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.18);
}
.heart-btn:hover:not(:disabled) { background: rgba(255,255,255,0.98); transform: scale(1.12); }
.heart-btn:disabled { opacity: 0.6; cursor: default; }
.heart-btn svg { width: 17px; height: 17px; display: block; }
.heart-path { fill: none; transition: fill 0.15s; }
.heart-btn.loved .heart-path { fill: #DA0000; stroke: #DA0000; stroke-width: 0; }
.heart-count {
  font-size: 9px;
  font-weight: 700;
  color: #DA0000;
  line-height: 1;
  letter-spacing: 0;
}

/* ── Love count badge on own design cards ────────────────── */
.love-count-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(255,255,255,0.88);
  border-radius: 12px;
  padding: 2px 6px 2px 5px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-weight: 700;
  color: #DA0000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  pointer-events: none;
}

/* ── Account page tabs ───────────────────────────────────── */
.account-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid var(--c-border);
  padding-bottom: 0;
}
.account-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 0.5rem 1rem 0.6rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-ink-3);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color 0.15s, border-color 0.15s;
  border-radius: 0;
}
.account-tab:hover { color: var(--c-ink); }
.account-tab.active { color: var(--c-accent); border-bottom-color: var(--c-accent); }
.account-tab-count {
  background: var(--c-border-2);
  color: var(--c-ink-3);
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 6px;
  min-width: 20px;
  text-align: center;
}
.account-tab.active .account-tab-count { background: #dbeafe; color: var(--c-accent); }

/* ── Fork/loved design card overlay button ───────────────── */
.btn-overlay-fork {
  background: var(--c-surface);
  color: var(--c-ink);
  border-color: var(--c-border);
}
.btn-overlay-fork:hover { background: var(--c-surface-2); }

/* ── Modal (login prompt + fork confirm) ─────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}
.modal-backdrop[hidden] { display: none; }
.modal-box {
  background: var(--c-surface);
  border-radius: var(--r-lg);
  padding: 2rem;
  max-width: 400px;
  width: 100%;
  position: relative;
  box-shadow: 0 8px 32px rgba(0,0,0,0.22);
}
.modal-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-ink);
  margin-bottom: 0.6rem;
}
.modal-body-text {
  font-size: 0.9rem;
  color: var(--c-ink-3);
  margin-bottom: 1.25rem;
  line-height: 1.5;
}
.modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.9rem;
  background: none;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--c-ink-6);
  cursor: pointer;
  padding: 2px 4px;
}
.modal-close:hover { color: var(--c-ink); }

/* ── Sidebar design title (non-owner view) ───────────────── */
.sidebar-design-info {
  padding: 0.75rem 1rem 0.6rem;
  border-bottom: 1px solid var(--c-border-2);
  margin-bottom: 0.25rem;
}
.sidebar-design-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--c-ink);
  line-height: 1.3;
}
.sidebar-design-author {
  font-size: 0.775rem;
  color: var(--c-ink-3);
  margin-top: 2px;
}
}
