/* ============================================================
   Serwis Ekspresów — design tokens
   ============================================================ */
:root {
  --bg: #F5EFE2;
  --bg-card: #FFFFFF;
  --ink: #2A2018;
  --ink-soft: #6B5D4F;
  --brown-900: #241610;
  --brown-800: #33221A;
  --brown-700: #4A3226;
  --line: #E4DAC7;

  --copper: #C1732E;
  --copper-dark: #A85F22;
  --copper-light: #F0DCC4;

  --sage: #6E8B5C;
  --sage-light: #E2EAD9;
  --steel: #4E7291;
  --steel-light: #DDE7EE;
  --amber: #D99A3D;
  --amber-light: #F7E7CB;
  --grey: #948A7C;
  --grey-light: #EAE5DB;
  --danger: #B54A3F;
  --danger-light: #F3DEDA;

  --blue: #3E6FA6;
  --blue-dark: #2C5580;
  --blue-light: #DCE9F5;

  /* stany napraw: przyjęty=czerwony, sprawdzony=żółty, naprawiony=jasnozielony, odebrany=zielony (średni) */
  --stan-przyjety-text: #9A2F22;
  --stan-przyjety-bg: #F2C1B8;
  --stan-przyjety-row: #FBEAE6;
  --stan-przyjety-strong: #D9614D;

  --stan-sprawdzony-text: #8A6A0A;
  --stan-sprawdzony-bg: #F2DD8E;
  --stan-sprawdzony-row: #FBF3D8;
  --stan-sprawdzony-strong: #E8C34D;

  --stan-naprawiony-text: #2E7A3B;
  --stan-naprawiony-bg: #BFE6BE;
  --stan-naprawiony-row: #E3F7E0;
  --stan-naprawiony-strong: #7FCB7E;

  --stan-odebrany-text: #FFFFFF;
  --stan-odebrany-bg: #5E9C6C;
  --stan-odebrany-row: #B7DCBC;
  --stan-odebrany-strong: #4C8A5A;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 1px 2px rgba(42,22,10,0.04), 0 8px 24px -12px rgba(42,22,10,0.16);
  --shadow-pop: 0 20px 60px -20px rgba(20,12,6,0.45);

  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Work Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: hidden; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ============================================================
   Layout shell
   ============================================================ */
.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--brown-900);
  background-image:
    radial-gradient(circle at 85% 8%, rgba(193,115,46,0.18), transparent 45%),
    radial-gradient(circle at 15% 95%, rgba(193,115,46,0.10), transparent 40%);
  color: var(--copper-light);
  display: flex;
  flex-direction: column;
  padding: 28px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(240,220,196,0.35) transparent;
}
.sidebar::-webkit-scrollbar { width: 7px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(240,220,196,0.3); border-radius: 999px; }
.sidebar::-webkit-scrollbar-thumb:hover { background: rgba(240,220,196,0.5); }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 28px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(240,220,196,0.14);
}
.brand-mark {
  font-size: 26px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--copper), var(--copper-dark));
  border-radius: 12px;
  box-shadow: 0 6px 16px -6px rgba(193,115,46,0.6);
}
.brand-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  color: #F7EEE1;
}

.sidebar-top { display: contents; }
.mobile-menu-btn, .mobile-nav-close, .mobile-nav-foot { display: none; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  color: #D9C7AF;
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav a:hover { background: rgba(240,220,196,0.08); color: #FBF3E7; }
.nav a.active {
  background: linear-gradient(135deg, var(--copper), var(--copper-dark));
  color: #fff;
  box-shadow: 0 4px 14px -4px rgba(193,115,46,0.5);
}
.nav-ico { width: 18px; text-align: center; font-size: 15px; opacity: 0.9; }

.sidebar-foot {
  font-size: 11px;
  color: rgba(217,199,175,0.5);
  padding-top: 16px;
  border-top: 1px solid rgba(240,220,196,0.1);
  letter-spacing: 0.02em;
}

.user-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 12.5px;
}
.user-email {
  color: #E8D8C2;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-logout {
  color: var(--copper-light);
  font-weight: 600;
  white-space: nowrap;
}
.user-logout:hover { color: #fff; }

.content {
  padding: 44px 52px 64px;
  max-width: 1180px;
  width: 100%;
  min-width: 0;
}
.content-wide { max-width: none; }
.content-center { max-width: 900px; margin: 0 auto; }
.content-center .page-head { text-align: center; }
.content-center .counters { margin-left: auto; margin-right: auto; }
.home-logo { display: block; max-width: 260px; margin: 0 auto 8px; }

/* ============================================================
   Page head
   ============================================================ */
.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--copper-dark);
  margin: 0 0 8px;
}
.breadcrumb-link { color: var(--copper-dark); text-decoration: underline; text-underline-offset: 2px; }
.page-head h1 {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 600;
  margin: 0 0 10px;
  color: var(--brown-800);
  letter-spacing: -0.01em;
}
.page-head .lede {
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0 0 32px;
}

/* ============================================================
   Dashboard counters
   ============================================================ */
.counters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 32px;
}
.counter-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 26px 24px;
  box-shadow: var(--shadow-card);
  border-top: 4px solid transparent;
  position: relative;
  overflow: hidden;
}
.counter-card::after {
  content: "";
  position: absolute; right: -20px; top: -20px;
  width: 90px; height: 90px; border-radius: 50%;
  opacity: 0.08;
}
.counter-przyjety { border-top-color: var(--stan-przyjety-strong); }
.counter-przyjety::after { background: var(--stan-przyjety-strong); }
.counter-sprawdzony { border-top-color: var(--stan-sprawdzony-strong); }
.counter-sprawdzony::after { background: var(--stan-sprawdzony-strong); }
.counter-naprawiony { border-top-color: var(--stan-naprawiony-strong); }
.counter-naprawiony::after { background: var(--stan-naprawiony-strong); }
.counter-card { display: block; }
.counter-card:hover { transform: translateY(-2px); transition: transform 0.15s ease; }

.counter-num {
  font-family: var(--font-mono);
  font-size: 46px;
  font-weight: 600;
  color: var(--brown-800);
  line-height: 1;
}
.counter-label {
  margin-top: 10px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}
.counter-label span { font-weight: 400; color: var(--ink-soft); }

/* ============================================================
   Quick action tiles
   ============================================================ */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.action-tile {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  border: 1px solid transparent;
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.action-tile:hover { transform: translateY(-2px); border-color: var(--copper-light); }
.action-tile h3 { margin: 0 0 4px; font-size: 15.5px; font-family: var(--font-display); font-weight: 600; color: var(--brown-800); }
.action-tile p { margin: 0; font-size: 13px; color: var(--ink-soft); }
.action-ico {
  width: 42px; height: 42px; min-width: 42px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--copper-light); color: var(--copper-dark);
  font-size: 19px; font-weight: 700;
}
.action-primary .action-ico { background: var(--blue); color: #fff; }
.action-primary { background: var(--blue-light); border-color: var(--blue); }
.action-primary:hover { border-color: var(--blue-dark); }
.action-primary h3 { color: var(--blue-dark); }

.featured-banner {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(120deg, var(--brown-900), var(--brown-700));
  border-radius: var(--radius-lg);
  padding: 26px 32px;
  margin-bottom: 24px;
  box-shadow: 0 14px 34px -16px rgba(36,22,16,0.55);
  transition: transform 0.15s ease;
  position: relative;
  overflow: hidden;
}
.featured-banner::after {
  content: "";
  position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  background: var(--copper); opacity: 0.15;
}
.featured-banner:hover { transform: translateY(-2px); }
.featured-banner-ico {
  width: 56px; height: 56px; min-width: 56px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--copper), var(--copper-dark));
  color: #fff; font-size: 26px;
  box-shadow: 0 8px 20px -6px rgba(193,115,46,0.7);
}
.featured-banner-text { flex: 1; }
.featured-banner-eyebrow {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--copper-light); margin-bottom: 4px;
}
.featured-banner-text h2 {
  font-family: var(--font-display); font-size: 22px; font-weight: 600;
  color: #FBF3E7; margin: 0 0 4px;
}
.featured-banner-text p { margin: 0; font-size: 13px; color: rgba(240,220,196,0.75); }
.featured-banner-arrow { font-size: 22px; color: var(--copper-light); }

/* ============================================================
   Strona główna — nagłówek z logo, dwa kluczowe kafelki (hero),
   kompaktowe liczniki
   ============================================================ */
.page-head-home { display: block; }
.home-logo-inline { max-width: 150px; display: block; margin-bottom: 14px; }

.hero-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 22px;
}
.hero-card {
  display: flex;
  align-items: center;
  gap: 18px;
  border-radius: var(--radius-lg);
  padding: 28px 30px;
  transition: transform 0.15s ease;
  position: relative;
  overflow: hidden;
}
.hero-card:hover { transform: translateY(-3px); }
.hero-card::after {
  content: "";
  position: absolute; right: -40px; top: -40px;
  width: 160px; height: 160px; border-radius: 50%;
  opacity: 0.15;
}
.hero-card-dark {
  background: linear-gradient(120deg, var(--brown-900), var(--brown-700));
  box-shadow: 0 14px 34px -16px rgba(36,22,16,0.55);
}
.hero-card-dark::after { background: var(--copper); }
.hero-card-blue {
  background: linear-gradient(120deg, var(--blue-dark), var(--blue));
  box-shadow: 0 14px 34px -16px rgba(46,85,128,0.5);
}
.hero-card-blue::after { background: #fff; }
.hero-card-ico {
  width: 58px; height: 58px; min-width: 58px;
  border-radius: 15px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.16);
  color: #fff; font-size: 27px; font-weight: 700;
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,0.25);
}
.hero-card-text { flex: 1; position: relative; z-index: 1; }
.hero-card-eyebrow {
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: rgba(255,255,255,0.65); margin-bottom: 5px;
}
.hero-card-text h2 {
  font-family: var(--font-display); font-size: 23px; font-weight: 600;
  color: #fff; margin: 0 0 5px;
}
.hero-card-text p { margin: 0; font-size: 13px; color: rgba(255,255,255,0.75); }
.hero-card-arrow { font-size: 24px; color: rgba(255,255,255,0.85); position: relative; z-index: 1; }

.mini-counters {
  display: flex;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.mini-counter {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  box-shadow: var(--shadow-card);
  border-left: 4px solid transparent;
  flex: 1;
  min-width: 160px;
}
.mini-counter:hover { transform: translateY(-2px); transition: transform 0.15s ease; }
.mini-counter-przyjety { border-left-color: var(--stan-przyjety-strong); }
.mini-counter-sprawdzony { border-left-color: var(--stan-sprawdzony-strong); }
.mini-counter-naprawiony { border-left-color: var(--stan-naprawiony-strong); }
.mini-counter-num {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  color: var(--brown-800);
  line-height: 1;
}
.mini-counter-label { font-size: 12px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.mini-counter-label small { font-weight: 400; color: var(--ink-soft); font-size: 11px; }
.mini-counter-link {
  display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 600; color: var(--copper-dark);
  padding: 12px 16px;
  white-space: nowrap;
}
.mini-counter-link:hover { text-decoration: underline; }

.section-divider-label {
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink-soft);
  margin: 6px 0 14px;
}

@media (max-width: 880px) {
  .home-logo-inline { max-width: 110px; }
  .hero-grid { grid-template-columns: 1fr; }
  .mini-counter { min-width: 100%; }
}

/* ============================================================
   Forms
   ============================================================ */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 30px 32px;
  box-shadow: var(--shadow-card);
}
.card-title { font-family: var(--font-display); font-size: 17px; margin: 0 0 16px; color: var(--brown-800); }

.pdf-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pdf-tile {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, #FBF6EC, #F3ECDD);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  transition: transform 0.15s ease, border-color 0.15s ease;
  position: relative;
}
.pdf-tile:hover { transform: translateY(-2px); border-color: var(--copper); }
.pdf-tile-ico { font-size: 28px; }
.pdf-tile h4 { margin: 0 0 3px; font-family: var(--font-display); font-size: 15px; color: var(--brown-800); }
.pdf-tile p { margin: 0; font-size: 12.5px; color: var(--ink-soft); }
.pdf-tile-cta { position: absolute; bottom: 12px; right: 16px; font-size: 11.5px; font-weight: 700; color: var(--copper-dark); }
@media (max-width: 880px) { .pdf-options { grid-template-columns: 1fr; } }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px 24px;
}
.form-field-wide { grid-column: 1 / -1; }
.form-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}
.required-star { color: var(--danger); }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #FFFEFC;
  color: var(--ink);
  transition: border-color 0.15s ease;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus {
  outline: none;
  border-color: var(--copper);
}
.form-field textarea { resize: vertical; }

.form-divider {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--copper-dark);
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px dashed var(--line);
}

.form-actions {
  display: flex; gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 22px;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  font-size: 14px;
  transition: transform 0.1s ease, box-shadow 0.15s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--copper), var(--copper-dark)); color: #fff; box-shadow: 0 8px 20px -8px rgba(193,115,46,0.6); }
.btn-primary:hover { transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--ink-soft); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--copper); color: var(--copper-dark); }
.btn-small { padding: 6px 14px; font-size: 12.5px; background: var(--grey-light); color: var(--brown-800); border-radius: 999px; }
.btn-small:hover { background: var(--copper-light); }
.btn-danger-ghost { background: transparent; color: var(--danger); border: 1.5px solid var(--danger-light); padding: 11px 22px; border-radius: 999px; font-weight: 600; font-size: 14px; }
.btn-danger-ghost:hover { background: var(--danger-light); }

/* ============================================================
   Alerts
   ============================================================ */
.alert {
  padding: 16px 20px;
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  font-size: 14px;
}
.alert ul { margin: 0; padding-left: 18px; }
.alert-error { background: var(--danger-light); color: #7A2E24; }
.alert-info { background: var(--amber-light); color: #7A5313; }
.alert-success { background: var(--sage-light); color: #3E5230; }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  overflow-x: auto;
}
.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.data-table th {
  text-align: left;
  padding: 14px 16px;
  background: var(--brown-900);
  color: #E8D8C2;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  white-space: nowrap;
}
.data-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  color: var(--ink);
}
.data-table tbody tr:hover { background: #FBF6EC; }
.data-table tbody tr[data-rekord-id] { cursor: pointer; }
.data-table tbody tr[data-rekord-id]:hover { filter: brightness(0.97); }
.data-table tbody tr[data-rekord-id] .row-actions,
.data-table tbody tr[data-rekord-id] select,
.data-table tbody tr[data-rekord-id] a,
.data-table tbody tr[data-rekord-id] button,
.data-table tbody tr[data-rekord-id] input,
.data-table tbody tr[data-rekord-id] label { cursor: default; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table td.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zysk-dodatni { color: #3E5230; font-family: var(--font-mono); font-weight: 600; }
.data-table td:has(> .zysk-dodatni) {}
.empty-state { text-align: center; color: var(--ink-soft); padding: 40px !important; white-space: normal; }

.row-actions { text-align: right; }

.lp-col { font-family: var(--font-mono); color: var(--ink-soft); font-weight: 600; text-align: center; width: 1%; }

.btn-hist6 { background: var(--steel-light); color: #2E5876; white-space: nowrap; }
.btn-hist6:hover { background: var(--steel); color: #fff; }
.hist6-brak { color: var(--ink-soft); opacity: 0.5; }

.sort-link { color: #E8D8C2; display: inline-flex; align-items: center; gap: 4px; }
.sort-link:hover { color: #fff; }

.stan-select {
  border: none; border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px; font-weight: 700;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}
.badge, .stan-select { }
.badge {
  display: inline-block;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.stan-przyjety, .badge.stan-przyjety { background: var(--stan-przyjety-bg); color: var(--stan-przyjety-text); }
.stan-sprawdzony, .badge.stan-sprawdzony { background: var(--stan-sprawdzony-bg); color: var(--stan-sprawdzony-text); }
.stan-naprawiony, .badge.stan-naprawiony { background: var(--stan-naprawiony-bg); color: var(--stan-naprawiony-text); }
.stan-odebrany, .badge.stan-odebrany { background: var(--stan-odebrany-bg); color: var(--stan-odebrany-text); }

.badge-reklamacja { background: var(--brown-700); color: #F3E9DC; font-size: 10.5px; padding: 3px 8px; margin-left: 4px; vertical-align: middle; }
.badge-wyslano { background: var(--sage-light); color: #2E5230; font-size: 10.5px; padding: 3px 8px; margin-left: 4px; vertical-align: middle; }

.btn-pdf { background: var(--copper-light); color: var(--copper-dark); white-space: nowrap; }
.btn-pdf:hover { background: var(--copper); color: #fff; }

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 14px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-card);
}
.bulk-bar .btn:disabled { opacity: 0.45; cursor: not-allowed; }

.phone-copy-box {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.7;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #FFFEFC;
  resize: vertical;
}

/* tło wiersza w zależności od stanu naprawy */
.data-table tbody tr.wiersz-przyjety { background: var(--stan-przyjety-row); }
.data-table tbody tr.wiersz-sprawdzony { background: var(--stan-sprawdzony-row); }
.data-table tbody tr.wiersz-naprawiony { background: var(--stan-naprawiony-row); }
.data-table tbody tr.wiersz-odebrany { background: var(--stan-odebrany-row); }
.data-table tbody tr.wiersz-przyjety:hover { filter: brightness(0.97); }
.data-table tbody tr.wiersz-sprawdzony:hover { filter: brightness(0.97); }
.data-table tbody tr.wiersz-naprawiony:hover { filter: brightness(0.97); }
.data-table tbody tr.wiersz-odebrany:hover { filter: brightness(0.97); }

.zysk-ujemny { color: var(--stan-przyjety-text); font-family: var(--font-mono); font-weight: 600; }

/* ============================================================
   Filter chips
   ============================================================ */
.filter-bar { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.chip {
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}
.chip:hover { border-color: var(--copper); }
.chip-active { background: var(--brown-900); border-color: var(--brown-900); color: #F3E9DC; }

/* ============================================================
   History / stats month tiles
   ============================================================ */
.year-block { margin-bottom: 34px; }
.year-title {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--brown-800);
  margin: 0 0 14px;
}
.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}
.month-tile {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 6px;
  border-left: 4px solid var(--copper);
  transition: transform 0.15s ease;
}
.month-tile:hover { transform: translateY(-2px); }
.month-tile-name { font-family: var(--font-display); font-weight: 600; font-size: 15.5px; color: var(--brown-800); }
.month-tile-count { font-family: var(--font-mono); font-size: 20px; font-weight: 600; color: var(--copper-dark); }
.month-tile-count small { font-family: var(--font-body); font-size: 11px; font-weight: 500; color: var(--ink-soft); }
.month-tile-sub { font-size: 12px; color: var(--ink-soft); }
.month-tile-czas { font-size: 11px; color: var(--copper-dark); font-weight: 600; }
.month-tile-stats { border-left-color: var(--sage); }
.month-tile-stats .month-tile-count { color: #3E5230; }

/* ============================================================
   Stat summary cards
   ============================================================ */
.stat-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 8px;
}
.stat-label { font-size: 12px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.04em; }
.stat-value { font-family: var(--font-mono); font-size: 24px; font-weight: 600; color: var(--brown-800); }
.stat-sub { font-size: 12px; color: var(--ink-soft); }
.stat-summary-narrow { grid-template-columns: repeat(2, 1fr); max-width: 560px; }
.stat-card-highlight { background: linear-gradient(135deg, var(--brown-900), var(--brown-700)); }
.stat-card-highlight .stat-label { color: rgba(240,220,196,0.7); }
.stat-card-highlight .stat-value { color: #F7DFB8; }

/* ============================================================
   Model bars
   ============================================================ */
.model-bars { display: flex; flex-direction: column; gap: 10px; }
.model-bar-row { display: grid; grid-template-columns: 140px 1fr 34px; align-items: center; gap: 12px; }
.model-bar-label { font-size: 13px; font-weight: 600; color: var(--ink); text-transform: capitalize; }
.model-bar-track { height: 10px; background: var(--grey-light); border-radius: 999px; overflow: hidden; }
.model-bar-fill { height: 100%; background: linear-gradient(90deg, var(--copper), var(--amber)); border-radius: 999px; }
.model-bar-num { font-family: var(--font-mono); font-size: 13px; font-weight: 600; text-align: right; color: var(--ink-soft); }

/* ============================================================
   Wykresy
   ============================================================ */
.chart-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.chart-card { padding: 24px 26px; }
.chart-card canvas { max-height: 260px; }
@media (max-width: 880px) { .chart-grid { grid-template-columns: 1fr; } }

/* ============================================================
   Search
   ============================================================ */
.search-box { margin-bottom: 28px; max-width: 640px; }
.search-box input {
  width: 100%;
  padding: 16px 20px;
  font-size: 17px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--line);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}
.search-box input:focus { outline: none; border-color: var(--copper); }

/* ---------------------------------------------------- podgląd historii telefonu */
.telefon-match-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.telefon-match {
  background: rgba(255,255,255,0.6);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  border: 1px solid rgba(0,0,0,0.06);
}
.telefon-match-head { font-size: 13px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.telefon-match-body { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.telefon-match-body label { display: block; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-soft); margin-bottom: 2px; }
.telefon-match-body p { margin: 0; font-size: 13px; color: var(--ink); }
@media (max-width: 880px) { .telefon-match-body { grid-template-columns: 1fr 1fr; } }

/* ============================================================
   Modal
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(36,22,16,0.55);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease;
  z-index: 100;
  padding: 24px;
}
.modal-overlay.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  max-width: 640px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-pop);
  position: relative;
}
.modal-close {
  position: absolute; top: 18px; right: 18px;
  background: var(--grey-light); border: none;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 18px; color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--danger-light); color: var(--danger); }
.modal-head { margin-bottom: 20px; padding-right: 30px; }
.modal-head h2 { font-family: var(--font-display); font-size: 20px; margin: 10px 0 0; color: var(--brown-800); }
.modal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.modal-grid-wide { grid-column: 1 / -1; }
.modal-grid label { display: block; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); margin-bottom: 4px; }
.modal-grid p { margin: 0; font-size: 14.5px; color: var(--ink); }
.modal-grid input, .modal-grid select, .modal-grid textarea {
  width: 100%; padding: 8px 11px; border: 1.5px solid var(--line); border-radius: var(--radius-sm); background: #FFFEFC;
}
.modal-actions { display: flex; gap: 10px; margin-top: 26px; }

.reklamacja-field {
  background: var(--amber-light);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-top: 4px;
}
.checkbox-label { display: flex; align-items: flex-start; gap: 10px; font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; text-transform: none; letter-spacing: normal; }
.checkbox-label input[type="checkbox"] { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--copper); }
.checkbox-hint { font-weight: 400; color: var(--ink-soft); font-size: 12.5px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 880px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 100;
    height: auto; min-width: 0;
    flex-direction: column;
    padding: 14px 18px;
  }
  .sidebar-top {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%;
  }
  .brand { border: none; padding: 0; margin: 0; }
  .mobile-menu-btn {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px;
    background: rgba(240,220,196,0.1);
    border: none; border-radius: 10px;
    color: #F3E9DC; font-size: 19px;
  }
  .nav {
    display: none;
    position: fixed; inset: 0; z-index: 250;
    background: var(--brown-900);
    flex-direction: column;
    padding: 20px 20px 32px;
    overflow-y: auto;
    gap: 6px;
  }
  .nav.nav-open { display: flex; }
  .nav a { font-size: 16px; padding: 14px 16px; }
  .mobile-nav-close {
    display: flex; align-self: flex-end;
    background: rgba(240,220,196,0.1);
    border: none; border-radius: 999px;
    color: #F3E9DC; font-size: 13px; font-weight: 600;
    padding: 9px 16px; margin-bottom: 12px;
  }
  .mobile-nav-foot { display: block; margin-top: 16px; padding-top: 16px; border-top: 1px solid rgba(240,220,196,0.14); }
  .sidebar-foot { display: none; }
  .content { padding: 22px 16px 50px; min-width: 0; }
  .counters, .quick-actions, .form-grid, .stat-summary { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .zegar { display: none; }

  /* tabele: mniejsza czcionka, żeby więcej się mieściło i mniej trzeba było przewijać */
  .data-table { font-size: 12.5px; }
  .data-table th, .data-table td { padding: 10px 10px; }
  .filter-bar { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; }
  .chip { flex-shrink: 0; }
}

/* ============================================================
   Zegar (stały, prawy górny róg)
   ============================================================ */
.zegar {
  position: fixed;
  top: 18px;
  right: 28px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-soft);
  background: rgba(255,255,255,0.7);
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  z-index: 50;
  pointer-events: none;
}

/* ============================================================
   Strony logowania / pierwszej konfiguracji
   ============================================================ */
.auth-body {
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.auth-wrap { width: 100%; max-width: 420px; }
.auth-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  box-shadow: var(--shadow-pop);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.auth-brand .brand-mark {
  font-size: 26px;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, var(--copper), var(--copper-dark));
  border-radius: 12px;
  box-shadow: 0 6px 16px -6px rgba(193,115,46,0.6);
}
.auth-brand span:last-child {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  color: var(--brown-800);
}
.auth-card h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  color: var(--brown-800);
  margin: 0 0 8px;
}
.auth-card .lede { margin: 0 0 22px; }
.auth-form .form-field { margin-bottom: 16px; }
.auth-form label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.auth-form input {
  width: 100%;
  padding: 11px 13px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  background: #FFFEFC;
  box-sizing: border-box;
}
.auth-form input:focus { outline: none; border-color: var(--copper); }

.inline-pass-form { display: flex; gap: 6px; }
.inline-pass-form input {
  width: 150px;
  padding: 6px 10px;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
}
