:root {
  --bg: #f4f5f7;
  --panel: #ffffff;
  --line: #e3e7ee;
  --line-strong: #cfd6df;
  --text: #16202a;
  --muted: #66727f;
  --accent: #1769ff;
  --accent-soft: #eef4ff;
  --danger: #c43d3d;
  --success: #1f8b4c;
  --shadow: 0 8px 24px rgba(22, 32, 42, 0.06);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

.page-shell {
  width: min(1500px, calc(100% - 24px));
  margin: 0 auto;
  padding: 12px 0 20px;
}

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

.topbar {
  padding: 14px 18px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.eyebrow,
.section-step {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.topbar h1,
.section-head h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.05;
}

.topbar-text,
.section-text,
.field-hint,
.alert-card strong {
  color: var(--muted);
}

.topbar-text {
  margin: 6px 0 0;
  font-size: 14px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.ghost-button,
.tiny-button,
.status-button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.primary-button,
.secondary-button,
.ghost-button {
  padding: 0 16px;
  font-weight: 700;
}

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

.secondary-button {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: #d7e5ff;
}

.ghost-button {
  background: #fff;
  color: var(--muted);
  border-color: var(--line-strong);
}

.workspace {
  margin-top: 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

.section-panel {
  padding: 14px;
  min-height: calc(100vh - 120px);
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.section-text {
  margin: 6px 0 0;
  font-size: 13px;
}

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

.entry-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px;
  display: grid;
  gap: 8px;
}

.entry-card.is-empty {
  background: #fafbfc;
}

.entry-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.entry-top h3 {
  margin: 0;
  font-size: 14px;
}

.tiny-button {
  min-height: 30px;
  padding: 0 10px;
  background: #fff5f5;
  color: var(--danger);
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 8px;
}

.field {
  display: grid;
  gap: 4px;
}

.field label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.field[data-span="3"] { grid-column: span 3; }
.field[data-span="4"] { grid-column: span 4; }
.field[data-span="5"] { grid-column: span 5; }
.field[data-span="6"] { grid-column: span 6; }
.field[data-span="7"] { grid-column: span 7; }
.field[data-span="12"] { grid-column: span 12; }

.field input,
.field select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
}

.spec-autocomplete {
  position: absolute;
  z-index: 1000;
  max-height: 320px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 16px 32px rgba(22, 32, 42, 0.12);
  padding: 6px;
  min-width: 320px;
}

.spec-option {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  border-radius: 10px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  text-align: left;
  cursor: pointer;
}

.spec-option:hover,
.spec-option.active {
  background: var(--accent-soft);
}

.spec-option-text {
  min-width: 0;
  flex: 1;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
  line-height: 1.3;
}

.spec-option-price {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.status-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.status-button {
  min-height: 34px;
  padding: 0 10px;
  background: #f3f5f8;
  color: var(--muted);
}

.status-button.active {
  background: var(--accent);
  color: #fff;
}

.save-badge {
  min-height: 36px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eef8f1;
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

.alerts {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.alerts-inline {
  margin-top: 12px;
}

.alert-card {
  border: 1px solid #f0cccc;
  border-radius: var(--radius-md);
  padding: 10px 12px;
  background: #fff7f7;
}

.alert-card p {
  margin: 6px 0 0;
  line-height: 1.45;
}

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

  .section-panel {
    min-height: auto;
  }
}

@media (max-width: 760px) {
  .page-shell {
    width: min(100% - 16px, 1380px);
    padding-top: 8px;
  }

  .topbar,
  .section-panel {
    padding: 14px;
  }

  .topbar,
  .topbar-actions,
  .entry-top {
    flex-direction: column;
  }

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

  .field[data-span="3"],
  .field[data-span="4"],
  .field[data-span="5"],
  .field[data-span="6"],
  .field[data-span="7"] {
    grid-column: span 6;
  }

}
