/* System Składki — style panelu (odwzorowanie wersji Next.js/Tailwind). */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --sidebar: #2b3542;
  --sidebar-active: #222a35;
  --brand: #d63384;
  --green: #5cb85c;
  --green-h: #4cae4c;
  --blue: #337ab7;
  --red: #d9534f;
  --bg: #eef1f4;
}

body {
  background: var(--bg);
  color: #333;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}
a { color: inherit; text-decoration: none; }

/* --- Górny pasek --- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 56px;
  background: #fff; border-bottom: 1px solid #e5e7eb;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; z-index: 30;
}
.brand { font-size: 22px; font-weight: 700; letter-spacing: .04em; color: var(--brand); }
.topbar .user { font-size: 13px; color: #555; display: flex; align-items: center; gap: 14px; }
.badge-view { font-size: 11px; background: #fef3c7; color: #b45309; padding: 2px 8px; border-radius: 4px; }
.logout { color: var(--red); font-size: 18px; }
.hamburger { display: none; font-size: 22px; color: #555; background: none; border: 0; cursor: pointer; }

/* --- Sidebar --- */
.sidebar {
  position: fixed; top: 56px; bottom: 0; left: 0; width: 240px;
  background: var(--sidebar); color: #d1d5db; z-index: 20; overflow-y: auto;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 20px 13px 16px; font-size: 14px;
  border-left: 4px solid transparent; color: #d1d5db;
}
.sidebar nav a:hover { background: var(--sidebar-active); }
.sidebar nav a.active { background: var(--sidebar-active); border-left-color: var(--brand); color: #fff; }
.sidebar nav a .ico { width: 20px; text-align: center; }

/* --- Treść --- */
main { padding-top: 56px; margin-left: 240px; }
.content { padding: 32px; }
@media (max-width: 900px) {
  .content { padding: 16px; }
  main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: block; }
}

/* --- Nagłówek strony --- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.page-head h1 { font-size: 28px; font-weight: 300; color: #9ca3af; }
.page-head h1 b { color: #6b7280; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- Przyciski --- */
.btn { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500;
  padding: 8px 14px; border-radius: 5px; border: 0; cursor: pointer; }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { background: var(--green-h); }
.btn-gray { background: #e5e7eb; color: #374151; }
.btn-gray:hover { background: #d1d5db; }
.btn-sm { padding: 6px 12px; }

/* --- Filtry --- */
.filters { background: rgba(209,213,219,.5); border-radius: 6px; padding: 12px;
  margin-bottom: 16px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.filters label { font-size: 13px; color: #6b7280; }
input, select, textarea {
  border: 1px solid #d1d5db; border-radius: 5px; padding: 8px 12px; font-size: 14px;
  background: #fff; font-family: inherit; color: #333;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(92,184,92,.25); }
.filters input, .filters select { padding: 6px 12px; }

/* --- Karty --- */
.card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.card-head { padding: 12px 20px; border-bottom: 1px solid #f1f2f4; font-weight: 600; color: #4b5563; }
.card-body { padding: 20px; }

/* --- Tabele --- */
.table-wrap { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { text-align: left; color: var(--blue); font-weight: 500; padding: 12px 16px;
  border-bottom: 1px solid #f1f2f4; white-space: nowrap; }
tbody td { padding: 10px 16px; vertical-align: middle; }
tbody tr:nth-child(even) { background: #f9fafb; }
.muted { color: #9ca3af; }
.gray { color: #6b7280; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

/* --- Plakietki salda / statusy --- */
.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 8px; border-radius: 4px; color: #fff; }
.badge-plus { background: var(--green); }
.badge-minus { background: var(--red); }
.badge-blue { background: var(--blue); }
.badge-gray { background: #e5e7eb; color: #6b7280; }
.txt-green { color: #16a34a; font-weight: 500; }
.txt-red { color: #dc2626; font-weight: 500; }

/* --- Kafelki dashboardu --- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 32px; }
@media (max-width: 1100px) { .tiles { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 700px) { .tiles { grid-template-columns: 1fr; } }
.tile { border-radius: 8px; padding: 20px; color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.tile .num { font-size: 36px; font-weight: 700; line-height: 1; }
.tile .lbl { margin-top: 6px; font-size: 13px; opacity: .9; }
.tile-red { background: var(--red); }
.tile-green { background: var(--green); }
.tile-blue { background: var(--blue); }
.tile-teal { background: #17a2b8; }

/* --- Układ dwukolumnowy / siatki --- */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 24px; align-items: start; }
.grid-1-2 { display: grid; grid-template-columns: 1fr 2fr; gap: 24px; align-items: start; }
.grid-2-1 { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 1100px) { .grid-2, .grid-3, .grid-1-2, .grid-2-1 { grid-template-columns: 1fr; } }

/* --- Definicje (dane osobowe / rozliczenie) --- */
dl.info { font-size: 14px; }
dl.info > div { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid #f6f7f8; }
dl.info dt { color: #6b7280; }
dl.info dd { font-weight: 500; text-align: right; }

/* --- Formularze --- */
.form-card { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); padding: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 640px) { .form-grid { grid-template-columns: 1fr; } }
.field label { display: block; font-size: 13px; font-weight: 500; color: #4b5563; margin-bottom: 4px; }
.field input, .field select, .field textarea { width: 100%; }
.field .hint { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.form-actions { display: flex; gap: 12px; margin-top: 20px; }

/* --- Komunikaty --- */
.alert { font-size: 14px; border-radius: 5px; padding: 10px 12px; margin: 12px 0; }
.alert-err { color: #b91c1c; background: #fef2f2; border: 1px solid #fecaca; }
.alert-ok { color: #15803d; background: #f0fdf4; border: 1px solid #bbf7d0; }

.icons { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.icons a, .icons button { background: none; border: 0; cursor: pointer; font-size: 16px; }
.link-blue { color: var(--blue); }
.link-blue:hover { text-decoration: underline; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
.dashed { background: rgba(255,255,255,.6); border: 2px dashed #d1d5db; border-radius: 8px;
  padding: 40px; text-align: center; color: #9ca3af; }

/* --- Logowanie --- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: var(--sidebar); padding: 16px; }
.login-box { width: 100%; max-width: 360px; background: #fff; border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.3); padding: 32px; }
.login-box .brand { display: block; text-align: center; font-size: 30px; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: #9ca3af; font-size: 13px; margin-bottom: 24px; }
.login-box .field { margin-bottom: 16px; }
.login-box .btn { width: 100%; justify-content: center; padding: 10px; }

/* --- Wyszukiwarka (smart form) --- */
.search-box { position: relative; }
.search-results { position: absolute; z-index: 10; left: 0; right: 0; margin-top: 4px;
  background: #fff; border: 1px solid #e5e7eb; border-radius: 5px; box-shadow: 0 8px 20px rgba(0,0,0,.12);
  max-height: 280px; overflow-y: auto; }
.search-results button { display: flex; width: 100%; text-align: left; justify-content: space-between;
  gap: 12px; padding: 10px 16px; background: none; border: 0; cursor: pointer; font-size: 14px; }
.search-results button:hover { background: #f9fafb; }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: #f1f2f4; text-align: center; }
@media (max-width: 640px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }
.stat-row .cell { background: #fff; padding: 12px; }
.stat-row .cell .k { font-size: 11px; color: #9ca3af; }
.stat-row .cell .v { font-weight: 700; }

/* --- Wydruk --- */
.print-only { display: none; }
.print-meta { font-size: 12px; color: #6b7280; margin-top: 4px; }

@media print {
  /* chowamy interfejs: menu, pasek, filtry, przyciski akcji, ikony edycji */
  .topbar, .sidebar, .filters, .no-print, .icons { display: none !important; }
  main { margin: 0 !important; padding-top: 0 !important; }
  .content { padding: 0 !important; }
  body { background: #fff; color: #000; font-size: 10px; }
  .print-only { display: block !important; }

  .page-head { display: block; margin-bottom: 8px; }
  .page-head h1 { color: #000; font-size: 15px; font-weight: 600; }
  .print-meta { font-size: 10px; color: #444; margin-top: 2px; }

  /* pełna szerokość strony, brak przewijania/cieni/zaokrągleń */
  .table-wrap, .card { box-shadow: none !important; border: none !important;
    border-radius: 0 !important; overflow: visible !important; }

  /* kompaktowa, czytelna tabela mieszcząca się na stronie */
  table { font-size: 9px; width: 100%; }
  thead th { color: #000; border-bottom: 1.5px solid #000;
    padding: 3px 4px; white-space: normal; word-break: break-word; }
  tbody td { padding: 2px 4px; border-bottom: 1px solid #ccc;
    white-space: normal; word-break: break-word; vertical-align: top; }
  tbody tr { page-break-inside: avoid; }
  tbody tr:nth-child(even) { background: #fff !important; }

  a { color: #000; text-decoration: none; }
  /* saldo/plakietki jako czytelny tekst z zachowaniem koloru */
  .badge { background: none !important; padding: 0 !important; font-weight: 700; border-radius: 0; }
  .badge-plus { color: #16a34a !important; }
  .badge-minus { color: #dc2626 !important; }
  .badge-blue, .badge-gray { color: #000 !important; }

  @page { margin: 1cm; }
}
