/* ================================================
   QRflow Studio — Dieter Rams × Apple Aesthetic
   Warm minimalism, functional clarity, quiet luxury
   ================================================ */

:root {
  --bg: #F6F4F0;
  --bg-warm: #EDEAE4;
  --surface: #FFFFFF;
  --surface-hover: #FAFAF7;
  --border: #E2DFDA;
  --border-light: #ECEAE6;
  --text: #1C1B18;
  --text-2: #6E6B63;
  --text-3: #A19D95;
  --brand: #B8860B;
  --brand-soft: #F5EFE0;
  --accent: #1C1B18;
  --danger: #C53030;
  --success: #2D7D46;
  --blue: #2563EB;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 4px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.1);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 6px 24px rgba(0,0,0,0.06);
  --font: 'DM Sans', -apple-system, sans-serif;
  --font-display: 'Cormorant Garamond', 'Georgia', serif;
  --font-mono: 'JetBrains Mono', monospace;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --sb-w: 210px;
}

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

html { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden;
}

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ---- APP SHELL ---- */
.app { display: flex; height: 100vh; }

/* ---- SIDEBAR ---- */
.sidebar {
  width: var(--sb-w);
  background: var(--surface);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 50;
}
.sb-header { padding: 20px 18px 16px; }
.sb-logo { display: flex; align-items: center; gap: 10px; }
.sb-logo svg { flex-shrink: 0; }
.sb-name { font-weight: 700; font-size: 16px; display: block; letter-spacing: -0.3px; }
.sb-sub { font-size: 10px; color: var(--text-3); display: block; margin-top: -1px; }

.sb-nav { flex: 1; padding: 4px 10px; display: flex; flex-direction: column; gap: 2px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  border: none; background: none; cursor: pointer;
  transition: all 0.15s var(--ease);
  font-family: var(--font); text-align: left; width: 100%;
}
.sb-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.sb-item:hover { background: var(--bg); color: var(--text); }
.sb-item.active { background: var(--accent); color: #fff; }

.sb-footer { padding: 12px; border-top: 1px solid var(--border-light); }
.sb-user {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background 0.15s;
}
.sb-user:hover { background: var(--bg); }
.sb-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.sb-user-name { font-size: 12.5px; font-weight: 600; display: block; }
.sb-user-email { font-size: 10.5px; color: var(--text-3); display: block; }

.sb-login-btn {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface);
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: var(--font); color: var(--text);
  transition: all 0.15s var(--ease);
}
.sb-login-btn:hover { background: var(--bg); }

.sb-donate {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-3); text-decoration: none;
  margin-top: 8px; padding: 4px 8px;
  transition: color 0.15s;
}
.sb-donate:hover { color: var(--brand); }
.donate-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

/* ---- MAIN ---- */
.main { flex: 1; overflow-y: auto; overflow-x: hidden; min-width: 0; }
.page-content { padding: 0; min-height: 100vh; }

/* ---- HOME PAGE ---- */
.home-hero { padding: 48px 48px 32px; }
.home-title { font-family: var(--font-display); font-size: 34px; font-weight: 400; letter-spacing: -0.3px; }
.home-title em { font-style: italic; color: var(--brand); }
.home-desc { font-size: 15px; color: var(--text-2); margin-top: 6px; }

.home-cards {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; padding: 0 48px; margin-bottom: 48px;
}
.home-card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 24px;
  cursor: pointer; transition: all 0.2s var(--ease);
}
.home-card:hover { border-color: var(--border); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.home-card-icon { font-size: 28px; margin-bottom: 14px; display: block; }
.home-card h3 { font-size: 15px; font-weight: 600; margin-bottom: 3px; }
.home-card p { font-size: 12.5px; color: var(--text-3); }

.home-section { padding: 0 48px 48px; }
.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.2px; color: var(--text-3); margin-bottom: 16px;
}

/* ---- QR EDITOR ---- */
.qr-page { padding: 40px 48px; }
.qr-page-title { font-family: var(--font-display); font-size: 28px; margin-bottom: 32px; }
.qr-page-title em { font-style: italic; color: var(--brand); }

.qr-layout { display: grid; grid-template-columns: 420px 1fr; gap: 32px; align-items: start; }
.qr-panel {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 28px;
}
.qr-preview-wrap {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 32px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 480px; position: relative;
}
.qr-preview-label {
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-3); margin-bottom: 24px; align-self: flex-start;
}
#qr-canvas { image-rendering: pixelated; max-width: 100%; }
.qr-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; color: var(--text-3); padding: 40px;
}
.qr-placeholder svg { opacity: 0.2; }
.qr-download-strip {
  display: flex; gap: 8px; margin-top: 24px;
  background: var(--bg); padding: 8px; border-radius: var(--radius);
}

/* Form elements */
.form-section { margin-bottom: 24px; }
.form-section:last-child { margin-bottom: 0; }
.form-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-3); margin-bottom: 10px; display: block;
}
.field {
  width: 100%; padding: 10px 14px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-size: 14px; font-family: var(--font);
  background: var(--bg); color: var(--text);
  transition: all 0.15s var(--ease); outline: none;
}
.field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(28,27,24,0.06); background: var(--surface); }
textarea.field { resize: vertical; min-height: 72px; }
select.field { cursor: pointer; -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%236E6B63' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }

/* Tabs (pill style) */
.tabs-pill {
  display: inline-flex; gap: 2px; background: var(--bg-warm);
  padding: 3px; border-radius: var(--radius); margin-bottom: 20px;
}
.tab-pill {
  padding: 7px 16px; border-radius: var(--radius-xs); font-size: 13px;
  font-weight: 500; border: none; background: none; cursor: pointer;
  font-family: var(--font); color: var(--text-2);
  transition: all 0.15s var(--ease);
}
.tab-pill.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 14px; border-radius: 20px; font-size: 12px;
  font-weight: 500; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-family: var(--font); color: var(--text-2);
  transition: all 0.15s var(--ease);
}
.chip:hover { border-color: var(--text-3); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
  font-family: var(--font); transition: all 0.15s var(--ease); white-space: nowrap;
}
.btn:hover { border-color: var(--text-3); background: var(--surface-hover); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { opacity: 0.9; }
.btn-brand { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-brand:hover { opacity: 0.9; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: flex; align-items: center; justify-content: center; }
.btn-ghost { border: none; background: none; color: var(--text-2); }
.btn-ghost:hover { color: var(--text); background: var(--bg); }
.btn-danger { color: var(--danger); border-color: rgba(197,48,48,0.2); }
.btn-danger:hover { background: rgba(197,48,48,0.05); }
.full { width: 100%; justify-content: center; }

/* Color inputs */
.color-row { display: flex; align-items: center; gap: 10px; }
.color-well {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 2px solid var(--border); cursor: pointer; position: relative;
  overflow: hidden; flex-shrink: 0;
}
.color-well input[type="color"] {
  position: absolute; top: -6px; left: -6px;
  width: 48px; height: 48px; border: none; cursor: pointer;
}
.color-label { font-size: 12.5px; font-weight: 500; color: var(--text-2); }

/* Range */
.range-wrap { display: flex; align-items: center; gap: 10px; }
.range-wrap input[type="range"] {
  flex: 1; -webkit-appearance: none; height: 3px;
  background: var(--border); border-radius: 2px; outline: none;
}
.range-wrap input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px;
  background: var(--accent); border-radius: 50%; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.range-val {
  font-size: 12px; font-weight: 600; min-width: 28px;
  text-align: right; font-family: var(--font-mono); color: var(--text-2);
}

/* Checkbox */
.check-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; cursor: pointer;
}
.check-row input[type="checkbox"] { accent-color: var(--accent); width: 15px; height: 15px; }

/* Logo upload area */
.upload-zone {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 28px; text-align: center; cursor: pointer;
  transition: all 0.2s var(--ease); background: var(--bg);
}
.upload-zone:hover { border-color: var(--brand); background: var(--brand-soft); }
.upload-zone svg { margin-bottom: 8px; color: var(--text-3); }
.upload-zone p { font-size: 13px; color: var(--text-2); }
.upload-zone .sub { font-size: 11px; color: var(--text-3); margin-top: 2px; }

/* Dot style selector */
.style-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.style-opt {
  aspect-ratio: 1; border: 2px solid var(--border); border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s var(--ease); background: var(--surface);
}
.style-opt:hover { border-color: var(--text-3); }
.style-opt.active { border-color: var(--accent); background: var(--bg); }
.style-opt canvas { width: 80%; height: 80%; }

/* ---- CARD EDITOR ---- */
.card-editor-layout {
  display: grid; grid-template-columns: 260px 1fr 250px;
  grid-template-rows: auto 1fr;
  height: 100vh; gap: 0;
}
.ce-topbar {
  grid-column: 1 / -1;
  background: var(--surface); border-bottom: 1px solid var(--border-light);
  padding: 6px 16px; display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap; min-height: 44px;
}
.ce-topbar .sep { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }
.ce-top-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 5px 10px; border-radius: var(--radius-xs); font-size: 11.5px;
  font-weight: 500; border: 1px solid var(--border-light); background: var(--surface);
  cursor: pointer; font-family: var(--font); color: var(--text-2);
  transition: all 0.12s; white-space: nowrap;
}
.ce-top-btn:hover { background: var(--bg); color: var(--text); border-color: var(--border); }
.ce-top-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ce-top-btn svg { width: 14px; height: 14px; }
.ce-dropdown { position: relative; display: inline-flex; }
.dd-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.14); z-index: 9999; min-width: 190px; padding: 4px 0; }
.ce-dropdown.open .dd-menu { display: block; }
.dd-item { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 14px; font-size: 12px; font-family: var(--font); color: var(--text); background: transparent; border: none; cursor: pointer; white-space: nowrap; }
.dd-item:hover { background: var(--bg); color: var(--text); }
.dd-sep { height: 1px; background: var(--border-light); margin: 4px 0; }
.ctx-menu { position: fixed; z-index: 10001; background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius); box-shadow: 0 8px 28px rgba(0,0,0,.18); padding: 4px 0; min-width: 210px; }
.ctx-item { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 7px 14px; font-size: 12px; font-family: var(--font); color: var(--text); background: transparent; border: none; cursor: pointer; text-align: left; gap: 10px; }
.ctx-item:hover { background: var(--bg); }
.ctx-danger { color: #ef4444; }
.ctx-key { font-size: 10px; color: var(--text-3); margin-left: auto; padding-left: 16px; font-family: var(--font-mono, monospace); }
.ctx-sep { height: 1px; background: var(--border-light); margin: 4px 0; }
.layer-rename-input { font-size: 11px; padding: 1px 4px; border: 1px solid var(--brand); border-radius: 3px; flex: 1; min-width: 0; font-family: var(--font); background: var(--surface); color: var(--text); outline: none; }
.layer-clipped { border-left: 2px solid var(--brand) !important; margin-left: 10px; }
.ce-tools {
  background: var(--surface); border-right: 1px solid var(--border-light);
  overflow-y: auto; padding: 16px;
}
.ce-canvas-area {
  background: var(--bg-warm); display: flex; align-items: center;
  justify-content: center; position: relative; overflow: hidden;
}
.ce-canvas-wrap {
  position: relative; box-shadow: var(--shadow-lg);
  background: white;
}
#card-canvas, #cc { display: block; cursor: default; }
.ce-props {
  background: var(--surface); border-left: 1px solid var(--border-light);
  overflow-y: auto; padding: 16px;
}

/* Tool bar in card editor */
.ce-toolbar {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 16px;
  padding-bottom: 16px; border-bottom: 1px solid var(--border-light);
}
.ce-tool {
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--border-light); border-radius: var(--radius-xs);
  background: var(--surface); cursor: pointer; transition: all 0.12s;
  color: var(--text-2);
}
.ce-tool:hover { background: var(--bg); color: var(--text); }
.ce-tool.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.ce-tool svg { width: 16px; height: 16px; }

.ce-section { margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border-light); }
.ce-section:last-child { border-bottom: none; }
.ce-section-title {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; color: var(--text-3); margin-bottom: 8px;
}

/* Layer list */
.layer {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 8px; border-radius: var(--radius-xs); cursor: pointer;
  font-size: 12px; transition: all 0.1s; border: 1px solid transparent;
}
.layer:hover { background: var(--bg); }
.layer.sel { background: var(--brand-soft); border-color: var(--brand); }
.layer-icon { width: 12px; font-size: 10px; text-align: center; color: var(--text-3); }
.layer-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer-vis { opacity: 0.3; cursor: pointer; font-size: 10px; }
.layer-vis:hover { opacity: 1; }

/* Layer drag handle */
.layer-drag-handle {
  cursor: grab; opacity: 0.25; font-size: 13px; flex-shrink: 0;
  user-select: none; padding: 0 2px; line-height: 1;
}
.layer:hover .layer-drag-handle { opacity: 0.6; }
.layer-drag-handle:active { cursor: grabbing; }

/* Drag-over drop indicators */
.layer.drag-over-top { box-shadow: 0 -2px 0 var(--brand); background: var(--brand-soft); }
.layer.drag-over-bottom { box-shadow: 0 2px 0 var(--brand); background: var(--brand-soft); }

/* Layer order buttons */
.layer-order-btns {
  display: flex; gap: 3px; margin-bottom: 8px;
}
.layer-order-btn {
  flex: 1; padding: 3px 0; font-size: 13px; font-weight: 700; line-height: 1;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-xs); cursor: pointer; color: var(--text-2);
  transition: all 0.1s;
}
.layer-order-btn:hover:not(:disabled) {
  background: var(--brand-soft); border-color: var(--brand); color: var(--brand);
}
.layer-order-btn:disabled { opacity: 0.3; cursor: default; }

/* ── Effects panel (Lightroom-style) ── */
.fx-sect {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--text-3); margin: 10px 0 5px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
}
.fx-row {
  display: flex; align-items: center; gap: 6px; margin-bottom: 4px;
}
.fx-lbl {
  font-size: 10px; color: var(--text-2); min-width: 72px; flex-shrink: 0; line-height: 1.3;
}
.fx-row .range-wrap { flex: 1; }

/* Filter presets grid */
.filter-presets {
  display: grid; grid-template-columns: repeat(5,1fr); gap: 4px; margin-bottom: 4px;
}
.filter-btn {
  padding: 4px 2px; font-size: 9px; font-weight: 600; text-align: center;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-xs); cursor: pointer; color: var(--text-2);
  transition: all 0.12s; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.filter-btn:hover {
  background: var(--brand-soft); border-color: var(--brand); color: var(--brand);
}

/* Alignment guides (canvas overlay) */
.align-guide-h, .align-guide-v {
  position: absolute; background: var(--blue); z-index: 10; pointer-events: none;
  opacity: 0; transition: opacity 0.1s;
}
.align-guide-h { height: 1px; left: 0; right: 0; }
.align-guide-v { width: 1px; top: 0; bottom: 0; }
.align-guide-h.show, .align-guide-v.show { opacity: 1; }

/* ---- TEMPLATES GRID ---- */
.tpl-page { padding: 40px 48px; }
.tpl-title { font-family: var(--font-display); font-size: 28px; margin-bottom: 4px; }
.tpl-title em { font-style: italic; color: var(--brand); }
.tpl-desc { font-size: 14px; color: var(--text-2); margin-bottom: 24px; }

.tpl-filters {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 24px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
}
.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-3); margin-right: 2px; }

.tpl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.tpl-card {
  border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface); cursor: pointer;
  transition: all 0.2s var(--ease);
}
.tpl-card:hover { border-color: var(--border); box-shadow: var(--shadow-card); transform: translateY(-2px); }
.tpl-thumb { height: 180px; overflow: hidden; position: relative; }
.tpl-thumb canvas { width: 100%; height: 100%; object-fit: cover; }
.tpl-info { padding: 14px; }
.tpl-info h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.tpl-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.tpl-tag {
  font-size: 10.5px; padding: 3px 8px; border-radius: 10px;
  border: 1px solid var(--border); color: var(--text-3);
}

/* ---- COMMUNITY ---- */
.comm-page { padding: 40px 48px; }
.comm-header { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }
.comm-card {
  border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface);
  transition: all 0.2s var(--ease);
}
.comm-card:hover { box-shadow: var(--shadow-card); }
.comm-thumb { height: 160px; overflow: hidden; cursor: pointer; }
.comm-thumb canvas { width: 100%; height: 100%; object-fit: cover; }
.comm-body { padding: 12px 14px; }
.comm-body h4 { font-size: 13.5px; font-weight: 600; }
.comm-body .comm-tags { display: flex; gap: 4px; margin-top: 6px; }
.comm-author { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; }
.comm-author-dot { width: 18px; height: 18px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 8px; font-weight: 700; color: #fff; }
.comm-author span:last-child { color: var(--text-3); }
.comm-footer {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; border-top: 1px solid var(--border-light);
}
.comm-likes { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-3); cursor: pointer; border: 1px solid var(--border-light); border-radius: 16px; padding: 4px 12px; background: none; font-family: var(--font); transition: all 0.15s; }
.comm-likes:hover { border-color: var(--danger); color: var(--danger); }
.comm-likes.liked { border-color: var(--danger); color: var(--danger); background: rgba(197,48,48,0.05); }

/* ---- PROJECTS ---- */
.proj-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.proj-card {
  border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface);
  transition: all 0.2s var(--ease); cursor: pointer;
}
.proj-card:hover { box-shadow: var(--shadow-card); transform: translateY(-1px); }
.proj-thumb { height: 160px; background: var(--bg-warm); overflow: hidden; display: flex; align-items: center; justify-content: center; }
.proj-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }
.proj-body { padding: 14px; }
.proj-body h4 { font-size: 14px; font-weight: 600; }
.proj-body p { font-size: 12px; color: var(--text-3); margin-top: 3px; }
.proj-actions { display: flex; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--border-light); }

/* ---- EMPTY STATE ---- */
.empty { text-align: center; padding: 64px 24px; }
.empty svg { margin-bottom: 12px; color: var(--border); }
.empty h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.empty p { font-size: 14px; color: var(--text-2); margin-bottom: 20px; }

/* ---- MODAL ---- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.35);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; backdrop-filter: blur(4px);
  opacity: 0; visibility: hidden; transition: all 0.2s var(--ease);
}
.modal-overlay.show { opacity: 1; visibility: visible; }
.modal-card {
  background: var(--surface); border-radius: var(--radius-xl);
  padding: 36px; width: 400px; max-width: 92vw;
  box-shadow: var(--shadow-lg); position: relative;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s var(--ease);
}
.modal-overlay.show .modal-card { transform: translateY(0) scale(1); }
.modal-close {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px; border-radius: 50%;
  border: none; background: var(--bg); cursor: pointer;
  font-size: 16px; color: var(--text-2); display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }
.modal-title { font-family: var(--font-display); font-size: 24px; margin-bottom: 6px; }
.modal-title em { font-style: italic; color: var(--brand); }
.modal-desc { font-size: 13.5px; color: var(--text-2); margin-bottom: 20px; }

.auth-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 18px 0; font-size: 11.5px; color: var(--text-3);
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-form { display: flex; flex-direction: column; gap: 10px; }

/* ---- TOAST ---- */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast-item {
  background: var(--accent); color: #fff; padding: 12px 20px;
  border-radius: var(--radius); font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); animation: toastIn 0.3s var(--ease);
  font-family: var(--font);
}
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Aspect ratio selector */
.ratio-grid { display: flex; gap: 6px; flex-wrap: wrap; }
.ratio-opt {
  padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-xs);
  font-size: 11px; font-weight: 600; cursor: pointer; font-family: var(--font-mono);
  transition: all 0.15s; background: var(--surface); color: var(--text-2);
}
.ratio-opt:hover { border-color: var(--text-3); }
.ratio-opt.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Pattern swatches */
.pattern-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.pat-swatch {
  aspect-ratio: 1; border: 2px solid var(--border); border-radius: var(--radius-xs);
  cursor: pointer; overflow: hidden; transition: border-color 0.15s;
}
.pat-swatch:hover { border-color: var(--brand); }
.pat-swatch.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(28,27,24,0.1); }
.pat-swatch canvas { width: 100%; height: 100%; }

/* Shapes list */
.shapes-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.shape-btn {
  aspect-ratio: 1; border: 1px solid var(--border); border-radius: var(--radius-xs);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  background: var(--surface); transition: all 0.15s; color: var(--text-2);
}
.shape-btn:hover { background: var(--bg); color: var(--text); border-color: var(--brand); }
.shape-btn svg { width: 20px; height: 20px; }

/* Search input */
.search-field {
  padding: 9px 14px 9px 36px; border: 1px solid var(--border);
  border-radius: 20px; font-size: 13px; font-family: var(--font);
  background: var(--surface); color: var(--text); width: 260px;
  outline: none; transition: all 0.15s;
}
.search-field:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(28,27,24,0.06); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 15px; height: 15px; }

/* User menu dropdown */
.user-menu {
  position: fixed; bottom: 60px; left: 16px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 4px; min-width: 180px;
  z-index: 200; display: none;
}
.user-menu.show { display: block; }
.um-item {
  display: flex; align-items: center; gap: 8px; padding: 9px 12px;
  font-size: 13px; border-radius: var(--radius-xs); cursor: pointer;
  border: none; background: none; width: 100%; text-align: left;
  font-family: var(--font); color: var(--text); transition: background 0.1s;
}
.um-item:hover { background: var(--bg); }
.um-item.danger { color: var(--danger); }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .sidebar { display: none; }
  .qr-layout { grid-template-columns: 1fr; }
  .card-editor-layout { grid-template-columns: 1fr; }
  .home-hero, .home-cards, .home-section, .qr-page, .tpl-page, .comm-page { padding-left: 20px; padding-right: 20px; }
}

/* ======================================================
   HOME V2 — Reforma visual espectacular
   ====================================================== */
.home-v2 { --hv2-max: 1100px; }

/* Hero */
.hv2-hero {
  position: relative; min-height: 540px; display: flex; align-items: center;
  overflow: hidden;
  background: linear-gradient(135deg, #1C1B18 0%, #2D2B24 55%, #3D3520 100%),
    url('data/assets/hero-alt.jpg') center/cover no-repeat;
  background-blend-mode: multiply;
}
.hv2-hero-bg {
  position: absolute; inset: 0; background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.5s ease;
}
.hv2-hero-bg.loaded { opacity: 0.38; }
.hv2-hero::before {
  content: ''; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(135deg, rgba(28,27,24,.96) 0%, rgba(28,27,24,.72) 50%, rgba(28,27,24,.45) 100%);
}
.hv2-hero-content { position: relative; z-index: 2; padding: 88px 64px; max-width: 640px; }
.hv2-badge {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 2px; color: var(--brand); border: 1px solid rgba(184,134,11,.4);
  padding: 4px 14px; border-radius: 20px; margin-bottom: 22px;
}
.hv2-title {
  font-family: var(--font-display); font-size: 64px; font-weight: 400; color: #fff;
  line-height: 1.05; letter-spacing: -2px; margin-bottom: 18px;
}
.hv2-title em { font-style: italic; color: var(--brand); }
.hv2-sub {
  font-size: 15.5px; color: rgba(255,255,255,.58); line-height: 1.65;
  margin-bottom: 32px; max-width: 490px;
}
.hv2-cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 52px; }
.hv2-btn-main { background: var(--brand) !important; border-color: var(--brand) !important; }
.hv2-btn-ghost {
  background: rgba(255,255,255,.08) !important; border-color: rgba(255,255,255,.18) !important;
  color: #fff !important; backdrop-filter: blur(8px);
}
.hv2-btn-ghost:hover { background: rgba(255,255,255,.15) !important; }
.hv2-stats { display: flex; gap: 44px; }
.hv2-stat-n {
  display: block; font-family: var(--font-display); font-size: 38px;
  font-weight: 500; color: #fff; line-height: 1;
}
.hv2-stat-l {
  font-size: 10px; color: rgba(255,255,255,.38); text-transform: uppercase;
  letter-spacing: 1px; margin-top: 3px; display: block;
}
.hv2-hero-visual {
  position: absolute; right: 72px; top: 50%; transform: translateY(-50%);
  z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 16px;
}
.hv2-qr-glass {
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.12);
  border-radius: 20px; padding: 20px; backdrop-filter: blur(16px);
}
.hv2-try-btn {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.16); color: #fff;
  padding: 8px 20px; border-radius: 20px; font-size: 12px; cursor: pointer;
  backdrop-filter: blur(8px); font-family: var(--font); transition: background .15s;
}
.hv2-try-btn:hover { background: rgba(255,255,255,.16); }

/* Features (3 col) */
.hv2-features { background: var(--bg-warm); padding: 64px 48px; }
.hv2-feat-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 20px;
  max-width: var(--hv2-max); margin: 0 auto;
}
.hv2-feat {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius-lg); padding: 28px 24px; cursor: pointer;
  transition: all .2s var(--ease); position: relative; overflow: hidden;
}
.hv2-feat::after {
  content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px;
  background: var(--brand); transform: scaleX(0); transition: transform .2s var(--ease); transform-origin: left;
}
.hv2-feat:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.hv2-feat:hover::after { transform: scaleX(1); }
.hv2-feat-icon {
  width: 44px; height: 44px; border-radius: var(--radius); background: var(--brand-soft);
  display: flex; align-items: center; justify-content: center; margin-bottom: 18px; color: var(--brand);
}
.hv2-feat h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; letter-spacing: -.2px; }
.hv2-feat p { font-size: 12.5px; color: var(--text-2); line-height: 1.65; }
.hv2-feat-arrow {
  display: inline-block; margin-top: 16px; font-size: 12px; font-weight: 600;
  color: var(--brand); opacity: 0; transition: opacity .2s;
}
.hv2-feat:hover .hv2-feat-arrow { opacity: 1; }

/* Tools section */
.hv2-tools-wrap { padding: 64px 48px; background: var(--surface); }
.hv2-tools-inner { max-width: var(--hv2-max); margin: 0 auto; }
.hv2-section-hdr { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.hv2-section-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: var(--text-3);
}
.hv2-tools-grid {
  display: grid; grid-template-columns: 1fr 1fr;
  grid-template-rows: auto auto; gap: 20px;
}
.hv2-tc {
  border: 1px solid var(--border-light); border-radius: var(--radius-lg);
  overflow: hidden; background: var(--surface); cursor: pointer; transition: all .2s var(--ease);
}
.hv2-tc:hover { box-shadow: var(--shadow-md); border-color: var(--border); }
.hv2-tc-preview {
  height: 190px; background: var(--bg-warm);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.hv2-tc-info { padding: 18px 20px; border-top: 1px solid var(--border-light); }
.hv2-tc-info h3 { font-size: 15px; font-weight: 600; margin-bottom: 4px; letter-spacing: -.2px; }
.hv2-tc-info p { font-size: 12px; color: var(--text-2); }
.hv2-tc.span2 { grid-column: span 2; }
.hv2-tc.span2 .hv2-tc-preview { height: 140px; }

/* Community marquee */
.hv2-marquee-section { background: var(--bg-warm); padding: 48px 0; overflow: hidden; }
.hv2-marquee-hdr {
  text-align: center; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 2px; color: var(--text-3); margin-bottom: 24px; padding: 0 48px;
}
.hv2-mq-track {
  display: flex; gap: 16px; animation: hv2Scroll 32s linear infinite; width: max-content; padding: 0 8px;
}
.hv2-mq-track:hover { animation-play-state: paused; }
@keyframes hv2Scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
.hv2-mq-item {
  width: 200px; height: 130px; border-radius: var(--radius); overflow: hidden;
  flex-shrink: 0; background: var(--surface); border: 1px solid var(--border-light);
}

/* Support / donate */
.hv2-support-wrap { padding: 0 48px 64px; }
.hv2-support-card {
  display: flex; align-items: center; gap: 24px;
  background: linear-gradient(135deg, #FDF6E6 0%, #FBF0D8 100%);
  border: 1px solid rgba(184,134,11,.18); border-radius: var(--radius-lg); padding: 28px 32px;
}
.hv2-support-emoji { font-size: 32px; flex-shrink: 0; line-height: 1; }
.hv2-support-text { flex: 1; }
.hv2-support-text h3 { font-size: 15px; font-weight: 600; margin-bottom: 5px; }
.hv2-support-text p { font-size: 12.5px; color: var(--text-2); line-height: 1.55; }
.hv2-support-btn {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 22px; border-radius: var(--radius-sm); font-size: 13px;
  font-weight: 600; background: var(--brand); color: #fff; border: none;
  cursor: pointer; text-decoration: none; font-family: var(--font);
  transition: opacity .15s; white-space: nowrap;
}
.hv2-support-btn:hover { opacity: .88; }

/* Recents */
.hv2-recents-wrap { padding: 0 48px 64px; max-width: var(--hv2-max); margin: 0 auto; }

/* ── REFINEMENTS — Opus 4.7 × Dieter Rams × Apple ──────────────────── */

/* Badge: gold dot accent */
.hv2-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px 6px 12px; border: 1px solid var(--border);
  border-radius: 100px; background: rgba(255,255,255,0.07);
  backdrop-filter: blur(8px);
  font-size: 10px; font-weight: 500; letter-spacing: 1.8px;
  text-transform: uppercase; color: rgba(255,255,255,0.55); line-height: 1;
}
.hv2-badge::before {
  content: ''; width: 5px; height: 5px; border-radius: 50%;
  background: var(--brand); box-shadow: 0 0 0 3px rgba(184,134,11,0.22); flex-shrink: 0;
}

/* Title: 56px, tighter */
.hv2-title { font-size: 56px; letter-spacing: -2px; line-height: 1.02; }

/* Subtitle: refined */
.hv2-sub {
  font-size: 15px; max-width: 460px; opacity: 0.6; line-height: 1.72;
  margin-bottom: 36px; font-weight: 400;
}

/* Buttons: Apple pill style */
.hv2-btn-main, .hv2-btn-ghost {
  padding: 14px 28px !important; border-radius: 100px !important;
  font-size: 14px !important; font-weight: 500 !important;
  letter-spacing: -0.1px; line-height: 1 !important;
  transition: all 0.25s cubic-bezier(0.4,0,0.2,1) !important;
}
.hv2-btn-main { background: var(--brand) !important; border-color: var(--brand) !important; color: #fff !important; }
.hv2-btn-main:hover { filter: brightness(1.08); transform: translateY(-1px); }
.hv2-btn-ghost {
  background: rgba(255,255,255,0.07) !important; border: 1px solid rgba(255,255,255,0.16) !important;
  color: rgba(255,255,255,0.85) !important; backdrop-filter: blur(8px);
}
.hv2-btn-ghost:hover { background: rgba(255,255,255,0.14) !important; border-color: rgba(255,255,255,0.28) !important; }

/* Stats: tabular, elegant */
.hv2-stat-n {
  font-size: 40px; font-variant-numeric: tabular-nums;
  letter-spacing: -1.5px; font-weight: 400;
}
.hv2-stat-l { font-size: 9px; letter-spacing: 2px; opacity: 0.35; margin-top: 5px; font-weight: 500; }
.hv2-stats { gap: 40px; padding-top: 4px; border-top: 1px solid rgba(255,255,255,0.08); }

/* Feature cards: ring-focus hover instead of bottom bar */
.hv2-feat {
  padding: 32px; border: 1px solid var(--border-light);
  transition: box-shadow 0.28s cubic-bezier(0.4,0,0.2,1), transform 0.28s ease, border-color 0.28s ease;
  position: relative;
}
.hv2-feat::after { display: none; }
.hv2-feat:hover { box-shadow: 0 0 0 1.5px var(--brand), 0 8px 32px rgba(184,134,11,0.08); border-color: transparent; transform: translateY(-2px); }

/* Feature icon: gradient warm pill */
.hv2-feat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand-soft) 0%, rgba(245,239,224,0.4) 100%);
  margin-bottom: 22px;
}
.hv2-feat h3 { font-size: 15px; letter-spacing: -0.3px; margin: 0 0 10px; line-height: 1.3; }
.hv2-feat p { font-size: 13px; line-height: 1.7; margin: 0 0 18px; opacity: 0.88; }
.hv2-feat-arrow { font-size: 11px; letter-spacing: 0.5px; text-transform: uppercase; display: inline-flex; align-items: center; gap: 6px; transition: gap 0.22s ease, opacity 0.22s ease; }
.hv2-feat:hover .hv2-feat-arrow { gap: 10px; }

/* Section labels: gold accent */
.hv2-section-label { font-size: 9px; letter-spacing: 3px; color: var(--brand); margin-bottom: 20px; }

/* Tools cards refinement */
.hv2-tc { transition: box-shadow 0.22s var(--ease), border-color 0.22s var(--ease), transform 0.22s var(--ease); }
.hv2-tc:hover { box-shadow: 0 0 0 1.5px var(--brand), 0 8px 24px rgba(184,134,11,0.06); border-color: transparent; transform: translateY(-2px); }
.hv2-tc-info h3 { letter-spacing: -0.3px; }

/* Support card: clean Rams — no gradient, just precision */
.hv2-support-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px 32px;
  box-shadow: 0 1px 2px rgba(28,27,24,0.04);
  transition: box-shadow 0.22s ease;
}
.hv2-support-card:hover { box-shadow: 0 4px 20px rgba(28,27,24,0.06); }

/* Marquee: edge fade with mask */
.hv2-marquee-section {
  -webkit-mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
  mask-image: linear-gradient(to right, transparent 0%, black 8%, black 92%, transparent 100%);
}
.hv2-mq-item { border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,0.06); border: 1px solid var(--border-light); }

/* Hero subtle grid overlay (Rams-like) */
.hv2-hero::after {
  content: ''; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image: linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 60px 60px;
  opacity: 0.6;
}

/* Feature section texture background */
.hv2-features {
  background-color: var(--bg-warm);
  background-image: url('data/assets/feat-texture.jpg');
  background-size: 400px 400px;
  background-blend-mode: multiply;
  background-repeat: repeat;
}

/* Hero content fade-in (Apple page aesthetic) */
@keyframes hv2FadeUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hv2-hero-content { animation: hv2FadeUp 0.9s cubic-bezier(0.4,0,0.2,1) both; }
.hv2-badge         { animation: hv2FadeUp 0.7s 0.1s cubic-bezier(0.4,0,0.2,1) both; }
.hv2-title         { animation: hv2FadeUp 0.7s 0.18s cubic-bezier(0.4,0,0.2,1) both; }
.hv2-sub           { animation: hv2FadeUp 0.7s 0.26s cubic-bezier(0.4,0,0.2,1) both; }
.hv2-cta-row       { animation: hv2FadeUp 0.7s 0.34s cubic-bezier(0.4,0,0.2,1) both; }
.hv2-stats         { animation: hv2FadeUp 0.7s 0.46s cubic-bezier(0.4,0,0.2,1) both; }
.hv2-hero-visual   { animation: hv2FadeUp 0.9s 0.3s cubic-bezier(0.4,0,0.2,1) both; }

/* Feature cards staggered entry */
@keyframes hv2SlideUp {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}
.hv2-feat { animation: hv2SlideUp 0.6s cubic-bezier(0.4,0,0.2,1) both; }
.hv2-feat:nth-child(1) { animation-delay: 0.05s; }
.hv2-feat:nth-child(2) { animation-delay: 0.15s; }
.hv2-feat:nth-child(3) { animation-delay: 0.25s; }

/* Recents section refinement */
.hv2-recents-wrap .hv2-section-label { margin-bottom: 20px; }

/* Responsive home-v2 */
@media (max-width: 1020px) {
  .hv2-hero-visual { display: none; }
  .hv2-title { font-size: 46px; letter-spacing: -1.5px; }
  .hv2-hero-content { padding: 60px 24px 56px; }
  .hv2-feat-grid { grid-template-columns: 1fr; }
  .hv2-tools-grid { grid-template-columns: 1fr; }
  .hv2-tc.span2 { grid-column: span 1; }
  .hv2-features { padding-left: 20px; padding-right: 20px; }
  .hv2-tools-wrap { padding-left: 20px; padding-right: 20px; }
  .hv2-support-wrap { padding-left: 20px; padding-right: 20px; }
  .hv2-recents-wrap { padding-left: 20px; padding-right: 20px; }
  .hv2-support-card { flex-direction: column; text-align: center; }
  .hv2-stats { gap: 24px; border-top: none; }
  .hv2-stat-n { font-size: 30px; }
  .hv2-cta-row { flex-direction: column; }
  .hv2-btn-main, .hv2-btn-ghost { width: 100% !important; justify-content: center; }
}
