:root {
  --ink: #1d2220;
  --muted: #68716c;
  --line: #d9ddd7;
  --paper: #f5f3ee;
  --surface: #fffdfa;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --warn: #b45309;
  --danger: #b91c1c;
  --ok: #15803d;
  --shadow: 0 16px 35px rgba(31, 41, 35, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(15, 118, 110, 0.09), transparent 38%),
    linear-gradient(180deg, #faf8f2 0%, #ecefe7 100%);
  font-family: "Segoe UI", "Aptos", sans-serif;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 28px 36px 18px;
  border-bottom: 1px solid rgba(29, 34, 32, 0.08);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

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

h2 {
  font-size: 18px;
}

main {
  padding: 24px 36px 42px;
}

button,
a.primary {
  border: 0;
  border-radius: 7px;
  padding: 10px 14px;
  color: white;
  background: var(--accent);
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
a.primary:hover {
  background: var(--accent-strong);
}

.ghost {
  color: var(--ink);
  background: #e7ebe4;
}

.ghost:hover {
  background: #dce4dc;
}

.top-actions,
.row-actions,
.filters,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.band {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.8fr);
  gap: 18px;
  margin-bottom: 18px;
}

.data-drawer {
  margin-bottom: 18px;
}

.data-drawer > summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 12px;
  border: 1px solid rgba(29, 34, 32, 0.11);
  border-radius: 8px;
  padding: 13px 16px;
  background: rgba(255, 253, 250, 0.9);
  box-shadow: var(--shadow);
  cursor: pointer;
  list-style: none;
}

.data-drawer > summary::-webkit-details-marker {
  display: none;
}

.data-drawer > summary::after {
  content: "rozwiń";
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--accent-strong);
  background: #dff1ec;
  font-size: 12px;
  font-weight: 800;
}

.data-drawer[open] > summary::after {
  content: "zwiń";
}

.data-drawer summary span {
  display: grid;
  gap: 3px;
}

.data-drawer summary small,
.drawer-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.panel {
  background: rgba(255, 253, 250, 0.86);
  border: 1px solid rgba(29, 34, 32, 0.11);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.panel-title p,
.status-text {
  margin: 0;
  color: var(--muted);
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.wide {
  grid-column: 1 / -1;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 9px 10px;
  color: var(--ink);
  background: white;
  font: inherit;
}

.status-done {
  border-color: #86c89a;
  color: #166534;
  background: #e8f7ed;
}

.status-danger {
  border-color: #f0a0a0;
  color: #991b1b;
  background: #fee2e2;
}

.status-custom {
  border-color: #e8c66a;
  color: #7a4d00;
  background: #fff4c7;
}

.note-filled {
  border-color: #86c89a;
  background: #e8f7ed;
  box-shadow: inset 4px 0 0 #16a34a;
}

.note-warning {
  border-color: #f0a0a0;
  color: #7f1d1d;
  background: #fee2e2;
  box-shadow: inset 4px 0 0 #dc2626;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

select[multiple] {
  min-height: 122px;
}

.row-actions {
  margin-top: 14px;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto minmax(180px, 1fr);
  gap: 12px;
  align-items: end;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.upload-split {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.upload-card {
  display: grid;
  gap: 12px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: rgba(240, 244, 237, 0.58);
}

.upload-card h3 {
  margin: 0 0 5px;
  font-size: 16px;
}

.upload-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.stats {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
}

.stats div {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px;
}

.stats dt {
  color: var(--muted);
  font-weight: 700;
}

.stats dd {
  margin: 0;
  font-size: 20px;
  font-weight: 800;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin: 18px 0;
}

.filters {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  align-items: stretch;
  gap: 12px;
}

.filter-main-row {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
}

.filter-main-row label {
  min-width: 150px;
}

.stock-filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  min-width: 280px;
  max-width: 420px;
  margin: 0;
  border: 0;
  padding: 0;
}

.stock-filter-group legend {
  width: 100%;
  margin-bottom: -1px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stock-filter-group label {
  display: inline-flex;
  min-width: auto;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.stock-filter-group input {
  width: auto;
}

.stock-filter-group label:has(input:checked) {
  border-color: #7fb8ad;
  color: var(--accent-strong);
  background: #dff1ec;
}

.brand-filter-group {
  width: 100%;
  min-width: 100%;
  max-width: none;
  padding-top: 4px;
  align-items: flex-start;
}

.brand-filter-group label {
  flex: 0 0 auto;
}

.filters .check {
  display: flex;
  min-width: auto;
  align-items: center;
  gap: 8px;
  padding: 9px 0;
}

.filters .check input {
  width: auto;
}

.table-wrap {
  overflow: auto;
  border: 1px solid rgba(29, 34, 32, 0.11);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.messages-panel {
  margin-top: 16px;
  padding: 18px;
  border: 1px solid rgba(220, 38, 38, 0.22);
  border-radius: 8px;
  background: #fff7f7;
  box-shadow: var(--shadow);
}

.messages-panel h2 {
  margin: 0 0 4px;
  font-size: 20px;
}

.messages-panel p {
  margin: 0 0 12px;
  color: var(--muted);
}

.messages-panel ul {
  margin: 0;
  padding-left: 20px;
}

.messages-panel li {
  margin: 7px 0;
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid #eceee8;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f0f4ed;
  color: #3e4944;
  font-size: 12px;
  text-transform: uppercase;
}

td {
  font-size: 14px;
}

.sku {
  font-weight: 800;
}

.stock-zero-note {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #991b1b;
  background: #fee2e2;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.muted {
  color: var(--muted);
}

.pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 4px 9px;
  background: #eef2ec;
  font-size: 12px;
  font-weight: 800;
}

.pill.hot {
  color: var(--danger);
  background: #fee2e2;
}

.pill.warn {
  color: var(--warn);
  background: #fef3c7;
}

.pill.urgent {
  color: #991b1b;
  background: #ffe4e6;
}

.pill.medium {
  color: #854d0e;
  background: #fef3c7;
}

.pill.calm {
  color: #166534;
  background: #dcfce7;
}

.editable {
  min-width: 88px;
}

.editable.price {
  min-width: 120px;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.empty.small {
  padding: 12px;
}

.hidden {
  display: none;
}

dialog {
  width: min(560px, calc(100vw - 32px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.28);
}

dialog::backdrop {
  background: rgba(22, 29, 27, 0.45);
}

#productForm {
  display: grid;
  gap: 12px;
  padding: 20px;
  background: var(--surface);
}

@media (max-width: 860px) {
  .topbar,
  .toolbar,
  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  main,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }

  .band,
  .import-grid,
  .upload-split {
    grid-template-columns: 1fr;
  }

  .filters {
    width: 100%;
  }

  .filter-main-row > label {
    min-width: 100%;
  }

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