/* QualiCore Demo – kolory i krój zgodne ze stroną (tailwind.config.ts) */
:root {
  color-scheme: light;
  --navy: #15304a;
  --navy-2: #1d4062;
  --steel: #6f8da2;
  --mist: #a9bfd0;
  --ice: #dceefa;
  --paper: #f2f5f8;
  --muted: #4d6578;
  --line: #d6e0e8;
  --white: #ffffff;
  --ok: #2e7d5b;
  --ok-bg: #e3f3eb;
  --warn: #9a6512;
  --warn-bg: #fbf0dc;
  --danger: #b4443c;
  --danger-bg: #fbe7e5;
  --info: #2f6fa3;
  --info-bg: #e2eef8;
  --radius: 10px;
  --shadow: 0 1px 0 rgba(21, 48, 74, 0.04), 0 8px 24px rgba(21, 48, 74, 0.08);
  --font: "Manrope", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { width: 100%; min-width: 320px; max-width: 100%; margin: 0; overflow-x: hidden; overflow-x: clip; }

body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  color: var(--navy);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.sidebar :focus-visible { outline-color: var(--ice); }

svg.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
[data-icon] { display: inline-flex; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.hide-sm { }
.hp-field { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted);
}
.eyebrow::before { content: ""; width: 12px; height: 2px; background: var(--steel); transform: rotate(45deg); }

/* Pasek DEMO */
.demo-banner {
  position: relative; z-index: 60;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  width: 100%; min-width: 0; padding: 8px 16px; background: var(--ice); color: var(--navy);
  border-bottom: 1px solid var(--mist); font-size: 13px;
}
.demo-pill { background: var(--navy); color: #fff; font-weight: 800; font-size: 11px; letter-spacing: 0.12em; padding: 3px 8px; border-radius: 4px; }
.demo-banner-text { flex: 1 1 280px; min-width: 0; }
.demo-banner-links { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; min-width: 0; }
.demo-banner-links a { font-weight: 700; text-decoration: none; }
.demo-banner-links a:hover { text-decoration: underline; }
.demo-banner-cta { background: var(--navy); color: #fff !important; padding: 5px 12px; border-radius: 6px; }

/* Układ aplikacji */
.app { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; width: 100%; min-width: 0; background: var(--paper); }

.sidebar {
  position: sticky; top: 0; height: 100vh; min-height: 0;
  display: flex; flex-direction: column;
  background: var(--navy); color: #fff; padding: 20px 14px;
}
.brand { display: block; padding: 4px 10px 22px; }
.brand img { display: block; height: 30px; width: auto; }
.nav { display: flex; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 2px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(220,238,250,.42) transparent; }
.nav::-webkit-scrollbar { width: 6px; }
.nav::-webkit-scrollbar-thumb { background: rgba(220,238,250,.35); border-radius: 99px; }
.nav-label { margin: 16px 10px 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mist); opacity: 0.8; }
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 7px; text-decoration: none;
  color: var(--mist); font-weight: 600; font-size: 14px;
  transition: background 0.15s, color 0.15s;
}
.nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.nav a.active { background: rgba(220, 238, 250, 0.14); color: #fff; box-shadow: inset 3px 0 0 var(--ice); }
.nav-count { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 800; background: rgba(220, 238, 250, 0.16); color: var(--ice); padding: 1px 7px; border-radius: 99px; }
.nav-count:empty { display: none; }
.nav-count-warn { background: #e9a23b; color: var(--navy); }
.sidebar-foot { flex: none; margin-top: auto; padding: 14px 10px 0; border-top: 1px solid rgba(169, 191, 208, 0.2); background: var(--navy); }
.tenant { font-weight: 700; font-size: 13px; }
.tenant-plan { font-size: 12px; color: var(--mist); margin-top: 2px; }

.workspace { min-width: 0; min-height: 100vh; display: flex; flex-direction: column; background: var(--paper); }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: 64px; min-width: 0; padding: 0 24px;
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1 1 0; min-width: 0; max-width: 460px; }
.search-ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px 0 38px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--paper);
}
.search input:focus { outline: none; border-color: var(--navy); background: #fff; }
.search-results {
  position: absolute; top: 46px; left: 0; right: 0; z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow);
  max-height: 380px; overflow: auto; padding: 6px;
}
.search-results button {
  display: flex; width: 100%; gap: 10px; align-items: center; text-align: left;
  border: 0; background: none; padding: 8px 10px; border-radius: 7px;
}
.search-results button:hover, .search-results button:focus { background: var(--paper); outline: none; }
.search-results small { color: var(--muted); margin-left: auto; white-space: nowrap; }
.search-empty { padding: 10px; color: var(--muted); }
.topbar-actions { flex: none; margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: #fff;
}
.icon-btn:hover { background: var(--paper); }
.bell-wrap { position: relative; }
.bell-count {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px;
  font-style: normal; font-size: 11px; font-weight: 800; line-height: 18px; text-align: center;
  color: #fff; background: var(--danger); border-radius: 99px;
}
.bell-panel {
  position: absolute; right: 0; top: 48px; width: 340px; max-width: calc(100vw - 24px); z-index: 40;
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
.bell-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.bell-list { max-height: 360px; overflow: auto; }
.bell-item { display: flex; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--paper); font-size: 13px; }
.bell-item.unread { background: #f7fbfe; }
.bell-item .dot { width: 8px; height: 8px; border-radius: 99px; margin-top: 6px; flex: none; background: var(--info); }
.bell-item .dot.warn { background: #e9a23b; }
.bell-item .dot.danger { background: var(--danger); }
.bell-item .dot.ok { background: var(--ok); }
.user { display: flex; align-items: center; gap: 10px; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 99px; background: var(--navy); color: #fff; font-weight: 800; font-size: 13px;
}
.avatar.sm { width: 26px; height: 26px; font-size: 10px; background: var(--steel); }
.user-meta { display: flex; flex-direction: column; line-height: 1.2; }
.user-meta small { color: var(--muted); font-size: 12px; }

.view { width: 100%; min-width: 0; padding: 28px 28px 60px; outline: none; }

/* Przyciski */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent;
  font-weight: 700; font-size: 13.5px; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.btn .ic { width: 16px; height: 16px; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-outline { border-color: var(--line); background: #fff; color: var(--navy); }
.btn-outline:hover { border-color: var(--navy); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--paper); color: var(--navy); }
.btn-danger { background: #fff; border-color: #efc9c5; color: var(--danger); }
.btn-danger:hover { background: var(--danger-bg); }
.btn-ok { background: var(--ok); color: #fff; }
.btn-ok:hover { background: #256b4d; }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.btn-lg { min-height: 48px; padding: 0 22px; font-size: 15px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* 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 h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; }
.page-head p.muted { margin-top: 4px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs button {
  border: 0; background: none; padding: 10px 14px; font-weight: 700; color: var(--muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs button:hover { color: var(--navy); }
.tabs button.active { color: var(--navy); border-bottom-color: var(--navy); }
.tabs button em { font-style: normal; font-size: 11px; background: var(--paper); border-radius: 99px; padding: 1px 7px; margin-left: 6px; }

/* Karty */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card h2 { font-size: 15px; font-weight: 800; }
.card-link { font-size: 12.5px; font-weight: 700; color: var(--muted); text-decoration: none; border: 0; background: none; padding: 0; }
.card-link:hover { color: var(--navy); text-decoration: underline; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; margin-top: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.grid-2e { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.kpi { position: relative; overflow: hidden; }
.kpi-label { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 12.5px; margin-top: 4px; color: var(--muted); }
.kpi-sub .up { color: var(--ok); font-weight: 700; }
.kpi-sub .down { color: var(--danger); font-weight: 700; }
.kpi::after { content: ""; position: absolute; right: -18px; top: -18px; width: 64px; height: 64px; border: 10px solid var(--ice); border-radius: 99px; border-left-color: transparent; transform: rotate(45deg); }

/* Przewodnik */
.tour { display: grid; grid-template-columns: 1fr auto; gap: 14px; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.tour h2 { font-size: 15px; font-weight: 800; }
.tour p { color: var(--mist); margin-top: 2px; font-size: 13px; }
.tour ol { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tour li a {
  display: flex; gap: 10px; align-items: flex-start; height: 100%;
  padding: 10px 12px; border-radius: 8px; background: rgba(255, 255, 255, 0.06); text-decoration: none; font-size: 13px;
}
.tour li a:hover { background: rgba(255, 255, 255, 0.12); }
.tour li .n { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 99px; border: 1px solid var(--mist); font-size: 11px; font-weight: 800; }
.tour li.done .n { background: var(--ok); border-color: var(--ok); }
.tour li.done span:last-child { text-decoration: line-through; opacity: 0.7; }
.tour .close { align-self: start; color: var(--mist); background: none; border: 0; padding: 4px; }

/* Listy alertów i aktywności */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--paper); }
.list li:first-child { border-top: 0; padding-top: 0; }
.list .ic-wrap { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: var(--paper); color: var(--navy); }
.list .ic-wrap .ic { width: 16px; height: 16px; }
.list .ic-wrap.warn { background: var(--warn-bg); color: var(--warn); }
.list .ic-wrap.danger { background: var(--danger-bg); color: var(--danger); }
.list .ic-wrap.ok { background: var(--ok-bg); color: var(--ok); }
.list .ic-wrap.auto { background: var(--ice); color: var(--navy); }
.list .body { min-width: 0; flex: 1; }
.list .body strong { font-weight: 700; }
.list .meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.list button.linkish { border: 0; background: none; padding: 0; text-align: left; font-weight: 700; color: var(--navy); }
.list button.linkish:hover { text-decoration: underline; }
.empty { padding: 18px 0; color: var(--muted); text-align: center; }

/* Tabele */
.table-wrap { overflow-x: auto; margin: 0 -20px -18px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fbfcfd;
}
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--paper); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: #f8fafc; }
.tbl th:first-child, .tbl td:first-child { padding-left: 20px; }
.tbl th:last-child, .tbl td:last-child { padding-right: 20px; }
.tbl .strong { font-weight: 700; }
.tbl .sub { display: block; font-size: 12px; color: var(--muted); }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .search-local { position: relative; flex: 1 1 220px; max-width: 320px; }
.toolbar .search-local input { width: 100%; height: 36px; padding: 0 10px 0 34px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.toolbar .search-local .ic { position: absolute; left: 10px; top: 9px; width: 16px; height: 16px; color: var(--muted); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 5px 11px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.chip:hover { border-color: var(--steel); color: var(--navy); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip em { font-style: normal; opacity: 0.7; margin-left: 4px; }

/* Etykiety statusów */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 99px; background: currentColor; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-danger { background: var(--danger-bg); color: var(--danger); }
.b-info { background: var(--info-bg); color: var(--info); }
.b-neutral { background: var(--paper); color: var(--muted); }
.late { color: var(--danger); font-weight: 700; }

.bar { height: 6px; background: var(--paper); border-radius: 99px; overflow: hidden; min-width: 60px; }
.bar > span { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.bar.warn > span { background: #e9a23b; }
.bar.danger > span { background: var(--danger); }
.bar.ok > span { background: var(--ok); }

/* Kanban (lejek sprzedaży, produkcja) */
.board { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(230px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 8px; }
.col { background: #e9eef3; border-radius: var(--radius); padding: 10px; min-height: 300px; display: flex; flex-direction: column; gap: 8px; transition: background 0.15s, box-shadow 0.15s; }
.col.drop { background: var(--ice); box-shadow: inset 0 0 0 2px var(--steel); }
.col-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; padding: 2px 4px 6px; }
.col-head h3 { font-size: 13px; font-weight: 800; }
.col-head small { color: var(--muted); font-weight: 700; font-size: 12px; }
.col-sum { padding: 0 4px; margin-top: -6px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: 9px; padding: 11px 12px; cursor: grab; box-shadow: 0 1px 2px rgba(21, 48, 74, 0.05); }
.kcard:hover { border-color: var(--mist); }
.kcard.dragging { opacity: 0.45; }
.kcard h4 { margin: 0; font-size: 13.5px; font-weight: 700; line-height: 1.3; }
.kcard .co { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.kcard .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; }
.kcard .val { font-weight: 800; font-variant-numeric: tabular-nums; }
.kcard .moves { display: flex; gap: 4px; }
.kcard .moves button { width: 26px; height: 26px; border: 1px solid var(--line); background: #fff; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); }
.kcard .moves button:hover { color: var(--navy); border-color: var(--navy); }
.kcard .moves .ic { width: 14px; height: 14px; }
.kcard .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.tag { font-size: 11.5px; font-weight: 700; color: var(--muted); background: var(--paper); border-radius: 5px; padding: 2px 6px; }
.tag.danger { color: var(--danger); background: var(--danger-bg); }
.tag.warn { color: var(--warn); background: var(--warn-bg); }
.board-hint { font-size: 12.5px; color: var(--muted); margin: -8px 0 12px; }

/* Harmonogram (Gantt) */
.gantt { overflow-x: auto; margin: 0 -20px -18px; }
.gantt-inner { min-width: 880px; padding: 0 20px 18px; }
.g-row { display: grid; grid-template-columns: 220px 1fr; align-items: center; min-height: 44px; border-bottom: 1px solid var(--paper); }
.g-row.g-headrow { min-height: 34px; border-bottom: 1px solid var(--line); }
.g-label { font-size: 13px; padding-right: 12px; }
.g-label strong { display: block; font-weight: 700; }
.g-label span { font-size: 12px; color: var(--muted); }
.g-track { position: relative; height: 44px; }
.g-headrow .g-track { height: 34px; display: grid; }
.g-day { font-size: 11px; color: var(--muted); text-align: center; align-self: center; font-weight: 700; }
.g-day.today { color: var(--navy); }
.g-day.we { color: var(--mist); }
.g-bar { position: absolute; top: 11px; height: 22px; border-radius: 6px; background: var(--steel); color: #fff; font-size: 11.5px; font-weight: 700; padding: 0 8px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; cursor: pointer; }
.g-bar.late { background: var(--danger); }
.g-bar .prog { position: absolute; left: 0; top: 0; bottom: 0; background: rgba(21, 48, 74, 0.55); }
.g-bar .lbl { position: relative; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--navy); opacity: 0.6; }
.g-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.g-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 5px; }

/* Wykresy */
.chart svg { display: block; width: 100%; height: auto; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 11px; }
.chart .bar-rect { fill: var(--navy); transition: opacity 0.15s; }
.chart .bar-rect.cur { fill: var(--steel); }
.chart .bar-rect:hover { opacity: 0.8; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.hbars { display: grid; gap: 10px; }
.hbar { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.hbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar .track { height: 10px; background: var(--paper); border-radius: 99px; overflow: hidden; }
.hbar .track span { display: block; height: 100%; background: var(--navy); border-radius: 99px; }
.hbar .v { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 70px; text-align: right; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut-wrap svg { width: 150px; height: 150px; flex: none; }
.legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 13px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; }
.legend b { margin-left: 6px; font-variant-numeric: tabular-nums; }

/* Stanowiska */
.stations { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.station h3 { font-size: 14px; font-weight: 800; }
.station .big { font-size: 28px; font-weight: 800; margin: 8px 0 6px; font-variant-numeric: tabular-nums; }
.station .bar { height: 8px; }
.station p { font-size: 12.5px; color: var(--muted); margin-top: 8px; }

/* Automatyzacje */
.rules { display: grid; gap: 12px; }
.rule { display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center; }
.rule .ic-wrap { display: inline-flex; width: 40px; height: 40px; border-radius: 10px; align-items: center; justify-content: center; background: var(--ice); color: var(--navy); }
.rule.off .ic-wrap { background: var(--paper); color: var(--mist); }
.rule h3 { font-size: 14.5px; font-weight: 800; }
.rule p { color: var(--muted); font-size: 13px; margin-top: 2px; }
.flow { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; font-size: 12px; }
.flow .tag { background: var(--paper); }
.flow .ic { width: 14px; height: 14px; color: var(--mist); }
.rule-runs { font-size: 12px; color: var(--muted); text-align: right; margin-top: 6px; }
.switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: var(--mist); border-radius: 99px; transition: background 0.15s; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 99px; background: #fff; transition: transform 0.15s; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--navy); outline-offset: 2px; }

/* Zadania */
.tasks li { align-items: center; }
.tasks input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--navy); flex: none; }
.tasks li.done .body strong { text-decoration: line-through; color: var(--muted); font-weight: 600; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.inline-form input, .inline-form select { height: 36px; border: 1px solid var(--line); border-radius: 8px; padding: 0 10px; background: #fff; }
.inline-form input[name="text"] { flex: 1 1 220px; }

/* Panel boczny (szczegóły) */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 70;
  width: min(560px, 100vw); background: #fff; box-shadow: -12px 0 40px rgba(21, 48, 74, 0.18);
  transform: translateX(105%); transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex; flex-direction: column; visibility: hidden;
}
.drawer.open { transform: none; visibility: visible; }
.drawer-head { padding: 20px 24px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 12px; justify-content: space-between; align-items: flex-start; }
.drawer-head h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; margin-top: 4px; }
.drawer-head .muted { margin-top: 2px; }
.drawer-body { padding: 18px 24px 30px; overflow-y: auto; flex: 1; }
.drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 24px; border-top: 1px solid var(--line); background: #fbfcfd; }
.drawer h3 { font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 22px 0 10px; }
.drawer h3:first-child { margin-top: 0; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 7px 12px; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 600; }
.stats-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stats-mini div { background: var(--paper); border-radius: 8px; padding: 10px 12px; }
.stats-mini small { display: block; color: var(--muted); font-size: 12px; font-weight: 700; }
.stats-mini strong { font-size: 17px; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 16px; border-left: 2px solid var(--line); }
.timeline li { position: relative; padding: 0 0 12px 12px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: -22px; top: 4px; width: 10px; height: 10px; border-radius: 99px; background: #fff; border: 2px solid var(--steel); }
.timeline li.auto::before { border-color: var(--ok); background: var(--ok-bg); }
.timeline small { display: block; color: var(--muted); font-size: 12px; }
.steps { display: flex; gap: 4px; margin: 4px 0 6px; }
.steps span { flex: 1; height: 6px; border-radius: 99px; background: var(--line); }
.steps span.on { background: var(--navy); }
.steps-lbl { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); font-weight: 700; }
.note-form { display: grid; gap: 8px; margin-top: 10px; }
.note-form .row { display: flex; gap: 8px; }
.note-form select, .note-form textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.note-form textarea { resize: vertical; min-height: 64px; width: 100%; }

/* Okno modalne */
.modal-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(21, 48, 74, 0.45); display: flex; align-items: flex-start; justify-content: center; width: 100%; padding: max(16px, env(safe-area-inset-top)) 12px max(16px, env(safe-area-inset-bottom)); overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.modal-wrap[hidden] { display: none; }
.modal { display: flex; flex-direction: column; width: min(620px, 100%); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); min-width: 0; background: #fff; border-radius: 14px; box-shadow: 0 24px 64px rgba(21, 48, 74, 0.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 18px; font-weight: 800; }
.modal-body { min-height: 0; padding: 18px 22px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fbfcfd; border-radius: 0 0 14px 14px; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; font-size: 13px; font-weight: 700; }
.field input, .field select, .field textarea { display: block; width: 100%; max-width: 100%; min-width: 0; height: 40px; border: 1px solid var(--line); border-radius: 8px; padding: 0 11px; background: #fff; font-weight: 500; font-size: 14px; }
.field textarea { height: auto; padding: 9px 11px; min-height: 70px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px var(--ice); }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; min-width: 0; }
.field-grid .span2 { grid-column: span 2; }
.items-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(84px, 90px) minmax(90px, 110px); gap: 8px; align-items: end; min-width: 0; margin-top: 12px; }
.items-grid .field { font-weight: 600; }
.items-grid .line-val { height: 40px; display: flex; align-items: center; justify-content: flex-end; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-box { margin-top: 14px; background: var(--paper); border-radius: 10px; padding: 12px 14px; font-size: 13px; }
.summary-box .total { display: flex; justify-content: space-between; font-size: 16px; font-weight: 800; }
.summary-box ul { margin: 8px 0 0; padding-left: 18px; color: var(--muted); }
.summary-box li.warn { color: var(--warn); font-weight: 600; }
.summary-box li.ok { color: var(--ok); font-weight: 600; }
.form-hint { font-size: 12.5px; color: var(--muted); margin-top: 12px; }

/* Powiadomienia (toasty) */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 90; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 36px)); }
.toast {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--navy); color: #fff; border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); font-size: 13.5px;
  animation: toast-in 0.25s ease-out both;
}
.toast .ic { margin-top: 1px; color: var(--ice); }
.toast.ok .ic { color: #7fd4ab; }
.toast.warn .ic { color: #f3c470; }
.toast .t-body { flex: 1; }
.toast button { margin-top: 8px; border: 1px solid var(--mist); background: transparent; color: #fff; border-radius: 6px; padding: 4px 10px; font-weight: 700; font-size: 12.5px; }
.toast button:hover { background: rgba(255, 255, 255, 0.1); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* Bramka wejścia */
.gate { position: fixed; inset: 0; z-index: 100; background: var(--navy); overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; }
.gate[hidden] { display: none; }
.gate::before {
  content: ""; position: fixed; right: -220px; top: -180px; width: 760px; height: 760px; border-radius: 50%;
  border: 56px solid rgba(169, 191, 208, 0.1); border-left-color: transparent; transform: rotate(45deg); pointer-events: none;
}
.gate-card { position: relative; width: min(600px, 100%); background: #fff; border-radius: 16px; padding: 32px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3); }
.gate-topline { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; margin-bottom: 26px; }
.gate-logo { display: block; height: 32px; width: auto; }
.gate-back { display: inline-flex; min-height: 40px; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); padding: 0 13px; color: var(--navy); font-size: 13px; font-weight: 800; text-decoration: none; transition: background .15s, border-color .15s, transform .15s; }
.gate-back:hover { transform: translateY(-1px); border-color: var(--mist); background: var(--ice); }
.gate-back:focus-visible { outline-color: var(--navy); }
.gate h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin-top: 10px; line-height: 1.15; }
.gate-lead { color: var(--muted); font-size: 15px; margin-top: 10px; }
.gate-points { margin: 16px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; font-size: 13.5px; }
.gate-points li { display: flex; gap: 8px; }
.gate-points li::before { content: ""; flex: none; width: 10px; height: 2px; background: var(--steel); transform: rotate(45deg); margin-top: 9px; }
.gate-form { margin-top: 22px; display: grid; gap: 14px; }
.gate-error { border: 1px solid #efc9c5; border-radius: 8px; background: var(--danger-bg); color: #7d2924; padding: 11px 13px; font-weight: 700; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--muted); }
.check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--navy); flex: none; }
.check a { color: var(--navy); font-weight: 700; }
.gate-form .btn { justify-self: start; }
.noscript { position: fixed; inset: 0; z-index: 200; background: #fff; padding: 40px; font-size: 18px; }

/* Responsywność */
@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tour ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 920px) {
  .app { grid-template-columns: minmax(0, 1fr); overflow-x: clip; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; height: 100dvh; z-index: 75; width: 260px; transform: translateX(-105%); transition: transform 0.22s ease; }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; z-index: 74; background: rgba(21, 48, 74, 0.45); }
  .topbar .menu-btn { display: inline-flex; flex: none; }
  .topbar { padding: 0 16px; }
  .view { max-width: 100vw; padding: 20px 16px 48px; overflow-x: clip; }
  .grid-2, .grid-2e { grid-template-columns: minmax(0, 1fr); }
  .hide-sm { display: none; }
}

@media (max-width: 640px) {
  .kpis, .grid-3, .tour ol { grid-template-columns: minmax(0, 1fr); }
  .field-grid, .stats-mini { grid-template-columns: 1fr; }
  .field-grid .span2 { grid-column: auto; }
  .dl { grid-template-columns: 1fr; gap: 2px; }
  .dl dd { margin-bottom: 8px; }
  .items-grid { grid-template-columns: minmax(0, 1fr) minmax(76px, 0.38fr); gap: 10px 8px; }
  .items-grid .line-val { display: none; }
  .modal-head { padding: 14px 16px; }
  .modal-body { padding: 16px; }
  .modal-foot { padding: 12px 16px; }
  .modal-foot .btn { flex: 1 1 120px; min-width: 0; padding: 0 10px; white-space: normal; }
  .topbar { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 8px; padding: 0 10px; }
  .topbar .menu-btn { width: 40px; }
  .search { width: 100%; max-width: none; }
  .topbar-actions { gap: 6px; margin-left: 0; }
  .search input,
  .toolbar .search-local input,
  .field input,
  .field select,
  .field textarea,
  .inline-form input,
  .inline-form select,
  .note-form select,
  .note-form textarea { font-size: 16px; }
  .demo-banner { gap: 8px; padding: 8px 12px; }
  .demo-banner-links { gap: 8px 12px; }
  .demo-banner-text { flex-basis: 100%; order: 3; font-size: 12px; }
  .gate-card { padding: 24px 20px; }
  .gate h1 { font-size: 24px; }
  .rule { grid-template-columns: 1fr auto; }
  .rule .ic-wrap { display: none; }
  .user { display: none; }
}

/* Nazwa programu pod logo, ikony w menu, strona wyboru */
.brand-prog { margin: -12px 10px 18px; font-size: 11px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--mist); }
.nav-ic { display: inline-flex; flex: none; }
.nav-ic .ic { width: 17px; height: 17px; }
.nav a { position: relative; }
.nav-count { margin-left: auto; }

.chooser-body { background: var(--navy); color: #fff; min-height: 100vh; }
.chooser-head { display: flex; justify-content: space-between; align-items: center; padding: 20px 32px; }
.chooser-head img { display: block; height: 32px; width: auto; }
.chooser-back { color: var(--mist); font-weight: 700; text-decoration: none; font-size: 14px; }
.chooser-back:hover { color: #fff; }
.chooser { max-width: 1040px; margin: 0 auto; padding: 24px 24px 60px; }
.chooser h1 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.12; margin-top: 10px; }
.chooser .eyebrow { color: var(--mist); }
.chooser .eyebrow::before { background: var(--mist); }
.chooser-lead { color: var(--mist); font-size: 16px; line-height: 1.6; margin-top: 14px; max-width: 640px; }
.chooser-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 40px; }
.choice {
  display: flex; flex-direction: column; gap: 12px; padding: 28px; border-radius: 16px;
  background: #fff; color: var(--navy); text-decoration: none; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s ease;
}
.choice:hover { transform: translateY(-3px); }
.choice-ic { display: inline-flex; width: 48px; height: 48px; border-radius: 12px; background: var(--ice); align-items: center; justify-content: center; }
.choice-ic svg { width: 26px; height: 26px; fill: none; stroke: var(--navy); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.choice h2 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; }
.choice p { color: var(--muted); font-size: 15px; line-height: 1.6; }
.choice ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; line-height: 1.7; display: grid; gap: 4px; }
.choice-cta { margin-top: auto; padding-top: 10px; font-weight: 800; color: var(--navy); }
@media (max-width: 760px) {
  .chooser-grid { grid-template-columns: minmax(0, 1fr); }
  .chooser-head { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
