:root {
  --bg: #fff;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --line: #e2e5e9;
  --accent: #2b7cd3;
  --danger: #c0392b;
  --radius: 6px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 16px;
  font: 14px/1.45 -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--fg);
  background: var(--bg);
}

.hidden { display: none !important; }

.state {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
}
.state.error { color: var(--danger); }

/* --- karty --- */
.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 14px;
  font-weight: 600;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.card-head h2 { margin: 0; }

/* --- pola --- */
.row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 8px;
}

.field { display: flex; flex-direction: column; gap: 4px; }
.field.grow { flex: 1 1 auto; min-width: 0; }
.field.price { width: 110px; flex: 0 0 110px; }
.field.qty   { width: 80px;  flex: 0 0 80px; }
.field.total { width: 90px;  flex: 0 0 90px; align-items: flex-end; }

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

input, select {
  width: 100%;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font: inherit;
  background: #fff;
  color: inherit;
}
input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
input:disabled {
  background: #f3f4f6;
  color: var(--muted);
}

output { font-variant-numeric: tabular-nums; padding: 7px 0; }

.hint, .empty {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.empty { margin: 0; }

/* --- przyciski --- */
button {
  font: inherit;
  border-radius: var(--radius);
  cursor: pointer;
}

.btn-add {
  border: 1px solid var(--line);
  background: #fff;
  padding: 5px 10px;
  font-size: 13px;
}
.btn-add:hover { border-color: var(--accent); color: var(--accent); }

.btn-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px 8px;
  flex: 0 0 auto;
}
.btn-remove:hover { color: var(--danger); }

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  padding: 8px 16px;
  font-weight: 600;
}
.btn-primary:disabled { opacity: .6; cursor: default; }

.btn-secondary {
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px 16px;
}

/* --- stopka --- */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  position: sticky;
  bottom: 0;
  background: var(--bg);
}

.grand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.grand span { color: var(--muted); font-size: 13px; }
.grand strong { font-size: 18px; font-variant-numeric: tabular-nums; }

.actions { display: flex; gap: 8px; }
.footer .actions { margin-left: auto; }

/* --- wybór pakietu --- */
.packages {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.pkg {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  cursor: pointer;
}
.pkg:hover { border-color: var(--accent); }
.pkg.is-active {
  border-color: var(--accent);
  background: #f0f7ff;
}
.pkg input { width: auto; }
.pkg-title { font-weight: 600; }

/* --- podgląd tabeli --- */
.preview { margin: 0; }
.tbl-scroll { overflow-x: auto; }
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.tbl th, .tbl td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: center;
  vertical-align: middle;
}
.tbl thead th {
  color: #1a7a4c;
  font-weight: 600;
  background: #f6f8fa;
}
.tbl tbody th {
  text-align: left;
  font-weight: 600;
  white-space: nowrap;
}
.tbl td { font-variant-numeric: tabular-nums; }
.tbl .dash { color: var(--danger); }
.tbl .total-row td { color: #1a7a4c; font-weight: 700; }
.tbl .total-row th { font-weight: 700; }

/* --- sekcja wyłączona (szkolenia) --- */
.card.is-disabled {
  opacity: .55;
  background: #f7f8f9;
  pointer-events: none;
}
.badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}
