:root {
  --bg: #0e1116;
  --panel: #161b23;
  --panel-2: #1c222c;
  --line: #262e3b;
  --text: #e8ecf2;
  --muted: #8b96a6;
  --accent: #4f8cff;
  --radius: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  font-size: 14px;
}

.topbar {
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.topbar-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #16324f, #2e86ab);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.15);
  position: relative;
}

.logo-mark::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #f18f01;
  top: 8px;
  left: 13px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.brand p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin: -8px 0 16px;
}

input[type="text"],
select {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--accent);
}

.color-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

input[type="color"] {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: none;
  cursor: pointer;
  flex-shrink: 0;
}

.hex-field {
  flex: 1;
}

.hex-field span {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 2px;
}

.hex-field input {
  font-family: "SF Mono", Consolas, monospace;
  font-size: 13px;
  padding: 8px 10px;
  cursor: pointer;
}

.tpl-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tpl-btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.tpl-btn:hover { border-color: var(--accent); }

.tpl-btn.active {
  border-color: var(--accent);
  background: rgba(79, 140, 255, 0.12);
  color: #a8c6ff;
  font-weight: 600;
}

.stage .toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}

.tabs {
  display: flex;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
  gap: 4px;
}

.stage-tab {
  background: none;
  border: none;
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}

.stage-tab.active {
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.btn:hover { border-color: var(--accent); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn-primary:hover { background: #3d7df0; }

.btn-sm { padding: 6px 10px; font-size: 12px; }

.btn-ghost { background: none; }

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

.preview-stage {
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.bg-light { background: #f6f6f4; }
.bg-dark { background: #0a0c10; }
.bg-check {
  background: repeating-conic-gradient(#e4e4e4 0% 25%, #f7f7f7 0% 50%) 0 0 / 22px 22px;
}

#preview {
  display: flex;
  justify-content: center;
  width: 100%;
}

#preview svg {
  max-width: 100%;
  max-height: 520px;
  width: auto;
  height: auto;
}

.brandkit { margin-top: 24px; }

.brandkit h3 {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.kit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 18px;
}

.swatch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 8px;
}

.swatch-color {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.swatch-meta {
  flex: 1;
}

.swatch-meta span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

.swatch-meta code {
  font-size: 13px;
  font-weight: 600;
}

.kit-text p {
  margin: 0 0 8px;
  line-height: 1.55;
}

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