/* =====================================================================
   MADEX Producent – system wizualny
   Marka: jak katalog Madex (Cormorant Garamond + Jost, czerń, brąz, krem)
   ===================================================================== */

@font-face { font-family: 'Jost'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/jost-latin-ext-400-normal.woff2') format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, 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: 'Jost'; font-style: normal; font-weight: 400; font-display: swap; src: url('../fonts/jost-latin-400-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/jost-latin-ext-500-normal.woff2') format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, 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: 'Jost'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/jost-latin-500-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'Jost'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/jost-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, 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: 'Jost'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/jost-latin-600-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/cormorant-garamond-latin-ext-500-normal.woff2') format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, 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: 'Cormorant Garamond'; font-style: normal; font-weight: 500; font-display: swap; src: url('../fonts/cormorant-garamond-latin-500-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'Cormorant Garamond'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/cormorant-garamond-latin-ext-600-normal.woff2') format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, 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: 'Cormorant Garamond'; font-style: normal; font-weight: 600; font-display: swap; src: url('../fonts/cormorant-garamond-latin-600-normal.woff2') format('woff2'); 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; }
@font-face { font-family: 'Cormorant Garamond'; font-style: italic; font-weight: 500; font-display: swap; src: url('../fonts/cormorant-garamond-latin-ext-500-italic.woff2') format('woff2'); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, 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: 'Cormorant Garamond'; font-style: italic; font-weight: 500; font-display: swap; src: url('../fonts/cormorant-garamond-latin-500-italic.woff2') format('woff2'); 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; }

:root {
  --ink: #1C1917;
  --ink-2: #3F3A36;
  --muted: #6B625B;
  --faint: #8F857C;
  --line: #E4DDD5;
  --line-strong: #CFC5BA;
  --paper: #FFFFFF;
  --ground: #F7F4F0;
  --cream: #F6F2ED;
  --cream-2: #EFE8E0;
  --accent: #5B3A2E;
  --accent-hover: #452B21;
  --accent-soft: #F1E8E2;
  --wine: #7A2E3A;

  --ok: #2F6B45;        --ok-bg: #E5F1E8;
  --warn: #8A5A00;      --warn-bg: #FBF0D9;
  --danger: #A3262E;    --danger-bg: #F9E4E4;
  --info: #2C4F7C;      --info-bg: #E5EDF7;

  --font-ui: 'Jost', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-display: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;

  --radius: 6px;
  --radius-lg: 10px;
  --shadow: 0 1px 2px rgba(28, 25, 23, .06), 0 4px 16px rgba(28, 25, 23, .05);
  --shadow-lg: 0 8px 40px rgba(28, 25, 23, .16);
  --sidebar: 248px;
  --topbar: 60px;
  --tap: 44px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font-family: var(--font-ui); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; font-weight: 600; }
p { margin: 0 0 .75em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
code, kbd { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: .9em; }
.num, td.num, th.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: .88em; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.icon { width: 18px; height: 18px; flex: none; vertical-align: -3px; }
.icon-sm { width: 15px; height: 15px; flex: none; vertical-align: -2px; }
.icon-lg { width: 24px; height: 24px; flex: none; }
[hidden] { display: none !important; }

/* ---------- Typografia stron ---------- */
.eyebrow { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; font-weight: 500; color: var(--accent); }
.display { font-family: var(--font-display); font-weight: 500; letter-spacing: -.005em; }
.display em, .page-title em { font-style: italic; }
.page-title { font-family: var(--font-display); font-weight: 500; font-size: 34px; line-height: 1.05; font-variant-numeric: lining-nums; }
.section-title { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; color: var(--ink-2); margin: 0 0 12px; }
.card-title { font-size: 16px; font-weight: 600; }

/* ---------- Szkielet aplikacji ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--cream);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 20px 14px 16px;
}
.sidebar-brand { display: flex; flex-direction: column; gap: 4px; padding: 4px 10px 18px; border-bottom: 1px solid var(--line); margin-bottom: 14px; text-decoration: none; color: var(--ink); }
.sidebar-brand img { width: 128px; height: auto; }
.sidebar-brand span { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.nav-group { margin-bottom: 14px; }
.nav-label { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--faint); font-weight: 600; padding: 6px 10px; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--ink-2);
  text-decoration: none; font-size: 14.5px; min-height: 38px;
}
.nav-link:hover { background: var(--cream-2); color: var(--ink); }
.nav-link.is-active { background: var(--paper); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.nav-link .icon { color: var(--muted); }
.nav-link.is-active .icon { color: var(--accent); }
.nav-count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 600; text-align: center; }
.sidebar-foot { margin-top: auto; padding: 12px 10px 0; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar); display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: rgba(247, 244, 240, .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line);
}
.topbar-title { font-size: 14px; color: var(--muted); display: flex; gap: 8px; align-items: center; min-width: 0; }
.topbar-title a { color: var(--muted); text-decoration: none; }
.topbar-title a:hover { color: var(--ink); }
.topbar-title .sep { color: var(--line-strong); }
.topbar-title .current { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn.menu-toggle { display: none; }
.nav-overlay { display: none; }
.content { padding: 28px 28px 64px; max-width: 1440px; width: 100%; }
.content-narrow { max-width: 920px; }

.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: var(--radius); border: 0; background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--cream-2); color: var(--ink); }
.icon-btn .dot { position: absolute; top: 5px; right: 4px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--wine); color: #fff; font-size: 11px; font-weight: 600; line-height: 18px; text-align: center; }

.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); cursor: pointer; font: inherit; color: var(--ink); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; letter-spacing: .02em; flex: none; }
.user-chip .who { display: flex; flex-direction: column; line-height: 1.15; text-align: left; padding-right: 4px; }
.user-chip .who small { color: var(--muted); font-size: 11.5px; }

/* menu rozwijane */
.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 260px; background: var(--paper); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 6px; z-index: 40;
}
.dropdown-panel a, .dropdown-panel button.menu-item {
  display: flex; gap: 10px; align-items: center; width: 100%; padding: 9px 10px; border-radius: var(--radius); color: var(--ink);
  text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; text-align: left;
}
.dropdown-panel a:hover, .dropdown-panel button.menu-item:hover { background: var(--cream); }
.notif-panel { width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto; padding: 0; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--paper); }
.notif-item { display: block; padding: 11px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.notif-item:hover { background: var(--cream); color: var(--ink); }
.notif-item.unread { background: #FBF8F4; }
.notif-item.unread .notif-title::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--wine); margin-right: 7px; vertical-align: 2px; }
.notif-title { font-weight: 500; font-size: 14px; }
.notif-body { font-size: 13px; color: var(--muted); margin-top: 2px; }
.notif-time { font-size: 12px; color: var(--faint); margin-top: 4px; }

/* dolna nawigacja (telefony – handlowiec, szwalnia, magazyn) */
.bottom-nav { display: none; }

/* ---------- Nagłówek strony ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head .lead { color: var(--muted); margin-top: 6px; max-width: 70ch; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Przyciski ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px;
  border-radius: var(--radius); border: 1px solid var(--ink); background: var(--ink); color: #fff; font: inherit; font-weight: 500;
  font-size: 14.5px; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: #000; color: #fff; }
.btn:focus-visible, .icon-btn:focus-visible, .nav-link:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-accent { background: var(--accent); border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
.btn-secondary:hover { background: var(--cream); color: var(--ink); border-color: var(--ink-2); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; }
.btn-ghost:hover { background: var(--cream-2); color: var(--ink); }
.btn-danger { background: var(--paper); color: var(--danger); border-color: #E2B6B9; }
.btn-danger:hover { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }
.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn-ok:hover { background: #24563A; border-color: #24563A; }
.btn-sm { min-height: 32px; padding: 4px 11px; font-size: 13.5px; }
.btn-lg { min-height: 48px; padding: 10px 22px; font-size: 16px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Karty i siatki ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { font-size: 16px; font-weight: 600; }
.card-body { padding: 18px 22px; }
.card-foot { padding: 14px 22px; border-top: 1px solid var(--line); background: #FCFAF8; border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card + .card { margin-top: 18px; }
.grid > .card + .card, .stack > .card + .card, .stack-lg > .card + .card, .row > .card + .card { margin-top: 0; }
.card-link { color: var(--ink); text-decoration: none; display: block; }
.card-link:hover { border-color: var(--line-strong); box-shadow: var(--shadow); color: var(--ink); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main-side { grid-template-columns: minmax(0, 1fr) 360px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 22px; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.spacer { flex: 1; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 18px; } .mt-4 { margin-top: 28px; }
.mb-0 { margin-bottom: 0 !important; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 18px; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.kpi { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 4px; min-height: 108px; }
a.kpi:hover { border-color: var(--line-strong); box-shadow: var(--shadow); color: var(--ink); }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; letter-spacing: .02em; }
.kpi-value { font-family: var(--font-display); font-size: 40px; font-weight: 600; line-height: 1; letter-spacing: -.01em; font-variant-numeric: lining-nums tabular-nums; }
.kpi-sub { font-size: 13px; color: var(--muted); margin-top: auto; }
.kpi.is-alert .kpi-value { color: var(--danger); }
.kpi.is-warn .kpi-value { color: var(--warn); }

/* ---------- Tabele ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: var(--muted);
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: #FCFAF8; white-space: nowrap; position: sticky; top: 0;
}
.table th.num, .table th.right { text-align: right; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FCFAF8; }
.table tr.is-muted td { color: var(--faint); }
.table tr.is-alert td { background: #FDF6F6; }
.table tr.is-warn td { background: #FFFBF2; }
.table tr.is-highlight td { background: #FBF4EF; }
.table .row-link { color: var(--ink); text-decoration: none; font-weight: 500; }
.table .row-link:hover { color: var(--accent); text-decoration: underline; }
.table-compact td, .table-compact th { padding: 7px 10px; }
.table tfoot td { font-weight: 600; background: #FCFAF8; border-top: 1px solid var(--line-strong); }
.card > .table-wrap .table th:first-child, .card > .table-wrap .table td:first-child { padding-left: 22px; }
.card > .table-wrap .table th:last-child, .card > .table-wrap .table td:last-child { padding-right: 22px; }

/* ---------- Plakietki statusów ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 500; white-space: nowrap; line-height: 1.6; border: 1px solid transparent; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-ok-strong { background: var(--ok); color: #fff; }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-accent { background: var(--accent-soft); color: var(--accent); }
.badge-neutral { background: var(--cream-2); color: var(--ink-2); }
.badge-muted { background: transparent; color: var(--faint); border-color: var(--line); }
.badge-outline { background: var(--paper); color: var(--ink-2); border-color: var(--line-strong); }

/* ---------- Kolory (swatch) ---------- */
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 1px solid #A8A29E; vertical-align: -2px; flex: none; }
.swatch-pattern { background: repeating-linear-gradient(45deg, #D9C4A8 0 3px, #5B3A2E 3px 5px); }
.swatch-lg { width: 20px; height: 20px; }
.color-label { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.color-dots { display: flex; gap: 4px; flex-wrap: wrap; }
.color-dots .swatch { width: 12px; height: 12px; }

/* ---------- Dostępność ---------- */
.avail { display: inline-flex; align-items: baseline; gap: 4px; font-variant-numeric: tabular-nums; font-weight: 600; }
.avail-ok { color: var(--ok); }
.avail-low { color: var(--warn); }
.avail-none { color: var(--danger); }
.avail small { font-weight: 400; color: var(--muted); }
.lock-note { display: inline-flex; gap: 5px; align-items: center; font-size: 12.5px; color: var(--danger); }

/* ---------- Pasek postępu ---------- */
.progress { position: relative; height: 8px; background: var(--cream-2); border-radius: 999px; overflow: hidden; min-width: 80px; }
.progress > span { position: absolute; inset: 0 auto 0 0; background: var(--accent); border-radius: 999px; transition: width .3s; }
.progress.is-done > span { background: var(--ok); }
.progress-lg { height: 12px; }
.progress-row { display: flex; align-items: center; gap: 10px; }
.progress-row .pct { font-variant-numeric: tabular-nums; font-size: 13px; font-weight: 600; min-width: 42px; text-align: right; }

/* ---------- Formularze ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2, .form-grid .span-all { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 500; color: var(--ink-2); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.field .error { font-size: 12.5px; color: var(--danger); }
.req::after { content: ' *'; color: var(--wine); }
.input, .select, .textarea, input[type=text].input, input[type=number].input {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: var(--paper);
  color: var(--ink); font: inherit; font-size: 15px; transition: border-color .12s, box-shadow .12s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236B625B' stroke-width='1.6' d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 58, 46, .14); }
.input-sm, .select-sm { min-height: 34px; padding: 5px 9px; font-size: 14px; }
.select-sm { padding-right: 28px; background-position: right 9px center; }
input[type=number].input-qty, .input.input-qty, .input-qty { width: 84px; text-align: right; font-variant-numeric: tabular-nums; }
.input-group { display: flex; }
.input-group .input { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .btn { border-radius: 0 var(--radius) var(--radius) 0; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14.5px; min-height: 32px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); flex: none; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 20px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { padding: 0; }

.stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--line-strong); border-radius: var(--radius); overflow: hidden; background: var(--paper); }
.stepper button { width: 40px; border: 0; background: var(--cream); color: var(--ink); font-size: 20px; cursor: pointer; line-height: 1; }
.stepper button:hover { background: var(--cream-2); }
.stepper input { width: 64px; border: 0; text-align: center; font: inherit; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; }
.stepper input:focus { outline: none; background: #FFFCF8; }

/* ---------- Pasek filtrów ---------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { min-width: 160px; }
.toolbar .grow { flex: 1; min-width: 220px; }
.search-input { position: relative; }
.search-input .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-input .input { padding-left: 38px; }

/* ---------- Zakładki ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a, .tabs button { padding: 10px 14px; color: var(--muted); text-decoration: none; border: 0; background: none; font: inherit; font-size: 14.5px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs a:hover, .tabs button:hover { color: var(--ink); }
.tabs .is-active { color: var(--ink); font-weight: 600; border-bottom-color: var(--accent); }
.tabs .count { font-size: 12px; padding: 0 7px; border-radius: 999px; background: var(--cream-2); color: var(--ink-2); font-weight: 600; }

/* ---------- Komunikaty ---------- */
.flashes { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; font-size: 14.5px; }
.alert .icon { margin-top: 2px; }
.alert-success { background: var(--ok-bg); border-color: #BBD8C3; color: #1E4A2F; }
.alert-error { background: var(--danger-bg); border-color: #EBC1C4; color: #7A1C22; }
.alert-warning { background: var(--warn-bg); border-color: #EBD3A0; color: #5E3E00; }
.alert-info { background: var(--info-bg); border-color: #C3D3E8; color: #1E3A5F; }
.callout { padding: 14px 16px; border-radius: var(--radius); background: var(--cream); border: 1px solid var(--line); font-size: 14px; }

.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .icon-lg { margin: 0 auto 10px; color: var(--line-strong); width: 34px; height: 34px; }
.empty h3 { color: var(--ink); font-size: 16px; margin-bottom: 4px; }

/* ---------- Listy definicji / szczegóły ---------- */
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 14.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; }
.stat-line { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 14.5px; }
.stat-line:last-child { border-bottom: 0; }
.stat-line strong { font-variant-numeric: tabular-nums; }

/* rozbicie stanu: fizyczny / rezerwacje / przydziały / minimum / dostępne */
.stock-break { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stock-break > div { padding: 10px 12px; border-right: 1px solid var(--line); background: var(--paper); }
.stock-break > div:last-child { border-right: 0; background: var(--cream); }
.stock-break span { display: block; font-size: 11.5px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.stock-break strong { font-size: 20px; font-variant-numeric: tabular-nums; }

/* ---------- Oś czasu (historia zmian) ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; font-size: 14px; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.timeline li::after { content: ''; position: absolute; left: 7.5px; top: 18px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline .when { font-size: 12.5px; color: var(--faint); }
.timeline .who { font-weight: 500; }
.timeline li.is-new::before { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Produkty (katalog) ---------- */
.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 18px; }
.product-card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; display: flex; flex-direction: column; text-decoration: none; color: var(--ink); transition: box-shadow .15s, border-color .15s; }
.product-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); color: var(--ink); }
.product-photo { aspect-ratio: 2 / 3; background: #F1ECE6; overflow: hidden; position: relative; }
.product-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 25%; }
.product-photo .tag { position: absolute; left: 10px; top: 10px; }
.product-body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.product-code { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.product-name { font-family: var(--font-display); font-size: 21px; font-weight: 600; line-height: 1.1; font-variant-numeric: lining-nums; }
.product-meta { font-size: 13px; color: var(--muted); }
.product-foot { margin-top: auto; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.price { font-family: var(--font-display); font-size: 22px; font-weight: 600; font-variant-numeric: lining-nums; }
.price small { font-family: var(--font-ui); font-size: 12px; color: var(--muted); font-weight: 400; }
.price-hidden { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.thumb { width: 44px; height: 60px; object-fit: cover; object-position: 50% 25%; border-radius: 4px; background: #F1ECE6; flex: none; }
.thumb-sm { width: 34px; height: 46px; }
.thumb-lg { width: 72px; height: 100px; }
.variant-cell { display: flex; align-items: center; gap: 12px; min-width: 220px; }
.variant-cell .v-title { font-weight: 500; line-height: 1.25; }
.variant-cell .v-sub { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ---------- Okna dialogowe ---------- */
dialog.modal { border: 0; border-radius: var(--radius-lg); padding: 0; width: min(560px, calc(100vw - 24px)); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog.modal::backdrop { background: rgba(28, 25, 23, .45); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 18px 20px; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px; border-top: 1px solid var(--line); background: #FCFAF8; }

/* ---------- Powiadomienia "toast" ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast { background: var(--ink); color: #fff; padding: 12px 14px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 14px; display: flex; gap: 10px; align-items: flex-start; animation: toast-in .2s ease-out; }
.toast a { color: #F3D9C9; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(47, 107, 69, .08); } }
.flash-update { animation: flash-bg 1.6s ease-out; }
@keyframes flash-bg { from { background: #FFF4D6; } to { background: transparent; } }

/* ---------- Autouzupełnianie (wybór wariantu) ---------- */
.ac { position: relative; }
.ac-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg); z-index: 30; max-height: 360px; overflow-y: auto; }
.ac-item { display: flex; gap: 10px; align-items: center; padding: 8px 10px; cursor: pointer; border-bottom: 1px solid var(--line); }
.ac-item:last-child { border-bottom: 0; }
.ac-item:hover, .ac-item.is-active { background: var(--cream); }
.ac-item .ac-main { flex: 1; min-width: 0; }
.ac-item .ac-title { font-weight: 500; font-size: 14px; }
.ac-item .ac-sub { font-size: 12.5px; color: var(--muted); }
.ac-empty { padding: 12px; color: var(--muted); font-size: 14px; }

/* ---------- Strony logowania / publiczne ---------- */
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); background: var(--paper); }
.auth-visual { position: relative; background: #1C1917; overflow: hidden; min-height: 100vh; }
.auth-visual img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.auth-visual::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to top, rgba(28, 25, 23, .82) 0%, rgba(28, 25, 23, .35) 32%, rgba(28, 25, 23, 0) 55%); }
.auth-visual .caption { z-index: 1; }
.auth-visual .caption { position: absolute; left: 40px; bottom: 36px; right: 40px; color: #fff; }
.auth-visual .caption .display { font-size: 44px; line-height: 1.05; }
.auth-visual .caption p { color: rgba(255, 255, 255, .8); margin-top: 10px; max-width: 46ch; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; padding: 48px clamp(24px, 6vw, 72px); }
.auth-panel .logo { width: 170px; margin-bottom: 36px; }
.auth-panel h1 { font-family: var(--font-display); font-weight: 500; font-size: 36px; margin-bottom: 6px; }
.auth-form { display: flex; flex-direction: column; gap: 14px; margin-top: 22px; max-width: 420px; }

/* sklep / katalog publiczny */
.shop-header { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.shop-header-inner { max-width: 1320px; margin: 0 auto; padding: 0 24px; height: 72px; display: flex; align-items: center; gap: 24px; }
.shop-header .logo img { height: 40px; width: auto; }
.shop-nav { display: flex; gap: 4px; }
.shop-nav a { padding: 8px 12px; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; font-size: 14.5px; }
.shop-nav a:hover { background: var(--cream); color: var(--ink); }
.shop-nav a.is-active { color: var(--ink); font-weight: 600; }
.shop-main { max-width: 1320px; margin: 0 auto; padding: 28px 24px 72px; }
.shop-hero { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; padding: 8px 0 24px; border-bottom: 1px solid var(--ink); margin-bottom: 24px; }
.shop-hero h1 { font-family: var(--font-display); font-weight: 500; font-size: 48px; line-height: 1; }
.shop-footer { border-top: 1px solid var(--line); padding: 28px 24px; text-align: center; color: var(--muted); font-size: 13px; background: var(--cream); }
.cart-link { position: relative; }
.cart-count { position: absolute; top: 2px; right: 0; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; min-width: 18px; height: 18px; line-height: 18px; text-align: center; border-radius: 9px; padding: 0 4px; }
.pending-banner { background: var(--warn-bg); border-bottom: 1px solid #EBD3A0; color: #5E3E00; padding: 10px 24px; text-align: center; font-size: 14px; }

/* ---------- Druk (etykiety, dokumenty) ---------- */
.print-only { display: none; }
@media print {
  body { background: #fff; font-size: 12pt; }
  .sidebar, .topbar, .bottom-nav, .no-print, .page-actions, .toasts, .flashes { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  .card { border: 0; }
  .print-only { display: block; }
  a { color: inherit; text-decoration: none; }
}

/* ---------- Responsywność ---------- */
@media (max-width: 1180px) {
  .grid-main-side { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .nav-overlay { display: none; position: fixed; inset: 0; background: rgba(28, 25, 23, .4); z-index: 55; }
  .app.nav-open .nav-overlay { display: block; }
  .icon-btn.menu-toggle { display: inline-flex; }
  .topbar { padding: 0 14px; }
  .content { padding: 20px 16px 96px; }
  .user-chip .who { display: none; }
  .auth-page { grid-template-columns: minmax(0, 1fr); }
  .auth-visual { display: none; }
}
@media (max-width: 760px) {
  body { font-size: 15.5px; }
  .grid-2, .grid-3, .grid-4, .form-grid, .form-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .page-title { font-size: 28px; }
  .page-head { margin-bottom: 16px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi { min-height: 92px; padding: 12px 14px; }
  .kpi-value { font-size: 32px; }
  .card-pad, .card-body { padding: 16px; }
  .card-head { padding: 14px 16px; }
  .card > .table-wrap .table th:first-child, .card > .table-wrap .table td:first-child { padding-left: 16px; }
  .card > .table-wrap .table th:last-child, .card > .table-wrap .table td:last-child { padding-right: 16px; }
  .toolbar .field, .toolbar .grow { min-width: 0; flex: 1 1 100%; }
  .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .product-name { font-size: 18px; }
  .stock-break { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stock-break > div { border-bottom: 1px solid var(--line); }
  .btn { min-height: var(--tap); }
  .btn-sm { min-height: 36px; }
  .input, .select { min-height: var(--tap); font-size: 16px; }
  .shop-header-inner { padding: 0 14px; height: 60px; gap: 10px; }
  .shop-header .logo img { height: 30px; }
  .shop-nav { display: none; }
  .shop-main { padding: 18px 14px 64px; }
  .shop-hero { grid-template-columns: 1fr; }
  .shop-hero h1 { font-size: 36px; }
  /* tabele zamieniane na karty na telefonie */
  .table-cards thead { display: none; }
  .table-cards, .table-cards tbody, .table-cards tr, .table-cards td { display: block; width: 100%; }
  .table-cards tr { border-bottom: 1px solid var(--line); padding: 10px 16px; }
  .table-cards td { border: 0; padding: 3px 0 !important; text-align: left !important; }
  .table-cards td[data-label]::before { content: attr(data-label); display: inline-block; min-width: 120px; color: var(--muted); font-size: 12.5px; }
  .has-bottom-nav .bottom-nav {
    display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: var(--paper); border-top: 1px solid var(--line); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px; color: var(--muted); text-decoration: none; font-size: 11.5px; min-height: 52px; justify-content: center; border-radius: var(--radius); position: relative; }
  .bottom-nav a.is-active { color: var(--accent); font-weight: 600; }
  .bottom-nav a .icon { width: 22px; height: 22px; }
  .bottom-nav .nav-count { position: absolute; top: 2px; left: 55%; margin: 0; font-size: 10.5px; min-width: 18px; padding: 0 5px; }
  .toasts { bottom: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
