:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #000000;
  --muted: #666666;
  --accent: #ff9800;
  --accent-dark: #cf7d17;
  --accent-light: #faaf40;
  --accent-soft: #fff8ef;
  --accent-gradient: linear-gradient(45deg, #cf7d17 1%, #faaf40 100%);
  --border: #e6e6e6;
  --warning-bg: #fff8ef;
  --warning-text: #cf7d17;
  --shadow: 0 8px 32px rgba(207, 125, 23, 0.1);
}

* {
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

body {
  margin: 0;
  font-family: "Raleway", "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 300;
  background: var(--bg);
  color: var(--text);
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 24px;
}

.header {
  position: relative;
  margin-bottom: 28px;
  text-align: center;
  min-height: 100px;
}

.logo-link {
  position: absolute;
  top: 0;
  left: 0;
  display: inline-block;
  line-height: 0;
  z-index: 1;
}

.header h1 {
  padding-top: 28px;
}

@media (max-width: 640px) {
  .header {
    text-align: left;
    min-height: 0;
  }

  .logo-link {
    position: static;
    margin-bottom: 12px;
  }

  .header h1 {
    padding-top: 0;
  }
}

.logo {
  display: block;
  width: auto;
  height: 100px;
  max-width: 100%;
}

h1 {
  margin: 0;
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 400;
  color: var(--text);
}

.wizard-step h2,
.chart-header h2 {
  color: var(--accent);
  font-weight: 400;
}

.subtitle {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 300;
}

.steps-indicator {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  overflow-x: auto;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 400;
}

.step-item.active {
  color: var(--accent-dark);
  font-weight: 600;
}

.step-item.done {
  color: var(--text);
}

.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 0;
  border: 2px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
}

.step-item.active .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.step-item.done .step-num {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #fff;
}

.step-line {
  flex: 1;
  min-width: 24px;
  height: 2px;
  background: var(--border);
  margin: 0 12px;
}

.wizard-layout {
  display: grid;
  grid-template-columns: 420px 1fr;
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0;
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

.wizard-step {
  display: none;
}

.wizard-step.active {
  display: block;
}

.wizard-step h2 {
  margin: 0 0 6px;
  font-size: 1.35rem;
}

#step-1 h2,
#step-2 h2,
#step-3 h2,
#step-4 h2 {
  margin-bottom: 28px;
}

#step-2 h2,
#step-3 h2,
#step-4 h2 {
  text-align: center;
}

.step-desc {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 300;
}

.choice-grid {
  display: grid;
  gap: 12px;
}

.choice-grid.cols-3 {
  grid-template-columns: repeat(3, 1fr);
}

.choice-grid.cols-5 {
  grid-template-columns: repeat(5, 1fr);
}

.choice-grid.cols-2 {
  grid-template-columns: 1fr;
}

.step-illustration {
  margin: 24px 0 0;
  padding: 0;
  text-align: center;
}

.step-illustration-img {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  margin: 0 auto;
}

.tip-figure {
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  line-height: 0;
}

.tip-figure img {
  display: block;
  width: 100%;
  height: auto;
}

#tip-illustration,
#height-illustration {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.tip-block {
  fill: rgba(255, 152, 0, 0);
  stroke: rgba(230, 120, 0, 0);
  stroke-width: 4;
  stroke-linejoin: round;
  cursor: pointer;
  transition: fill 0.15s ease, stroke 0.15s ease;
}

.tip-block.is-active,
.tip-block:hover {
  fill: rgba(255, 152, 0, 0.55);
  stroke: rgba(217, 108, 0, 0.9);
}

.choice-card-wide {
  align-items: flex-start;
  text-align: left;
  padding: 18px 16px;
}

.choice-card-wide strong {
  font-size: 1.05rem;
  font-weight: 500;
}

.loads-form.hidden {
  display: none;
}

.choice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px 12px;
  border: 2px solid var(--border);
  border-radius: 0;
  background: #fff;
  cursor: pointer;
  transition: 0.2s ease;
  font-family: inherit;
  color: var(--text);
}

.choice-card strong {
  font-size: 1.4rem;
  font-weight: 500;
  color: var(--accent-dark);
}

.choice-card span {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 300;
}

.choice-card:hover,
.choice-card.is-hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.choice-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.form-grid {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 0.92rem;
  color: var(--muted);
  font-weight: 400;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 12px 14px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}

input:focus {
  outline: 2px solid rgba(255, 152, 0, 0.25);
  border-color: var(--accent);
}

.wizard-nav {
  display: flex;
  gap: 10px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.materials-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-items: stretch;
}

.materials-nav > .btn {
  width: 100%;
  min-height: 46px;
  flex: none;
}

.materials-meta-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 46px;
  padding: 10px 14px;
  border: 2px solid var(--accent);
  border-radius: 0;
  background: #fff;
  color: var(--accent-dark);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: 0.2s ease;
  text-align: center;
}

.materials-meta-tile:hover {
  background: var(--accent-soft);
}

.materials-meta-tile.is-editing {
  cursor: text;
  padding: 0;
  background: #fff;
}

.materials-meta-tile.is-editing:hover {
  background: #fff;
}

.materials-meta-label {
  pointer-events: none;
}

.materials-meta-input {
  width: 100%;
  height: 100%;
  min-height: 42px;
  border: none;
  border-radius: 0;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  background: transparent;
}

.materials-meta-input:focus {
  outline: none;
}

.materials-meta-select-tile {
  padding: 0;
  cursor: pointer;
}

.materials-meta-select {
  width: 100%;
  min-height: 42px;
  border: none;
  border-radius: 0;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent-dark);
  background: transparent;
  text-align: center;
  text-align-last: center;
  cursor: pointer;
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--accent-dark) 50%),
    linear-gradient(135deg, var(--accent-dark) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% - 3px), calc(100% - 12px) calc(50% - 3px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.materials-meta-select:focus {
  outline: none;
}

.materials-meta-select:not([data-has-value="true"]) {
  color: var(--accent-dark);
}

.materials-meta-select[data-has-value="true"] {
  color: var(--text);
}

@media (max-width: 480px) {
  .materials-nav {
    grid-template-columns: 1fr;
  }
}

.btn {
  padding: 12px 20px;
  border-radius: 0;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: 0.2s ease;
  letter-spacing: 0.02em;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  flex: 1;
}

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--accent-dark);
  border: 2px solid var(--accent);
}

.btn-secondary:hover {
  background: var(--accent-soft);
}

.selection-summary {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  border-radius: 0;
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 300;
}

.selection-summary strong {
  color: var(--text);
  font-weight: 500;
}

.result-hero {
  background: var(--accent-gradient);
  border-radius: 0;
  padding: 28px 24px;
  text-align: center;
  margin-bottom: 16px;
  color: #fff;
}

.result-hero .result-label {
  display: block;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.92);
  margin-bottom: 8px;
  font-weight: 400;
}

.result-hero strong {
  font-size: 3.5rem;
  color: #fff;
  line-height: 1;
  font-weight: 400;
}

.result-hero--error {
  background: #fff5f5;
  border: 2px solid #e53935;
}

.result-hero-error {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.5rem);
  font-weight: 600;
  color: #e53935;
  line-height: 1.35;
}

.results-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.result-card {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 12px 14px;
}

.result-label {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 400;
}

.result-card strong {
  font-size: 1.15rem;
  color: var(--accent-dark);
  font-weight: 500;
}

.warning {
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 0;
  background: var(--warning-bg);
  color: var(--warning-text);
  font-weight: 500;
  font-size: 0.9rem;
  border-left: 4px solid var(--accent);
}

.warning.hidden {
  display: none;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.chart-header h2 {
  margin: 0;
  font-size: 1.35rem;
}

.chart-note {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 300;
}

.chart-dot {
  display: inline-block;
  width: 22px;
  height: 22px;
  margin: 0 2px;
  vertical-align: -6px;
}

.chart-wrap {
  position: relative;
  min-height: 520px;
}

.materials-table-wrap {
  overflow-x: auto;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}

.materials-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: clamp(0.62rem, 1.3vw, 0.8rem);
}

.materials-table th,
.materials-table td {
  padding: 8px 6px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

/* Kolumny: Lp. | Symbol | Element | Sztuk | Długość */
.materials-table th:nth-child(1),
.materials-table td:nth-child(1) {
  width: 8%;
}

.materials-table th:nth-child(2),
.materials-table td:nth-child(2) {
  width: 28%;
}

.materials-table th:nth-child(3),
.materials-table td:nth-child(3) {
  width: 28%;
}

.materials-table th:nth-child(4),
.materials-table td:nth-child(4) {
  width: 16%;
  text-align: center;
}

.materials-table th:nth-child(5),
.materials-table td:nth-child(5) {
  width: 20%;
  text-align: center;
}

.materials-table td:nth-child(2) {
  white-space: nowrap;
}

.materials-table th {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
  white-space: nowrap;
}

.materials-table tbody tr:last-child td {
  border-bottom: none;
}

.materials-table td:nth-child(4),
.materials-table td:nth-child(5) {
  font-weight: 500;
  white-space: nowrap;
}

.footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 300;
  text-align: center;
}

@media (max-width: 960px) {
  .wizard-layout {
    grid-template-columns: 1fr;
  }

  .choice-grid.cols-3,
  .choice-grid.cols-5,
  .choice-grid.cols-2 {
    grid-template-columns: 1fr;
  }

  .results-detail {
    grid-template-columns: 1fr;
  }

  .chart-wrap {
    min-height: 380px;
  }
}

@media (max-width: 480px) {
  .choice-grid.cols-3,
  .choice-grid.cols-5 {
    grid-template-columns: 1fr;
  }
}
