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

:root {
  --bg:         #0a0a0e;
  --surface:    #14141a;
  --surface-2:  #1a1a22;
  --line:       #26262f;
  --t1:         #f5f5f7;
  --t2:         #c8c8d0;
  --t3:         #8a8a92;
  --accent:     #ef4444;
  --accent-soft: #ef444433;
  --radius:     12px;
  --radius-sm:  6px;
  --serif: 'Fraunces', Georgia, serif;
  --sans:  'Syne', system-ui, sans-serif;
  --body:  'DM Sans', system-ui, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;
}

body {
  font-family: var(--body);
  background: radial-gradient(circle at 10% -10%, #1a1a22, var(--bg) 60%);
  color: var(--t1);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

/* ─── Header ────────────────────────────────────────────────────── */
.app-header {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 24px;
  padding: 24px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 14, 0.6);
  backdrop-filter: blur(8px);
}
.brand {
  display: flex; align-items: center; gap: 14px;
}
.brand-logo {
  width: 36px; height: 36px;
  fill: var(--accent);
  filter: drop-shadow(0 4px 12px rgba(239, 68, 68, 0.35));
}
.brand-mark {
  font-family: var(--serif); font-weight: 700; font-size: 28px;
  letter-spacing: -0.02em;
  line-height: 1;
}
.brand-mark .dot { color: var(--accent); }
.brand-name {
  font-family: var(--sans); font-weight: 600; font-size: 14px;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--t2);
}
.brand-tagline {
  font-size: 13px; color: var(--t3); font-family: var(--mono);
}

/* ─── Layout ────────────────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  padding: 24px 32px 48px;
  align-items: start;
  max-width: 1600px;
  margin: 0 auto;
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.form-panel {
  position: sticky;
  top: 24px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
}
.form-panel h2 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--t3);
  margin: 24px 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}
.form-panel h2:first-child { margin-top: 0; }

/* ─── Form fields ───────────────────────────────────────────────── */
.field { margin-bottom: 16px; }
.field label {
  display: block; margin-bottom: 6px;
  font-size: 13px; font-weight: 500; color: var(--t2);
}
.field .hint {
  font-size: 11px; color: var(--t3); font-weight: 400;
  margin-left: 4px;
}
.field.row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.field.row .row-col { margin: 0; }

input[type="text"], input[type="file"], select {
  width: 100%;
  background: var(--bg);
  color: var(--t1);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: var(--body);
  font-size: 14px;
  transition: border-color .15s;
}
input[type="text"]:focus, select:focus, input[type="file"]:focus {
  outline: none;
  border-color: var(--accent);
}
input[type="color"] {
  width: 100%; height: 42px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 4px;
}
input[type="range"] {
  width: 100%; accent-color: var(--accent);
}
output {
  float: right; font-family: var(--mono); font-size: 12px; color: var(--t3);
}

/* Swatches */
.swatches {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.swatch {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--line);
  background: var(--color);
  cursor: pointer;
  transition: transform .12s, border-color .12s;
}
.swatch:hover { transform: scale(1.1); border-color: var(--t2); }

/* Segmented control */
.seg {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.seg-btn {
  background: transparent;
  color: var(--t3);
  border: 0;
  padding: 8px 6px;
  border-radius: 4px;
  font-family: var(--body);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.seg-btn:hover { color: var(--t2); }
.seg-btn.active {
  background: var(--accent);
  color: white;
}

/* Logo grid */
.logo-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
  padding: 6px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.logo-tile {
  aspect-ratio: 1;
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 6px;
  transition: border-color .12s, background .12s;
}
.logo-tile:hover { background: var(--surface); border-color: var(--t3); }
.logo-tile.selected { border-color: var(--accent); background: var(--surface); }
.logo-tile svg { width: 100%; height: 100%; fill: var(--t1); }

/* Upload preview */
.upload-preview {
  margin-top: 8px;
  padding: 12px;
  background: var(--bg);
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  min-height: 80px;
}
.upload-preview img { max-width: 100%; max-height: 80px; }

/* Actions */
.actions {
  display: flex; gap: 10px; margin-top: 20px;
}
.btn {
  flex: 1;
  background: var(--surface-2);
  color: var(--t1);
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { background: var(--line); border-color: var(--t3); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn-primary:hover {
  background: #f87171;
  border-color: #f87171;
}

/* ─── Preview ───────────────────────────────────────────────────── */
.preview-panel { padding: 16px; }
.preview-header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 8px 8px 16px;
}
.preview-header h2 {
  font-family: var(--sans); font-weight: 600;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.22em;
  color: var(--t3); margin: 0;
}
.zoom-info {
  font-family: var(--mono); font-size: 11px; color: var(--t3);
}
.preview-wrap {
  background: repeating-conic-gradient(#0c0c10 0% 25%, #16161e 0% 50%) 50% / 24px 24px;
  border-radius: var(--radius-sm);
  padding: 24px;
  display: flex; align-items: center; justify-content: center;
  min-height: 540px;
}
#preview-frame {
  width: 800px; max-width: 100%;
  aspect-ratio: 8/5;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
}
#preview-frame svg {
  width: 100%; height: 100%;
  display: block;
}
.preview-footer {
  padding: 16px 8px 4px;
  display: flex; justify-content: flex-end;
}
.status {
  font-family: var(--mono); font-size: 11px;
  color: var(--t3);
}
.status.working { color: #f59e0b; }
.status.ok { color: #22c55e; }
.status.err { color: var(--accent); }

/* Responsive */
@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .form-panel { position: static; max-height: none; }
  .preview-wrap { padding: 12px; }
}
