:root {
  --bg: #131619;
  --bg-alt: #1b2127;
  --panel: rgba(17, 22, 28, 0.9);
  --panel-strong: rgba(24, 30, 37, 0.95);
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #ecf0e9;
  --muted: #a6b2ab;
  --accent: #ee7d2d;
  --accent-cool: #79b6b6;
  --danger: #d95c4e;
  --success: #67c58c;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  --radius: 22px;
  --font: "Bahnschrift", "Trebuchet MS", "Segoe UI Variable Text", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(238, 125, 45, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(121, 182, 182, 0.12), transparent 20%),
    linear-gradient(180deg, #0d1012 0%, #151a1f 100%);
  color: var(--text);
  font-family: var(--font);
}

body {
  padding: 32px;
}

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

button {
  cursor: pointer;
  border: 0;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 12px 14px;
  color-scheme: dark;
  transition: border-color 160ms ease, background 160ms ease;
}

select option {
  background: #1b2127;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.08);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 8px;
}

label > span {
  color: var(--muted);
  font-size: 0.92rem;
}

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

.hero,
.panel {
  backdrop-filter: blur(14px);
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  gap: 24px;
  grid-template-columns: 1.4fr 1fr;
  padding: 30px;
  border-radius: 30px;
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -12% -55% 35%;
  height: 280px;
  background: linear-gradient(90deg, rgba(238, 125, 45, 0.22), rgba(121, 182, 182, 0));
  transform: rotate(-10deg);
}

.eyebrow,
.panel-kicker {
  margin: 0 0 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-cool);
  font-size: 0.78rem;
}

.hero h1,
.panel h2,
.section-heading h3,
.empty-state h3 {
  margin: 0;
}

.hero h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 0.94;
  max-width: 14ch;
}

.hero-text {
  max-width: 65ch;
  color: var(--muted);
  line-height: 1.55;
}

.hero-copy,
.hero-side {
  position: relative;
  z-index: 1;
}

.hero-copy {
  display: grid;
  align-content: start;
  gap: 14px;
}

.hero-text-logo {
  width: min(240px, 60%);
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0, 0, 0, 0.35));
}

.hero-side {
  display: grid;
  gap: 18px;
  align-content: start;
}

.hero-logo-frame {
  display: flex;
  justify-content: flex-end;
  align-items: start;
  padding: 12px 8px 0;
}

.hero-main-logo {
  width: min(100%, 360px);
  max-height: 280px;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 35px rgba(0, 0, 0, 0.45));
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-content: start;
  justify-content: flex-end;
  position: relative;
  z-index: 1;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  border-radius: 999px;
  padding: 12px 18px;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.small-btn {
  padding: 10px 14px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  padding: 0;
}

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

.primary-btn {
  background: linear-gradient(135deg, #ee7d2d, #ffb348);
  color: #141414;
  font-weight: 700;
}

.ghost-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--line);
}

.danger-btn {
  background: rgba(217, 92, 78, 0.12);
  color: #ffd4cf;
  border: 1px solid rgba(217, 92, 78, 0.28);
}

.workspace,
.footer-grid {
  display: grid;
  gap: 24px;
}

.workspace {
  grid-template-columns: 280px 340px minmax(0, 1fr);
  margin-bottom: 24px;
}

.footer-grid {
  grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.6fr) minmax(320px, 0.8fr);
}

.panel {
  border-radius: var(--radius);
  padding: 22px;
}

.panel-header,
.section-heading,
.inline-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-header,
.inline-actions {
  flex-wrap: wrap;
  align-items: flex-start;
}

.section-heading {
  align-items: start;
  margin-bottom: 14px;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  max-width: 52ch;
}

.helper-text {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.component-source-panel {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  padding: 14px;
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.component-source-header h3 {
  margin: 0;
}

.component-source-preview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  max-height: 220px;
  overflow: auto;
}

.component-source-file {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.35;
  word-break: break-word;
  text-align: left;
}

.component-source-file.active {
  border-color: rgba(103, 197, 140, 0.32);
  background: rgba(103, 197, 140, 0.1);
}

.component-source-file.selected {
  border-color: rgba(238, 125, 45, 0.42);
  background: linear-gradient(135deg, rgba(238, 125, 45, 0.14), rgba(255, 255, 255, 0.04));
}

.component-source-file-title {
  font-weight: 700;
}

.component-source-file-meta {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 4px;
}

.stack-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.list-card {
  border-radius: 16px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  padding: 14px 16px;
  display: grid;
  gap: 6px;
  text-align: left;
}

.list-card:hover {
  border-color: var(--line-strong);
}

.list-card.active {
  border-color: rgba(238, 125, 45, 0.55);
  background: linear-gradient(135deg, rgba(238, 125, 45, 0.16), rgba(255, 255, 255, 0.04));
}

.card-title {
  font-weight: 700;
}

.card-subtitle {
  color: var(--muted);
  font-size: 0.92rem;
}

.empty-list {
  color: var(--muted);
  line-height: 1.5;
  padding: 14px;
  border-radius: 16px;
  border: 1px dashed var(--line-strong);
}

.editor-form {
  display: grid;
  gap: 18px;
}

.form-section {
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  padding: 18px;
}

.accent-section {
  background:
    linear-gradient(135deg, rgba(238, 125, 45, 0.08), transparent 35%),
    var(--panel-strong);
}

.field-grid,
.component-grid,
.customization-grid,
.meta-columns {
  display: grid;
  gap: 14px;
}

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

.component-grid {
  grid-template-columns: 2fr 0.8fr 0.9fr 0.9fr;
  align-items: end;
}

.meta-columns {
  grid-template-columns: 320px minmax(0, 1fr);
}

.customization-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 100%;
  border-radius: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.checkbox-field input {
  width: auto;
  margin: 0;
}

.checkbox-field span {
  color: var(--text);
}

.token-editor,
.component-list,
.validation-list,
.saved-projects-list {
  display: grid;
  gap: 12px;
}

.token-row,
.component-card,
.validation-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.token-row {
  padding: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.attachment-fields {
  display: grid;
  gap: 10px;
}

.stacked-field {
  display: grid;
  gap: 10px;
}

.component-card {
  padding: 14px;
  display: grid;
  gap: 12px;
}

.validation-card {
  padding: 14px 16px;
  line-height: 1.5;
}

.validation-card.good {
  border-color: rgba(103, 197, 140, 0.28);
  background: rgba(103, 197, 140, 0.1);
}

.validation-card.bad {
  border-color: rgba(217, 92, 78, 0.32);
  background: rgba(217, 92, 78, 0.1);
}

.empty-state {
  border-radius: 18px;
  padding: 28px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
}

.empty-state p {
  margin-bottom: 0;
}

.save-controls {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.library-brand {
  display: flex;
  justify-content: center;
  padding: 8px 0 18px;
}

.library-brand-logo {
  width: min(220px, 100%);
  height: auto;
  object-fit: contain;
  opacity: 0.92;
  filter: drop-shadow(0 12px 26px rgba(0, 0, 0, 0.3));
}

.save-status {
  margin: 0;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  line-height: 1.45;
}

.save-status.dirty {
  border-color: rgba(238, 125, 45, 0.28);
  background: rgba(238, 125, 45, 0.1);
  color: #ffd3af;
}

.save-status.clean {
  border-color: rgba(103, 197, 140, 0.24);
  background: rgba(103, 197, 140, 0.1);
  color: #caedd8;
}

.saved-project-card {
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  padding: 14px;
  display: grid;
  gap: 12px;
}

.saved-project-card.active {
  border-color: rgba(121, 182, 182, 0.4);
  background: linear-gradient(135deg, rgba(121, 182, 182, 0.14), rgba(255, 255, 255, 0.04));
}

.saved-project-title {
  font-weight: 700;
}

.saved-project-meta {
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.saved-project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.validation-panel {
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 16px;
}

.panel-footer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

@media (max-width: 1180px) {
  .workspace,
  .footer-grid,
  .hero,
  .meta-columns,
  .field-grid,
  .component-grid,
  .customization-grid {
    grid-template-columns: 1fr;
  }

  .toolbar {
    justify-content: start;
  }
}

@media (max-width: 720px) {
  body {
    padding: 18px;
  }

  .hero,
  .panel {
    padding: 18px;
  }
}
