/* ============================================================
   Biura Poselskie — styl główny v2
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #FFFFFF;
  --bg-subtle:   #F8FAFC;
  --text:        #1E293B;
  --text-strong: #0F172A;
  --text-muted:  #64748B;
  --border:      #E2E8F0;
  --row-alt:     #F8FAFC;
  --row-hover:   #F1F5F9;

  /* Akcenty */
  --blue:        #2563EB;
  --blue-light:  #EFF6FF;
  --blue-mid:    #BFDBFE;
  --green:       #059669;
  --green-light: #ECFDF5;
  --amber:       #D97706;
  --amber-light: #FFFBEB;
  --violet:      #7C3AED;
  --violet-light:#F5F3FF;

  --radius:      8px;
  --radius-sm:   5px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Header — ciemny ────────────────────────────────────────── */
header {
  background: var(--text-strong);
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  box-shadow: 0 1px 8px rgba(0,0,0,.25);
}

.logo {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.logo span { color: #60A5FA; }

nav { display: flex; gap: 1.5rem; font-size: .875rem; }
nav a { color: #94A3B8; font-weight: 500; transition: color .15s; }
nav a:hover { color: #fff; text-decoration: none; }
nav a.active {
  color: #fff;
  border-bottom: 2px solid #60A5FA;
  padding-bottom: 2px;
}

/* ── Layout ─────────────────────────────────────────────────── */
main { max-width: 1280px; margin: 0 auto; padding: 0 2rem 3rem; }

/* ── Hero — gradient pod tytułem strony ─────────────────────── */
.page-hero {
  background: linear-gradient(135deg, #0F172A 0%, #1E3A5F 60%, #1D4ED8 100%);
  color: #fff;
  margin: 0 -2rem 2.5rem;
  padding: 2.5rem 2rem 2.25rem;
}
.page-hero h1 {
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -.5px;
  color: #fff;
}
.page-hero p {
  color: #93C5FD;
  font-size: .9rem;
  margin-top: .35rem;
}

/* Fallback dla stron bez hero */
.page-title { margin: 2rem 0 1.75rem; }
.page-title h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -.3px;
}
.page-title p { color: var(--text-muted); font-size: .875rem; margin-top: .25rem; }

/* ── Karty statystyk — kolorowe ─────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, transform .15s;
  position: relative;
  overflow: hidden;
}
.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Kolorowy pasek po lewej */
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 4px;
  border-radius: var(--radius) 0 0 var(--radius);
}
.stat-card:nth-child(1)::before { background: var(--blue); }
.stat-card:nth-child(2)::before { background: var(--green); }
.stat-card:nth-child(3)::before { background: var(--amber); }
.stat-card:nth-child(4)::before { background: var(--violet); }

.stat-card .label {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
}
.stat-card .value {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--text-strong);
  margin-top: .3rem;
  letter-spacing: -.5px;
  line-height: 1.1;
}
.stat-card:nth-child(1) .value { color: var(--blue); }
.stat-card:nth-child(2) .value { color: var(--green); }
.stat-card:nth-child(3) .value { color: var(--amber); }
.stat-card:nth-child(4) .value { color: var(--violet); }

.stat-card .sub {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .3rem;
}

/* ── Pasek filtrów ──────────────────────────────────────────── */
.filters {
  display: flex;
  gap: .75rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}
.filters input,
.filters select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .45rem .75rem;
  font-size: .875rem;
  color: var(--text);
  background: var(--bg);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.filters input:focus,
.filters select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}
.filters input { min-width: 240px; }
.filters .count { margin-left: auto; font-size: .8rem; color: var(--text-muted); }

/* ── Tabela ─────────────────────────────────────────────────── */
.table-wrap {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
table { width: 100%; border-collapse: collapse; font-size: .875rem; }

thead th {
  background: var(--text-strong);
  color: #94A3B8;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .8rem 1rem;
  text-align: left;
  border-bottom: none;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color .15s;
}
thead th:hover { color: #fff; }
thead th.sorted { color: #60A5FA; }
thead th .sort-icon { margin-left: .3rem; opacity: .4; }
thead th.sorted .sort-icon { opacity: 1; }

tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
tbody tr:last-child { border-bottom: none; }
tbody tr:nth-child(even) { background: var(--row-alt); }
tbody tr:hover { background: var(--blue-light); }
tbody tr:hover td:first-child { box-shadow: inset 3px 0 0 var(--blue); }

td { padding: .7rem 1rem; color: var(--text); vertical-align: middle; }
.td-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.td-center { text-align: center; }

tfoot tr td {
  background: var(--bg-subtle);
  border-top: 2px solid var(--border);
  font-weight: 700;
  color: var(--text-strong);
}

/* ── Odznaki klubów ─────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 99px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
  background: var(--row-alt);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.badge-ko         { background: #EFF6FF; border-color: var(--blue-mid);  color: var(--blue); }
.badge-pis        { background: #FFF7ED; border-color: #FED7AA; color: #C2410C; }
.badge-td         { background: var(--green-light); border-color: #6EE7B7; color: var(--green); }
.badge-pl2050     { background: var(--violet-light); border-color: #C4B5FD; color: var(--violet); }
.badge-konfederacja { background: #FFF1F2; border-color: #FECDD3; color: #BE123C; }
.badge-psl        { background: #FFFBEB; border-color: #FDE68A; color: var(--amber); }
.badge-lewica     { background: #FFF1F2; border-color: #FECDD3; color: #BE123C; }

.btn-link {
  color: var(--blue);
  font-size: .8rem;
  font-weight: 600;
}
.btn-link:hover { text-decoration: underline; }

/* ── Szczegóły posła ────────────────────────────────────────── */
.deputy-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, var(--text-strong) 0%, #1E3A5F 100%);
  border-radius: var(--radius);
  flex-wrap: wrap;
  color: #fff;
}
.deputy-header h1 {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.3px;
}
.deputy-header .meta {
  font-size: .875rem;
  color: #93C5FD;
  margin-top: .4rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.deputy-header .total-box {
  text-align: right;
}
.deputy-header .total-box .total-value {
  font-size: 2rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.5px;
}
.deputy-header .total-box .total-label {
  font-size: .8rem;
  color: #93C5FD;
  margin-top: .15rem;
}

.financial-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.section-title {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  margin-bottom: .75rem;
  margin-top: 2rem;
  padding-bottom: .5rem;
  border-bottom: 2px solid var(--blue);
  display: inline-block;
}

tr.poz-23 td { font-weight: 700; color: var(--text-strong); }

.poz23-details {
  margin-top: .5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.poz23-details table { font-size: .825rem; }
.poz23-empty { color: var(--text-muted); font-size: .825rem; font-style: italic; }

/* ── Statystyki — dwie kolumny ──────────────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-top: 2rem;
}
@media (max-width: 768px) { .two-col { grid-template-columns: 1fr; } }

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  padding: .85rem 1.25rem;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #fff;
  background: var(--text-strong);
}

/* ── Strona prawna ──────────────────────────────────────────── */
.legal-wrap { max-width: 760px; margin-top: 1.5rem; }
.legal-section {
  margin-bottom: 2.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}
.legal-section:last-child { border-bottom: none; }
.legal-section h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-strong);
  margin-bottom: .9rem;
  padding-left: .75rem;
  border-left: 3px solid var(--blue);
}
.legal-section p { color: var(--text); margin-bottom: .75rem; line-height: 1.75; }
.legal-section ul { padding-left: 1.25rem; display: flex; flex-direction: column; gap: .65rem; }
.legal-section li { color: var(--text); line-height: 1.7; }

/* ── Stopka ─────────────────────────────────────────────────── */
footer {
  background: var(--text-strong);
  color: #64748B;
  padding: 1.5rem 2rem;
  margin-top: 4rem;
  font-size: .8rem;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
}
footer a { color: #94A3B8; }
footer a:hover { color: #fff; text-decoration: none; }

/* ── Responsywność ──────────────────────────────────────────── */
@media (max-width: 640px) {
  main { padding: 0 1rem 2rem; }
  header { padding: 0 1rem; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .filters input { min-width: 100%; }
  .deputy-header { padding: 1.25rem; }
  .deputy-header .total-box .total-value { font-size: 1.5rem; }
}
