:root {
  /* Strona ma jeden, jasny motyw — wymuś go niezależnie od preferencji systemu, inaczej
     natywny silnik przeglądarki (np. GTK w trybie ciemnym) renderuje widżety (button, select,
     checkbox) własnym motywem nad autorskim tłem poza stanem :hover. */
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  font-family: system-ui, sans-serif;
  margin: 0;
  padding: 0 0.75rem 2rem;
  background: #f5f5f2;
  color: #222;
}

header {
  position: sticky;
  top: 0;
  background: #f5f5f2;
  padding-top: 0.75rem;
  z-index: 1;
}

h1 {
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
}

#tab-nav {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.5rem;
}

.tab-btn {
  padding: 0.5rem 0.75rem;
  border: 1px solid #999;
  background: #fff;
  border-radius: 4px 4px 0 0;
  cursor: pointer;
  font-size: 0.9rem;
}

.tab-btn.active {
  background: #2c6e49;
  color: #fff;
  border-color: #2c6e49;
}

main > section {
  padding: 1.25rem;
  margin-top: 1rem;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}

main > section h2 {
  margin-top: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e5e0;
}

.hint {
  background: #eef5f0;
  border: 1px solid #cfe3d6;
  border-radius: 4px;
  padding: 0.6rem 0.85rem;
  font-size: 0.9rem;
  color: #3a4a41;
  margin: 0 0 1rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  max-width: 420px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.9rem;
}

label.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
}

input,
select,
button {
  font-size: 1rem;
  padding: 0.4rem;
}

select,
input[type='checkbox'] {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

select {
  background: #fff;
  border: 1px solid #999;
  border-radius: 4px;
}

input[type='checkbox'] {
  width: 1rem;
  height: 1rem;
  border: 1px solid #999;
  border-radius: 3px;
  background: #fff;
  padding: 0;
  display: inline-block;
  position: relative;
}

input[type='checkbox']:checked {
  background: #2c6e49;
  border-color: #2c6e49;
}

input[type='checkbox']:checked::after {
  content: '';
  position: absolute;
  left: 0.28rem;
  top: 0.08rem;
  width: 0.28rem;
  height: 0.5rem;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

button {
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  border: 1px solid #2c6e49;
  background: #2c6e49;
  color: #fff;
  border-radius: 4px;
  width: fit-content;
}

button:hover {
  background: #235939;
}

fieldset {
  border: 1px solid #ccc;
  border-radius: 4px;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.3rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  margin-top: 0.75rem;
  font-size: 0.85rem;
}

th,
td {
  border: 1px solid #ddd;
  padding: 0.35rem 0.5rem;
  text-align: left;
}

thead th {
  background: #e8e8e3;
}

tbody tr:nth-child(even) {
  background: #f6f6f3;
}

tbody tr:hover {
  background: #eef5f0;
}

th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th.sortable .sort-arrow {
  color: #2c6e49;
  margin-left: 0.25rem;
}

.error-box {
  background: #fdecea;
  border: 1px solid #f5c2c0;
  color: #7a1f1a;
  padding: 0.5rem 0.75rem;
  border-radius: 4px;
  margin-bottom: 0.6rem;
}

.plan-card {
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  display: inline-block;
  vertical-align: top;
  margin-right: 0.75rem;
  min-width: 240px;
  background: #fafaf8;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.plan-card-best {
  border-color: #2c6e49;
  border-width: 2px;
}

.kv-table th {
  background: none;
  font-weight: normal;
  color: #555;
}

.optimizer-summary {
  font-weight: bold;
}

.skipped-details {
  margin-top: 1rem;
}

#ceny-sync-result {
  margin-top: 0.4rem;
  font-size: 0.9rem;
}
