:root {
  --ls-red: #d91f1a;
  --ink: #151515;
  --muted: #6b6f76;
  --line: #dedede;
  --panel: #ffffff;
  --page: #f4f5f7;
  --soft: #f9fafb;
  --warning: #a46200;
  --error: #b42318;
  --ok: #1c7c45;
  --shadow: 0 18px 45px rgba(18, 18, 18, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 26px clamp(18px, 4vw, 44px) 18px;
  background: #111111;
  color: #ffffff;
}

.eyebrow {
  margin: 0 0 6px;
  color: #f7a5a2;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1;
}

h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

h3 {
  margin-bottom: 0;
  font-size: 15px;
}

.header-status,
.status-pill {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  padding: 8px 12px;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(420px, 1fr) minmax(280px, 340px);
  gap: 18px;
  padding: 22px clamp(14px, 3vw, 32px) 32px;
}

.panel,
.preview-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.controls-panel,
.summary-panel {
  padding: 20px;
  height: 94vh;
  overflow: auto;
}

.section-title p,
.preview-toolbar p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.field {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-row.single-field {
  grid-template-columns: 1fr;
}

label {
  color: #34363a;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #cfd3d8;
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--ls-red);
  box-shadow: 0 0 0 3px rgba(217, 31, 26, 0.13);
}

textarea {
  resize: vertical;
}

.range-field {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 76px;
  gap: 10px;
  align-items: center;
}

.range-field input[type="range"] {
  padding: 0;
  accent-color: var(--ls-red);
}

.range-field input[type="number"] {
  text-align: center;
}

.logo-field {
  margin-top: 12px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #34363a;
  font-size: 13px;
  font-weight: 800;
}

.checkbox-line input {
  width: auto;
  margin: 0;
  accent-color: var(--ls-red);
}

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

.section-subtitle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--ls-red);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.zone-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.zone-control {
  display: grid;
  grid-template-columns: 1fr minmax(145px, 190px);
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: var(--soft);
  border: 1px solid #e8e9eb;
  border-radius: 8px;
}

.zone-label {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  font-weight: 800;
}

.swatch {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 50%;
  background: #ffffff;
}

.validation-box {
  display: none;
  margin-top: 18px;
  border-radius: 8px;
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
}

.validation-box.is-visible {
  display: block;
}

.validation-box.has-errors {
  border: 1px solid rgba(180, 35, 24, 0.28);
  background: #fff4f2;
  color: var(--error);
}

.validation-box.has-warnings {
  border: 1px solid rgba(164, 98, 0, 0.28);
  background: #fff8e8;
  color: var(--warning);
}

.validation-box.is-ok {
  border: 1px solid rgba(28, 124, 69, 0.24);
  background: #eefaf3;
  color: var(--ok);
}

.validation-box ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 900;
}

.primary-button {
  border: 1px solid var(--ls-red);
  background: var(--ls-red);
  color: #ffffff;
}

.secondary-button {
  border: 1px solid #222222;
  background: #222222;
  color: #ffffff;
}

.ghost-button {
  border: 1px solid #cfd3d8;
  background: #ffffff;
  color: #222222;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.preview-panel {
  min-height: 720px;
  overflow: hidden;
}

.preview-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.preview-toolbar .status-pill {
  border-color: #d8d8d8;
  color: #34363a;
  background: #f7f7f7;
  white-space: nowrap;
}

.svg-stage {
  display: grid;
  place-items: center;
  min-height: 640px;
  padding: 18px;
  background:
    linear-gradient(45deg, #f3f3f3 25%, transparent 25%),
    linear-gradient(-45deg, #f3f3f3 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f3f3f3 75%),
    linear-gradient(-45deg, transparent 75%, #f3f3f3 75%);
  background-color: #ffffff;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.svg-stage svg {
  width: min(100%, 620px);
  height: auto;
  max-height: 650px;
  filter: drop-shadow(0 16px 28px rgba(0, 0, 0, 0.12));
}

.empty-state {
  max-width: 280px;
  color: var(--muted);
  text-align: center;
  line-height: 1.45;
}

.summary-list {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

.summary-list div {
  padding-bottom: 12px;
  border-bottom: 1px solid #ececec;
}

.summary-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-list dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.csv-preview {
  margin-top: 18px;
}

.csv-preview pre {
  max-height: 250px;
  overflow: auto;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  background: #111111;
  color: #ffffff;
  padding: 12px;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.series-panel {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid #ececec;
}

.count-pill {
  border: 1px solid #d8d8d8;
  border-radius: 999px;
  padding: 5px 9px;
  background: #f7f7f7;
  color: #34363a;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.series-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
  max-height: 310px;
  overflow: auto;
}

.series-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid #e8e9eb;
  border-radius: 8px;
  background: var(--soft);
}

.series-item strong,
.series-item span {
  display: block;
  overflow-wrap: anywhere;
}

.series-item strong {
  font-size: 13px;
}

.series-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.series-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-top: 12px;
}

.empty-state.small {
  max-width: none;
  padding: 12px;
  border: 1px dashed #d8d8d8;
  border-radius: 8px;
  background: var(--soft);
  font-size: 13px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: minmax(320px, 420px) 1fr;
  }

  .summary-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 820px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .field-row,
  .actions,
  .series-actions,
  .zone-control {
    grid-template-columns: 1fr;
  }

  .series-item {
    grid-template-columns: 1fr;
  }

  .preview-panel {
    min-height: 520px;
  }

  .svg-stage {
    min-height: 440px;
  }
}
