/* Jeden styl z logowaniem: ciemny pasek jak ekran logowania, w środku jasno (krem, białe karty), akcent bursztynowy.
   Kolory marki z cannabio.pl: bursztyn #C47D39, mokka #B2948B, beż #DBCABE, szałwia (algi) #80A07D */
:root {
  --bg: #f6f1ec; --card: #fff; --card2: #f4ede7; --ink: #1f1a17; --muted: #7a6d64; --line: #e8ded6;
  --accent: #cf8b45; --accent-grad: linear-gradient(135deg, #cf8b45, #a8690a); --beige: #dbcabe;
  --ok: #3c8a4c; --amber: #c4842f; --red: #c8452f; --gray: #6c625b; --r: 14px;
  --night: #110e0d;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.45 Nunito, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink);
  background-image: radial-gradient(900px 500px at 85% -10%, rgba(207, 139, 69, .12), transparent 60%); background-attachment: fixed; }
a { color: var(--accent); }
h1 { font-size: 22px; margin: 4px 0 12px; font-weight: 700; }
h2 { font-size: 17px; margin: 24px 0 8px; }
h1 small, h2 small { font-weight: 400; color: var(--muted); font-size: 13px; }
h1 .mnav { width: 32px; height: 32px; margin: 0 8px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink); font: inherit; font-size: 20px; line-height: 1; cursor: pointer; vertical-align: 2px; }
h1 .mnav:first-child { margin-left: 0; }
h1 .mnav:disabled { opacity: .3; cursor: default; }
h3 { font-size: 12px; margin: 0 0 10px; color: #7d6049; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; }
h4 { font-size: 13px; margin: 14px 0 6px; color: var(--muted); }

.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 10px; align-items: center; padding: 10px 16px; height: 52px;
  background: rgba(17, 14, 13, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); color: #f1e8e1; }
.brand { color: #f1e8e1; text-decoration: none; font-weight: 700; font-size: 18px; display: flex; align-items: center; gap: 8px; margin-right: auto; }
.brand small { font-weight: 400; color: var(--beige); letter-spacing: .18em; font-size: 11px; }
.brand img { height: 17px; filter: invert(1); } /* czarne logo → białe */
.top select { background: #251f1c; color: #f1e8e1; border: 1px solid #342c27; width: auto; max-width: 170px; padding: 5px 8px; border-radius: 8px; font-size: 13px; }
.who { font-size: 13px; color: #a5978d; }
.link { background: none; border: 0; color: var(--beige); text-decoration: underline; cursor: pointer; font: inherit; font-size: 13px; padding: 0; }
@media (max-width: 520px) { .who { display: none; } .top select { max-width: 130px; } }

main { padding: 16px 16px 96px; max-width: 1100px; margin: 0 auto; }
.nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: rgba(255, 255, 255, .94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); z-index: 5; padding-bottom: env(safe-area-inset-bottom); }
.nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0; font-size: 11px; color: var(--muted); text-decoration: none; }
.nav a.on { color: var(--accent); font-weight: 700; }
.nav svg { width: 22px; height: 22px; }
@media (min-width: 900px) {
  .nav { top: 52px; right: auto; width: 190px; flex-direction: column; border-top: 0; border-right: 1px solid var(--line); padding-top: 12px; background: transparent; backdrop-filter: none; }
  .nav a { flex: 0 0 auto; flex-direction: row; gap: 10px; padding: 10px 20px; font-size: 14px; border-left: 2px solid transparent; }
  .nav a.on { border-left-color: var(--accent); background: linear-gradient(90deg, rgba(207, 139, 69, .12), transparent); }
  main { margin: 0 0 0 190px; padding: 24px 32px 40px; max-width: none; } /* szeroki ekran: treść na całą szerokość obok menu */
}

/* kafelki: tyle w rzędzie, ile się mieści; ostatni rząd rozciąga się na całą szerokość (bez dziur) */
.cards { display: flex; flex-wrap: wrap; gap: 10px; }
.cards > .card { flex: 1 1 160px; }
.cards > .card.big { flex: 2 1 330px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; min-width: 0; }
.lbl { font-size: 12px; color: var(--muted); }
.num { font-size: 26px; font-weight: 700; margin: 2px 0; }
.num small { font-size: 14px; color: var(--muted); font-weight: 500; }
.sub { font-size: 12.5px; color: var(--muted); }
/* kwoty netto: duże */
.cards > .card.money { flex: 1.3 1 220px; }
.card.money .num { font-size: clamp(26px, 7vw, 34px); font-weight: 800; letter-spacing: -.5px; white-space: nowrap; }
.card.money .sub b { color: var(--ink); }
/* panel handlowca: 5 kart z kwotami w jednym rzędzie, pod nimi drobne liczby */
.cards.five { margin-bottom: 10px; }
.cards.five > .card { flex: 1 1 190px; }
@media (min-width: 900px) { .cards.five .card.money .num { font-size: 30px; } }
.bar { height: 6px; background: var(--card2); border-radius: 5px; overflow: hidden; margin: 6px 0; }
.bar i { display: block; height: 100%; background: var(--accent-grad); }
.bar i.amber { background: var(--amber); } .bar i.red { background: var(--red); } .bar i.gray { background: var(--gray); }

.row { display: flex; gap: 10px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 6px; color: inherit; text-decoration: none; }
a.row:hover { border-color: rgba(207, 139, 69, .5); }
.row.overdue { border-left: 3px solid var(--red); }
.grow { flex: 1; min-width: 0; }
.right { text-align: right; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mini { width: 104px; text-align: right; font-size: 13px; flex: none; }
.mini .bar { margin: 3px 0; height: 5px; }
.badge { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 20px; background: var(--card2); color: var(--muted); white-space: nowrap; }
.badge.green { background: rgba(60, 138, 76, .12); color: var(--ok); } .badge.amber { background: rgba(196, 132, 47, .14); color: var(--amber); } .badge.red { background: rgba(200, 69, 47, .12); color: var(--red); }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--gray); flex: none; }
.dot.r90 { background: var(--red); } .dot.r85 { background: var(--amber); } .dot.task { background: var(--ok); } .dot.note { background: var(--beige); }

/* jedna wysokość kontrolek: pola, listy i przyciski = 40 px */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; background: var(--accent-grad); color: #fff; border: 0; border-radius: 10px; padding: 0 16px; font: inherit; font-weight: 700; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer; box-shadow: 0 6px 18px rgba(196, 125, 57, .25); }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn:disabled { opacity: .45; cursor: default; }
button.sm, a.sm { display: inline-block; text-decoration: none; font: inherit; font-size: 12.5px; padding: 5px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--card2); color: var(--ink); cursor: pointer; }
button.sm:hover, a.sm:hover { border-color: var(--accent); }
.danger { color: var(--red) !important; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.head > h1, .head > h2 { margin: 0; }
* + .head { margin-top: 20px; }
/* pasek filtrów (wspólny dla modułów): pola i przyciski w jednym rzędzie, ta sama wysokość */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin: 10px 0 14px; }
.filters label { margin: 0; flex: 1 1 160px; min-width: 0; }
.filters > input, .filters > select { flex: 1 1 160px; width: auto; min-width: 0; }
.filters .btn, .filters .chip { flex: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }

input, select, textarea { width: 100%; font: inherit; font-size: 15px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card2); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(207, 139, 69, .6); border-color: transparent; }
input:-webkit-autofill { -webkit-text-fill-color: var(--ink); box-shadow: 0 0 0 40px var(--card2) inset; caret-color: var(--ink); }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select { height: 40px; padding-top: 0; padding-bottom: 0; }
textarea { min-height: 80px; resize: vertical; }
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
label input, label select, label textarea { margin-top: 4px; }
label.check { display: flex; gap: 8px; align-items: center; color: var(--ink); }
label.check input { width: auto; margin: 0; accent-color: var(--accent); }
.form { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; margin: 10px 0; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 0 12px; }
@media (min-width: 700px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.inline { display: flex; gap: 8px; align-items: end; }
.inline label { flex: 1; }

.chips { display: flex; gap: 6px; overflow-x: auto; margin: 10px 0; padding-bottom: 2px; scrollbar-width: none; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 20px; padding: 6px 12px; font: inherit; font-size: 13px; white-space: nowrap; cursor: pointer; color: var(--ink); }
.chip.on { background: var(--accent-grad); color: #fff; border-color: transparent; }
.cols { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .cols { grid-template-columns: repeat(3, 1fr); } }
dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 14px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.back { display: inline-block; margin-bottom: 6px; text-decoration: none; font-size: 14px; }
.empty { color: var(--muted); font-style: italic; }
.err { color: var(--red); }
.loading { color: var(--muted); padding: 20px 0; }

.tablewrap { overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; white-space: nowrap; }
details.row { display: block; }
details summary { display: flex; gap: 10px; align-items: center; cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details table { margin-top: 8px; }

.step { display: flex; align-items: center; gap: 6px; flex: none; }
.step button { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: var(--card2); font-size: 18px; color: var(--accent); cursor: pointer; }
.step span { min-width: 24px; text-align: center; font-weight: 600; }
.cart { position: sticky; bottom: 70px; display: flex; gap: 12px; align-items: center; background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; box-shadow: 0 -6px 24px rgba(60, 40, 20, .08); margin-top: 12px; }
.cart b { font-size: 20px; }
.cart .bar { margin: 4px 0 2px; }
@media (min-width: 900px) { .cart { bottom: 12px; } }
s { color: var(--muted); }
.tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }

/* logowanie: wideo (pion 2:3) wtapia się w tło, karta = przydymione szkło.
   telefon: wideo na cały ekran, karta na dole; komputer: butelki po prawej, karta po lewej */
.login { position: relative; min-height: 100vh; min-height: 100dvh; display: flex; align-items: flex-end; justify-content: center; background: var(--night); overflow: hidden; color: #f3e9e2;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }
/* telefon: zdjęcie u góry (butelki całe), niżej czerń i formularz bez ramki — nic nie zasłania */
.login-art { position: absolute; top: 0; left: 0; right: 0; height: 62%; }
.login-art video { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; display: block; }
.login-art::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, var(--night) 100%); }
.login-box { position: relative; width: 100%; max-width: 380px; padding: 0 6px 4px; background: none; border: 0; }
.login-box .logo { display: block; width: 150px; max-width: 60%; margin: 0 auto; filter: invert(1) drop-shadow(0 2px 8px rgba(0, 0, 0, .6)); }
.login-box .tag { text-align: center; margin: 6px 0 12px; color: var(--beige); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; }
.login-box label { margin-bottom: 8px; }
.login-box .form { background: none; border: 0; padding: 0; margin: 0; }
.login-box h3, .login-box label, .login-box .muted { color: #cdbfb6; }
.login-box input { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .16); color: #fff; }
.login-box input:-webkit-autofill { -webkit-text-fill-color: #fff; caret-color: #fff; box-shadow: 0 0 0 40px #2b2320 inset; }
.login-box .err { color: #ff9b85; }
@media (min-width: 900px) {
  .login { align-items: center; justify-content: flex-start; padding-left: max(6vw, calc(50vw - 560px)); }
  /* butelki po prawej, lewa krawędź rozmyta w czerń */
  .login-art video { object-position: 50% 34%; }
  .login-art { left: auto; height: 100%; width: min(64vw, 100vh); -webkit-mask-image: linear-gradient(90deg, transparent, #000 32%); mask-image: linear-gradient(90deg, transparent, #000 32%); }
  .login-art::after { background: linear-gradient(180deg, rgba(17, 14, 13, .5), transparent 22%, transparent 78%, rgba(17, 14, 13, .6)); }
  .login-box { background: rgba(24, 19, 17, .35); padding: 26px 22px 16px; border: 1px solid rgba(255, 255, 255, .09); border-radius: 20px; backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
  .login-box .logo { width: 200px; }
  .login-box .tag { margin: 10px 0 20px; }
}
.forgot { display: block; margin: 10px auto 0; background: none; border: 0; font: inherit; font-size: 13px; color: var(--beige); text-decoration: underline; cursor: pointer; }
.row.rm-gotowe { border-left: 3px solid var(--ok); } .row.rm-teraz { border-left: 3px solid var(--amber); }
.row.rm-pytanie { border-left: 3px solid var(--red); } .row.rm-plan { border-left: 3px solid var(--line); }
@media (max-width: 600px) { .row[class*="rm-"] { flex-wrap: wrap; } .row[class*="rm-"] .grow { flex-basis: 100%; } }

/* mapa województw (pulpit admina): szare = bez handlowca, niebieskie = z handlowcem */
.map { position: relative; margin-bottom: 12px; }
.pl-grid > .cards { margin-bottom: 10px; }
/* szeroki ekran: podsumowanie Polski w kolumnie obok mapy */
@media (min-width: 1400px) { .pl-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 2fr; gap: 10px; align-items: start; } .pl-grid > .cards { flex-direction: column; margin: 0; } .pl-grid > .cards > .card { flex: none; } .pl-grid > .map { margin: 0; } }
.map svg { display: block; width: 100%; max-width: 660px; height: auto; max-height: 72vh; margin: 0 auto; }
.map path { fill: #e3d9d0; stroke: #fff; stroke-width: 1.4; stroke-linejoin: round; cursor: pointer; transition: fill .15s, filter .15s; }
.map path.has { fill: #5b8bd0; }
.map path:hover, .map path.on, .map path:focus { fill: #cbbdb1; outline: none; }
.map path.has:hover, .map path.has.on, .map path.has:focus { fill: #2f62ad; filter: drop-shadow(0 4px 10px rgba(47, 98, 173, .35)); }
.legend { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; background: #e3d9d0; vertical-align: -2px; margin-right: 5px; }
.legend i.has { background: #5b8bd0; }
.tip { position: absolute; z-index: 3; pointer-events: none; width: 260px; background: rgba(255, 255, 255, .97); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; box-shadow: 0 14px 40px rgba(60, 40, 20, .16); font-size: 13px; backdrop-filter: blur(8px); }
.tip h4 { margin: 0 0 4px; color: var(--ink); font-size: 16px; }
.tip-row { display: flex; justify-content: space-between; gap: 10px; margin-top: 7px; }
.tip .bar { margin: 4px 0 0; }
.tip .hint { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); color: #2f62ad; font-size: 12px; }
/* mapa województwa: kropki salonów */
.rmap { height: 64vh; min-height: 360px; border-radius: var(--r); border: 1px solid var(--line); overflow: hidden; z-index: 0; background: #f2f1ee; }
.rmap[data-base="Ciemna"] { background: #0e1116; }
.rmap .leaflet-control-layers { border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 4px 16px rgba(60, 40, 20, .12); font: 13px Nunito, system-ui, sans-serif; }
.rmap .leaflet-control-layers-base label { margin: 0; color: var(--ink); }
.rmap .leaflet-control-layers-base label > span { display: flex; align-items: center; gap: 6px; padding: 2px 0; }
.rmap .leaflet-control-layers-base input { width: auto; margin: 0; accent-color: var(--accent); }
.pins .chip { display: inline-flex; align-items: center; gap: 6px; opacity: .5; }
.pins .chip.on { opacity: 1; background: var(--card); color: var(--ink); border-color: var(--c); box-shadow: inset 0 0 0 1px var(--c), 0 0 12px -4px var(--c); }
.pins .chip i { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.pin { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--c); border: 2px solid #fff; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 25%, transparent), 0 1px 4px rgba(0, 0, 0, .3); }
.rmap[data-base="Ciemna"] .pin { border-color: #0e1116; box-shadow: 0 0 10px 3px var(--c); }
.leaflet-popup-content { font: 13px/1.45 Nunito, system-ui, sans-serif; }
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: #1f1a17; color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 20; font-size: 14px; max-width: calc(100% - 32px); box-shadow: 0 10px 30px rgba(0, 0, 0, .25); }
.toast.bad { background: var(--red); }

/* noc: ciemny motyw (przełącznik ☀/☾ w pasku; domyślnie wg ustawień systemu) */
:root[data-theme="dark"] {
  --bg: #120f0e; --card: #1c1715; --card2: #251f1c; --ink: #f1e8e1; --muted: #a5978d; --line: #342c27;
  --ok: #86b98f; --amber: #d9a050; --red: #e0705c; color-scheme: dark;
}
[data-theme="dark"] h3 { color: var(--beige); }
[data-theme="dark"] .nav { background: rgba(17, 14, 13, .92); }
@media (min-width: 900px) { [data-theme="dark"] .nav { background: transparent; } }
[data-theme="dark"] .cart, [data-theme="dark"] .tip { background: rgba(28, 23, 21, .96); box-shadow: 0 14px 40px rgba(0, 0, 0, .5); }
[data-theme="dark"] .map path { fill: #3a322e; stroke: #4a403b; }
[data-theme="dark"] .map path.has { fill: #3f6fb5; }
[data-theme="dark"] .map path:hover, [data-theme="dark"] .map path.on { fill: #51463f; }
[data-theme="dark"] .map path.has:hover, [data-theme="dark"] .map path.has.on { fill: #5b8bd0; filter: drop-shadow(0 0 10px rgba(91, 139, 208, .6)); }
[data-theme="dark"] .legend i { background: #3a322e; box-shadow: inset 0 0 0 1px #4a403b; } [data-theme="dark"] .legend i.has { background: #3f6fb5; }
[data-theme="dark"] .tip .hint { color: #7fa6e0; }
[data-theme="dark"] .badge.green { background: rgba(134, 185, 143, .15); } [data-theme="dark"] .badge.amber { background: rgba(217, 160, 80, .15); } [data-theme="dark"] .badge.red { background: rgba(224, 112, 92, .15); }
[data-theme="dark"] .rmap .leaflet-control-layers, [data-theme="dark"] .rmap .leaflet-bar a { background: rgba(28, 23, 21, .92); color: var(--ink); border-color: var(--line); }
[data-theme="dark"] .leaflet-popup-content-wrapper, [data-theme="dark"] .leaflet-popup-tip { background: #1c1715; color: var(--ink); }
.theme { background: none; border: 1px solid #342c27; border-radius: 8px; color: #f1e8e1; font-size: 15px; line-height: 1; padding: 5px 8px; cursor: pointer; }
/* „Nie jestem robotem” */
.robot { display: flex; align-items: center; gap: 10px; margin: 2px 0 12px; padding: 10px 12px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 10px; background: rgba(255, 255, 255, .05); cursor: pointer; color: #f1e8e1; font-size: 14px; user-select: none; }
.robot input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.rb-box { width: 22px; height: 22px; flex: none; border: 2px solid #cdbfb6; border-radius: 5px; display: grid; place-items: center; transition: .15s; }
.robot input:focus-visible + .rb-box { outline: 2px solid var(--accent); outline-offset: 2px; }
.robot.busy .rb-box { border-color: var(--accent); border-right-color: transparent; border-radius: 50%; animation: rb-spin .7s linear infinite; }
.robot.ok .rb-box { background: #3c8a4c; border-color: #3c8a4c; }
.robot.ok .rb-box::after { content: "✓"; color: #fff; font-size: 15px; font-weight: 700; }
@keyframes rb-spin { to { transform: rotate(360deg); } }
/* pulpit szefa */
.cols2 { display: grid; gap: 0 24px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .cols2 { grid-template-columns: 1fr 1fr; } }
.zs-table .bar { width: 110px; height: 5px; margin: 4px 0 0; }
.row.feed { padding: 8px 12px; }
.zs-table tr.on td { background: var(--card2); } .zs-table tbody tr.zs-more { cursor: default; } .zs-table tbody tr.zs-more:hover td { background: transparent; }
.zs-list { max-height: 480px; overflow: auto; }
.as-chip { background: var(--accent-grad); color: #fff; border: 0; border-radius: 20px; padding: 5px 12px; font: inherit; font-size: 13px; cursor: pointer; }
