/* Manrope (SIL OFL 1.1, fonts/Manrope-OFL.txt) — hostowany lokalnie, bez zapytań do Google. */
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/manrope-latin-ext-wght-normal.91e6441f12d2.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Manrope";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("fonts/manrope-latin-wght-normal.fc03edc2c673.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Motyw jasny „mięta”: białe karty na szałwiowym tle, butelkowa zieleń jako akcent. */
:root {
  --bg: #e6efeb;
  --card: #ffffff;
  --field: #f2f6f4;
  --ink: #13241f;
  --ink-2: #44544e;
  --muted: #5e6e68;
  --line: #dce5e1;
  --line-soft: #eef3f1;
  --brand: #14533f;
  --brand-dark: #0b3327;
  --accent: #14533f;
  --accent-dark: #0b3327;
  --accent-ink: #ffffff;
  --emerald: #2e8b66;
  --mint: #9fe0bf;
  --mint-soft: #ddf3e7;
  --shadow: 0 1px 2px rgba(20, 60, 45, .06), 0 12px 32px -18px rgba(20, 60, 45, .25);
  --radius: 20px;
  --mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
  --ok: #14533f;
  --ok-bg: #ddf3e7;
  --warn: #9a3f12;
  --warn-bg: #fbe3d3;
  --err: #a1251b;
  --err-bg: #fde4e1;
  --info: #1f4e85;
  --info-bg: #e3ecf7;
  /* Barwy grup funkcjonalnych launchera (pulpit) — odcienie zieleni + akcenty */
  --g-recv: #2e8b66;
  --g-stock: #14533f;
  --g-issue: #c4622d;
  --g-ops: #3d7a8c;
  --g-report: #5b6f9e;
  --g-admin: #5e6e68;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
}

a { color: var(--brand); text-decoration: none; font-weight: 600; }
a:hover { color: var(--brand-dark); text-decoration: underline; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--emerald) 55%, transparent); outline-offset: 2px; }

/* Ikony SVG (sprite, styl liniowy).
   fill/stroke ustawione tu, bo są dziedziczone i wchodzą do shadow-DOM <use>,
   dzięki czemu ikony renderują się jako ostre linie, a nie wypełnione plamy. */
svg.ic {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  vertical-align: -0.18em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Topbar — biała karta nad treścią */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  color: var(--ink);
  padding: 10px 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 8px 24px -18px rgba(20, 60, 45, .45);
}
.topbar .brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; font-size: 18px; letter-spacing: -.01em; }
.topbar .brand:hover { text-decoration: none; }
.topbar .brand .brand-accent { color: var(--emerald); }
.brand-mark { width: 32px; height: 32px; flex: 0 0 auto; }
.brand-sub { color: var(--muted); font-weight: 600; font-size: 13px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; color: var(--ink); font-size: 13px; font-weight: 700; }
.user-chip small { display: block; color: var(--muted); font-weight: 600; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--mint); color: var(--brand-dark);
  font-weight: 800; font-size: 13px; text-transform: uppercase;
}
.menu-toggle {
  display: none;
  background: none; border: none; color: var(--ink); cursor: pointer;
  padding: 4px; line-height: 0;
}
.menu-toggle svg.ic { width: 26px; height: 26px; }
.inline { display: inline; }

/* Layout — menu jako wolnostojąca karta po lewej */
.layout { display: flex; gap: 20px; padding: 20px; min-height: calc(100vh - 60px); align-items: flex-start; }
.sidebar {
  width: 232px;
  flex: 0 0 auto;
  background: var(--card);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: sticky;
  top: 80px;
}
.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 14px;
}
.sidebar a svg.ic { width: 19px; height: 19px; }
.sidebar a:hover { background: var(--field); color: var(--ink); text-decoration: none; }
.sidebar a[aria-current="page"] { background: var(--mint); color: var(--brand-dark); font-weight: 800; }
.nav-label {
  font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); padding: 14px 12px 6px;
}
.nav-label:first-child { padding-top: 4px; }
.nav-promo {
  position: relative; overflow: hidden;
  margin-top: 18px; padding: 16px; border-radius: 18px;
  background: var(--brand); color: #fff;
}
.nav-promo strong { display: block; font-size: 15px; }
.nav-promo p { margin: 6px 0 12px; font-size: 12px; line-height: 1.45; color: #cfefdf; }
.nav-promo svg.promo-art { position: absolute; right: -10px; top: -6px; width: 110px; height: 72px; opacity: .2; }
.sidebar .nav-promo a {
  position: relative; justify-content: center; min-height: 38px;
  background: var(--mint); color: var(--brand-dark); font-weight: 800; font-size: 13px;
}
.sidebar .nav-promo a:hover { background: #b8ead0; color: var(--brand-dark); }
.content { flex: 1; min-width: 0; max-width: 1200px; }

/* Nagłówki, karty, siatki */
h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 18px; }
h2 { font-size: 18px; font-weight: 800; margin: 24px 0 12px; }
.page-sub { margin: -12px 0 18px; color: var(--muted); font-weight: 600; font-size: 14px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 16px; }
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
}
.card .kpi { font-size: 32px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.card .kpi-label { color: var(--ink-2); font-size: 13px; font-weight: 700; }
.panel {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}

/* Tabele */
table { width: 100%; border-collapse: collapse; background: var(--card); font-size: 14px; }
.table-wrap { overflow-x: auto; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 8px; }
th, td { padding: 11px 12px; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
th { background: var(--field); color: var(--muted); font-size: 12px; font-weight: 700; }
th:first-child { border-radius: 10px 0 0 10px; }
th:last-child { border-radius: 0 10px 10px 0; }
thead th { border-bottom: none; }
tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f7faf8; }

/* Etykiety statusów */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800;
}
.badge-DO_ULOZENIA { background: var(--warn-bg); color: var(--warn); }
.badge-ZMAGAZYNOWANY { background: var(--ok-bg); color: var(--ok); }
.badge-PUSTY { background: var(--field); color: var(--ink-2); }
.badge-PICKING { background: var(--info-bg); color: var(--info); }
.badge-ZAPAS { background: var(--field); color: var(--ink-2); }
.badge-OTWARTY { background: var(--warn-bg); color: var(--warn); }
.badge-ZREALIZOWANY { background: var(--ok-bg); color: var(--ok); }
.badge-ZAMKNIETY { background: var(--ok-bg); color: var(--ok); }
.badge-SPAKOWANY { background: var(--info-bg); color: var(--info); }
.badge-WYSLANY { background: #ece8f6; color: #4b3a8c; }
.badge-ADMIN { background: var(--err-bg); color: var(--err); }
.badge-OPERATOR { background: var(--info-bg); color: var(--info); }
.badge-VIEWER { background: var(--field); color: var(--ink-2); }
.badge-DO_ULOZENIA::before, .badge-ZMAGAZYNOWANY::before, .badge-OTWARTY::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor;
}

/* Przyciski */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 18px -10px rgba(20, 83, 63, .6);
}
.btn svg.ic { width: 17px; height: 17px; vertical-align: middle; }
.btn:hover { background: var(--accent-dark); color: var(--accent-ink); text-decoration: none; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); box-shadow: none; }
.btn-ghost:hover { background: var(--field); color: var(--ink); }
.btn-secondary { background: var(--card); color: var(--ink); border-color: var(--line); box-shadow: none; }
.btn-secondary:hover { background: var(--field); color: var(--ink); }
.btn-danger { background: var(--err); box-shadow: none; }
.btn-danger:hover { background: #7f1d14; }
.btn-sm { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar input, .toolbar select { width: auto; min-width: 200px; background: var(--card); }

/* Formularze */
form .field { margin-bottom: 14px; }
label { display: block; font-weight: 700; margin-bottom: 6px; font-size: 13px; color: var(--ink-2); }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=search],
input[type=email], input[type=file], select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  background: var(--field);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--emerald); background: #fff; box-shadow: 0 0 0 3px var(--mint-soft); }
.helptext { color: var(--muted); font-size: 12px; margin-top: 4px; }
.errorlist { color: var(--err); list-style: none; padding: 0; margin: 4px 0; font-size: 13px; font-weight: 600; }
ul.radio { list-style: none; padding: 0; margin: 0; }
ul.radio li { margin-bottom: 4px; }
ul.radio label { display: inline; font-weight: 600; }
.form-narrow { max-width: 560px; }

/* Komunikaty */
.messages { margin-bottom: 16px; display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 700; }
.msg-success { background: var(--ok-bg); color: var(--ok); }
.msg-error, .msg-danger { background: var(--err-bg); color: var(--err); }
.msg-warning { background: var(--warn-bg); color: var(--warn); }
.msg-info { background: var(--info-bg); color: var(--info); }

.muted { color: var(--muted); }
.mono { font-family: var(--mono); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.dl { display: grid; grid-template-columns: 160px 1fr; gap: 8px 16px; }
.dl dt { color: var(--muted); font-weight: 600; }
.dl dd { margin: 0; font-weight: 600; }

/* Logowanie */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--bg); padding: 20px; }
.login-card { background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 32px; width: 100%; max-width: 400px; }
.login-card h1 { text-align: center; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 10px; }
.login-brand .brand-accent { color: var(--emerald); }
.login-sub { text-align: center; margin: -8px 0 22px; color: var(--muted); font-weight: 700; letter-spacing: .08em; font-size: 13px; }

/* Pulpit — karty KPI ze stopką (wzór „TeamHub”) */
.cards .card { display: flex; flex-direction: column; padding: 6px; }
.card-body { padding: 12px 12px 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-code {
  font: 700 11px var(--mono);
  width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--mint-soft); color: var(--brand);
}
.card .kpi { margin-top: 10px; }
.card-foot {
  margin-top: auto;
  border-radius: 14px; padding: 9px 12px;
  font-size: 12px; font-weight: 700;
  background: var(--mint-soft); color: var(--brand);
}
.cards .card.alert .card-code, .cards .card.alert .card-foot { background: var(--warn-bg); color: var(--warn); }

.section-title { font-size: 18px; font-weight: 800; color: var(--ink); margin: 28px 0 14px; }

.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; margin-top: 20px; }
.dash-grid .panel { margin: 0; min-width: 0; }
.dash-grid .wide { grid-column: span 2; }
@media (max-width: 900px) { .dash-grid .wide { grid-column: auto; } }
.panel-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.panel-head h2 { margin: 0; font-size: 17px; }
.big-num { display: flex; align-items: baseline; gap: 10px; margin-top: 8px; }
.big-num strong { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.pill { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 99px; background: var(--mint-soft); color: var(--brand); }

/* Mapa obłożenia lokalizacji */
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 6px; }
.heat-cell { height: 30px; border-radius: 7px; background: var(--line-soft); border: 1px solid var(--line); }
.heat-1 { background: #cdefd9; border-color: #cdefd9; }
.heat-2 { background: #7fd0a6; border-color: #7fd0a6; }
.heat-3 { background: #2e8b66; border-color: #2e8b66; }
.heat-4 { background: #14533f; border-color: #14533f; }
.heat-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.heat-legend span { display: inline-flex; align-items: center; gap: 6px; }
.heat-legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; border: 1px solid var(--line); }

/* Słupki ruchów (14 dni) */
.bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 8px; align-items: end; height: 170px; }
.bar { position: relative; border-radius: 8px 8px 3px 3px; background: var(--mint); min-height: 4px; }
.bar.today { background: var(--brand); }
.bar span {
  position: absolute; left: 50%; bottom: calc(100% + 4px); transform: translateX(-50%);
  font-size: 11px; font-weight: 800; color: var(--ink-2);
}
.bars-axis { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 8px; margin-top: 8px; font: 500 11px var(--mono); color: var(--muted); text-align: center; }

/* Kafle skrótów */
.groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-items: start; }
.group {
  --gc: #5e6e68;
  display: flex; flex-direction: column; gap: 12px;
  padding: 16px 16px 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}
.group-head {
  display: flex; align-items: center; gap: 9px;
  font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-2);
}
.group-head::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--gc); }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

.tile {
  position: relative;
  display: flex; flex-direction: column; gap: 10px;
  min-height: 100px; padding: 12px;
  border-radius: 16px; text-decoration: none;
  color: var(--ink);
  background: var(--field);
  border: 1px solid transparent;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease, background .12s ease;
}
.tile:hover {
  transform: translateY(-2px);
  background: var(--card);
  border-color: color-mix(in srgb, var(--gc) 45%, var(--line));
  box-shadow: 0 12px 24px -14px color-mix(in srgb, var(--gc) 60%, transparent);
  text-decoration: none;
}
.tile:focus-visible { outline: 3px solid color-mix(in srgb, var(--gc) 55%, transparent); outline-offset: 2px; }
.tile-ic {
  width: 42px; height: 42px; border-radius: 12px;
  display: grid; place-items: center;
  color: #fff;
  background: var(--gc);
}
.tile-ic svg.ic { width: 22px; height: 22px; stroke-width: 2.1; }
.tile-code {
  position: absolute; top: 12px; right: 12px;
  font: 700 11px var(--mono);
  color: var(--muted);
}
.tile-lab { font-size: 13px; font-weight: 700; line-height: 1.25; margin-top: auto; }

@supports not (background: color-mix(in srgb, red, blue)) {
  .tile:hover { border-color: var(--gc); }
}

@media (max-width: 900px) { .groups { grid-template-columns: 1fr; } }
@media (max-width: 520px) { .tiles { grid-template-columns: repeat(2, 1fr); } }

/* Responsywność */
@media (max-width: 820px) {
  .menu-toggle { display: block; }
  .brand-sub, .user-chip .user-meta { display: none; }
  .layout { padding: 12px; }
  .sidebar {
    position: fixed;
    left: -260px;
    top: 60px;
    bottom: 12px;
    overflow-y: auto;
    transition: left .2s ease;
    z-index: 30;
  }
  body.nav-open .sidebar { left: 12px; }
  .btn, .sidebar a { min-height: 44px; }
}

/* Tryb demo — baner (ciemny tekst na brzoskwiniowym tle: kontrast > 7:1, WCAG AA). */
.demo-banner {
  background: var(--warn-bg);
  color: #5c2408;
  font-weight: 800;
  text-align: center;
  padding: 7px 12px;
  font-size: 14px;
}
.demo-logins {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--mint-soft);
  color: var(--ink);
  font-size: 14px;
}
.demo-logins ul { margin: 6px 0 0; padding-left: 18px; }

/* Typy ruchów magazynowych */
.mv-PRZYJECIE { background: var(--ok-bg); color: var(--ok); }
.mv-WYDANIE { background: var(--info-bg); color: var(--info); }
.mv-ALOKACJA, .mv-PRZESUNIECIE { background: var(--field); color: var(--ink-2); }
.mv-KOREKTA { background: var(--warn-bg); color: var(--warn); }
.mv-PRZEPAKOWANIE { background: #ece8f6; color: #4b3a8c; }

/* Realizacja wydań — półokrągły wskaźnik */
.gauge { display: flex; justify-content: center; }
.gauge svg { width: 100%; max-width: 260px; height: auto; }
.gauge-num { font-family: inherit; font-weight: 800; font-size: 34px; fill: var(--ink); }
.gauge-cap { font-family: inherit; font-weight: 600; font-size: 12px; fill: var(--muted); }
.stat-list { margin: 14px 0 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.stat-list div { display: flex; justify-content: space-between; gap: 12px; }
.stat-list dt { color: var(--ink-2); font-weight: 600; }
.stat-list dd { margin: 0; font-weight: 800; font-variant-numeric: tabular-nums; }

/* Plan na dziś — kolejka zadań */
.plan { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.plan-item {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px; border-radius: 14px;
  background: var(--mint-soft); color: var(--ink);
}
.plan-item:hover { text-decoration: none; color: var(--ink); box-shadow: inset 0 0 0 2px var(--emerald); }
.plan-item strong { font-size: 14px; font-weight: 800; }
.plan-tag { font-size: 12px; font-weight: 800; color: var(--brand); }
.plan-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.plan-time { font-family: var(--mono); padding: 2px 8px; border-radius: 6px; background: var(--card); }
.plan-pack, .plan-ship { background: var(--field); }
.plan-pack .plan-tag, .plan-ship .plan-tag { color: var(--ink-2); }
.plan-alert, .plan-count { background: var(--warn-bg); }
.plan-alert .plan-tag, .plan-count .plan-tag { color: var(--warn); }
