:root {
  /* --- KOLORY I STYLE --- */
  --bg-app: #fafbfc;          /* Tło aplikacji */
  --panel-bg: #ffffff;        /* Białe karty */

  --primary-color: #1f6feb;   /* Niebieski */
  --danger-color: #c62828;    /* Czerwony */
  --success-color: #28a745;   /* Zielony */

  --text-main: #0f172a;       /* Ciemny tekst */
  --text-muted: #6b7280;      /* Szary tekst */

  --border-color: #c9ced6;    /* Ramki */
  --selected-bg: #e8f0fe;     /* Tło zaznaczonego wiersza */
  --hover-bg: #f5f7fb;        /* Tło po najechaniu */

  --radius: 8px;              /* Zaokrąglenie */

  /* --- WYMIARY UKŁADU --- */
  --header-height: 50px;
  --footer-height: 320px;     
  --right-col-width: 160px;
}

* { box-sizing: border-box; }

body, html {
  margin: 0; padding: 0;
  height: 100%; width: 100%;
  overflow: hidden; /* Brak scrolla strony */
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px; 
  line-height: 1.4;
  background-color: var(--bg-app);
  color: var(--text-main);
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 12px;
  gap: 12px;
}

/* --- GÓRA (Pasek filtrów) --- */
.top-bar {
  height: var(--header-height);
  display: flex; align-items: center; gap: 12px;
  padding: 0; 
}

.app-title {
  font-size: 18px;
  font-weight: 600;
  margin-right: 16px;
  color: var(--text-main);
}

/* Grupa filtrów */
.filters-group {
  display: flex; align-items: center; gap: 8px; flex: 1;
}

.actions-group {
  display: flex; gap: 8px;
}

/* --- ŚRODEK (Lista + Przyciski) --- */
.middle-section {
  flex: 1;
  display: flex;
  overflow: hidden; 
  gap: 12px;
}

.task-list-wrapper {
  flex: 1;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: auto; 
}

.right-buttons-column {
  width: var(--right-col-width);
  display: flex;
  flex-direction: column;
  justify-content: space-between; 
}

.btn-group-top, .btn-group-bottom {
  display: flex; flex-direction: column; gap: 8px;
}

/* --- DÓŁ (Szczegóły + Lista Finansowa) --- */
.bottom-section {
  height: var(--footer-height);
  display: flex;
  gap: 12px;
}

.details-panel {
  width: 40%;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto;
}

.financial-panel {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 6px; 
}

.financial-list-wrapper {
  flex: 1;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  overflow: auto;
}

/* Pasek podsumowania */
.summary-bar {
  display: flex;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 8px;
  font-weight: 600;
  justify-content: space-between; 
}
.summary-item {
  text-align: right;
  flex: 1;
  padding: 0 4px;
}
.summary-label {
  text-align: left;
  background: var(--bg-app);
  padding: 0 8px;
  border-radius: 4px;
}

/* --- ELEMENTY INTERFEJSU (UI) --- */

/* Inputy */
input, select, textarea {
  border: 1px solid var(--border-color);
  border-radius: 6px; 
  padding: 6px 8px;
  font-family: inherit; font-size: inherit;
  background: #fff;
  width: 100%; 
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(31, 111, 235, 0.1);
}
textarea { resize: none; }

label {
  font-size: 12px; color: var(--text-muted); 
  display: block; margin-bottom: 4px;
}

/* Przyciski */
button, .btn {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  font-weight: 500;
  color: var(--text-main);
  transition: 0.15s background, 0.15s border-color, 0.15s opacity;
  font-size: 13px;
  text-align: center;
}

button:hover { background: var(--hover-bg); }

/* Warianty przycisków */
.btn-primary {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}
.btn-primary:hover { filter: brightness(0.95); background: var(--primary-color); }

.btn-danger {
  background: var(--danger-color);
  border-color: var(--danger-color);
  color: #fff;
}
.btn-danger:hover { filter: brightness(0.95); background: var(--danger-color); }

.btn-success {
  background: var(--success-color);
  border-color: var(--success-color);
  color: #fff;
}
.btn-success:hover { filter: brightness(0.95); background: var(--success-color); }

.btn-sm {
  padding: 4px 8px;
  font-size: 12px;
}

/* --- NIEAKTYWNE PRZYCISKI (Wyszarzone) --- */
button:disabled, 
.btn:disabled {
  background-color: transparent !important;
  color: #aaa !important;
  border: 1px solid #ddd !important;
  cursor: not-allowed;
  box-shadow: none !important;
  opacity: 0.7;
  filter: none !important;
}

/* Nieaktywne pola formularza */
select:disabled, input:disabled, textarea:disabled {
  background-color: #f9f9f9;
  color: #999;
  border-color: #eee;
  cursor: not-allowed;
}

/* --- TABELA --- */
table { 
  width: 100%; 
  border-collapse: separate; 
  border-spacing: 0; 
  table-layout: fixed; 
}

th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-app); 
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600;
  font-size: 13px;
  color: var(--text-main);
  white-space: nowrap;
}

td {
  padding: 6px 8px;
  border-bottom: 1px solid #e2e8f0; 
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Styl wiersza i blokada zaznaczania tekstu */
tbody tr {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    cursor: default;

    /* TO JEST NAPRAWA: */
    scroll-margin-top: 45px; 
}

tbody tr:hover { background: var(--hover-bg); cursor: pointer; }
tbody tr.selected { background: var(--selected-bg); }

/* --- KLASY POMOCNICZE --- */
.w-100 { width: 100%; }
.text-right { text-align: right; }
.row-inline { display: flex; gap: 12px; }
.field-group { margin-bottom: 8px; }

/* Do formularza PZW */
.input-money { text-align: right; }
.form-row { margin-bottom: 10px; }
#exportUsersList label.keyboard-active {
    outline: 2px solid #0d6efd;
    background: rgba(13,110,253,0.08);
    border-radius: 2px;
}

