:root {
  color-scheme: dark;
  --bg: #0f0f10;
  --surface: #19191b;
  --surface-2: #232326;
  --border: #2c2c2f;
  --text: #f4f4f5;
  --muted: #afb0b6;
  --accent: #e60000;
  --accent-2: #a30000;
  --success: #34d399;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  --radius: 18px;
  --radius-sm: 12px;
  --gap: 1rem;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at top, #202022, #0d0d0f 65%);
  color: var(--text);
}

body {
  padding: 20px;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input,
textarea,
select {
  width: 100%;
  margin-top: 0.4rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #111113;
  color: var(--text);
  padding: 0.75rem 0.85rem;
}

input[type='checkbox'] {
  width: auto;
  min-width: 1rem;
  height: 1rem;
  margin-top: 0.85rem;
  padding: 0;
  accent-color: var(--accent);
}

textarea {
  resize: vertical;
}

.app-shell {
  max-width: 1600px;
  margin: 0 auto;
}

.topbar,
.status-grid,
.tabs,
.workspace,
.footer {
  margin-bottom: 1rem;
}

.topbar {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.1rem;
  background: rgba(24, 24, 26, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.brand-logo {
  width: 62px;
  height: 62px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: #0f0f10;
}

.eyebrow {
  margin: 0 0 0.2rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.subtitle {
  margin-bottom: 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.primary,
.ghost,
.danger,
.file-label {
  border-radius: 999px;
  padding: 0.75rem 1rem;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}

.primary:hover,
.ghost:hover,
.danger:hover,
.file-label:hover {
  transform: translateY(-1px);
}

.primary {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: white;
}

.ghost,
.file-label {
  background: #121214;
  color: var(--text);
  border: 1px solid var(--border);
}

.danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fecaca;
  border: 1px solid rgba(239, 68, 68, 0.4);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.status-card,
.editor-card {
  background: rgba(24, 24, 26, 0.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.status-card {
  padding: 1rem;
}

.status-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
}

.status-card strong {
  font-size: 1.2rem;
}

.tabs {
  display: inline-flex;
  gap: 0.5rem;
  padding: 0.45rem;
  background: rgba(24, 24, 26, 0.92);
  border: 1px solid var(--border);
  border-radius: 999px;
}

.tab {
  padding: 0.75rem 1rem;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.tab.active {
  color: var(--text);
  background: rgba(230, 0, 0, 0.18);
  border: 1px solid rgba(230, 0, 0, 0.4);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 1rem;
}

.main-column,
.side-column {
  min-width: 0;
}

.panel {
  display: none;
  padding: 1rem;
  background: rgba(19, 19, 21, 0.85);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel.active {
  display: block;
}

.panel-head,
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.two-up {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 1rem;
}

.cards {
  display: grid;
  gap: 0.85rem;
}

.product-card {
  padding: 1rem;
  background: linear-gradient(180deg, rgba(33, 33, 36, 0.92), rgba(23, 23, 25, 0.92));
  border: 1px solid var(--border);
  border-radius: 18px;
}

.product-card.active {
  outline: 2px solid rgba(230, 0, 0, 0.6);
}

.product-top {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  background: rgba(230, 0, 0, 0.18);
  color: #ffd8d8;
  font-size: 0.8rem;
}

.muted {
  color: var(--muted);
}

.editor-card {
  padding: 1rem;
}

.stacked-form {
  display: grid;
  gap: 0.85rem;
}

.stacked-form label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.92rem;
}

.checkbox-row {
  display: flex !important;
  align-items: center;
  gap: 0.6rem;
}

.form-actions.tight {
  margin-top: 0.35rem;
  justify-content: space-between;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.field-grid .full {
  grid-column: 1 / -1;
}

.form-actions {
  margin-top: 1rem;
  justify-content: flex-start;
}

.preview-card {
  overflow: hidden;
}

.preview-stage {
  --preview-bg: var(--bg);
  --preview-surface: var(--surface);
  --preview-accent: var(--accent);
  --preview-text: var(--text);
  --preview-border: var(--border);
  display: grid;
  gap: 0.85rem;
  padding: 1rem;
  border-radius: 18px;
  background: var(--preview-bg);
  border: 1px solid var(--preview-border);
}

.preview-hero {
  padding: 1.1rem;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid rgba(255,255,255,0.06);
}

.preview-announcement {
  margin-bottom: 0.5rem;
  color: var(--preview-accent);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
}

.preview-hero h4 {
  font-size: 2rem;
  line-height: 0.95;
  margin-bottom: 0.7rem;
}

.preview-hero p {
  color: rgba(255,255,255,0.82);
}

.preview-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.preview-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  border: 1px solid transparent;
}

.preview-cta.primary {
  background: var(--preview-accent);
  color: white;
}

.preview-cta.secondary {
  background: transparent;
  border-color: rgba(255,255,255,0.18);
  color: var(--preview-text);
}

.preview-product {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 0.8rem;
  align-items: center;
  padding: 0.85rem;
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
}

.preview-swatch {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.12);
}

.preview-footer {
  padding: 0.85rem;
  border-radius: 16px;
  background: rgba(255,255,255,0.04);
}

.diff-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.diff-list,
.help-list {
  padding-left: 1.2rem;
  margin-bottom: 0;
}

.timeline {
  display: grid;
  gap: 0.6rem;
  max-height: 520px;
  overflow: auto;
  padding-right: 0.2rem;
}

.timeline-item {
  text-align: left;
  width: 100%;
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--text);
}

.timeline-item.active {
  border-color: rgba(230, 0, 0, 0.7);
  background: rgba(230, 0, 0, 0.14);
}

.timeline-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 0.35rem;
}

.timeline-title {
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.timeline-core {
  font-size: 0.85rem;
  color: var(--muted);
}

.compact + .compact {
  margin-top: 1rem;
}

.footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 1180px) {
  .workspace,
  .two-up,
  .status-grid,
  .diff-columns {
    grid-template-columns: 1fr 1fr;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .side-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
  }
}

@media (max-width: 760px) {
  body {
    padding: 12px;
  }

  .topbar,
  .panel-head,
  .footer,
  .form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .status-grid,
  .two-up,
  .field-grid,
  .diff-columns,
  .side-column {
    grid-template-columns: 1fr;
  }

  .tabs {
    width: 100%;
    justify-content: space-between;
  }

  .tab {
    flex: 1;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-logo {
    width: 52px;
    height: 52px;
  }
}
