/* ==========================================================================
   Sklep z aplikacjami – wspólne style (sklep, panel klienta, panel admina)
   ========================================================================== */

:root {
  --bg: #F1F3F2;
  --surface: #FFFFFF;
  --surface-2: #E7EBEA;
  --ink: #18203A;
  --ink-2: #4A5270;
  --ink-3: #7A819A;
  --line: #D6DBE2;
  --cobalt: #2F45E0;
  --cobalt-ink: #1F31B5;
  --cobalt-tint: #E4E8FD;
  --mint: #12875C;
  --mint-tint: #DDF3E9;
  --amber: #A86500;
  --amber-tint: #FBEFD6;
  --red: #B9332A;
  --red-tint: #FBE3E0;

  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Instrument Sans", "Segoe UI", system-ui, sans-serif;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 18px;
  --gutter: clamp(16px, 4vw, 40px);
  --wrap: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--cobalt-ink); text-underline-offset: 3px; }
a:hover { color: var(--cobalt); }
:focus-visible { outline: 3px solid var(--cobalt); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 .5em; letter-spacing: -0.015em; }
h1 { font-size: clamp(2.1rem, 5.2vw, 3.6rem); font-weight: 750; letter-spacing: -0.03em; }
h2 { font-size: clamp(1.5rem, 3vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 650; }
h4 { font-size: 1.02rem; font-weight: 650; }
p { margin: 0 0 1em; }
small, .muted { color: var(--ink-2); }
.tiny { font-size: .82rem; color: var(--ink-3); }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* --- Przyciski -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  border: 1.5px solid transparent; border-radius: var(--r-sm);
  font: 600 .98rem/1 var(--font-body); text-decoration: none; cursor: pointer;
  background: var(--cobalt); color: #fff;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { background: var(--cobalt-ink); color: #fff; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--surface); color: var(--ink); border-color: var(--ink-3); }
.btn--quiet { background: transparent; color: var(--cobalt-ink); padding: 0 8px; min-height: 36px; }
.btn--quiet:hover { background: var(--cobalt-tint); color: var(--cobalt-ink); }
.btn--danger { background: var(--red); }
.btn--danger:hover { background: #962820; }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: .88rem; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* --- Formularze ------------------------------------------------------- */
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=search],
input[type=date], input:not([type]), select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  border: 1.5px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: inherit;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
.field { margin-bottom: 18px; }
.field .help { font-size: .84rem; color: var(--ink-3); margin-top: 4px; }
.field .error, .errorlist { color: var(--red); font-size: .88rem; margin: 6px 0 0; padding: 0; list-style: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--cobalt); flex: none; }

/* --- Komunikaty ------------------------------------------------------- */
.messages { list-style: none; margin: 0 0 24px; padding: 0; }
.messages li { padding: 12px 16px; border-radius: var(--r-sm); margin-bottom: 8px; background: var(--cobalt-tint); color: var(--cobalt-ink); }
.messages .success { background: var(--mint-tint); color: #0B5E40; }
.messages .error { background: var(--red-tint); color: #8B2119; }
.messages .warning { background: var(--amber-tint); color: #7A4A00; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip--ok { background: var(--mint-tint); color: var(--mint); }
.chip--trial { background: var(--amber-tint); color: var(--amber); }
.chip--warn { background: var(--amber-tint); color: var(--amber); }
.chip--bad { background: var(--red-tint); color: var(--red); }
.chip--info { background: var(--cobalt-tint); color: var(--cobalt-ink); }

/* ==========================================================================
   Nagłówek sklepu
   ========================================================================== */
.site-header { padding: 18px 0; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font: 750 1.2rem/1 var(--font-display); color: var(--ink); text-decoration: none; letter-spacing: -0.02em; }
.brand-mark { width: 30px; height: 30px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.brand-mark i { background: var(--cobalt); border-radius: 2px; }
.brand-mark i:nth-child(2), .brand-mark i:nth-child(4) { background: var(--ink); }
.brand-mark i:nth-child(9) { background: var(--mint); }
.nav { display: flex; align-items: center; gap: 6px; }
.nav a:not(.btn) { color: var(--ink-2); text-decoration: none; font-weight: 600; padding: 8px 10px; border-radius: var(--r-sm); }
.nav a:not(.btn):hover { color: var(--ink); background: var(--surface-2); }
.nav form { margin: 0; }
@media (max-width: 640px) {
  .nav .nav-hide-sm { display: none; }
}

.site-footer { margin-top: 96px; padding: 32px 0 48px; border-top: 1px solid var(--line); color: var(--ink-3); font-size: .9rem; }
.site-footer a { color: var(--ink-2); }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; }

/* ==========================================================================
   Strona główna – pasek 14 dni
   ========================================================================== */
.hero { padding: clamp(32px, 7vw, 88px) 0 clamp(40px, 6vw, 72px); }
.hero h1 { max-width: 15ch; }
.hero-lead { font-size: clamp(1.05rem, 1.6vw, 1.22rem); color: var(--ink-2); max-width: 54ch; margin-bottom: 28px; }

.trialstrip { margin-top: clamp(36px, 6vw, 64px); }
.trialstrip-days {
  display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)) minmax(0, 2.4fr);
  gap: 6px; align-items: stretch;
}
.day {
  aspect-ratio: 3 / 4; border-radius: var(--r-sm); background: var(--surface);
  border: 1.5px solid var(--line); padding: 6px 6px 8px;
  display: flex; flex-direction: column; justify-content: space-between;
  font-variant-numeric: tabular-nums;
}
.day b { font: 700 clamp(.9rem, 1.7vw, 1.35rem)/1 var(--font-display); }
.day span { font-size: .68rem; color: var(--ink-3); }
.day--free { background: var(--cobalt); border-color: var(--cobalt); color: #fff; }
.day--free span { color: rgba(255,255,255,.75); }
.day--free:first-child { background: var(--ink); border-color: var(--ink); }
.day--decide { aspect-ratio: auto; border-style: dashed; border-color: var(--ink-3); background: transparent; justify-content: center; padding: 8px 12px; }
.day--decide b { font-size: clamp(.82rem, 1.3vw, 1rem); }
.day--decide span { font-size: .78rem; color: var(--ink-2); }
.trialstrip-legend { display: flex; justify-content: space-between; gap: 16px; margin-top: 12px; font-size: .9rem; color: var(--ink-2); }
@media (prefers-reduced-motion: no-preference) {
  .trialstrip .day--free { animation: fill .45s cubic-bezier(.2,.7,.2,1) both; animation-delay: calc(var(--i) * 45ms + 150ms); }
  @keyframes fill { from { background: var(--surface); border-color: var(--line); color: var(--ink); } }
}
@media (max-width: 720px) {
  .trialstrip-days { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .day--decide { grid-column: 1 / -1; flex-direction: row; justify-content: space-between; align-items: center; min-height: 52px; }
  .trialstrip-legend { flex-direction: column; gap: 4px; }
}

/* --- Produkty --------------------------------------------------------- */
.section { padding: clamp(48px, 8vw, 96px) 0 0; }
.section-head { max-width: 60ch; margin-bottom: 32px; }
.section-head p { color: var(--ink-2); }

.billing-switch { display: inline-flex; padding: 4px; background: var(--surface-2); border-radius: 999px; margin-bottom: 28px; }
.billing-switch input { position: absolute; opacity: 0; pointer-events: none; }
.billing-switch label { margin: 0; padding: 8px 18px; border-radius: 999px; cursor: pointer; font-weight: 600; color: var(--ink-2); }
#cykl-mies:checked ~ .billing-switch label[for=cykl-mies],
#cykl-rok:checked ~ .billing-switch label[for=cykl-rok] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(24,32,58,.14); }
#cykl-mies:focus-visible ~ .billing-switch label[for=cykl-mies],
#cykl-rok:focus-visible ~ .billing-switch label[for=cykl-rok] { outline: 3px solid var(--cobalt); outline-offset: 2px; }
.billing-switch .save { font-weight: 500; color: var(--mint); font-size: .85rem; margin-left: 4px; }

.products { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 20px; }
.product {
  position: relative; background: var(--surface); border-radius: var(--r-lg); padding: 32px;
  border: 1.5px solid var(--line); display: flex; flex-direction: column;
}
.product::before { content: ""; position: absolute; left: 32px; top: -1.5px; width: 64px; height: 5px; border-radius: 0 0 4px 4px; background: var(--accent, var(--cobalt)); }
.product h3 { font-size: 1.6rem; margin-bottom: 6px; }
.product .tagline { color: var(--ink-2); margin-bottom: 22px; }
.product ul { list-style: none; padding: 0; margin: 0 0 28px; }
.product li { padding: 9px 0 9px 28px; border-top: 1px solid var(--surface-2); position: relative; }
.product li::before { content: ""; position: absolute; left: 2px; top: 15px; width: 12px; height: 7px; border-left: 2.5px solid var(--accent, var(--cobalt)); border-bottom: 2.5px solid var(--accent, var(--cobalt)); transform: rotate(-45deg); }
.price { margin-top: auto; padding-top: 4px; }
.price-amount { font: 750 2.4rem/1 var(--font-display); letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.price-unit { color: var(--ink-2); font-weight: 600; }
.price-note { font-size: .88rem; color: var(--ink-3); margin: 6px 0 20px; min-height: 1.4em; }
.price-yearly { display: none; }
#cykl-rok:checked ~ .products .price-monthly { display: none; }
#cykl-rok:checked ~ .products .price-yearly { display: block; }
.product .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- Bezpieczeństwo danych ------------------------------------------- */
.isolation { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(24px, 5vw, 64px); align-items: center; }
.isolation-diagram { background: var(--ink); color: #fff; border-radius: var(--r-lg); padding: 28px; display: grid; gap: 10px; }
.iso-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; font-size: .92rem; }
.iso-row .who { padding: 10px 12px; border-radius: var(--r-sm); background: rgba(255,255,255,.08); }
.iso-row .db { padding: 10px 12px; border-radius: var(--r-sm); background: var(--cobalt); font-weight: 600; }
.iso-row .db--b { background: #0F7A54; }
.iso-row .db--c { background: #6B4FD8; }
.iso-row .wire { width: 34px; height: 2px; background: rgba(255,255,255,.5); }
.iso-caption { font-size: .84rem; color: rgba(255,255,255,.7); margin-top: 6px; }
@media (max-width: 820px) { .isolation { grid-template-columns: 1fr; } }

/* --- FAQ -------------------------------------------------------------- */
.faq { max-width: 760px; }
.faq details { border-top: 1px solid var(--line); padding: 4px 0; }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 16px 32px 16px 0; font: 650 1.08rem/1.3 var(--font-display); list-style: none; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font-size: 1.5rem; color: var(--ink-3); transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { color: var(--ink-2); max-width: 64ch; }

/* ==========================================================================
   Strony formularzy (logowanie, rejestracja, zakup)
   ========================================================================== */
.narrow { max-width: 460px; margin: clamp(24px, 6vw, 64px) auto 0; }
.medium { max-width: 720px; margin: clamp(24px, 5vw, 48px) auto 0; }
.panel-box { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: clamp(20px, 4vw, 36px); }
.panel-box + .panel-box { margin-top: 20px; }
.form-foot { margin-top: 20px; font-size: .92rem; color: var(--ink-2); }

.plan-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.plan-option { position: relative; }
.plan-option input { position: absolute; opacity: 0; }
.plan-option label {
  margin: 0; height: 100%; display: block; cursor: pointer; padding: 16px; border-radius: var(--r-md);
  border: 1.5px solid var(--line); background: var(--surface); font-weight: 500;
}
.plan-option label strong { display: block; font: 700 1.05rem/1.2 var(--font-display); margin-bottom: 4px; }
.plan-option label .amount { font: 750 1.5rem/1.1 var(--font-display); display: block; margin: 6px 0 2px; font-variant-numeric: tabular-nums; }
.plan-option input:checked + label { border-color: var(--cobalt); box-shadow: 0 0 0 3px var(--cobalt-tint); }
.plan-option input:focus-visible + label { outline: 3px solid var(--cobalt); outline-offset: 2px; }
@media (max-width: 520px) { .plan-options { grid-template-columns: 1fr; } }

.summary { display: grid; grid-template-columns: auto 1fr; gap: 8px 20px; margin: 0 0 20px; }
.summary dt { color: var(--ink-2); }
.summary dd { margin: 0; font-weight: 600; text-align: right; font-variant-numeric: tabular-nums; }
.summary .total { font: 750 1.4rem/1.2 var(--font-display); }

/* ==========================================================================
   Panel klienta
   ========================================================================== */
.page-head { padding: clamp(20px, 4vw, 40px) 0 24px; }
.page-head h1 { font-size: clamp(1.8rem, 4vw, 2.5rem); margin-bottom: 6px; }
.page-head p { color: var(--ink-2); margin: 0; }
.subnav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
@media (max-width: 560px) { .subnav a { padding: 10px 10px; } }
.subnav a { padding: 10px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; border-bottom: 2.5px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.subnav a[aria-current=page] { color: var(--ink); border-color: var(--cobalt); }

.projects { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; }
.project {
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-lg); padding: 22px;
  display: flex; flex-direction: column; gap: 14px; position: relative;
}
.project::before { content: ""; position: absolute; left: 22px; top: -1.5px; width: 40px; height: 4px; border-radius: 0 0 3px 3px; background: var(--accent, var(--cobalt)); }
.project h3 { margin: 0; font-size: 1.2rem; }
.project h3 a { color: inherit; text-decoration: none; }
.project h3 a:hover { color: var(--cobalt-ink); }
.project .meta { font-size: .9rem; color: var(--ink-2); margin: 2px 0 0; }
.project .actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.project--new { border-style: dashed; background: transparent; justify-content: center; align-items: flex-start; }
.project--new::before { display: none; }

/* mini-pasek dni okresu próbnego */
.ministrip { display: grid; grid-template-columns: repeat(var(--n, 14), 1fr); gap: 3px; }
.ministrip i { height: 8px; border-radius: 2px; background: var(--surface-2); }
.ministrip i.used { background: var(--ink-3); }
.ministrip i.left { background: var(--amber); }
.ministrip-label { font-size: .85rem; color: var(--ink-2); margin-top: 6px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 860px) { .detail-grid { grid-template-columns: 1fr; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0; }
.kv dt { color: var(--ink-2); }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.callout { padding: 16px 18px; border-radius: var(--r-md); background: var(--amber-tint); color: #6A4100; margin-bottom: 20px; }
.callout--bad { background: var(--red-tint); color: #7E1E16; }
.callout--ok { background: var(--mint-tint); color: #0B5E40; }
.callout--info { background: var(--cobalt-tint); color: var(--cobalt-ink); }
.callout strong { display: block; margin-bottom: 2px; }
.callout p:last-child { margin-bottom: 0; }

/* --- Tabele (panel klienta i admina) ---------------------------------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); }
table.data { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.data th { text-align: left; font-weight: 600; color: var(--ink-2); padding: 11px 14px; background: #F8F9FA; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data td { padding: 11px 14px; border-bottom: 1px solid var(--surface-2); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover td { background: #FAFBFC; }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .nowrap { white-space: nowrap; }
table.data a { font-weight: 600; text-decoration: none; }
table.data a:hover { text-decoration: underline; }
table.data .check-cell { width: 36px; }
table.data input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--cobalt); }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }

/* --- Bramka testowa --------------------------------------------------- */
.fake-gw { border: 2px dashed var(--amber); }

/* ==========================================================================
   Panel admina
   ========================================================================== */
.admin { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
.admin-side { background: var(--ink); color: #C9CEE0; padding: 22px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.admin-side .brand { color: #fff; padding: 0 8px 22px; }
.admin-side .brand-mark i:nth-child(2), .admin-side .brand-mark i:nth-child(4) { background: #fff; }
.admin-side nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 10px; border-radius: var(--r-sm); color: #C9CEE0; text-decoration: none; font-weight: 600; font-size: .95rem; }
.admin-side nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.admin-side nav a[aria-current=page] { background: rgba(255,255,255,.12); color: #fff; }
.admin-side nav .badge { background: var(--amber); color: #2A1A00; border-radius: 999px; padding: 1px 8px; font-size: .78rem; }
.admin-side .side-group { margin-top: 22px; padding: 0 10px 6px; font-size: .8rem; color: #8E95B0; }
.admin-side .side-foot { margin-top: 28px; padding: 0 10px; font-size: .85rem; }
.admin-side .side-foot a { color: #C9CEE0; }
.admin-side form { margin: 0; }
.admin-side .linkbtn { background: none; border: 0; color: #C9CEE0; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }
.admin-main { padding: 28px clamp(16px, 3vw, 40px) 64px; min-width: 0; }
.admin-main .page-head { padding-top: 0; }
@media (max-width: 900px) {
  .admin { grid-template-columns: 1fr; }
  .admin-side { position: static; height: auto; padding: 14px; }
  .admin-side .brand { padding-bottom: 12px; }
  .admin-side nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .admin-side .side-group, .admin-side .side-foot { display: none; }
}

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 16px 18px; }
.stat dt { font-size: .86rem; color: var(--ink-2); margin-bottom: 6px; }
.stat dd { margin: 0; font: 750 1.65rem/1.1 var(--font-display); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: .82rem; color: var(--ink-3); margin-top: 4px; font-family: var(--font-body); font-weight: 500; letter-spacing: 0; }
.stat--action { border-color: var(--amber); background: #FFFBF2; }
.stat--action a { text-decoration: none; color: inherit; display: block; }

.cols-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
@media (max-width: 1100px) { .cols-2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 20px; }
.card h2 { font-size: 1.15rem; margin-bottom: 14px; }
.card .table-wrap { border: 0; border-radius: 0; margin: 0 -20px -20px; }

.bars { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; align-items: end; height: 170px; padding-top: 8px; }
.bar { display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 6px; }
.bar i { display: block; width: 100%; max-width: 56px; background: var(--cobalt); border-radius: 4px 4px 0 0; min-height: 2px; }
.bar:last-child i { background: var(--ink); }
.bar span { font-size: .78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.bar b { font-size: .78rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 140px; flex: 1 1 140px; max-width: 220px; }
.filters .field--wide { max-width: 320px; flex-basis: 220px; }
.filters label { font-size: .82rem; color: var(--ink-2); }
.filters input, .filters select { min-height: 40px; padding: 7px 10px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a { padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1.5px solid var(--line); color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: .88rem; }
.tabs a[aria-current=page] { background: var(--ink); border-color: var(--ink); color: #fff; }
.tabs a .n { color: var(--ink-3); font-weight: 500; margin-left: 4px; }
.tabs a[aria-current=page] .n { color: #B5BBD2; }

.bulkbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 14px; background: var(--ink); color: #fff; border-radius: var(--r-md); margin-bottom: 12px; }
.bulkbar[hidden] { display: none; }
.bulkbar .btn--ghost { color: #fff; border-color: rgba(255,255,255,.35); }
.bulkbar .btn--ghost:hover { background: rgba(255,255,255,.1); color: #fff; }
.totals { font-size: .9rem; color: var(--ink-2); margin: 10px 2px 0; }

.doc-toggle { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.doc-toggle input[type=text] { min-height: 32px; padding: 4px 8px; width: 130px; font-size: .86rem; }
.doc-done { color: var(--mint); font-weight: 600; white-space: nowrap; }
.doc-todo { color: var(--amber); font-weight: 600; white-space: nowrap; }

.pagination { display: flex; gap: 6px; align-items: center; margin-top: 16px; font-size: .9rem; color: var(--ink-2); }
.log { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .8rem; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); max-width: 520px; }
.danger-zone { border-color: var(--red); }

/* Telefon: tabele jako karty – bez przewijania w bok */
@media (max-width: 640px) {
  .table-wrap { overflow-x: visible; background: transparent; border: 0; }
  .card .table-wrap { margin: 0; }
  table.data.data-cards, table.data.data-cards tbody, table.data.data-cards tr, table.data.data-cards td { display: block; width: 100%; }
  table.data.data-cards thead { display: none; }
  table.data.data-cards tr { background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 6px 12px; margin-bottom: 10px; }
  table.data.data-cards tbody tr:hover td { background: transparent; }
  table.data.data-cards td { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--surface-2); text-align: right; white-space: normal; overflow-wrap: anywhere; min-width: 0; }
  table.data.data-cards tr td:last-child { border-bottom: 0; }
  table.data.data-cards td[data-label]::before { content: attr(data-label); font-weight: 600; color: var(--ink-2); text-align: left; flex: 0 0 auto; max-width: 45%; }
  table.data.data-cards td:not([data-label]) { justify-content: flex-start; text-align: left; }
  table.data.data-cards td.cell-empty { display: none; }
  table.data.data-cards .num, table.data.data-cards .nowrap { white-space: normal; }
  table.data.data-cards .check-cell { width: 100%; }
  table.data.data-cards .log { max-width: 100%; text-align: left; }
}
@media (max-width: 640px) {
  .bars { gap: 4px; }
  .bar b { white-space: normal; text-align: center; font-size: .68rem; overflow-wrap: anywhere; }
  .bar span { font-size: .7rem; }
  .card { padding: 16px; }
}

/* Komunikaty błędów w formularzach – biały tekst na czerwonym tle */
.field .error, form p.error, .errorlist li {
  display: flex; gap: 8px; align-items: flex-start;
  background: var(--red); color: #fff; font-weight: 600; font-size: .9rem; line-height: 1.4;
  padding: 9px 12px; border-radius: var(--r-sm); margin: 8px 0 0;
}
.field .error::before, form p.error::before, .errorlist li::before { content: "!"; flex: 0 0 18px; height: 18px; border-radius: 50%; background: #fff; color: var(--red); font-weight: 800; font-size: .8rem; display: grid; place-items: center; margin-top: 1px; }
form > p.error { margin: 0 0 14px; }
.field--error input, .field--error select, .field--error textarea { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-tint); }

/* Nagłówek na telefonie: przyciski w jednej linii */
.nav a, .nav .btn { white-space: nowrap; }
@media (max-width: 420px) {
  .site-header .wrap { gap: 8px; }
  .site-header .brand { font-size: 1.1rem; }
  .nav { gap: 2px; }
  .nav a:not(.btn) { padding: 8px 6px; }
  .nav .btn { padding: 9px 12px; font-size: .92rem; }
}
