:root {
  --bg: #f4f1ea;
  --paper: #fffdf8;
  --ink: #1c2430;
  --muted: #5c6773;
  --line: #d9d2c5;
  --accent: #c45c26;
  --accent-dark: #9a4318;
  --ok: #2f6b4f;
  --warn: #a15c12;
  --bad: #9b2c2c;
  --navy: #1b2a41;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  min-height: 100vh;
}

.wrap { width: min(980px, calc(100% - 32px)); margin: 0 auto; }

.top {
  background: var(--navy);
  color: #fff;
  border-bottom: 4px solid var(--accent);
}
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; }
.brand small { display: block; font-weight: 400; opacity: .75; font-size: 12px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--accent); display: grid; place-items: center;
  font-size: 13px; letter-spacing: .04em;
}
.top nav { display: flex; gap: 12px; align-items: center; }
.top nav a { color: #e8eef5; text-decoration: none; font-size: 14px; }
.top nav a:hover { color: #fff; }

main { padding: 28px 0 48px; }

.hero {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px 28px;
  box-shadow: 0 10px 30px rgba(27, 42, 65, .06);
}
.hero h1 { margin: 0 0 8px; font-size: 32px; line-height: 1.15; }
.lead { color: var(--muted); font-size: 17px; max-width: 58ch; }
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 24px 0 0; }
.step { background: #f7f4ee; border-radius: 12px; padding: 14px; }
.step strong { display: block; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px;
  margin-top: 18px;
}
.card h2 { margin: 0 0 12px; font-size: 20px; }

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn-sm { padding: 8px 12px; font-size: 14px; }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn-ghost:hover { background: #eee; color: var(--navy); }
.btn-ok { background: var(--ok); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }

label { display: block; font-size: 13px; font-weight: 650; margin: 12px 0 4px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=file], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; background: #fff;
}
textarea { min-height: 90px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-weight: 400; }

.pozycja {
  border: 1px dashed #c9c0b0;
  border-radius: 12px;
  padding: 12px;
  margin: 10px 0;
  background: #fbf8f2;
}
.alert { padding: 12px 14px; border-radius: 10px; margin: 12px 0; }
.alert-bad { background: #fde8e8; color: var(--bad); }
.alert-ok { background: #e6f4ec; color: var(--ok); }
.alert-info { background: #eef3f8; }

.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.badge-nowe { background: #e8eef5; }
.badge-w_trakcie, .badge-do_akceptacji { background: #fff3d6; color: var(--warn); }
.badge-gotowe { background: #d9f0e3; color: var(--ok); }
.badge-blad, .badge-odrzucone { background: #fde8e8; color: var(--bad); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 700; }

.foot { border-top: 1px solid var(--line); padding: 18px 0 28px; color: var(--muted); font-size: 13px; }
.foot a { color: var(--navy); }

code, .mono { font-family: ui-monospace, Consolas, monospace; }

.pozycja-linia {
  display: grid;
  grid-template-columns: minmax(160px, 1.3fr) minmax(180px, 1.5fr) 88px;
  gap: 10px;
  align-items: end;
}
.pozycja-ilosc input { max-width: 100%; }
.mat-inny-wrap { margin-top: 8px; }
.mat-inny-wrap[hidden] { display: none !important; }

@media (max-width: 720px) {
  .steps, .grid-2, .pozycja-linia { grid-template-columns: 1fr; }
  .hero { padding: 22px 16px; }
  .hero h1 { font-size: 26px; }
}

.mat-modal[hidden] { display: none !important; }
.mat-modal {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(27, 42, 65, .45);
  display: grid; place-items: center; padding: 16px;
}
.mat-dialog {
  width: min(560px, 100%);
  max-height: min(82vh, 720px);
  overflow: hidden;
  background: var(--paper);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px rgba(27, 42, 65, .22);
  padding: 16px 16px 10px;
  display: flex; flex-direction: column;
}
.mat-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.mat-head h2 { margin: 0; font-size: 20px; }
.mat-tabs { display: flex; gap: 8px; margin: 12px 0 8px; }
.mat-tab {
  flex: 1; border: 1px solid var(--line); background: #f7f4ee;
  border-radius: 10px; padding: 10px 8px; font: inherit; font-weight: 650; cursor: pointer;
  color: var(--navy);
}
.mat-tab.is-on { background: var(--navy); color: #fff; border-color: var(--navy); }
.mat-list { overflow: auto; flex: 1; min-height: 180px; border-top: 1px solid var(--line); padding-top: 8px; }
.mat-item {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: 10px 10px; border-radius: 8px; font: inherit; cursor: pointer;
}
.mat-item:hover { background: #efe8dc; }
.mat-item-inny { color: var(--muted); font-style: italic; }
.mat-empty { padding: 20px 8px; color: var(--muted); }
.mat-val { cursor: pointer; background: #fff; }
