﻿/* ============================================
   MATERIAL DESIGN SYSTEM - DESKTOP WATER CSS
   Ujednolicony system Material Design dla LuizaBB
   ============================================ */

/* Universal box-sizing */
*, *::before, *::after {
  box-sizing: border-box;
}

/* CSS Variables - Light Theme */
:root {
  --md-primary: #1976d2;
  --md-primary-dark: #1565c0;
  --md-primary-darker: #0d47a1;
  --md-primary-light: #42a5f5;
  --md-primary-lighter: #90caf9;
  --md-accent: #ff4081;
  --md-success: #4caf50;
  --md-success-dark: #388e3c;
  --md-warning: #ff9800;
  --md-warning-dark: #f57c00;
  --md-danger: #f44336;
  --md-danger-dark: #d32f2f;
  --md-error: #f44336;
  --md-info: #2196f3;
  --md-primary-container: #e3f2fd;
  --md-background: #ffffff;
  --md-surface: #ffffff;
  --md-surface-elevated: #ffffff;
  --md-surface-container: #f5f5f5;
  --md-surface-container-high: #eeeeee;
  --md-surface-variant: #f0f0f0;
  --md-text-primary: #1a1a1a;
  --md-text-secondary: #757575;
  --md-text-disabled: #bdbdbd;
  --md-border: #e0e0e0;
  --md-border-light: #f0f0f0;
  --md-shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
  --md-shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --md-shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
  --md-radius: 8px;
  --md-radius-lg: 16px;
  --md-spacing: 8px;
  --sidebar-width: 250px;
  --md-input-bg: #ffffff;
}

/* CSS Variables - Dark Theme (Manual Toggle) */
[data-theme="dark"] {
  --md-primary: #64b5f6;
  --md-primary-dark: #42a5f5;
  --md-primary-darker: #2196f3;
  --md-primary-light: #90caf9;
  --md-primary-lighter: #bbdefb;
  
  --md-background: #121212;
  --md-surface: #1e1e1e;
  --md-surface-elevated: #2d2d2d;
  --md-surface-container: #2a2a2a;
  --md-surface-container-high: #333333;
  --md-surface-variant: #424242;
  
  --md-text-primary: #e0e0e0;
  --md-text-secondary: #b0b0b0;
  --md-text-disabled: #666666;
  
  --md-border: #404040;
  --md-border-light: #333333;
  
  --md-input-bg: #2a2a2a;
  --md-card-bg: #1e1e1e; /* Tło kart/formularzy w dashboard */
  color-scheme: dark;
}

/* Fallback dla inputów w dark mode */
[data-theme="dark"] input, 
[data-theme="dark"] select, 
[data-theme="dark"] textarea {
  background-color: var(--md-input-bg);
  color: var(--md-text-primary);
  border-color: var(--md-border);
}

/* =====================================================
   SUBMIT WINDOW BANNER (water readings window)
   Kopiowane z water.css - używane w dashboard.php i water.php
   ===================================================== */

.submit-window {
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border: 1px solid #ef5350;
    border-left: 4px solid #e53935;
    color: #c62828;
    padding: 16px 20px;
    border-radius: var(--md-radius);
    margin-bottom: 24px;
    font-weight: 500;
    position: relative;
    transition: all 0.3s ease;
}

.submit-window.open {
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 1px solid #66bb6a;
    border-left: 4px solid #43a047;
    color: #2e7d32;
}

.submit-window-label {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    opacity: 0.8;
    display: block;
    margin-bottom: 4px;
}

/* Mobile responsiveness for submit window */
@media (max-width: 768px) {
    .submit-window {
        padding: 12px 16px;
        font-size: 0.9rem;
    }
}

/* =====================================================
   APP INSTALL BANNER
   Banner promujący instalację aplikacji mobilnej
   ===================================================== */

.app-install-banner {
  background: linear-gradient(135deg, var(--md-primary) 0%, var(--md-primary-dark) 100%);
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.app-install-banner .banner-content {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-install-banner .banner-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.app-install-banner .banner-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.app-install-banner .banner-text strong {
  font-size: 0.95rem;
  font-weight: 600;
}

.app-install-banner .banner-desc {
  font-size: 0.8rem;
  opacity: 0.9;
}

.app-install-banner .banner-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.app-install-banner .banner-btn {
  background: white;
  color: var(--md-primary);
  padding: 8px 20px;
  border-radius: 20px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.app-install-banner .banner-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.app-install-banner .banner-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.app-install-banner .banner-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

@media (max-width: 768px) {
  .app-install-banner {
    padding: 10px 16px;
  }
  
  .app-install-banner .banner-text strong {
    font-size: 0.85rem;
  }
  
  .app-install-banner .banner-desc {
    display: none;
  }
  
  .app-install-banner .banner-btn {
    padding: 6px 16px;
    font-size: 0.85rem;
  }
}

/* CSS Variables - Dark Theme */
[data-theme="dark"] {
  --md-primary: #90caf9;
  --md-primary-dark: #64b5f6;
  --md-primary-darker: #42a5f5;
  --md-primary-light: #bbdefb;
  --md-primary-lighter: #e3f2fd;
  --md-accent: #ff80ab;
  --md-success: #66bb6a;
  --md-success-dark: #4caf50;
  --md-warning: #ffb74d;
  --md-warning-dark: #ffa726;
  --md-danger: #ef5350;
  --md-danger-dark: #f44336;
  --md-error: #ef5350;
  --md-info: #64b5f6;
  --md-primary-container: #1a3a52;
  --md-background: #121212;
  --md-surface: #1e1e1e;
  --md-surface-elevated: #2a2a2a;
  --md-surface-container-high: #353535;
  --md-surface-variant: #424242;
  --md-surface-container: #2c2c2c;
  --md-text-primary: #ffffff;
  --md-text-secondary: #b3b3b3;
  --md-text-disabled: #666666;
  --md-border: #404040;
  --md-border-light: #333333;
  --md-shadow-sm: 0 2px 4px rgba(0,0,0,0.3);
  --md-shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --md-shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

/* Reset */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  background: var(--md-background);
  color: var(--md-text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* ============================================
   MATERIAL DESIGN NAVIGATION SYSTEM
   ============================================ */

/* Sidebar Navigation (Desktop) */
.material-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--md-primary);
  color: white;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  box-shadow: 2px 0 8px rgba(0,0,0,0.1);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-brand {
  padding: 0 12px;
  height: 100px;
  font-size: 1.3rem;
  font-weight: 500;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--md-primary-dark);
  box-sizing: border-box;
}

.brand-logo {
  max-width: 180px;
  max-height: 80px;
  object-fit: contain;
}

.brand-icon {
  font-size: 1.8rem;
}

.brand-text {
  color: white;
  font-weight: 500;
}

.sidebar-links {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px 0;
  list-style: none;
  margin: 0;
  max-height: calc(100vh - 100px); /* Wysokość ekranu minus header */
  min-height: 0; /* Pozwala flex-item się skurczyć */
}

.sidebar-links li {
  margin: 0;
}

.sidebar-links li hr {
  border: none;
  border-top: 1px solid rgba(255,255,255,0.1);
  margin: 6px 16px;
}

.sidebar-links a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: white;
  text-decoration: none;
  padding: 8px 16px;
  font-size: 0.9rem;
  transition: background 0.2s;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}

.sidebar-links a::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--md-accent);
  transform: translateX(-100%);
  transition: transform 0.2s;
}

.sidebar-links a:hover {
  background: rgba(255,255,255,0.1);
}

.sidebar-links a:hover::before {
  transform: translateX(0);
}

.sidebar-links a.active {
  background: rgba(255,255,255,0.15);
  font-weight: 500;
}

/* Submenu Styles for Sidebar */
.sidebar-links .has-submenu {
  position: relative;
}

.sidebar-links .submenu-toggle {
  cursor: pointer;
  user-select: none;
}

.sidebar-links .submenu-toggle .arrow {
  margin-left: auto;
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  display: inline-block;
}

.sidebar-links .has-submenu.open .arrow {
  transform: rotate(180deg);
}

.sidebar-links .submenu {
  display: none;
  list-style: none;
  padding: 0;
  margin: 0;
  background: rgba(0,0,0,0.1);
}

.sidebar-links .has-submenu.open .submenu {
  display: block;
}

.sidebar-links .submenu li {
  margin: 0;
}

.sidebar-links .submenu a {
  padding: 6px 16px 6px 40px;
  font-size: 0.85rem;
  background: rgba(0,0,0,0.05);
}

.sidebar-links .submenu a:hover {
  background: rgba(255,255,255,0.08);
}

.sidebar-links .submenu a.active {
  background: rgba(255,255,255,0.12);
}

/* Responsive adjustments for short screens */
@media (max-height: 800px) {
  .sidebar-brand {
    height: 80px;
    padding: 0 8px;
  }
  
  .brand-logo {
    max-width: 150px;
    max-height: 60px;
  }
  
  .sidebar-links {
    max-height: calc(100vh - 80px);
  }
  
  .sidebar-links a {
    padding: 6px 12px;
    font-size: 0.85rem;
    gap: 8px;
  }
  
  .sidebar-links .submenu a {
    padding: 5px 12px 5px 32px;
    font-size: 0.8rem;
  }
  
  .sidebar-links li hr {
    margin: 4px 12px;
  }
}

@media (max-height: 700px) {
  .sidebar-brand {
    height: 60px;
    font-size: 1.1rem;
  }
  
  .brand-logo {
    max-width: 130px;
    max-height: 50px;
  }
  
  .sidebar-links {
    padding: 4px 0;
    max-height: calc(100vh - 60px);
  }
  
  .sidebar-links a {
    padding: 5px 10px;
    font-size: 0.8rem;
    gap: 6px;
  }
  
  .sidebar-links .submenu a {
    padding: 4px 10px 4px 28px;
    font-size: 0.75rem;
  }
  
  .sidebar-links li hr {
    margin: 3px 10px;
  }
}

/* Main Content Area */
.material-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: var(--md-background);
  display: flex;
  flex-direction: column;
}

/* Top Bar */
.material-topbar {
  background: var(--md-surface);
  box-shadow: var(--md-shadow-sm);
  padding: 0 16px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--md-border);
  box-sizing: border-box;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-logo {
  display: none; /* Desktop: ukryte */
  align-items: center;
}

.topbar-logo img {
  max-height: 40px !important;
  max-width: 120px;
  object-fit: contain;
  display: block;
  height: auto;
  width: auto;
}

.topbar-brand-container {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}

.topbar-brand {
  display: block; /* Desktop: WIDOCZNE - nazwa strony po lewej */
  font-weight: 600;
  color: var(--md-primary);
  font-size: 1.1rem;
}

.material-topbar .user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  font-size: 0.9rem;
}

.material-topbar .user-name {
  font-weight: 500;
  color: var(--text-primary);
}

.material-topbar .user-role {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.material-topbar .user-role.admin {
  background: var(--md-accent);
  color: white;
}

.material-topbar .user-role.resident {
  background: var(--md-primary-lighter);
  color: var(--md-primary-dark);
}

[data-theme="dark"] .material-topbar .user-role.resident {
  background: #1565c0;
  color: #bbdefb;
}

/* Legacy support - deprecated */
.material-topbar .user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--md-primary);
  font-size: 0.9rem;
}

.material-topbar .badge.role {
  background: var(--md-primary-lighter);
  color: var(--md-primary-dark);
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

/* Content Container */
.material-content {
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  padding: 32px;
  box-sizing: border-box;
}

/* ============================================
   HAMBURGER MENU SYSTEM (Mobile)
   ============================================ */

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  transition: background 0.2s;
  flex-direction: column;
  gap: 3px;
  width: 32px;
  height: 32px;
  justify-content: center;
  align-items: center;
}

.hamburger-btn:hover {
  background: rgba(0,0,0,0.05);
}

.hamburger-line {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--md-text-primary);
  transition: all 0.3s;
  border-radius: 1px;
}

.hamburger-btn[aria-expanded="true"] .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}

.hamburger-btn[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
}

.hamburger-btn[aria-expanded="true"] .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -6px);
}

/* ============================================
   DRAWER SYSTEM (Mobile Menu)
   ============================================ */

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100%;
  background: var(--md-surface);
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2000;
  box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}

/* Drawer starts CLOSED by default - force it */
.drawer:not(.open) {
  transform: translateX(-100%) !important;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head {
  padding: 12px 16px;
  background: var(--md-primary);
  color: white;
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.drawer-close {
  background: none;
  border: none;
  color: white;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background 0.2s;
}

.drawer-close:hover {
  background: rgba(255,255,255,0.1);
}

.drawer-body {
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  height: calc(100% - 48px);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  text-decoration: none;
  color: var(--md-text-primary);
  font-size: 0.9rem;
  transition: background 0.2s;
  border: none;
  white-space: nowrap;
}

.drawer-link:hover {
  background: rgba(0,0,0,0.05);
}

/* Drawer Submenu Styles */
.drawer-submenu-wrapper {
  display: flex;
  flex-direction: column;
}

.drawer-submenu-toggle {
  cursor: pointer;
  user-select: none;
  justify-content: space-between;
}

.drawer-submenu-toggle .arrow {
  font-size: 0.8rem;
  transition: transform 0.3s ease;
  display: inline-block;
  margin-left: auto;
}

.drawer-submenu-toggle.open .arrow {
  transform: rotate(180deg);
}

.drawer-submenu {
  display: none;
  background: rgba(0,0,0,0.03);
}

.drawer-submenu-toggle.open + .drawer-submenu {
  display: flex;
  flex-direction: column;
}

.drawer-submenu .submenu-item {
  padding: 6px 16px 6px 40px;
  font-size: 0.85rem;
  background: rgba(0,0,0,0.02);
}

.drawer-submenu .submenu-item:hover {
  background: rgba(0,0,0,0.08);
}

.drawer-separator {
  height: 1px;
  background: var(--md-border);
  margin: 6px 16px;
}

.drawer-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 1999;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

/* Force backdrop to stay hidden by default */
.drawer-backdrop:not(.show) {
  opacity: 0 !important;
  visibility: hidden !important;
  display: none !important;
}

.drawer-backdrop.show {
  opacity: 1;
  visibility: visible;
  display: block;
}

/* ============================================
   MATERIAL DESIGN COMPONENTS
   ============================================ */

/* Card Component */
.material-card {
  background: var(--md-surface);
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius-lg);
  box-shadow: var(--md-shadow-md);
  padding: 24px;
  margin-bottom: 24px;
  transition: box-shadow 0.3s;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.material-card:hover {
  box-shadow: var(--md-shadow-lg);
}

.material-card h2,
.material-card h3 {
  margin-top: 0;
  margin-bottom: 16px;
  color: var(--md-primary);
  font-weight: 500;
}

.material-card h2 {
  font-size: 1.5rem;
}

.material-card h3 {
  font-size: 1.25rem;
}

/* Optymalizacja kart w grid-2 (houses.php) - kompaktowy widok */
.material-grid-2 .material-card {
  padding: 16px;
  margin-bottom: 0;
}

.material-grid-2 .material-card h3 {
  font-size: 1.05rem;
  margin-bottom: 12px;
}

.material-grid-2 .material-form-group {
  margin-bottom: 6px;
}

.material-grid-2 .material-label {
  font-size: 0.8rem;
}

.material-grid-2 .material-input {
  font-size: 0.85rem;
  padding: 8px 10px;
  height: 36px;
}

.material-grid-2 .material-pill {
  font-size: 0.7rem;
  padding: 2px 6px;
}

/* Form row - 2 kolumny obok siebie */
.material-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.material-grid-2 .material-form-row {
  gap: 8px;
  margin-bottom: 6px;
}

/* Specjalny ukĹ‚ad dla Nazwa + WĹ‚aĹ›ciciel (nazwa wÄ…ska, wĹ‚aĹ›ciciel szeroki) */
.material-form-row-name-owner {
  grid-template-columns: 90px 1fr;
  gap: 10px;
}

/* Grid Layouts */
.material-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

/* Dashboard - kafelki statystyk (4 kafelki u góry) */
.dashboard-stat-card {
  text-align: center;
  padding: 16px 12px !important;
  min-height: auto;
}

.dashboard-stat-label {
  font-size: 0.75rem;
  color: var(--md-text-secondary);
  margin-bottom: 8px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.dashboard-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--md-primary);
  line-height: 1.2;
}

/* Mobile - 2x2 grid dla kafelków statystyk */
@media (max-width: 768px) {
  .material-grid-4 {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 12px !important;
  }
  
  .dashboard-stat-card {
    padding: 12px 8px !important;
  }
  
  .dashboard-stat-label {
    font-size: 0.65rem;
    margin-bottom: 6px;
  }
  
  .dashboard-stat-value {
    font-size: 1.2rem;
  }
}

/* Bardzo małe ekrany - jeszcze mniejszy tekst */
@media (max-width: 480px) {
  .dashboard-stat-label {
    font-size: 0.6rem;
    margin-bottom: 4px;
  }
  
  .dashboard-stat-value {
    font-size: 1.1rem;
  }
}

.material-grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.rates-forms-column .material-grid-2 {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.material-grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 20px;
}

/* Water reading form - Dom + Stan licznika responsywnie obok siebie */
.water-reading-row {
  display: grid;
  grid-template-columns: minmax(80px, 150px) 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

/* Jeśli brak miejsca (bardzo małe ekrany), przejdź pod siebie */
@media (max-width: 400px) {
  .water-reading-row {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

.material-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Chart container - wyĹ›rodkowanie wykresĂłw */
.chart-container {
  position: relative;
  height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
}

/* Form Elements */
.material-input,
.material-select,
.material-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--md-border);
  border-radius: var(--md-radius);
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: var(--md-surface);
  color: var(--md-text-primary);
  margin-bottom: 16px;
}

.material-input:focus,
.material-select:focus,
.material-textarea:focus {
  outline: none;
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(25,118,210,0.1);
}

/* Dark mode overrides dla form elements */
[data-theme="dark"] .material-input,
[data-theme="dark"] .material-select,
[data-theme="dark"] .material-textarea {
  background: var(--md-surface-elevated);
  color: var(--md-text-primary);
  border-color: var(--md-border);
}

[data-theme="dark"] .material-input:focus,
[data-theme="dark"] .material-select:focus,
[data-theme="dark"] .material-textarea:focus {
  background: var(--md-surface-container);
  border-color: var(--md-primary);
  box-shadow: 0 0 0 3px rgba(144, 202, 249, 0.15);
}

[data-theme="dark"] .material-label {
  color: var(--md-text-secondary);
}

.material-input.compact {
  padding: 10px 12px;
  font-size: 0.95rem;
  margin-bottom: 12px;
}

/* File input styling */
.material-input[type="file"] {
  padding: 10px 12px;
  cursor: pointer;
  color: var(--md-text-primary);
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.material-input[type="file"]::file-selector-button {
  padding: 8px 16px;
  background: var(--md-primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  margin-right: 12px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.material-input[type="file"]::file-selector-button:hover {
  background: var(--md-primary-dark);
}

[data-theme="dark"] .material-input[type="file"] {
  color: #e0e0e0;
  background: var(--md-surface);
}

[data-theme="dark"] .material-input[type="file"]::file-selector-button {
  background: var(--md-surface-elevated);
  color: var(--md-text-primary);
  border: 1px solid var(--md-border);
}

[data-theme="dark"] .material-input[type="file"]::file-selector-button:hover {
  background: var(--md-surface-container);
}

/* Email required field - red border with pulse animation */
.material-input.email-required {
  border: 2px solid var(--md-danger);
  animation: email-required-pulse 2s ease-in-out infinite;
}

.material-input.email-required:focus {
  border-color: var(--md-danger-dark);
  box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.2);
}

@keyframes email-required-pulse {
  0%, 100% {
    border-color: var(--md-danger);
  }
  50% {
    border-color: var(--md-danger-dark);
  }
}

[data-theme="dark"] .material-input.email-required {
  border-color: var(--md-danger);
}

[data-theme="dark"] .material-input.email-required:focus {
  border-color: var(--md-danger-dark);
  box-shadow: 0 0 0 3px rgba(229, 115, 115, 0.2);
}

.input-with-currency {
  position: relative;
  display: inline-block;
  width: 75px;
}

.currency-input {
  width: 100%;
  padding-right: 20px;
  box-sizing: border-box;
}

.currency-suffix {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--md-text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  pointer-events: none;
}

.material-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--md-text-secondary);
}

/* Buttons */
.material-btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--md-radius);
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  background: var(--md-primary);
  color: white;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
}

/* Small navigation buttons for month picker arrows */
.material-btn-nav {
  padding: 4px 6px;
  font-size: 0.6rem;
  min-height: 15px;
}

/* Hover tylko na urzÄ…dzeniach z myszÄ… (nie touch) */
@media (hover: hover) {
  .material-btn:hover {
    background: var(--md-primary-dark);
    transform: translateY(-1px);
  }
}

.material-btn.primary,
.material-btn-primary {
  background: var(--md-primary);
  color: white;
}

.material-btn.secondary,
.material-btn-secondary {
  background: var(--md-surface-container);
  color: var(--md-text-primary);
  border: 1px solid var(--md-border);
}

.material-btn.secondary:hover,
.material-btn-secondary:hover {
  background: var(--md-surface-container-high);
  border-color: var(--md-primary);
}

.material-btn.danger,
.material-btn-danger {
  background: var(--md-danger);
  color: white;
}

.material-btn.small {
  padding: 6px 12px;
  font-size: 0.8rem;
  min-height: auto;
}

.material-btn.danger:hover,
.material-btn-danger:hover {
  background: var(--md-danger-dark);
}

.material-btn.ghost,
.material-btn-ghost {
  background: transparent;
  border: 1px solid var(--md-primary);
  color: var(--md-primary);
}

.material-btn.ghost:hover,
.material-btn-ghost:hover {
  background: rgba(25,118,210,0.05);
}

/* Tables */
.material-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--md-surface);
  border-radius: var(--md-radius);
  overflow: hidden;
  box-shadow: var(--md-shadow-sm);
  margin-bottom: 24px;
}

.material-table th,
.material-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--md-border);
  color: var(--md-text-primary);
}

/* Kolory success/danger w tabelach - nadpisujÄ… domyĹ›lny kolor */
.material-table td.u-text-success {
  color: var(--md-success) !important;
}

.material-table td.u-text-danger {
  color: var(--md-danger) !important;
}

/* Kolory success/danger dla elementĂłw wewnÄ…trz tabel */
.material-table td.u-text-success strong,
.material-table td.u-text-success span {
  color: var(--md-success) !important;
}

.material-table td.u-text-danger strong,
.material-table td.u-text-danger span {
  color: var(--md-danger) !important;
}

.material-table th {
  background: var(--md-background);
  font-weight: 500;
  color: var(--md-text-primary);
}

.material-table tr:last-child td {
  border-bottom: none;
}

.material-table tr:hover {
  background: rgba(0,0,0,0.02);
}

/* Responsive Table */
.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Tabela responsive - min-width tylko na desktop */
@media (min-width: 769px) {
  .material-table.mobile-responsive {
    min-width: 600px;
  }
}

/* Alerts */
.material-alert {
  padding: 16px;
  border-radius: var(--md-radius);
  margin-bottom: 16px;
  position: relative;
  color: var(--md-text-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.material-alert.success {
  background: rgba(76, 175, 80, 0.1);
  color: var(--md-success);
  border-left: 4px solid var(--md-success);
}

.material-alert.warning {
  background: rgba(255, 152, 0, 0.1);
  color: var(--md-warning);
  border-left: 4px solid var(--md-warning);
}

.material-alert.danger,
.material-alert.error {
  background: rgba(244, 67, 54, 0.1);
  color: var(--md-danger);
  border-left: 4px solid var(--md-danger);
}

.material-alert .close {
  cursor: pointer;
  font-size: 1.25rem;
  opacity: 0.7;
  transition: 0.2s;
}

.material-alert .close:hover {
  opacity: 1;
}

/* Info Banners - uniwersalne bannery informacyjne z obsĹ‚ugÄ… dark mode */
.info-banner,
.warning-banner,
.success-banner,
.danger-banner {
  padding: 16px;
  border-radius: var(--md-radius);
  margin-bottom: 20px;
  line-height: 1.6;
}

.info-banner {
  background: #e3f2fd;
  color: #1565c0;
  border-left: 4px solid #2196f3;
}

.warning-banner {
  background: #fff3cd;
  color: #856404;
  border-left: 4px solid #ffc107;
}

.success-banner {
  background: #e8f5e9;
  color: #2e7d32;
  border-left: 4px solid #4caf50;
}

.danger-banner {
  background: #ffebee;
  color: #c62828;
  border-left: 4px solid #f44336;
}

.info-banner strong,
.warning-banner strong,
.success-banner strong,
.danger-banner strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

/* Dark mode variants */
[data-theme="dark"] .info-banner {
  background: rgba(33, 150, 243, 0.15);
  color: #90caf9;
  border-left-color: #42a5f5;
}

[data-theme="dark"] .warning-banner {
  background: rgba(255, 193, 7, 0.15);
  color: #ffb74d;
  border-left-color: #ffa726;
}

[data-theme="dark"] .success-banner {
  background: rgba(76, 175, 80, 0.15);
  color: #81c784;
  border-left-color: #66bb6a;
}

[data-theme="dark"] .danger-banner {
  background: rgba(244, 67, 54, 0.15);
  color: #ef5350;
  border-left-color: #e57373;
}

/* Segmented Control - przeĹ‚Ä…cznik zakĹ‚adek */
.segmented-control {
  display: inline-flex;
  background: var(--md-surface);
  border-radius: var(--md-radius-lg);
  padding: 4px;
  gap: 4px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
  margin-bottom: 24px;
}

.segmented-control-button {
  padding: 10px 20px;
  border: none;
  background: transparent;
  color: var(--md-text-secondary);
  font-size: 0.95rem;
  font-weight: 500;
  border-radius: var(--md-radius);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.segmented-control-button:hover {
  background: rgba(0,0,0,0.05);
  color: var(--md-text-primary);
}

.segmented-control-button.active {
  background: var(--md-primary);
  color: white;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

[data-theme="dark"] .segmented-control {
  background: rgba(255,255,255,0.05);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

[data-theme="dark"] .segmented-control-button:hover {
  background: rgba(255,255,255,0.1);
}

/* Upload Zone */
.material-upload-zone {
  border: 2px dashed #90caf9;
  border-radius: var(--md-radius);
  padding: 32px;
  text-align: center;
  background: rgba(25, 118, 210, 0.02);
  transition: all 0.3s;
  cursor: pointer;
  color: var(--md-text-primary);
  position: relative;
}

.material-upload-zone:hover {
  border-color: #1976d2;
  background: rgba(25, 118, 210, 0.05);
}

.material-upload-zone.dragover {
  border-color: #1976d2;
  background: rgba(25, 118, 210, 0.1);
  transform: scale(1.02);
}

.material-upload-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 2;
  width: 100%;
  height: 100%;
}

.material-upload-zone.has-file input[type="file"] {
  pointer-events: none;
}

.dropzone-text {
  pointer-events: none;
  color: var(--md-text-secondary);
  position: relative;
  z-index: 1;
}

.dropzone-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: var(--md-background);
  border-radius: 8px;
  margin-top: 12px;
  color: var(--md-text-primary);
  position: relative;
  z-index: 2;
}

/* Dropzone icon */
.dropzone-icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

/* Dropzone subtext */
.dropzone-subtext {
  font-size: 0.875rem;
  color: var(--md-text-secondary);
  margin-top: 4px;
}

/* Dropzone clear button */
.dropzone-clear-btn {
  background: var(--md-danger);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 4px 8px;
  margin-left: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.dropzone-clear-btn:hover {
  background: var(--md-danger-dark);
}

/* Dark mode dla upload zone */
[data-theme="dark"] .material-upload-zone {
  border-color: rgba(144, 202, 249, 0.3);
  background: rgba(25, 118, 210, 0.05);
}

[data-theme="dark"] .material-upload-zone:hover {
  border-color: rgba(144, 202, 249, 0.5);
  background: rgba(25, 118, 210, 0.08);
}

[data-theme="dark"] .material-upload-zone.dragover {
  border-color: rgba(144, 202, 249, 0.7);
  background: rgba(25, 118, 210, 0.12);
}

/* Modal/Lightbox */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.modal-backdrop.open {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--md-surface);
  border-radius: var(--md-radius-lg);
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: var(--md-shadow-lg);
  color: var(--md-text-primary);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--md-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--md-text-primary);
}

.modal-header h3 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--md-text-secondary);
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--md-text-primary);
}

.modal-body {
  padding: 24px;
  max-height: 60vh;
  overflow-y: auto;
  color: var(--md-text-primary);
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--md-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* Lightbox - Dynamiczne dopasowanie do wielkoĹ›ci okna */
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7); /* Delikatne przyciemnienie tla */
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1300;
  transition: all 0.3s;
  padding: 0; /* Brak paddingu - lightbox-content ma wlasny */
}

.lightbox-backdrop img {
  max-width: 90vw; /* Max 90% viewportu */
  max-height: 88vh; /* Max 88vh - więcej miejsca pionowo */
  width: auto; /* Zachowaj naturalna szerokosc */
  height: auto; /* Zachowaj naturalna wysokosc */
  object-fit: contain;
  display: block; /* Usun inline spacing */
  box-sizing: border-box;
}

/* Style dla iframe w kontenerze lightbox */
#universalLightboxContainer iframe,
.lightbox-backdrop iframe {
  width: 90vw; /* Takie same jak img - było 80vw */
  height: 88vh; /* Takie same jak img - było 84vh */
  border: none;
  border-radius: 4px;
  background: white;
  overflow: auto; /* Wlacz scrollowanie */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling na iOS */
  touch-action: pan-y; /* Pozwol na scrollowanie pionowe dotykiem */
  box-sizing: border-box;
}

.lightbox-content {
  position: relative;
  width: auto; /* Auto width - dopasuj do grafiki */
  height: auto; /* Auto height - dopasuj do grafiki */
  max-width: 95vw; /* Max 95% szerokosci viewportu */
  max-height: 96vh; /* Max 96vh - maksymalne wykorzystanie wysokosci */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px; /* Równomierne padddingi ze wszystkich stron */
  background: rgba(0,0,0,0.95); /* Ciemne tlo wokol grafiki */
  border-radius: 8px;
}

/* Kontener wewnÄ™trzny na treĹ›Ä‡ lightbox */
#universalLightboxContainer {
  width: auto; /* Auto - dopasuj do grafiki */
  height: auto; /* Auto - dopasuj do grafiki */
  max-width: 100%; /* Nie przekraczaj lightbox-content */
  max-height: 100%; /* Nie przekraczaj lightbox-content */
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: auto; /* Pozwol na wszystkie touch gestures w kontenerze */
}

.lightbox-close {
  position: absolute;
  top: 10px; /* Wewnatrz lightbox-content - zawsze widoczny */
  right: 10px;
  font-size: 2rem;
  color: white;
  cursor: pointer;
  opacity: 0.9;
  transition: all 0.2s ease;
  background: rgba(255,0,0,0.85); /* Czerwone tlo - bardziej widoczny */
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  border: 2px solid rgba(255,255,255,0.5);
}

.lightbox-close:hover {
  opacity: 1;
  background: rgba(0,0,0,0.9);
  transform: scale(1.1);
  border-color: rgba(255,255,255,0.6);
}

/* Responsywnosc dla malych urzadzen */
@media (max-width: 768px) {
  .lightbox-backdrop {
    padding: 0; /* Bez paddingu - backdrop wypełnia cały ekran */
    background: rgba(0,0,0,0.8); /* Przyciemnienie */
  }
  
  .lightbox-content {
    max-width: calc(100vw - 40px);
    max-height: 85vh; /* Bezpieczne vh zamiast dvh */
    padding: 10px;
    margin: 20px auto; 
    background: rgba(0,0,0,0.95);
    display: flex;
    flex-direction: column;
  }
  
  .lightbox-backdrop img {
    max-width: calc(100vw - 80px);
    max-height: 80vh;
    width: auto;
    height: auto;
  }
  
  #universalLightboxContainer iframe,
  .lightbox-backdrop iframe,
  iframe#mobilePdfFrame {
    width: calc(100vw - 60px) !important;
    height: 75vh !important; /* Sztywna wysokosc w vh - bezpieczniejsza niz calc(dvh) */
    max-width: 100%;
    border-radius: 4px;
    overflow: hidden;
    box-sizing: border-box;
    background: white;
  }
  
  .lightbox-close {
    top: 8px; /* Wewnatrz lightbox-content */
    right: 8px;
    width: 40px;
    height: 40px;
    font-size: 1.8rem;
    background: rgba(255,0,0,0.9); /* Czerwone tlo - bardziej widoczne */
    border-color: rgba(255,255,255,0.9);
  }
  
  .lightbox-close:hover {
    background: rgba(255,0,0,1);
  }
}

/* Modal Forms (using lightbox classes) */
.lightbox-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.lightbox-modal.open {
  display: flex;
  opacity: 1;
  visibility: visible;
}

.lightbox-modal .lightbox-content {
  background: var(--md-surface);
  border-radius: var(--md-radius-lg);
  box-shadow: var(--md-shadow-lg);
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.lightbox-modal .lightbox-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--md-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lightbox-modal .lightbox-header h3 {
  margin: 0;
  color: var(--md-text-primary);
  font-size: 1.25rem;
  font-weight: 500;
}

.lightbox-modal .lightbox-close {
  position: static;
  background: transparent;
  color: var(--md-text-secondary);
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  transition: all 0.2s;
}

.lightbox-modal .lightbox-close:hover {
  background: var(--md-surface-elevated);
  color: var(--md-text-primary);
}

.lightbox-modal .lightbox-body {
  padding: 24px;
}

.lightbox-modal .form-group {
  margin-bottom: 20px;
}

.lightbox-modal .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.lightbox-modal .form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--md-border);
}

@media (max-width: 480px) {
  .lightbox-modal .lightbox-content {
    width: 95%;
    margin: 20px;
  }
  
  .lightbox-modal .form-row {
    grid-template-columns: 1fr;
  }
  
  .lightbox-modal .form-actions {
    flex-direction: column;
  }
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Desktop: Always show sidebar, hide hamburger */
@media (min-width: 1025px) {
  .material-sidebar {
    transform: translateX(0) !important;
    display: block !important;
  }
  
  .material-main {
    margin-left: var(--sidebar-width) !important;
  }
  
  .hamburger-btn {
    display: none !important;
  }
  
  .drawer {
    display: none !important;
  }
}

/* Mobile: Hide sidebar, show hamburger */
@media (max-width: 1024px) {
  .material-sidebar {
    transform: translateX(-100%);
  }
  
  .material-main {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
  }
  
  .material-content {
    padding: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
  }
  
  .hamburger-btn {
    display: flex;
  }
  
  /* Mobile topbar adjustments */
  .material-topbar {
    min-height: 56px;
    height: auto;
    padding: 8px 12px;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
  }
  
  /* Kompensacja dla fixed topbar - dodaj padding do main */
  .material-main {
    padding-top: 72px;
  }
  
  /* Pokazuj kontener na mobile */
  .topbar-brand-container {
    display: flex !important;
  }
  
  .topbar-logo {
    display: flex !important; /* Pokazuj logo na mobile */
  }
  
  .topbar-brand {
    font-size: 0.9rem; /* Zmniejsz font na mobile */
  }
  
  /* Zmniejsz user-info na mobile - bardziej kompaktowo */
  .material-topbar .user-info {
    font-size: 0.75rem;
    gap: 2px;
  }
  
  .material-topbar .user-name {
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
  }
  
  .material-topbar .user-role {
    font-size: 0.65rem;
    padding: 2px 6px;
  }
  
  .topbar-page-title {
    font-size: 0.7rem;
  }
  
  .material-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  
  .material-grid-2,
  .material-grid-3,
  .material-grid-4 {
    grid-template-columns: 1fr;
  }
  
  /* Force show hamburger on mobile */
  .hamburger-btn {
    display: flex !important;
  }
  
  /* Hide sidebar on mobile */
  .material-sidebar {
    transform: translateX(-100%) !important;
  }
  
  /* Ensure drawer system works */
  .drawer {
    display: block !important;
  }
}

/* Mobile drawer optimization */
@media (max-width: 480px) {
  /* Extra small screens - topbar musi być bardziej kompaktowy */
  .material-topbar {
    padding: 6px 8px;
  }
  
  .topbar-left {
    gap: 8px;
  }
  
  .topbar-right {
    gap: 8px;
  }
  
  .topbar-logo {
    font-size: 1.2rem;
  }
  
  .topbar-logo img {
    max-height: 32px !important;
    max-width: 100px;
    height: auto;
    width: auto;
  }
  
  .topbar-brand {
    font-size: 0.8rem; /* Jeszcze mniejszy font na małych ekranach */
  }
  
  .material-topbar .user-info {
    font-size: 0.7rem;
    gap: 1px;
  }
  
  .material-topbar .user-name {
    font-size: 0.75rem;
    max-width: 100px;
  }
  
  .material-topbar .user-role {
    font-size: 0.6rem;
    padding: 1px 4px;
  }
  
  .theme-toggle {
    font-size: 1rem;
  }
  
  .drawer {
    width: 260px; /* Slightly narrower on small screens */
  }
  
  .drawer-head {
    padding: 12px 16px; /* Reduced padding */
    font-size: 1.1rem; /* Smaller header text */
  }
  
  .drawer-body {
    padding: 4px 0; /* Reduced top/bottom padding */
  }
  
  .drawer-link {
    padding: 8px 16px; /* Reduced padding */
    font-size: 0.9rem; /* Smaller font */
    gap: 8px; /* Smaller gap between icon and text */
    line-height: 1.3; /* Tighter line height */
  }
  
  /* Make emoji icons smaller */
  .drawer-link::before {
    font-size: 0.85em;
  }
  
  .drawer-separator {
    margin: 4px 16px; /* Reduced margins */
  }
}

/* Ultra small screens - even more compact */
@media (max-width: 360px) {
  .drawer {
    width: 240px;
  }
  
  .drawer-link {
    padding: 6px 12px;
    font-size: 0.85rem;
    gap: 6px;
    min-height: auto; /* Remove any min-height constraints */
  }
  
  .drawer-head {
    padding: 10px 12px;
    font-size: 1rem;
  }
  
  .drawer-body {
    padding: 2px 0; /* Even less padding */
  }
}

/* For very short screens (landscape phones) */
@media (max-height: 500px) {
  .drawer-link {
    padding: 4px 16px !important;
    font-size: 0.8rem !important;
    gap: 6px !important;
  }
  
  .drawer-head {
    padding: 8px 16px !important;
    font-size: 0.95rem !important;
  }
  
  .drawer-body {
    padding: 0 !important;
  }
  
  .drawer-separator {
    margin: 2px 16px !important;
  }
}

/* Mobile table responsiveness */
@media (max-width: 768px) {
  .material-topbar {
    padding: 12px 16px;
  }
  
  /* PokaĹĽ logo w topbar tylko na mobilnym */
  .topbar-logo {
    display: block;
  }
  
  .material-card {
    padding: 8px !important;
    margin-bottom: 8px !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }
  
  .input-with-currency {
    width: 100px;
  }
  
  /* ResponsywnoĹ›Ä‡ wykresĂłw */
  .chart-container {
    height: 250px;
    width: 100%;
    padding: 0;
  }
  
  /* Stawki - na mobilnym pola obok siebie, ale z mniejszym odstÄ™pem */
  .rates-forms-column .material-grid-2 {
    gap: 8px !important;
  }
  
  /* Mniejsze inputy na mobilnym */
  .rates-forms-column .material-input {
    font-size: 0.9rem;
    padding: 8px;
  }
  
  .rates-forms-column .material-label {
    font-size: 0.85rem;
  }
  
  .rates-forms-column .field-hint {
    font-size: 0.75rem;
  }
}

@media (max-width: 768px) {
  /* Force table to be responsive on mobile */
  .payments-table {
    width: 100% !important;
    max-width: 100% !important;
    font-size: 0.7rem !important;
  }
  
  .table-responsive {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  .material-table {
    font-size: 0.875rem;
  }
  
  .material-table th,
  .material-table td {
    padding: 10px 12px;
  }
  
  /* Responsive table - stacked cards */
  .material-table.mobile-responsive {
    min-width: unset !important;
    width: 100%;
  }
  
  .material-table.mobile-responsive thead {
    display: none;
  }
  
  .material-table.mobile-responsive tbody {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
  }
  
  .material-table.mobile-responsive tbody tr {
    display: block;
    margin-bottom: 12px;
    border: 1px solid var(--md-border);
    border-radius: 8px;
    padding: 12px;
    background: var(--md-surface);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 500px;
  }
  
  /* ⭐ TYLKO dla NON-payment material tables (EXCLUDE .material-table-container) */
  .material-table.mobile-responsive td {
    display: block;
    padding: 8px 0;
    border: none;
    border-bottom: 1px solid #f0f0f0;
  }
  
  /* ⭐ EXCLUDE payment tables from block display - WYŻSZA SPECYFICZNOŚĆ */
  body .material-table-container .material-table.mobile-responsive td,
  body .table-responsive .payments-table.mobile-responsive td {
    display: table-cell; /* Przywróć table-cell - later rules will override to inline-block for amount columns */
    padding: unset;
    border: unset;
    border-bottom: unset;
  }
  
  .material-table.mobile-responsive td:last-child {
    border-bottom: none;
  }
  
  .material-table.mobile-responsive td:before:not(.payments-table td:before) {
    content: attr(data-label) ": ";
    font-weight: 600;
    color: var(--md-text-secondary);
    display: inline-block;
    min-width: 80px;
  }
  
  .material-table.mobile-responsive td[data-label="Akcje"] {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 2px solid #f0f0f0;
  }
  
  .material-table.mobile-responsive td[data-label="Akcje"]:before {
    display: none;
  }
  
  /* Payments table specific mobile fixes */
  .payments-table.mobile-responsive td[data-label="Pozycja"],
  .payments-table td[data-label="Pozycja"],
  .payments-table.mobile-responsive td[data-label="Nazwa"],
  .payments-table td[data-label="Nazwa"] {
    font-weight: 500;
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
    max-width: 200px; /* Ograniczenie szerokoĹ›ci kolumny na desktop */
  }
  
  /* History Extended - mobile responsive (card layout) */
  .history-extended {
    overflow-x: visible !important;
    max-height: none;
  }
  
  .history-header {
    display: none !important;
  }
  
  .history-row-extended {
    display: block !important;
    background: var(--md-surface);
    border: 1px solid var(--md-border);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 12px;
  }
  
  .history-row-extended > div {
    display: grid;
    grid-template-columns: 100px 1fr;
    padding: 6px 0;
    border-bottom: 1px solid var(--md-border-light);
    align-items: center;
  }
  
  .history-row-extended > div:last-child {
    border-bottom: none;
  }
  
  /* Etykiety dla mobilnych i style wierszy - Ujednolicone (AI Fix) */
  .history-row-extended > div {
    color: var(--md-text-primary);
  }

  /* Bazowy styl dla wszystkich etykiet */
  .history-row-extended > div::before {
    font-weight: 700 !important;
    color: var(--md-text-primary) !important;
    font-size: 0.85rem !important;
    text-transform: uppercase;
    display: inline-block;
    min-width: 80px;
  }

  /* Konkretne treści */
  .history-month:before { content: "Miesiąc:"; }
  .history-photo:before { content: "Zdjęcie:"; }
  .history-reading:before { content: "Odczyt:"; }
  .history-ocr-status::before { content: "Status OCR:"; }
  .history-prev:before { content: "Poprzedni:"; }
  .history-usage:before { content: "Zużycie:"; }
  .history-price:before { content: "Cena/m³:"; }
  .history-cost:before { content: "Koszt:"; }
  .history-correction:before { content: "Korekta:"; }
  .history-correction-desc:before { content: "Opis kor.:"; }
  
  /* Wyjątki (Saldo przen. i Do zapłaty) - zachowują odrębny styl */
  .history-carry:before { 
    content: "Saldo przen.:"; 
    color: var(--md-text-secondary) !important; 
    font-weight: 600 !important; 
    text-transform: none;
  }
  .history-due:before { 
    content: "Do zapłaty:"; 
    color: #f44336 !important; 
    font-weight: 700 !important; 
    text-transform: none;
  }
  .history-paid:before { 
    content: "Zapłacono:"; 
    color: var(--md-text-secondary) !important; 
    font-weight: 600 !important; 
    text-transform: none;
  }
  .history-balance:before { 
    content: "Saldo:"; 
    color: var(--md-text-secondary) !important; 
    font-weight: 600 !important; 
    text-transform: none;
  }
  .history-actions:before { 
    content: ""; 
    display: none; 
  }
  
  .history-photo {
    justify-content: flex-start;
  }
  
  .history-actions {
    grid-template-columns: 1fr;
    justify-content: flex-start;
    padding-top: 8px;
    border-top: 2px solid var(--md-border) !important;
  }
  
  /* Lightbox mobile improvements */
  .lightbox-backdrop {
    padding: 0;
    background: rgba(0,0,0,0.85);
  }
  
  .lightbox-content {
    max-width: 100vw;
    max-height: 100vh;
    padding: 1.5vh 0.5%; /* 1.5vh pionowo */
    border-radius: 0; /* Bez zaokraglenia na bardzo malych ekranach */
  }
  
  .lightbox-backdrop img {
    max-width: 97vw;
    max-height: 95vh; /* Maksymalne wykorzystanie wysokości */
  }
  
  .lightbox-backdrop iframe {
    width: 95vw;
    height: 85vh;
    border-radius: 0;
    overflow-y: scroll; /* Wymusz scrollbar */
  }
  
  .lightbox-close {
    top: 4px;
    right: 4px;
    font-size: 1.6rem;
    width: 36px;
    height: 36px;
  }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.u-text-center { text-align: center; }
.u-text-right { text-align: right; }
.u-text-muted { color: var(--md-text-secondary); }
.u-text-primary { color: var(--md-primary); }
.u-text-success { color: var(--md-success) !important; }
.u-text-danger { color: var(--md-danger) !important; }
.u-text-warning { color: var(--md-warning); }

/* Ensure h2 respects color classes */
h2.u-text-success { color: var(--md-success) !important; }
h2.u-text-danger { color: var(--md-danger) !important; }

.u-mt-0 { margin-top: 0 !important; }
.u-mt-8 { margin-top: 8px; }
.u-mt-16 { margin-top: 16px; }
.u-mt-24 { margin-top: 24px; }
.u-mt-32 { margin-top: 32px; }

.u-mb-0 { margin-bottom: 0 !important; }
.u-mb-8 { margin-bottom: 8px; }
.u-mb-16 { margin-bottom: 16px; }
.u-mb-24 { margin-bottom: 24px; }

.u-m-0 { margin: 0 !important; }

.u-p-0 { padding: 0 !important; }
.u-p-8 { padding: 8px; }
.u-p-16 { padding: 16px; }
.u-p-24 { padding: 24px; }

.u-pl-20 { padding-left: 20px; }

.u-gap-8 { gap: 8px; }
.u-gap-16 { gap: 16px; }
.u-gap-24 { gap: 24px; }

.u-flex { display: flex; }
.u-flex-column { flex-direction: column; }
.u-flex-wrap { flex-wrap: wrap; }
.u-items-center { align-items: center; }
.u-justify-between { justify-content: space-between; }
.u-justify-center { justify-content: center; }

.u-hidden { display: none !important; }
.u-overflow-auto { overflow: auto; }
.u-w-full { width: 100%; }

/* ============================================
   SELECT ARROW STYLING
   ============================================ */

.material-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%231a1a1a' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  appearance: none;
}

/* ============================================
   PRINT STYLES
   ============================================ */

@media print {
  .material-sidebar,
  .material-topbar,
  .material-btn,
  .hamburger-btn,
  .drawer,
  .no-print {
    display: none !important;
  }
  
  .material-main {
    margin-left: 0;
  }
  
  .material-card {
    box-shadow: none;
    border: 1px solid var(--md-border);
    page-break-inside: avoid;
  }
}

.modal-backdrop.open {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

.modal-backdrop:not(.u-hidden).open {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
}

/* Na koĹ„cu pliku - najwyĹĽsza specyficznoĹ›Ä‡ */
.modal-backdrop.open {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 99999 !important;
}

/* Jeszcze silniej */
div.modal-backdrop.open {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

/* Najbardziej brutalnie */
#editModal.modal-backdrop.open {
    display: flex !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    background: rgba(0, 0, 0, 0.5) !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 99999 !important;
}

/* ============================================
   PRIVACY POLICY STYLES
   ============================================ */

.privacy-content {
    line-height: 1.8;
    max-width: none;
    width: 100%;
    padding: 0;
    position: relative;
    z-index: 1;
}

.privacy-content section {
    margin-bottom: 48px;
}

.privacy-content h2 {
    color: var(--md-primary);
    margin-bottom: 24px;
    font-size: 1.5rem;
    font-weight: 600;
}

.privacy-content h3 {
    color: var(--md-text-primary);
    margin-bottom: 16px;
    font-size: 1.25rem;
    font-weight: 500;
}

.privacy-content h4 {
    color: var(--md-text-primary);
    margin-bottom: 12px;
    font-size: 1.1rem;
    font-weight: 500;
}

.admin-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
    margin-bottom: 24px;
}

.admin-info-card {
    background: var(--md-surface);
    border: 1px solid var(--md-border);
    border-radius: var(--md-radius);
    padding: 20px;
    box-shadow: var(--md-shadow-sm);
}

.admin-info-card h4 {
    margin-bottom: 16px;
    color: var(--md-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.info-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--md-border);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-weight: 500;
    color: var(--md-text-secondary);
    flex: 1;
}

.info-value {
    font-weight: 600;
    color: var(--md-text-primary);
    text-align: right;
    flex: 1;
}

.privacy-highlight {
    background: rgba(25, 118, 210, 0.08);
    border-left: 4px solid var(--md-primary);
    padding: 16px;
    border-radius: var(--md-radius);
    margin: 16px 0;
}

.privacy-highlight strong {
    color: var(--md-primary);
}

.privacy-list {
    list-style: none;
    padding: 0;
}

.privacy-list li {
    padding: 8px 0;
    border-bottom: 1px solid var(--md-border);
    position: relative;
    padding-left: 24px;
}

.privacy-list li:before {
    content: "â€˘";
    color: var(--md-primary);
    font-weight: bold;
    position: absolute;
    left: 0;
}

.privacy-list li:last-child {
    border-bottom: none;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */

.u-hidden {
    display: none !important;
}

/* ============================================  
   MATERIAL STATS GRID
   ============================================ */

.material-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)) !important;
    gap: 16px;
    margin-bottom: 24px;
}

.material-stat-card {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-left: 4px solid #4caf50;
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.material-stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    transform: translateY(-2px);
}

.material-stat-card.primary {
    background: linear-gradient(135deg, #e3f2fd 0%, #f0f7fc 100%);
    border-left-color: #2196f3;
}

.material-stat-card.stat-card-warning {
    background: linear-gradient(135deg, #fff3e0 0%, #fffaf5 100%);
    border-left-color: #ff9800;
}

.material-stat-card.stat-card-success {
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8f4 100%);
    border-left-color: #4caf50;
}

/* Elementy wewnątrz material-stat-card - kolejność 2/1/3 (label/value/pill) */
.material-stat-card .material-stat-label {
    order: 1;
    color: #666;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0;
}

.material-stat-card .material-stat-value {
    order: 2;
    color: #1a1a1a;
    font-size: 1.8rem;
    font-weight: 700;
    margin: 4px 0;
}

.material-stat-card small {
    order: 3;
    color: #888;
    font-size: 0.75rem;
    margin-top: 4px;
}

.material-stat-card .material-pill {
    order: 4;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-top: 8px;
    align-self: flex-start;
}

.material-stat-card .material-pill.info {
    background: rgba(33, 150, 243, 0.15);
    color: #1976d2;
}

.material-stat-card .material-pill.warning {
    background: rgba(255, 152, 0, 0.15);
    color: #f57c00;
}

.material-stat-card .material-pill.success {
    background: rgba(76, 175, 80, 0.15);
    color: #388e3c;
}

/* Dark mode dla material-stat-card */
[data-theme="dark"] .material-stat-card {
    background: linear-gradient(135deg, #1e3a2e 0%, #243329 100%);
    border-left-color: #66bb6a;
}

[data-theme="dark"] .material-stat-card.primary {
    background: linear-gradient(135deg, #1a2f3d 0%, #1e3847 100%);
    border-left-color: #64b5f6;
}

[data-theme="dark"] .material-stat-card.stat-card-warning {
    background: linear-gradient(135deg, #3d2f1a 0%, #47361e 100%);
    border-left-color: #ffb74d;
}

[data-theme="dark"] .material-stat-card.stat-card-success {
    background: linear-gradient(135deg, #1e3a2e 0%, #243329 100%);
    border-left-color: #66bb6a;
}

[data-theme="dark"] .material-stat-card .material-stat-label {
    color: #aaa;
}

[data-theme="dark"] .material-stat-card .material-stat-value {
    color: #e0e0e0;
}

[data-theme="dark"] .material-stat-card small {
    color: #888;
}

[data-theme="dark"] .material-stat-card .material-pill.info {
    background: rgba(100, 181, 246, 0.2);
    color: #90caf9;
}

[data-theme="dark"] .material-stat-card .material-pill.warning {
    background: rgba(255, 183, 77, 0.2);
    color: #ffb74d;
}

[data-theme="dark"] .material-stat-card .material-pill.success {
    background: rgba(102, 187, 106, 0.2);
    color: #81c784;
}

.material-stat-card h4 {
    color: var(--primary-blue);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--accent-blue);
}

.material-stat-card .balance {
    font-size: 1.8rem;
    font-weight: 700;
    margin: 12px 0;
}

.material-stat-card .balance.positive {
    color: var(--success-green);
}

.material-stat-card .balance.negative {
    color: var(--danger-red);
}

.material-stat-card .balance.zero {
    color: var(--text-secondary);
}

.material-stat-card .account-info {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 8px 0;
}

.material-stat-card .account-actions {
    margin-top: 16px;
    display: flex;
    gap: 8px;
}

.material-stat-card .btn-edit {
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.material-stat-card .btn-edit:hover {
    background: var(--primary-blue);
}

/* Bank info styles */
.bank-info-item {
    margin: 12px 0;
    padding: 8px 0;
    border-bottom: 1px solid var(--md-border);
}

.bank-info-item:last-child {
    border-bottom: none;
}

.bank-info-label {
    font-weight: 600;
    color: var(--md-text-secondary);
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.bank-info-value {
    color: var(--md-text-primary);
    font-size: 1rem;
}

.account-number {
    font-family: 'Courier New', monospace;
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary-blue);
    background: var(--md-surface-variant);
    padding: 8px 12px;
    border-radius: var(--md-radius);
    display: inline-block;
}

@media (max-width: 768px) {
    .material-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .material-stat-card {
        padding: 16px;
    }
    
    .material-stat-card .balance {
        font-size: 1.5rem;
    }
    
    .material-stat-card .material-stat-value {
        font-size: 1.5rem;
    }
    
    .material-stat-card .material-stat-label {
        font-size: 0.8rem;
    }
}

.u-text-center {
    text-align: center !important;
}

.u-text-muted {
    color: var(--md-text-secondary) !important;
}

.u-text-success {
    color: var(--md-success) !important;
}

.u-text-danger {
    color: var(--md-danger) !important;
}

/* Dark mode - jawne kolory dla tekstĂłw success/danger */
html[data-theme="dark"] body .u-text-success {
    color: var(--md-success) !important;
}

html[data-theme="dark"] body .u-text-danger {
    color: var(--md-danger) !important;
}

/* ZwiÄ™kszona specyficznoĹ›Ä‡ dla stat values w dark mode */
html[data-theme="dark"] body .material-stat-value.u-text-success,
html[data-theme="dark"] body .material-stat-card .u-text-success {
    color: var(--md-success) !important;
}

html[data-theme="dark"] body .material-stat-value.u-text-danger,
html[data-theme="dark"] body .material-stat-card .u-text-danger {
    color: var(--md-danger) !important;
}

/* Kolory w tabelach dla dark mode */
html[data-theme="dark"] body td.u-text-success,
html[data-theme="dark"] body strong.u-text-success {
    color: var(--md-success) !important;
}

html[data-theme="dark"] body td.u-text-danger,
html[data-theme="dark"] body strong.u-text-danger {
    color: var(--md-danger) !important;
}

/* Kolory dla duĹĽych wartoĹ›ci (div z inline style) */
html[data-theme="dark"] body div.u-text-success {
    color: var(--md-success) !important;
}

html[data-theme="dark"] body div.u-text-danger {
    color: var(--md-danger) !important;
}

/* ============================================
   MATERIAL MODALS
   ============================================ */

.material-modal {
    display: none; /* Ukryty domyślnie - NIE flex! */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.material-modal.open {
    display: flex !important; /* Pokaż jako flex */
    opacity: 1 !important;
    visibility: visible !important;
    animation: modalFadeIn 0.3s ease;
}

/* Specific override for balance modal */
#balanceModal.material-modal.open {
    opacity: 1 !important;
    visibility: visible !important;
    display: flex !important;
}

.material-modal-content {
    background: var(--md-surface) !important;
    border-radius: var(--md-radius-lg);
    box-shadow: var(--md-shadow-lg) !important;
    max-width: 500px;
    max-height: 90vh;
    width: 90%;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s ease;
    position: relative;
    margin: auto;
}

.material-modal.open .material-modal-content {
    transform: scale(1);
}

.material-modal-header {
    padding: 24px 24px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--md-border);
    margin-bottom: 24px;
    padding-bottom: 16px;
}

.material-modal-header h3 {
    margin: 0;
    color: var(--md-text-primary);
    font-size: 1.25rem;
    font-weight: 500;
}

.material-modal-body {
    padding: 0 24px;
}

.material-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 20px;
    padding-bottom: 24px;
    border-top: 1px solid var(--md-border-light, #f0f0f0);
}

.material-modal-footer {
    padding: 24px;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    border-top: 1px solid var(--md-border);
    margin-top: 24px;
}

/* Confirm modal - kompaktowy styl */
#confirmModal .material-modal-content {
    max-width: 420px;
    width: 90%;
}

#confirmModal .material-modal-header {
    padding: 16px 20px 12px;
    margin-bottom: 0;
}

#confirmModal .material-modal-header h4 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--md-text-primary);
}

#confirmModal .material-modal-body {
    padding: 16px 20px;
}

#confirmModal .material-modal-body p {
    margin: 0;
    line-height: 1.5;
    font-size: 0.95rem;
    color: var(--md-text-primary);
}

#confirmModal .material-modal-footer {
    padding: 12px 16px;
    margin-top: 0;
}

/* Existing Attachments List in Edit Modal */
.existing-attachments-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.existing-attachment-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: var(--md-grey-50, #fafafa);
    border: 1px solid var(--md-border-light, #e0e0e0);
    border-radius: 8px;
    font-size: 0.9em;
    transition: background-color 0.2s ease;
}

.existing-attachment-item:hover {
    background-color: var(--md-grey-100, #f5f5f5);
}

.existing-attachment-item .attachment-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 12px;
}

.existing-attachment-item button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2em;
    padding: 4px 8px;
    transition: transform 0.2s ease;
}

.existing-attachment-item button:hover {
    transform: scale(1.2);
}

/* Modal Overlay Animation */
@keyframes modalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px) scale(0.9);
    }
    to {
        transform: translateY(0) scale(1);
    }
}

.material-modal.open .material-modal-content {
    animation: modalSlideIn 0.3s ease;
}

/* ============================================
   CONSENT BANNER OVERRIDES
   ============================================ */

#consent-banner {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 1400 !important;
    background: var(--md-surface) !important;
    border-top: 2px solid var(--md-primary) !important;
    box-shadow: var(--md-shadow-lg) !important;
    transition: transform 0.3s ease !important;
    padding: 16px;
    display: block;
}

#consent-banner[hidden] {
    display: none !important;
}

/* Show consent banner by default unless hidden */
#consent-banner:not([hidden]) {
    display: block !important;
}

/* Debug: Force all consent buttons to be visible */
#consent-banner .cbtn {
    display: inline-flex !important;
    opacity: 1 !important;
    visibility: visible !important;
}

#consent-banner .consent-actions {
    display: flex !important;
    gap: 8px !important;
}

/* Ensure consent actions are always visible */
.consent-actions .cbtn {
    flex-shrink: 0 !important;
}

/* Desktop - przesunięcie o szerokość sidebara */
@media (min-width: 1025px) {
    #consent-banner {
        left: var(--sidebar-width) !important;
    }
}

/* Consent banner components */
.consent-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: stretch;
}

.consent-text {
    color: var(--md-text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.consent-text h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: var(--md-text-primary);
    font-weight: 500;
}

.consent-text p {
    margin: 0;
    color: var(--md-text-secondary);
}

.consent-text a {
    color: var(--md-primary);
    text-decoration: none;
}

.consent-text a:hover {
    text-decoration: underline;
}

/* Tablet i mobile - responsywny layout dla consent banner */
@media (max-width: 768px) {
    .consent-inner {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    .consent-text {
        width: 100% !important;
        margin-bottom: 8px !important;
    }
    
    .consent-actions {
        width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        gap: 8px !important;
    }
    
    .consent-actions .cbtn {
        width: 100% !important;
        padding: 12px !important;
        text-align: center !important;
    }
}

/* =====================================================
   PAYMENTS TABLE RESPONSIVE STYLES
   ===================================================== */

/* Alias: material-table = payments-table (dla kompatybilności) */
.material-table {
    font-size: 0.9rem;
}

/* Alias: material-table-container = table-responsive (dla kompatybilności) */
.material-table-container {
    overflow-x: auto;
}

/* Responsive table styling for payments */
.payments-table {
    font-size: 0.9rem;
}

/* Only set min-width on desktop */
@media (min-width: 769px) {
    .payments-table,
    .material-table {
        min-width: 600px;
    }
}

/* KOMPAKTOWY MOBILE LAYOUT dla dashboard "Moje płatności" - MAX PRIORYTET */
@media (max-width: 768px) {
    /* Wyłącz stary tablet layout dla payments-table w dashboard */
    .table-responsive .payments-table.mobile-responsive,
    .material-table-container .material-table.mobile-responsive {
        font-size: 0.85rem !important;
    }
    
    .table-responsive .payments-table.mobile-responsive thead,
    .material-table-container .material-table.mobile-responsive thead {
        display: none !important;
    }
    
    .table-responsive .payments-table.mobile-responsive tbody tr,
    .material-table-container .material-table.mobile-responsive tbody tr {
        display: flex !important; /* ⭐ FLEX zamiast block - pozwala 3 kolumny obok siebie */
        flex-wrap: wrap !important;
        margin-bottom: 12px !important;
        border: 1px solid var(--md-border) !important;
        border-radius: 8px !important;
        padding: 0 !important;
        background: var(--md-surface) !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.08) !important;
        overflow: visible !important;
        position: relative !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    /* Wszystkie TD - reset (ale NIE dla kwot w gridzie!) */
    .table-responsive .payments-table.mobile-responsive tbody td,
    .material-table-container .material-table.mobile-responsive tbody td {
        border: none !important;
    }
    
    /* DOM - wyświetl na początku karty z etykietą */
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Dom"],
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Dom"] {
        flex: 0 0 100% !important; /* Full width w flex container */
        padding: 8px 12px 4px 12px !important;
        background: rgba(0,0,0,0.02) !important;
        font-weight: 600 !important;
        font-size: 0.85rem !important;
        color: var(--md-primary) !important;
        box-sizing: border-box !important;
        border-bottom: none !important;
    }
    
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Dom"]:before,
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Dom"]:before {
        content: "Dom: " !important;
        display: inline !important;
        font-weight: 500 !important;
        font-size: 0.7rem !important;
        color: var(--md-text-secondary) !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        margin-right: 6px !important;
    }
    
    /* HEADER ROW: Pozycja (nazwa) + Status inline badge */
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Pozycja"],
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Pozycja"] {
        flex: 0 0 100% !important; /* Full width w flex container */
        padding: 8px 12px 12px 12px !important;
        background: rgba(0,0,0,0.02) !important;
        font-weight: 600 !important;
        font-size: 0.9rem !important;
        box-sizing: border-box !important;
        word-wrap: break-word !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        border-bottom: 1px solid var(--md-border) !important;
        max-width: 100% !important;
        width: auto !important;
    }
    
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Pozycja"]:before,
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Pozycja"]:before {
        display: none !important;
    }
    
    /* Status kolumna - UKRYTA na mobile (status pokazany jako inline badge w Pozycji) */
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Status"],
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Status"] {
        display: none !important;
    }
    
    /* Status badge w TD Pozycja - pokazany jako inline na mobile */
    .table-responsive .payments-table.mobile-responsive tbody .status-mobile-inline,
    .material-table-container .material-table.mobile-responsive tbody .status-mobile-inline {
        display: inline-block !important;
        margin-left: 6px !important;
    }
    
    /* GRID ROW: Do zapłaty | Zapłacono | Saldo - 3 kolumny obok siebie */
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Do zapłaty"],
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Zapłacono"],
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Saldo"],
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Do zapłaty"],
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Zapłacono"],
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Saldo"] {
        flex: 1 1 33.333% !important; /* Flex zamiast inline-block */
        max-width: 33.333% !important;
        padding: 12px 4px !important;
        text-align: center !important;
        vertical-align: top !important;
        box-sizing: border-box !important;
        font-weight: 700 !important;
        color: var(--md-text-primary) !important;
        margin: 0 !important;
        border-bottom: none !important;
    }
    
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Do zapłaty"],
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Zapłacono"],
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Do zapłaty"],
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Zapłacono"] {
        border-right: 1px solid var(--md-border) !important;
    }
    
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Saldo"],
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Saldo"] {
        border-right: none !important;
    }
    
    /* Labele nad wartościami kwot */
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Do zapłaty"]:before,
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Zapłacono"]:before,
    .table-responsive .payments-table.mobile-responsive tbody td[data-label="Saldo"]:before,
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Do zapłaty"]:before,
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Zapłacono"]:before,
    .material-table-container .material-table.mobile-responsive tbody td[data-label="Saldo"]:before {
        content: attr(data-label) !important;
        display: block !important;
        font-weight: 600 !important;
        font-size: 0.65rem !important;
        color: var(--md-text-secondary) !important;
        margin-bottom: 4px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
    }
    
    /* Status badge - MOBILE: inline obok nazwy pozycji, DESKTOP: w osobnej kolumnie */
    .table-responsive .payments-table.mobile-responsive tbody .status-mobile-inline,
    .material-table-container .material-table.mobile-responsive tbody .status-mobile-inline {
        display: inline-block !important;
        margin-left: 6px !important;
    }
    
    .table-responsive .payments-table.mobile-responsive tbody .status-desktop-column,
    .material-table-container .material-table.mobile-responsive tbody .status-desktop-column {
        display: none !important;
    }
}

/* Desktop - pokaż kolumnę Status, ukryj inline badge */
@media (min-width: 769px) {
    .payments-table .status-mobile-inline,
    .material-table .status-mobile-inline {
        display: none !important;
    }
    
    .payments-table .status-desktop-column,
    .material-table .status-desktop-column {
        display: table-cell !important;
    }
}

/* STARE STYLE - WYŁĄCZONE dla payments-table.mobile-responsive */
@media (max-width: 768px) {
    /* Tablet - compress dla INNYCH tabel (nie dashboard) */
    .payments-table:not(.mobile-responsive),
    .material-table:not(.mobile-responsive) {
        font-size: 0.75rem !important;
    }
    
    .payments-table:not(.mobile-responsive) th,
    .payments-table:not(.mobile-responsive) td,
    .material-table:not(.mobile-responsive) th,
    .material-table:not(.mobile-responsive) td {
        padding: 4px 2px !important;
        font-size: 0.65rem !important;
    }
}

@media (max-width: 480px) {
    /* Ultra mobile - WYŁĄCZONE dla dashboard payments-table.mobile-responsive */
    .payments-table:not(.mobile-responsive),
    .payments-table:not(.mobile-responsive).mobile-responsive,
    .material-table:not(.mobile-responsive),
    .material-table:not(.mobile-responsive).mobile-responsive {
        min-width: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        table-layout: auto !important;
    }
    
    .payments-table:not(.mobile-responsive).mobile-responsive thead,
    .material-table:not(.mobile-responsive).mobile-responsive thead {
        display: none !important;
    }
    
    .payments-table:not(.mobile-responsive).mobile-responsive tbody tr {
        display: block;
        margin-bottom: 8px;
        border: 1px solid var(--md-border);
        border-radius: 6px;
        padding: 8px;
        background: var(--md-surface);
        box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        width: calc(100% - 2px);
        max-width: calc(100% - 2px);
        box-sizing: border-box;
        overflow: hidden;
        margin-left: 0;
        margin-right: 0;
    }
    
    .payments-table:not(.mobile-responsive).mobile-responsive td {
        display: flex;
        justify-content: flex-start;
        align-items: center;
        padding: 6px 0;
        border: none;
        border-bottom: 1px solid #f0f0f0;
        font-size: 0.85rem;
        line-height: 1.3;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        gap: 6px;
        overflow: hidden;
    }
    
    .payments-table:not(.mobile-responsive).mobile-responsive td:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .payments-table:not(.mobile-responsive).mobile-responsive td:before {
        content: attr(data-label) ": ";
        font-weight: 600;
        color: var(--md-text-secondary);
        min-width: 85px;
        max-width: 85px;
        font-size: 0.85rem;
        flex-shrink: 0;
    }
    
    .payments-table:not(.mobile-responsive).mobile-responsive td[data-label="Pozycja"] {
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    /* WYŁĄCZONE dla dashboard - duplikuje nazwę pozycji
    .payments-table.mobile-responsive td[data-label="Pozycja"]:before {
        content: "Pozycja: " !important;
        font-weight: 600 !important;
        color: var(--md-text-secondary) !important;
        font-size: 0.85rem !important;
        display: inline !important;
        min-width: auto !important;
        max-width: none !important;
        margin-right: 4px !important;
    }
    
    .payments-table.mobile-responsive td[data-label="Pozycja"]:after {
        content: attr(data-full-title);
        font-size: 0.85rem !important;
        line-height: 1.4;
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
        color: var(--md-text-primary);
        font-weight: 500;
        display: inline !important;
    }
    */
    
    .payments-table:not(.mobile-responsive) td[data-label="Status"] {
        justify-content: flex-start;
        align-items: center;
    }
    
    .payments-table.mobile-responsive td[data-label="Status"]:before {
        margin-right: 6px;
        font-size: 0.85rem !important;
    }
    
    .payments-table.mobile-responsive td[data-label="Status"] .material-badge {
        font-size: 0.85rem;
        padding: 3px 8px;
    }
    
    /* Money columns styling - uniform font size */
    .payments-table.mobile-responsive td[data-label="Do zapĹ‚aty"],
    .payments-table.mobile-responsive td[data-label="ZapĹ‚acono"],
    .payments-table.mobile-responsive td[data-label="Saldo"] {
        font-weight: 500;
        color: var(--md-text-primary);
        font-size: 0.85rem !important;
    }
    
    .payments-table.mobile-responsive td[data-label="Saldo"] {
        color: var(--md-text-primary);
        font-weight: 600;
    }
    
    /* WYŁĄCZONE - ukrywa oryginalną nazwę pozycji w dashboard
    .payments-table.mobile-responsive td[data-label="Pozycja"] {
        font-size: 0 !important;
    }
    */
    
    /* Ensure card container fits screen */
    .material-card {
        margin-left: 0;
        margin-right: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        padding: 8px !important;
    }
    
    .table-responsive {
        width: 100%;
        max-width: 100%;
        overflow-x: visible;
        padding: 0;
        margin: 0;
    }
    
    /* Specific fix for payments table container */
    .payments-table.mobile-responsive {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
    }
    
    /* Ensure values don't extend beyond container */
    .payments-table.mobile-responsive td:not([data-label="Pozycja"]):not([data-label="Status"]) {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex: 1;
        min-width: 0;
    }
    
    /* Add proper spacing after label */
    .payments-table.mobile-responsive td:not([data-label="Pozycja"]):not([data-label="Status"]):after {
        content: "";
        flex: 1;
    }
}

/* Extra small screens - even tighter spacing */
@media (max-width: 360px) {
    .material-content {
        padding: 6px !important;
    }
    
    .material-card {
        padding: 6px !important;
        margin-bottom: 8px !important;
    }
    
    .payments-table.mobile-responsive tbody tr {
        padding: 6px !important;
        margin-bottom: 6px !important;
        width: calc(100% - 1px) !important;
    }
    
    .payments-table.mobile-responsive td:before {
        min-width: 70px !important;
        max-width: 70px !important;
        font-size: 0.7rem !important;
    }
}

/* =====================================================
   EMERGENCY NAVIGATION FALLBACKS
   ===================================================== */

/* EMERGENCY: Only if BOTH hamburger AND sidebar are completely missing */
@media (max-width: 1024px) {
    /* DISABLE auto-opening drawer - only show hamburger button */
    .hamburger-btn {
        display: flex !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
    
    /* Ensure drawer stays CLOSED by default */
    #drawer-nav:not(.open) {
        transform: translateX(-100%) !important;
        display: block !important;
    }
    
    /* Only auto-open drawer in absolute emergency when NO hamburger exists */
    body.no-hamburger-emergency #drawer-nav {
        display: block !important;
        transform: translateX(0) !important;
        position: fixed !important;
        left: 0 !important;
        top: 60px !important;
        z-index: 9999 !important;
        width: 280px !important;
        background: white !important;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1) !important;
    }
}

/* Desktop fallback - force sidebar */
@media (min-width: 1025px) {
    .material-sidebar {
        display: block !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: translateX(0) !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        z-index: 998 !important;
    }
    
    /* Hide hamburger on desktop */
    .hamburger-btn {
        display: none !important;
    }
    
    #drawer-nav {
        display: none !important;
    }
    
    /* Ensure main content has proper margin */
    .material-main {
        margin-left: var(--sidebar-width) !important;
    }
}

/* =====================================================
   CONSENT BANNER RESPONSIVE STYLES
   ===================================================== */

#consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 9999;
    background: var(--md-surface);
    border-top: 1px solid var(--md-border);
    box-shadow: 0 -4px 12px rgba(0,0,0,0.15);
    padding: 16px;
    max-width: 100vw;
    box-sizing: border-box;
}

.consent-inner {
    display: flex;
    flex-direction: column;
    gap: 16px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: stretch;
}

.consent-text h4 {
    margin: 0 0 8px 0;
    font-size: 1rem;
    color: var(--md-text-primary);
}

.consent-text p {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
    color: var(--md-text-secondary);
}

.consent-text a {
    color: var(--md-primary);
    text-decoration: none;
}

.consent-text a:hover {
    text-decoration: underline;
}

.consent-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
}

/* Consent Modal */
#consent-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1401;
    display: none;
    backdrop-filter: blur(4px);
}

#consent-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--md-surface);
    border-radius: var(--md-radius-lg);
    box-shadow: var(--md-shadow-lg);
    max-width: 520px;
    width: 90%;
    z-index: 1402;
    display: none;
    overflow: hidden;
}

#consent-modal header {
    padding: 24px 24px 16px;
    background: var(--md-surface);
    font-weight: 500;
    font-size: 1.25rem;
    color: var(--md-text-primary);
    border-bottom: 1px solid var(--md-border);
}

#consent-modal .body { 
    padding: 0 24px 16px; 
    max-height: 60vh; 
    overflow-y: auto; 
}

#consent-modal .row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 16px 0;
    border-bottom: 1px solid var(--md-border);
    gap: 16px;
}

#consent-modal .row:last-child { 
    border-bottom: none; 
    padding-bottom: 0;
}

#consent-modal .lbl { 
    font-weight: 500; 
    margin-bottom: 4px; 
    color: var(--md-text-primary);
    font-size: 1rem;
}

#consent-modal .desc { 
    font-size: 0.875rem; 
    color: var(--md-text-secondary); 
    line-height: 1.4;
    margin: 0;
}

#consent-modal footer {
    padding: 16px 24px 24px;
    background: var(--md-surface);
    border-top: 1px solid var(--md-border);
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* Consent buttons */
.cbtn {
    padding: 10px 24px !important;
    border-radius: var(--md-radius) !important;
    font-weight: 500 !important;
    font-size: 0.875rem !important;
    cursor: pointer !important;
    border: none !important;
    transition: all 0.2s ease !important;
    min-height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-decoration: none !important;
    outline: none !important;
    position: relative !important;
    overflow: hidden !important;
    opacity: 1 !important;
    visibility: visible !important;
}

.cbtn:hover { 
    transform: translateY(-1px); 
    box-shadow: var(--md-shadow-md); 
}

.cbtn:active {
    transform: translateY(0);
}

.cbtn.primary { 
    background: var(--md-primary); 
    color: white; 
}

/* Duplicate styles removed - consolidated version below */

/* Switch/Toggle styles for consent modal */
.switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--md-border);
    transition: 0.2s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    transition: 0.2s;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

input:checked + .slider {
    background: var(--md-primary);
}

input:focus + .slider {
    box-shadow: 0 0 0 2px var(--md-primary-lighter);
}

input:checked + .slider:before {
    transform: translateX(20px);
}

input:disabled + .slider {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Utility classes */
.u-hidden {
    display: none !important;
}

/* ============================================
   SHARED ATTACHMENTS STYLES (polls + announcements)
   ============================================ */

.attachments-grid {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 12px 0;
    width: 100%;
    box-sizing: border-box;
}

.attachment-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 8px 12px;
    background: var(--md-surface-container, #f5f5f5);
    border-radius: 8px;
    text-decoration: none;
    color: var(--md-text-primary, #333);
    transition: background 0.2s;
    border: 1px solid var(--md-border, #e0e0e0);
    max-width: 100%;
    box-sizing: border-box;
    min-width: 0;
}

.attachment-item:hover {
    background: var(--md-surface-container-high, #e0e0e0);
}

.attachment-item > span {
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0;
    flex: 1;
    font-size: 0.9em;
    line-height: 1.4;
}

.attachment-thumbnail {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: transform 0.2s ease;
    flex-shrink: 0;
}

.attachment-item:hover .attachment-thumbnail {
    transform: scale(1.05);
}

.attachment-icon {
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
    background: var(--md-surface-variant, #e8eaf6);
    border-radius: 4px;
}

[data-theme="dark"] .attachment-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .attachment-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .attachment-icon {
    background: rgba(255, 255, 255, 0.1);
}

/* Responsive attachments for mobile */
@media (max-width: 768px) {
    .attachments-grid {
        gap: 8px;
        margin: 8px 0;
    }
    
    .attachment-item {
        padding: 6px 10px;
        max-width: 100%;
        width: 100%;
    }
    
    .attachment-thumbnail {
        width: 40px;
        height: 40px;
    }
    
    .attachment-icon {
        width: 40px;
        height: 40px;
        font-size: 20px;
    }
    
    .attachment-item > span {
        font-size: 0.85em;
    }
}

/* Footer styles */
.footer {
    margin-top: 24px;
    padding: 16px 0;
    text-align: center;
    border-top: 1px solid var(--md-border);
    background: var(--md-background);
    color: var(--md-text-secondary);
    font-size: 0.875rem;
}

.footer a {
    color: var(--md-primary);
    text-decoration: none;
}

.footer a:hover {
    text-decoration: underline;
}

/* Duplicate .cbtn definition removed */

.cbtn.ghost {
    background: transparent !important;
    color: var(--md-text-primary) !important;
    border: 1px solid var(--md-border) !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-flex !important;
}

.cbtn.ghost:hover {
    background: var(--md-primary-lighter) !important;
    color: var(--md-primary) !important;
    border-color: var(--md-primary) !important;
}

.cbtn.warn {
    background: var(--md-danger) !important;
    color: white !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-flex !important;
}

.cbtn.warn:hover {
    background: var(--md-danger-dark) !important;
}

.cbtn.primary {
    background: var(--md-primary) !important;
    color: white !important;
    opacity: 1 !important;
    visibility: visible !important;
    display: inline-flex !important;
}

.cbtn.primary:hover {
    background: var(--md-primary-dark) !important;
}

/* Tablet and up - horizontal layout */
@media (min-width: 481px) {
    .consent-inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    .consent-text {
        flex: 1;
        margin-right: 24px;
    }
    
    .consent-actions {
        flex-direction: row;
        width: auto;
        min-width: 280px;
        flex-shrink: 0;
    }
    
    .cbtn {
        width: auto;
        min-width: 80px;
        padding: 10px 16px;
    }
}

/* Desktop - more compact */
@media (min-width: 769px) {
    #consent-banner {
        padding: 20px;
    }
    
    .consent-text h4 {
        font-size: 1.1rem;
    }
    
    .consent-text p {
        font-size: 0.95rem;
    }
    
    .consent-actions {
        min-width: 320px;
        gap: 12px;
    }
    
    .cbtn {
        padding: 12px 20px;
    }
}

/* ============================================
   THEME TOGGLE BUTTON
   ============================================ */

.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--md-surface-elevated);
    border: 1px solid var(--md-border);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 16px;
    user-select: none;
    margin-left: 12px;
}

.theme-toggle:hover {
    background: var(--md-primary);
    color: white;
    transform: scale(1.05);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* Topbar integration */
.topbar-right {
    display: flex;
    align-items: center;
}

/* Dark mode theme toggle */
[data-theme="dark"] .theme-toggle {
    background: var(--md-surface-elevated);
    border-color: var(--md-border);
    color: var(--md-text-secondary);
}

[data-theme="dark"] .theme-toggle:hover {
    background: var(--md-primary);
    color: var(--md-background);
}

/* ============================================
   MOBILE RESPONSIVE TABLE IMPROVEMENTS
   ============================================ */

/* Fix oversized buttons in mobile view */
@media (max-width: 480px) {
    .mobile-responsive.payments-table td .material-btn {
        font-size: 12px !important;
        padding: 4px 8px !important;
        min-width: auto !important;
        height: auto !important;
        line-height: 1.2 !important;
        margin: 2px 0 !important;
        display: inline-block !important;
        white-space: nowrap;
    }
    
    .mobile-responsive.payments-table td .material-btn.small {
        font-size: 11px !important;
        padding: 3px 6px !important;
    }
    
    /* Fix text display issues */
    .mobile-responsive.payments-table td {
        font-size: 14px !important;
        line-height: 1.4 !important;
        word-wrap: break-word;
        overflow-wrap: break-word;
        max-width: 100% !important;
    }
    
    /* Ensure full text display, not ellipsis */
    .mobile-responsive.payments-table td,
    .mobile-responsive.payments-table td * {
        white-space: normal !important;
        text-overflow: clip !important;
        overflow: visible !important;
    }
    
    /* Better spacing in mobile cards */
    .mobile-responsive.payments-table td::before {
        font-size: 12px !important;
        font-weight: 500 !important;
        color: var(--md-text-secondary) !important;
        margin-bottom: 4px !important;
        display: block !important;
    }
}

/* ============================================
   DARK MODE ENHANCEMENTS
   ============================================ */

[data-theme="dark"] {
    color-scheme: dark;
}

[data-theme="dark"] body {
    background: var(--md-background) !important;
}

[data-theme="dark"] .material-main {
    background: var(--md-background) !important;
}

[data-theme="dark"] .material-card {
    background: var(--md-surface);
    border-color: var(--md-border);
}

/* Dark theme - submit window banner */
[data-theme="dark"] .submit-window {
    background: linear-gradient(135deg, #4e2626 0%, #5d3333 100%);
    border: 1px solid #e57373;
    border-left: 4px solid #ef5350;
    color: #ffcdd2;
}

[data-theme="dark"] .submit-window.open {
    background: linear-gradient(135deg, #1b5e20 0%, #2e7d32 100%);
    border: 1px solid #66bb6a;
    border-left: 4px solid #4caf50;
    color: #a5d6a7;
}

[data-theme="dark"] .material-sidebar {
    background: var(--md-surface);
    border-color: var(--md-border);
}

[data-theme="dark"] .sidebar-brand {
    background: #1a1a1a;
    border-bottom: 1px solid var(--md-border);
}

[data-theme="dark"] .material-nav .nav-item {
    color: var(--md-text-secondary);
}

[data-theme="dark"] .material-nav .nav-item:hover,
[data-theme="dark"] .material-nav .nav-item.active {
    background: var(--md-surface-elevated);
    color: var(--md-text-primary);
}

[data-theme="dark"] .material-btn {
    background: var(--md-surface-elevated);
    color: var(--md-text-primary);
    border-color: var(--md-border);
}

@media (hover: hover) {
  [data-theme="dark"] .material-btn:hover {
      background: var(--md-surface-container);
  }
}

[data-theme="dark"] .material-btn.primary {
    background: var(--md-primary);
    color: var(--md-background);
}

[data-theme="dark"] .material-btn-primary {
    background: #42a5f5;
    color: #0d1117;
    border: none;
    font-weight: 600;
}

[data-theme="dark"] .material-btn-primary:hover {
    background: #64b5f6;
}

[data-theme="dark"] .material-btn.danger {
    background: var(--md-danger);
    color: white;
}

[data-theme="dark"] .material-btn-danger {
    background: #ef5350;
    color: white;
    border: none;
    font-weight: 600;
}

[data-theme="dark"] .material-btn-danger:hover {
    background: #e57373;
}

[data-theme="dark"] .material-btn.ghost,
[data-theme="dark"] .material-btn-ghost {
    background: transparent;
    border: 1px solid #64b5f6;
    color: #64b5f6;
}

[data-theme="dark"] .material-btn.ghost:hover,
[data-theme="dark"] .material-btn-ghost:hover {
    background: rgba(100, 181, 246, 0.1);
    border-color: #90caf9;
    color: #90caf9;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    background: var(--md-surface-elevated);
    color: var(--md-text-primary);
    border-color: var(--md-border);
}

[data-theme="dark"] input:focus,
[data-theme="dark"] select:focus,
[data-theme="dark"] textarea:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px rgba(144, 202, 249, 0.2);
}

[data-theme="dark"] table {
    background: var(--md-surface);
}

[data-theme="dark"] th {
    background: var(--md-surface-elevated);
    color: var(--md-text-primary);
    border-color: var(--md-border);
}

[data-theme="dark"] td {
    border-color: var(--md-border);
    color: var(--md-text-primary);
}

[data-theme="dark"] tr:hover {
    background: var(--md-surface-elevated);
}

[data-theme="dark"] .u-text-muted {
    color: var(--md-text-secondary) !important;
}

[data-theme="dark"] .flash-success {
    background: rgba(129, 199, 132, 0.1);
    color: var(--md-success);
    border-color: var(--md-success);
}

[data-theme="dark"] .flash-error {
    background: rgba(229, 115, 115, 0.1);
    color: var(--md-danger);
    border-color: var(--md-danger);
}

[data-theme="dark"] .flash-info {
    background: rgba(100, 181, 246, 0.1);
    color: var(--md-info);
    border-color: var(--md-info);
}

/* Dark mode modal styles */
[data-theme="dark"] .lightbox-modal .lightbox-content {
    background: var(--md-surface);
    border: 1px solid var(--md-border);
}

[data-theme="dark"] .lightbox-modal .lightbox-header {
    border-color: var(--md-border);
}

[data-theme="dark"] .lightbox-modal .lightbox-header h3 {
    color: var(--md-text-primary);
}

[data-theme="dark"] .lightbox-modal .lightbox-close {
    color: var(--md-text-secondary);
}

[data-theme="dark"] .lightbox-modal .lightbox-close:hover {
    background: var(--md-surface-elevated);
    color: var(--md-text-primary);
}

[data-theme="dark"] .lightbox-modal .form-actions {
    border-color: var(--md-border);
}

/* ============================================
   FORM STYLES
   ============================================ */

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--md-border);
    border-radius: var(--md-radius);
    background: var(--md-surface);
    color: var(--md-text-primary);
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.1);
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    color: var(--md-text-primary);
    font-weight: 500;
    font-size: 14px;
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Dark mode form styles */
[data-theme="dark"] .form-control {
    background: var(--md-surface-elevated);
    border-color: var(--md-border);
    color: var(--md-text-primary);
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px rgba(144, 202, 249, 0.2);
}

[data-theme="dark"] .form-group label {
    color: var(--md-text-primary);
}

/* =====================================================
   SETTINGS ADMIN PAGE STYLES
   ===================================================== */

/* Card headers */
.material-card-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--md-border);
}

.material-card-header h1 {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.material-card-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 8px 0;
}

.material-card-subtitle {
    color: var(--md-text-secondary);
    font-size: 0.95rem;
    margin: 0;
    line-height: 1.4;
}

/* Container for narrow forms (like login, password reset) */
.container-narrow {
    max-width: 500px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Form styles */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--md-text-primary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--md-border);
    border-radius: var(--md-radius);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--md-surface);
    color: var(--md-text-primary);
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--md-primary);
    box-shadow: 0 0 0 3px rgba(25,118,210,0.1);
}

.form-text {
    display: block;
    margin-top: 8px;
    font-size: 0.875rem;
    color: var(--md-text-secondary);
    line-height: 1.4;
}

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

.form-actions .btn {
    flex: 0 1 auto;
}

/* Card styles for standalone pages */
.card {
    background: var(--md-surface);
    border-radius: var(--md-radius-lg);
    box-shadow: var(--md-shadow-lg);
    overflow: hidden;
}

.card-header {
    padding: 24px;
    border-bottom: 1px solid var(--md-border);
    background: var(--md-surface-elevated);
}

.card-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--md-text-primary);
}

.card-body {
    padding: 24px;
}

/* Alert styles for standalone pages */
.alert {
    padding: 16px 20px;
    border-radius: var(--md-radius);
    margin-bottom: 20px;
    border-left: 4px solid;
    line-height: 1.6;
}

.alert-success {
    background: rgba(76, 175, 80, 0.1);
    border-left-color: #4caf50;
    color: var(--md-text-primary);
}

.alert-danger {
    background: rgba(244, 67, 54, 0.1);
    border-left-color: var(--md-danger);
    color: var(--md-text-primary);
}

.alert-info {
    background: rgba(33, 150, 243, 0.1);
    border-left-color: #2196f3;
    color: var(--md-text-primary);
}

.alert strong {
    display: block;
    margin-bottom: 4px;
    font-weight: 600;
}

/* Button styles for forms */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--md-radius);
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    line-height: 1.5;
}

.btn-primary {
    background: var(--md-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--md-primary-dark);
}

.btn-text {
    background: transparent;
    color: var(--md-text-secondary);
}

.btn-text:hover {
    background: var(--md-surface-container);
    color: var(--md-text-primary);
}

/* Dark mode for form elements */
[data-theme="dark"] .form-control {
    background: var(--md-surface-elevated);
    border-color: var(--md-border);
    color: var(--md-text-primary);
}

[data-theme="dark"] .form-control:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.2);
}

[data-theme="dark"] .card {
    background: var(--md-surface);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .card-header {
    background: var(--md-surface-elevated);
    border-bottom-color: var(--md-border);
}

[data-theme="dark"] .alert-success {
    background: rgba(76, 175, 80, 0.15);
}

[data-theme="dark"] .alert-danger {
    background: rgba(244, 67, 54, 0.15);
}

[data-theme="dark"] .alert-info {
    background: rgba(33, 150, 243, 0.15);
}

/* Utility margin classes */
.u-mt-16 { margin-top: 16px; }
.u-mt-24 { margin-top: 24px; }
.u-mt-48 { margin-top: 48px; }
.u-mb-24 { margin-bottom: 24px; }

/* Form sections */
.material-form-section {
    margin-bottom: 32px;
}

.material-section-title {
    color: var(--md-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0 0 20px 0;
    padding: 0 0 8px 0;
    border-bottom: 2px solid var(--md-primary-lighter);
}

.material-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    .material-form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
}

/* Form styles */
.material-form {
    padding: 20px;
    background: var(--md-surface);
    border-radius: var(--md-radius);
}

.material-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.material-label {
    color: var(--md-text-primary);
    font-weight: 500;
    font-size: 0.95rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* =====================================================
   MONTHLY SUMMARY MATERIAL DESIGN STYLES
   ===================================================== */

/* Form for date selection */
.monthly-summary-form {
    display: flex;
    align-items: end;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--md-surface);
    border-radius: var(--md-radius-lg);
    border: 1px solid var(--md-border);
    box-shadow: var(--md-shadow-sm);
}

/* Main summary sections */
.monthly-summary-section {
    background: var(--md-surface);
    border-radius: var(--md-radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--md-shadow-md);
    border: 1px solid var(--md-border);
    transition: box-shadow 0.3s ease;
}

.monthly-summary-section:hover {
    box-shadow: var(--md-shadow-lg);
}

.monthly-summary-section.monthly-summary-individual {
    border-left: 4px solid var(--md-accent);
}

/* Section headers */
.monthly-summary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--md-surface-container);
}

.monthly-summary-header h3 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.monthly-summary-period {
    background: var(--md-primary);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--md-shadow-sm);
}

.monthly-summary-subtitle {
    color: var(--md-text-secondary);
    font-size: 0.9rem;
    font-style: italic;
}

/* Empty state */
.monthly-summary-empty {
    text-align: center;
    padding: 2rem;
    color: var(--md-text-secondary);
}

.monthly-summary-empty-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}

.monthly-summary-empty-text {
    font-size: 1.1rem;
    font-weight: 500;
}

/* Expense items list */
.monthly-summary-items {
    margin-bottom: 1.5rem;
}

.monthly-summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--md-surface-container);
    transition: background 0.2s ease;
}

.monthly-summary-item:hover {
    background: rgba(0,0,0,0.02);
    border-radius: var(--md-radius);
}

.monthly-summary-item:last-child {
    border-bottom: none;
}

.monthly-summary-item-name {
    color: var(--md-text-primary);
    font-weight: 500;
    font-size: 1rem;
}

.monthly-summary-item-amount {
    color: var(--md-text-primary);
    font-weight: 600;
    font-family: 'Segoe UI', monospace;
    font-size: 1rem;
    padding: 0.25rem 0.5rem;
    background: var(--md-surface-container);
    border-radius: var(--md-radius);
}

/* New elegant totals section */
.monthly-summary-totals-new {
    display: flex;
    gap: 16px;
    margin-top: 16px;
}

.monthly-summary-totals-new.individual-totals {
    justify-content: center;
}

.summary-total-card,
.summary-per-house-card {
    background: var(--md-surface);
    border: 2px solid var(--md-border);
    border-radius: var(--md-radius-lg);
    padding: 20px;
    text-align: center;
    flex: 1;
    transition: all 0.2s ease;
}

.summary-total-card {
    border-color: var(--md-primary);
    background: rgba(25, 118, 210, 0.02);
}

.summary-per-house-card {
    border-color: var(--md-success);
    background: rgba(76, 175, 80, 0.02);
}

.summary-total-card.individual-card {
    border-color: var(--md-accent);
    background: rgba(255, 64, 129, 0.02);
    max-width: 300px;
}

.summary-total-card:hover,
.summary-per-house-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--md-shadow-md);
}

.summary-total-value,
.summary-per-house-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--md-text-primary);
    font-family: 'Segoe UI', monospace;
    margin-bottom: 8px;
    line-height: 1.2;
}

.summary-total-card .summary-total-value {
    color: var(--md-primary);
}

.summary-per-house-card .summary-per-house-value {
    color: var(--md-success);
}

.summary-total-card.individual-card .summary-total-value {
    color: var(--md-accent);
}

.summary-total-desc,
.summary-per-house-desc {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--md-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Dark theme adjustments */
[data-theme="dark"] .monthly-summary-section {
    background: var(--md-surface);
    border-color: var(--md-border);
}

[data-theme="dark"] .monthly-summary-form {
    background: var(--md-surface);
    border-color: var(--md-border);
}

[data-theme="dark"] .monthly-summary-item:hover {
    background: var(--md-surface-elevated);
}

[data-theme="dark"] .monthly-summary-item-amount {
    background: var(--md-surface-elevated);
}

/* Dark theme for new totals cards */
[data-theme="dark"] .summary-total-card,
[data-theme="dark"] .summary-per-house-card {
    background: var(--md-surface);
    border-color: var(--md-border);
}

[data-theme="dark"] .summary-total-card {
    background: rgba(144, 202, 249, 0.05);
    border-color: var(--md-primary);
}

[data-theme="dark"] .summary-per-house-card {
    background: rgba(129, 199, 132, 0.05);
    border-color: var(--md-success);
}

[data-theme="dark"] .summary-total-card.individual-card {
    background: rgba(255, 128, 171, 0.05);
    border-color: var(--md-accent);
}

/* Responsive design */
@media (max-width: 768px) {
    .monthly-summary-form {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .monthly-summary-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .monthly-summary-period {
        align-self: flex-start;
    }
    
    .monthly-summary-section {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .monthly-summary-total-amount {
        font-size: 1.2rem;
    }
    
    .monthly-summary-per-house-amount {
        font-size: 1rem;
    }
    
    .monthly-summary-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 1rem 0;
    }
    
    .monthly-summary-item-amount {
        align-self: flex-end;
    }
}

@media (max-width: 480px) {
    .monthly-summary-section {
        padding: 0.75rem;
    }
    
    .monthly-summary-form {
        padding: 1rem;
    }
    
    .monthly-summary-header h3 {
        font-size: 1.1rem;
    }
    
    .monthly-summary-totals-new {
        flex-direction: column;
        gap: 12px;
    }
    
    .summary-total-card,
    .summary-per-house-card {
        padding: 16px;
    }
    
    .summary-total-value,
    .summary-per-house-value {
        font-size: 1.3rem;
    }
    
    .summary-total-desc,
    .summary-per-house-desc {
        font-size: 0.8rem;
    }
}

/* =====================================================
   ADD CHARGE + MONTHLY SUMMARY LAYOUT
   ===================================================== */

/* Two-column layout for add charge form and monthly summary */
.add-charge-summary-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

/* Add charge section styling */
.add-charge-section {
    height: fit-content;
}

.add-charge-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.add-charge-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.add-charge-type-amount {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.add-charge-description {
    width: 100%;
}

.add-charge-textarea {
    min-height: 80px !important;
    max-height: 120px;
    resize: vertical;
}

.add-charge-actions {
    text-align: right;
}

/* Monthly summary container adjustments */
.monthly-summary-section-container {
    height: fit-content;
}

.monthly-summary-section-container .material-card-header {
    margin-bottom: 16px;
}

.monthly-summary-section-container .monthly-summary-form {
    margin-bottom: 16px;
    padding: 12px;
}

.monthly-summary-section-container .monthly-summary-section {
    margin-bottom: 12px;
    padding: 12px;
}

.monthly-summary-section-container .monthly-summary-header {
    margin-bottom: 12px;
}

.monthly-summary-section-container .monthly-summary-items {
    margin-bottom: 12px;
}

.monthly-summary-section-container .monthly-summary-item {
    padding: 8px 0;
}

.monthly-summary-section-container .monthly-summary-totals {
    padding: 12px;
}

/* Responsive behavior */
@media (max-width: 1200px) {
    .add-charge-summary-layout {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .add-charge-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .add-charge-type-amount {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }
}

@media (max-width: 768px) {
    .add-charge-summary-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .add-charge-grid {
        grid-template-columns: 1fr;
    }
    
    .add-charge-type-amount {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .add-charge-textarea {
        min-height: 60px !important;
    }
    
    /* Restore full-width monthly summary sections on mobile */
    .monthly-summary-section-container .monthly-summary-form {
        padding: 16px;
    }
    
    .monthly-summary-section-container .monthly-summary-section {
        padding: 16px;
    }
}

/* =====================================================
   MONTH PICKER - SIMPLIFIED
   ===================================================== */

/* Month input styling for both themes */
input[type="month"] {
    position: relative;
}

input[type="month"]::-webkit-calendar-picker-indicator {
    opacity: 0.7;
    cursor: pointer;
    padding: 4px;
}

[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.8;
}

/* Ensure month inputs work properly in forms */
.material-form-group input[type="month"],
.monthly-summary-form input[type="month"] {
    background: var(--md-surface);
    color: var(--md-text-primary);
    border: 1px solid var(--md-outline);
}

/* =====================================================
   POLLS/SURVEYS DARK MODE FIXES
   ===================================================== */

/* Fix poll cards background and banner colors in dark theme */
[data-theme="dark"] .material-card .material-card {
    background: var(--md-surface) !important;
    color: var(--md-text-primary) !important;
    border: 1px solid var(--md-border);
}

[data-theme="dark"] .material-card .material-card h3 {
    color: var(--md-text-primary) !important;
}

[data-theme="dark"] .material-card h2,
[data-theme="dark"] .material-card h3 {
    color: var(--md-text-primary);
}

/* Override dla utility classes w material-card h2/h3 */
[data-theme="dark"] .material-card h2.u-text-success,
[data-theme="dark"] .material-card h3.u-text-success {
    color: var(--md-success) !important;
}

[data-theme="dark"] .material-card h2.u-text-danger,
[data-theme="dark"] .material-card h3.u-text-danger {
    color: var(--md-danger) !important;
}

/* MAKSYMALNA specyficznoĹ›Ä‡ dla wszystkich elementĂłw w material-card */
[data-theme="dark"] .material-card td.u-text-success,
[data-theme="dark"] .material-card strong.u-text-success,
[data-theme="dark"] .material-card span.u-text-success,
[data-theme="dark"] .material-card div.u-text-success {
    color: var(--md-success) !important;
}

[data-theme="dark"] .material-card td.u-text-danger,
[data-theme="dark"] .material-card strong.u-text-danger,
[data-theme="dark"] .material-card span.u-text-danger,
[data-theme="dark"] .material-card div.u-text-danger {
    color: var(--md-danger) !important;
}

/* Elementy wewnÄ…trz td z klasÄ… success/danger w dark mode */
[data-theme="dark"] .material-card td.u-text-success strong,
[data-theme="dark"] .material-card td.u-text-success span {
    color: var(--md-success) !important;
}

[data-theme="dark"] .material-card td.u-text-danger strong,
[data-theme="dark"] .material-card td.u-text-danger span {
    color: var(--md-danger) !important;
}

/* Material table w dark mode - reguĹ‚y dla td i strong */
[data-theme="dark"] .material-table td.u-text-success,
[data-theme="dark"] .material-table td.u-text-success strong,
[data-theme="dark"] .material-table td.u-text-success span {
    color: var(--md-success) !important;
}

[data-theme="dark"] .material-table td.u-text-danger,
[data-theme="dark"] .material-table td.u-text-danger strong,
[data-theme="dark"] .material-table td.u-text-danger span {
    color: var(--md-danger) !important;
}

/* Fix poll banners in dark theme */
[data-theme="dark"] .material-card .material-card div[style*="background:#e8f5e8"] {
    background: rgba(76, 175, 80, 0.15) !important;
    color: var(--md-text-primary) !important;
}

[data-theme="dark"] .material-card .material-card div[style*="background:#ffebee"] {
    background: rgba(244, 67, 54, 0.15) !important;
    color: var(--md-text-primary) !important;
}

[data-theme="dark"] .material-card .material-card div[style*="background:#fff3e0"] {
    background: rgba(255, 152, 0, 0.15) !important;
    color: var(--md-text-primary) !important;
}

/* Fix poll option labels in dark theme */
[data-theme="dark"] .material-card .material-card label[style*="background:white"] {
    background: var(--md-surface-elevated) !important;
    color: var(--md-text-primary) !important;
    border-color: var(--md-border) !important;
}

[data-theme="dark"] .material-card .material-card label[style*="background:white"]:hover {
    background: var(--md-surface-container) !important;
}

/* Fix poll description and meta text colors */
[data-theme="dark"] .material-card .material-card div[style*="color:#666"] {
    color: var(--md-text-secondary) !important;
}

[data-theme="dark"] .material-card .material-card span[style*="color:#666"] {
    color: var(--md-text-secondary) !important;
}

/* =====================================================
   WATER READING BANNER DARK MODE FIXES
   ===================================================== */

/* Fix water reading banners in dark theme */
[data-theme="dark"] .material-card div[style*="background:#fff3e0"] {
    background: rgba(255, 152, 0, 0.15) !important;
    color: var(--md-text-primary) !important;
}

[data-theme="dark"] .material-card div[style*="background:#ffebee"] {
    background: rgba(244, 67, 54, 0.15) !important;
    color: var(--md-text-primary) !important;
}

[data-theme="dark"] .material-card div[style*="background:#e8f5e8"] {
    background: rgba(76, 175, 80, 0.15) !important;
    color: var(--md-text-primary) !important;
}

/* Fix banner text elements */
[data-theme="dark"] .material-card div[style*="background:#fff3e0"] div,
[data-theme="dark"] .material-card div[style*="background:#ffebee"] div,
[data-theme="dark"] .material-card div[style*="background:#e8f5e8"] div {
    color: var(--md-text-primary) !important;
}

[data-theme="dark"] .material-card div[style*="background:#fff3e0"] strong,
[data-theme="dark"] .material-card div[style*="background:#ffebee"] strong,
[data-theme="dark"] .material-card div[style*="background:#e8f5e8"] strong {
    color: var(--md-text-primary) !important;
}

/* =====================================================
   ADDITIONAL DARK MODE POLL FIXES
   ===================================================== */

/* Fix poll inner cards to have proper dark theme styling */
[data-theme="dark"] .material-card .material-card[style*="background:#f9f9f9"] {
    background: var(--md-surface-elevated) !important;
    border: 1px solid var(--md-border) !important;
}

/* Fix all text elements within poll cards */
[data-theme="dark"] .material-card .material-card * {
    color: var(--md-text-primary) !important;
}

/* Fix specific styled elements that override text color */
[data-theme="dark"] .material-card .material-card div[style*="color:"],
[data-theme="dark"] .material-card .material-card span[style*="color:"] {
    color: var(--md-text-secondary) !important;
}

/* Ensure poll results bars are visible */
[data-theme="dark"] .material-card .material-card div[style*="background:#e0e0e0"] {
    background: var(--md-surface-container) !important;
}

/* Fix radio button labels to be more visible */
[data-theme="dark"] .material-card .material-card input[type="radio"] {
    filter: brightness(1.2);
}

/* Override inline styles more aggressively */
[data-theme="dark"] .material-card .material-card h3[style],
[data-theme="dark"] .material-card .material-card div[style],
[data-theme="dark"] .material-card .material-card span[style] {
    color: var(--md-text-primary) !important;
}

/* Specific fix for subtitle text */
[data-theme="dark"] .material-card .material-card div[style*="color:#666;"] {
    color: var(--md-text-secondary) !important;
}



.material-label-hint {
    color: var(--md-text-secondary);
    font-weight: 400;
    font-size: 0.85rem;
}

.material-input-helper {
    color: var(--md-text-secondary);
    font-size: 0.85rem;
    line-height: 1.3;
    margin-top: 4px;
}

/* Checkbox styling */
.material-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px;
    background: var(--md-surface-container);
    border: 1px solid var(--md-border);
    border-radius: var(--md-radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.material-checkbox-label:hover {
    background: var(--md-surface-container-high);
    border-color: var(--md-primary);
}

.material-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--md-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Div wrapper dla checkboxa - ukĹ‚ad flexbox */
div.material-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    width: 100%;
    height: auto;
}

.material-grid-2 div.material-checkbox {
    margin-bottom: 6px;
    gap: 6px;
}

.material-grid-2 div.material-checkbox label {
    font-size: 0.85rem;
}

div.material-checkbox input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

div.material-checkbox label {
    flex: 1;
    cursor: pointer;
    user-select: none;
    line-height: 1.5;
    color: var(--md-text-primary);
}

label.material-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    width: auto;
    height: auto;
}

.material-checkbox-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.material-checkbox-text strong {
    color: var(--md-text-primary);
    font-size: 0.95rem;
}

.material-checkbox-text small {
    color: var(--md-text-secondary);
    font-size: 0.85rem;
    line-height: 1.3;
}

/* Info and warning boxes */
.material-info-box,
.material-warning-box {
    display: flex;
    gap: 12px;
    padding: 16px;
    border-radius: var(--md-radius);
    margin: 16px 0;
}

.material-info-box {
    background: rgba(33, 150, 243, 0.1);
    border: 1px solid rgba(33, 150, 243, 0.3);
}

.material-warning-box {
    background: rgba(255, 152, 0, 0.1);
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.material-info-icon,
.material-warning-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.material-info-content,
.material-warning-content {
    flex: 1;
}

.material-info-content strong,
.material-warning-content strong {
    color: var(--md-text-primary);
}

.material-info-content small {
    color: var(--md-text-secondary);
    font-size: 0.85rem;
}

/* Stats grid for preview */
.material-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
    margin: 20px 0;
}

.material-stat-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--md-surface-container);
    border: 1px solid var(--md-border);
    border-radius: var(--md-radius-lg);
    transition: all 0.2s ease;
}

.material-stat-card:hover {
    box-shadow: var(--md-shadow-md);
    transform: translateY(-1px);
}

.material-stat-icon {
    font-size: 2rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.material-stat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.material-stat-label {
    color: var(--md-text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.material-stat-value {
    color: var(--md-text-primary);
    font-size: 1.25rem;
    font-weight: 600;
}

/* Dark mode - kolory success/danger dla stat-value */
[data-theme="dark"] .material-stat-value.u-text-success {
    color: var(--md-success) !important;
}

[data-theme="dark"] .material-stat-value.u-text-danger {
    color: var(--md-danger) !important;
}

/* ZwiÄ™kszona specyficznoĹ›Ä‡ dla elementĂłw w material-card */
[data-theme="dark"] .material-card .material-stat-value.u-text-success {
    color: var(--md-success) !important;
}

[data-theme="dark"] .material-card .material-stat-value.u-text-danger {
    color: var(--md-danger) !important;
}

[data-theme="dark"] .material-card div.u-text-success {
    color: var(--md-success) !important;
}

[data-theme="dark"] .material-card div.u-text-danger {
    color: var(--md-danger) !important;
}

.material-stat-description {
    color: var(--md-text-secondary);
    font-size: 0.85rem;
    line-height: 1.3;
}

/* Badges */
.material-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Payment status badges - kolory z payments.php */
.material-badge.pastylka--ok {
    background: #4caf50;
    color: white;
    border: none;
}

.material-badge.pastylka--warn {
    background: #ff9800;
    color: white;
    border: none;
}

.material-badge.pastylka--info {
    background: #1976d2;
    color: white;
    border: none;
}

.material-badge.pastylka--danger {
    background: #f44336;
    color: white;
    border: none;
}

/* Dark theme - te same kolory */
[data-theme="dark"] .material-badge.pastylka--ok {
    background: #4caf50;
    color: white;
    border: none;
}

[data-theme="dark"] .material-badge.pastylka--warn {
    background: #ff9800;
    color: white;
    border: none;
}

[data-theme="dark"] .material-badge.pastylka--info {
    background: #1976d2;
    color: white;
    border: none;
}

[data-theme="dark"] .material-badge.pastylka--danger {
    background: #f44336;
    color: white;
    border: none;
}

/* Category badge */
.material-badge.category-badge {
    background: #e3f2fd;
    color: #1976d2;
    border: none;
}

[data-theme="dark"] .material-badge.category-badge {
    background: #1565c0;
    color: #e3f2fd;
    border: none;
}

.material-badge-success {
    background: rgba(76, 175, 80, 0.15);
    color: #2e7d32;
    border: 1px solid rgba(76, 175, 80, 0.3);
}

.material-badge-danger {
    background: rgba(244, 67, 54, 0.15);
    color: #c62828;
    border: 1px solid rgba(244, 67, 54, 0.3);
}

[data-theme="dark"] .material-badge-success {
    background: rgba(129, 199, 132, 0.2);
    color: #81c784;
}

[data-theme="dark"] .material-badge-danger {
    background: rgba(229, 115, 115, 0.2);
    color: #e57373;
}

/* =====================================================
/* Form styling for announcements */
.material-form-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 16px;
}

@media (max-width: 768px) {
    .material-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
}

.material-form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.material-textarea {
    min-height: 120px;
    resize: vertical;
    padding: 12px 16px;
    border: 1px solid var(--md-border);
    border-radius: var(--md-radius);
    background: var(--md-surface);
    color: var(--md-text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    line-height: 1.5;
    transition: all 0.2s ease;
}

.material-textarea:focus {
    outline: none;
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px rgba(144, 202, 249, 0.2);
}

/* Dropzone styling */
.material-dropzone {
    border: 2px dashed var(--md-border);
    border-radius: var(--md-radius-lg);
    padding: 32px 16px;
    text-align: center;
    background: var(--md-surface-container);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
}

.material-dropzone:hover {
    border-color: var(--md-primary);
    background: var(--md-primary-lighter);
}

.material-dropzone.dragover {
    border-color: var(--md-primary);
    background: var(--md-primary-lighter);
    transform: scale(1.02);
}

.material-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.material-dropzone-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
    color: var(--md-text-secondary);
}

.material-dropzone-text {
    font-size: 1rem;
    font-weight: 500;
    color: var(--md-text-primary);
    margin-bottom: 4px;
}

.material-dropzone-subtext {
    font-size: 0.875rem;
    color: var(--md-text-secondary);
}

/* Button group styling */
.material-button-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    flex-wrap: wrap;
}

/* Mini historia */
.history-mini {
    background: var(--md-surface-container);
    border-radius: var(--md-radius);
    padding: 12px;
    max-height: 180px;
    overflow-y: auto;
}

.history-row {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 1fr;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--md-border-light);
    font-size: 0.8rem;
}

.history-row:last-child {
    border-bottom: none;
}

.history-row span:first-child {
    font-weight: 600;
    color: var(--md-primary);
}

/* Rozszerzona historia */
.history-extended {
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.5px;
    opacity: 0.8;
    display: block;
    margin-bottom: 4px;
}







/* Grid Layout Enhancements */
.material-grid-wide {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
}

@media (min-width: 1200px) {
    .material-grid-wide {
        grid-template-columns: 2fr 1fr;
    }
}



/* Dark theme readonly inputs - lepsze dla czytelnoĹ›ci */
[data-theme="dark"] .material-input[readonly] {
    background: #2d2d2d !important;
    color: #bbbbbb !important;
    border-color: #444444 !important;
}

/* Dark theme bank info styles */
[data-theme="dark"] .bank-info-item {
    border-bottom-color: var(--md-border);
}

[data-theme="dark"] .bank-info-label {
    color: var(--md-text-secondary);
}

[data-theme="dark"] .bank-info-value {
    color: var(--md-text-primary);
}

[data-theme="dark"] .account-number {
    background: #2d2d2d;
    color: #4fc3f7;
}


/* Table responsive improvements */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.material-table input.material-input {
    min-width: 80px;
    font-size: 0.9rem;
    padding: 6px 8px;
}







/* Mini historia */
.history-mini {
    background: var(--md-surface-container);
    border-radius: var(--md-radius);
    padding: 12px;
    max-height: 180px;
    overflow-y: auto;
}

.history-row {
    display: grid;
    grid-template-columns: 80px 1fr 1fr 1fr;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px solid var(--md-border-light);
    font-size: 0.8rem;
}

.history-row:last-child {
    border-bottom: none;
}

.history-row span:first-child {
    font-weight: 600;
    color: var(--md-primary);
}

.no-photo {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--md-surface-variant);
    border-radius: 4px;
    color: var(--md-text-secondary);
    font-size: 1rem;
}

.history-reading {
    font-weight: 500;
}

.history-prev {
    color: var(--md-text-secondary);
    font-size: 0.75rem;
}

.history-usage {
    color: var(--md-text-secondary);
}

.history-price {
    color: var(--md-text-secondary);
}

.history-cost {
    font-weight: 600;
    color: var(--md-text-primary);
}

.history-balance {
    font-weight: 600;
}

.history-actions {
    display: flex;
    justify-content: center;
    align-items: center;
}

.delete-btn {
    background: #e53935;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(229, 57, 53, 0.2);
}

.delete-btn:hover {
    background: #c62828;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(229, 57, 53, 0.3);
}

.delete-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(229, 57, 53, 0.2);
}

/* Upload zdjÄ™cia */
.admin-photo-balance-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.admin-balance-section {
    display: flex;
    flex-direction: column;
}

.photo-filename {
    min-height: 20px;
    font-style: italic;
}

/* Photo upload button - desktop auto-width */
.photo-upload-btn {
    width: auto;
}

.photo-upload-area {
    background: var(--md-surface-container);
    border: 2px dashed var(--md-border);
    border-radius: var(--md-radius);
    padding: 12px;
    text-align: center;
    transition: border-color 0.2s ease;
}

.photo-upload-area:hover {
    border-color: var(--md-primary);
}

.current-photo {
    margin-bottom: 12px;
    text-align: center;
}

.photo-thumbnail {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    border: 2px solid var(--md-border);
    transition: all 0.2s ease;
    box-shadow: var(--md-shadow-sm);
}

.photo-thumbnail:hover {
    transform: scale(1.1);
    border-color: var(--md-primary);
    box-shadow: var(--md-shadow-md);
}

/* Kontekst miesiÄ…ca */
.month-context {
    background: var(--md-surface-container);
    border-radius: var(--md-radius);
    padding: 12px;
    margin-bottom: 16px;
}

/* ============================================
   RESIDENT HOUSE TILE - KOMPAKTOWY WIDOK
   ============================================ */

/* Kompaktowy kafelek rezydenta */
.resident-house-tile {
    background: var(--md-surface);
    border: 1px solid var(--md-border);
    border-radius: var(--md-radius);
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: var(--md-shadow-sm);
    margin-bottom: 16px;
}

.resident-house-tile:hover {
    border-color: var(--md-primary);
    box-shadow: var(--md-shadow-md);
    transform: translateY(-2px);
}

/* Wskazówka "Kliknij aby rozwinąć" - animacja przy hover */
.resident-house-tile:hover .resident-tile-hint {
    opacity: 1 !important;
    color: var(--md-primary) !important;
}

.resident-tile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.resident-tile-stats {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 16px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
}

.stat-item .stat-label {
    font-size: 0.8rem;
    color: var(--md-text-secondary);
    font-weight: 500;
}

.stat-item .stat-value {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--md-text-primary);
}

/* Panel szczegĂłĹ‚Ăłw rezydenta */
.resident-details {
    background: var(--md-surface);
    border: 2px solid var(--md-primary);
    border-radius: var(--md-radius-lg);
    padding: 24px;
    margin: 16px 0;
    box-shadow: var(--md-shadow-lg);
    animation: slideDown 0.3s ease;
}

.resident-details-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--md-border);
}

.resident-details-header h3 {
    margin: 0;
    color: var(--md-primary);
    font-size: 1.3rem;
}

/* Responsive dla widoku rezydenta */
@media (max-width: 1024px) {
    .resident-tile-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
}

@media (max-width: 768px) {
    .resident-tile-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .resident-details {
        padding: 12px;
        margin: 6px 0;
    }
    
    /* Zmniejsz nagĹ‚Ăłwek szczegĂłĹ‚Ăłw rezydenta */
    .resident-details-header h3 {
        font-size: 0.95rem !important;
    }
    
    .resident-details-header {
        margin-bottom: 12px;
        padding-bottom: 8px;
    }
    
    .close-btn {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
    
    /* Grid 2x3 dla 6 kafelkĂłw rezydenta */
    .resident-details .material-grid-3 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
        margin-bottom: 16px !important;
    }
    
    .resident-details .stat-display {
        padding: 8px;
    }
    
    .resident-details .material-label {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }
    
    .resident-details .stat-big {
        font-size: 0.9rem;
    }
    
    /* Odczyt kompletny - zmniejsz checkmark i fonty */
    .resident-details h4 {
        font-size: 0.9rem !important;
        margin: 12px 0 8px 0 !important;
    }
    
    .material-card h4 {
        font-size: 0.9rem;
    }
    
    .material-card [style*="font-size: 2rem"] {
        font-size: 1.5rem !important;
    }
    
    .material-card [style*="font-size: 0.9em"] {
        font-size: 0.8rem !important;
    }
    
    /* Pola wprowadzania - mniejsze */
    .resident-details .material-input {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    
    .resident-details .material-btn {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    .resident-details .material-btn-primary {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    
    /* PowiÄ™kszona historia dla rezydenta */
    .resident-details .history-mini,
    .resident-details .history-extended {
        max-height: 450px !important;
    }
    
    .material-grid-2 .material-card {
        padding: 12px;
    }
    
    .material-grid-2 .material-card h3 {
        font-size: 0.95rem;
        margin-bottom: 8px;
    }
    
    .material-form-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .material-form-row-name-owner {
        grid-template-columns: 1fr;
    }
}

/* Desktop: ukryj tekstowÄ… legendÄ™ pod kaflami, pokaĹĽ badges */
.payment-legend-row {
    display: none !important;
}

.payment-legend-badges {
    display: flex;
}

/* Houses grid - domyślnie 4 kolumny na desktop */
.houses-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* Medium screens - tablety i maĹ‚e desktopy (1 kolumna gdy < 800px) */
@media (max-width: 800px) {
    .material-grid-2 {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

/* Responsive adjustments for rates */
@media (max-width: 768px) {
    .rates-section {
        padding: 16px;
    }
    
    .material-grid-2 {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .calculation-formula {
        padding: 12px;
    }
    
    .formula-text {
        font-size: 0.9rem;
        padding: 6px 8px;
    }
    
    /* Responsive house tiles - auto-fit dla pełnej responsywności */
    .houses-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)) !important;
        gap: 6px;
    }
    
    .house-tile {
        padding: 6px;
    }
    
    .house-tile-header {
        margin-bottom: 4px;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .house-name {
        font-size: 0.85rem;
        line-height: 1.2;
    }
    
    .house-status {
        padding: 2px 4px;
        font-size: 0.6rem;
        border-radius: 8px;
        white-space: nowrap;
    }
    
    .house-tile-stats {
        grid-template-columns: 1fr 1fr;
        gap: 4px;
    }
    
    .stat {
        gap: 2px;
    }
    
    .stat-label {
        font-size: 0.65rem;
        line-height: 1.1;
    }
    
    .stat-value {
        font-size: 0.8rem;
        line-height: 1.1;
    }
    
    .est-badge {
        font-size: 0.6rem;
        padding: 1px 3px;
    }
    
    .house-details {
        padding: 12px;
        margin: 6px 0;
    }
    
    .house-details-header h3 {
        font-size: 0.95rem;
    }
    
    .close-btn {
        width: 24px;
        height: 24px;
        font-size: 0.9rem;
    }
    
    .stat-display {
        padding: 8px;
    }
    
    .stat-display .material-label {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }
    
    .stat-big {
        font-size: 0.95rem;
    }
    
    .history-mini {
        padding: 8px;
        max-height: 250px;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    .history-extended {
        padding: 4px;
        max-height: 400px !important; /* Ograniczenie wysokoĹ›ci - przewijanie */
        overflow-y: auto; /* Przewijanie pionowe */
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Tabela historii - na mobile ukryta, zastÄ…piona kartami */
    .history-header {
        display: none !important;
    }
    
    .history-row-extended {
        display: block !important;
        background: var(--md-surface);
        border: 1px solid var(--md-border);
        border-radius: 8px;
        padding: 10px;
        margin-bottom: 10px;
        min-width: auto !important;
    }
    
    .history-row-extended > div {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 5px 0;
        border-bottom: 1px solid var(--md-border-light);
        font-size: 0.8rem;
    }
    
    .history-row-extended > div:last-child {
        border-bottom: none;
    }
    
    .history-thumbnail,
    .no-photo {
        width: 28px;
        height: 28px;
    }
    
    .material-grid-3,
    .material-grid-4 {
        grid-template-columns: 1fr;
        gap: 8px !important;
    }
    
    /* UKRYJ duplikujÄ…cy siÄ™ kafel month-context na mobile */
    .hide-on-mobile {
        display: none !important;
    }
    
    /* Poprzedni i BieĹĽÄ…cy odczyt obok siebie na mobile */
    .house-details .material-grid-2 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }
    
    /* Admin: ZdjÄ™cie + Saldo mobile w jednym wierszu - zachowujemy ukĹ‚ad 2 kolumn */
    .admin-photo-balance-row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 12px;
        margin-bottom: 20px;
    }
    
    .admin-balance-section .material-btn {
        font-size: 0.75rem;
        padding: 6px 12px;
    }
    
    /* Kafle statystyk - 2x2 na mobile */
    .house-details .material-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 10px !important;
    }
    
    .house-details .stat-display {
        padding: 10px 8px;
    }
    
    .house-details .stat-display .material-label {
        font-size: 0.7rem;
        margin-bottom: 4px;
    }
    
    .house-details .stat-big {
        font-size: 0.9rem;
    }
    
    /* NagĹ‚Ăłwki h4 w szczegĂłĹ‚ach */
    .house-details h4 {
        font-size: 0.9rem;
        margin: 12px 0 8px 0;
    }
    
    /* Historia odczytów - scrollowalna na mobile */
    .house-details [id^="history-container-resident-"] {
        max-height: 400px;
        overflow-y: auto;
        overflow-x: hidden;
        border: 1px solid var(--md-border, #e0e0e0);
        border-radius: 8px;
        padding: 8px;
        background: var(--md-surface, #fff);
    }
    
    /* Zmniejszone elementy formularza na mobile */
    .house-details .material-label {
        font-size: 0.75rem;
    }
    
    .house-details .material-input {
        font-size: 0.85rem;
        padding: 6px 10px;
    }
    
    .house-details .material-btn {
        font-size: 0.8rem;
        padding: 6px 10px;
    }
    
    .house-details .material-btn-primary {
        font-size: 0.85rem;
        padding: 8px 12px;
    }
    
    /* Photo upload - usuĹ„ drag&drop, zostaw zwykĹ‚y input */
    .photo-upload-area {
        padding: 8px;
        border: 1px solid var(--md-border);
        border-style: solid !important;
    }
    
    /* Photo upload button - peĹ‚na szerokoĹ›Ä‡ na mobile */
    .photo-upload-btn {
        width: 100%;
    }
    
    /* Wrapper nazwy pliku - flex row z przyciskiem Clear po prawej */
    .photo-upload-area > div[style*="display: flex"] {
        align-items: center !important;
    }
    
    /* Zmniejsz teksty pomocnicze */
    .photo-upload-area > div[style*="font-size"] {
        font-size: 0.75rem !important;
    }
    
    .photo-thumbnail {
        width: 50px;
        height: 50px;
    }
    
    .current-photo {
        margin-bottom: 8px;
    }
    
    .current-photo > div {
        font-size: 0.75rem !important;
    }
    
    /* Historia - POWIÄKSZONE okno przewijania */
    .history-mini {
        max-height: 300px !important;
    }
    
    .history-extended {
        max-height: 450px !important;
    }
    
    /* Bank2 wykresy - 1 kolumna na mobile */
    .bank-charts-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    
    /* Payments - kafle w 1 linii (4 kolumny) */
    #payments-results-container .material-grid-4 {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 4px;
    }
    
    #payments-results-container .material-grid-4 .material-card {
        padding: 8px 4px !important;
    }
    
    #payments-results-container .material-grid-4 .material-card > div:first-child {
        font-size: 0.85rem !important;
        margin-bottom: 4px !important;
        line-height: 1.1;
    }
    
    #payments-results-container .material-grid-4 .material-card > div:last-child {
        font-size: 1.6rem !important;
        font-weight: 600 !important;
    }
    
    /* Mobile: pokaĹĽ tekstowÄ… legendÄ™ pod kaflami, ukryj badges */
    .payment-legend-row {
        display: grid !important;
    }
    
    .payment-legend-row > div {
        font-size: 0.75rem !important;
        line-height: 1.2;
    }
    
    .payment-legend-badges {
        display: none !important;
    }
    
    /* Mniejsze kafle statystyk na mobile */
    .stat-display {
        padding: 10px 8px;
    }
    
    .stat-display .material-label {
        font-size: 0.75rem;
        margin-bottom: 4px;
    }
    
    .stat-big {
        font-size: 1.1rem;
    }
    
    /* File input container na mobile - peĹ‚na szerokoĹ›Ä‡ */
    .file-input-container {
        grid-column: 1 / -1;
    }
    
    /* File input na mobile */
    .material-input[type="file"]::file-selector-button {
        padding: 6px 12px;
        font-size: 0.85rem;
        margin-right: 8px;
    }
    
    /* Invoice filters summary - responsywny tekst na mobile */
    details.material-card.material-accordion summary h3 {
        font-size: 0.95rem;
        white-space: nowrap;
    }
    
    details.material-card.material-accordion summary .filter-summary-info {
        font-size: 0.75em;
        text-align: right;
        max-width: 60%;
    }
    
    details.material-card.material-accordion summary .filter-summary-text {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    /* Invoice filters - przyciski na pełną szerokość */
    .invoice-filters .filter-buttons {
        grid-column: 1 / -1;
        justify-content: stretch !important;
    }
    
    .invoice-filters .filter-buttons .material-btn {
        flex: 1;
    }
}
/* ===================================
   BANK ACCOUNT CARDS - MOBILE COLLAPSE
   =================================== */
.account-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--md-border);
    margin-bottom: 16px;
}

.account-toggle-btn {
    background: var(--md-primary);
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
    display: none;
}

@media (max-width: 768px) {
    .account-header {
        cursor: pointer;
    }
    
    .account-toggle-btn {
        display: block;
    }
    
    .account-details {
        display: none;
    }
}

@media (min-width: 769px) {
    .account-header {
        cursor: default;
        border-bottom: none;
        padding: 0;
        margin-bottom: 0;
    }
    
    .account-details {
        display: block !important;
    }
}

.account-details .material-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--md-text-secondary);
    margin-bottom: 4px;
}

.account-details .account-data-value {
    font-size: 1rem;
    font-weight: 400;
    color: var(--md-text-primary);
    line-height: 1.5;
}

.account-details .account-data-value.monospace {
    font-family: 'Courier New', Courier, monospace;
}

.account-details .account-data-value.multiline {
    white-space: pre-line;
}

.account-data-readonly {
    resize: none !important;
    overflow: hidden !important;
    background: var(--md-surface-container, #f5f5f5) !important;
    border: 1px solid var(--md-border, #e0e0e0) !important;
    color: var(--md-text-primary) !important;
    font-family: 'Roboto', sans-serif !important;
    font-size: 0.95rem !important;
    font-weight: 400 !important;
    padding: 4px 10px !important;
    border-radius: var(--md-radius, 8px) !important;
    cursor: text !important;
    user-select: text !important;
    width: 100% !important;
    box-sizing: border-box !important;
    line-height: 1.3 !important;
    min-height: 0 !important;
    height: auto !important;
    display: block !important;
    margin: 0 !important;
}

.account-data-readonly.monospace {
    font-family: 'Roboto Mono', 'Courier New', Courier, monospace !important;
    letter-spacing: 0.5px !important;
}

.account-data-readonly:focus {
    outline: 2px solid var(--md-primary, #1976d2) !important;
    outline-offset: 2px !important;
}

@media (max-width: 768px) {
    .account-data-readonly {
        font-size: 0.9rem !important;
        padding: 6px 8px !important;
        line-height: 1.4 !important;
    }
    
    .account-details .material-label {
        font-size: 0.7rem;
        margin-bottom: 3px;
    }
}

[data-theme="dark"] .account-details .material-label {
    color: var(--md-text-secondary);
}

[data-theme="dark"] .account-details .account-data-value {
    color: var(--md-text-primary);
}

[data-theme="dark"] .account-data-readonly {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
    color: var(--md-text-primary);
}

/* ===================================
   BANK ACCOUNT CARDS - MOBILE COLLAPSE
/* ===================================
   SIMPLE MONTH PICKER (Firefox fallback)
   =================================== */
.month-picker-popup {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: var(--md-surface);
    border: 1px solid var(--md-border);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    padding: 12px;
    min-width: 280px;
    display: none;
}

.month-picker-popup.active {
    display: block;
}

.month-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--md-border);
}

.month-picker-year {
    font-weight: 600;
    font-size: 1rem;
    color: var(--md-text-primary);
}

.month-picker-nav {
    display: flex;
    gap: 8px;
}

.month-picker-nav button {
    background: var(--md-primary);
    color: white;
    border: none;
    border-radius: 4px;
    width: 32px;
    height: 32px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: background 0.2s;
}

.month-picker-nav button:hover {
    background: var(--md-primary-dark);
}

.month-picker-months {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.month-picker-month {
    padding: 10px;
    text-align: center;
    border: 1px solid var(--md-border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--md-background);
    font-size: 0.9rem;
    color: var(--md-text-primary);
}

.month-picker-month:hover {
    background: var(--md-primary-lighter);
    border-color: var(--md-primary);
}

.month-picker-month.selected {
    background: var(--md-primary);
    color: white;
    border-color: var(--md-primary);
    font-weight: 600;
}

/* Firefox fallback - ukryj natywny picker */
@-moz-document url-prefix() {
    input[type="month"].month-picker-input {
        appearance: textfield;
        -moz-appearance: textfield;
    }
}
/* ============================================
   LISTA PLIKďż˝W W DROPZONE - OGďż˝OSZENIA
   ============================================ */

.files-list-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--md-surface-container, #f5f5f5);
    border-radius: 4px;
    border: 1px solid var(--md-border, #e0e0e0);
    transition: background 0.2s ease;
}

.file-item:hover {
    background: var(--md-surface-container-high, #eeeeee);
}

.file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--md-text-primary, #1a1a1a);
    font-size: 14px;
}

.file-remove-btn {
    background: var(--md-danger, #f44336);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    padding: 0;
    flex-shrink: 0;
    margin-left: 8px;
    transition: background 0.2s ease, transform 0.1s ease;
}

.file-remove-btn:hover {
    background: var(--md-danger-dark, #d32f2f);
    transform: scale(1.1);
}

.file-remove-btn:active {
    transform: scale(0.95);
}

/* Dark mode - dodatowe dostosowania */
[data-theme="dark"] .file-item {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .file-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .file-name {
    color: rgba(255, 255, 255, 0.9);
}







.material-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.material-form-grid-3col {
    grid-template-columns: 1fr 1fr 1fr;
}

.material-form-field {
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    /* Material form grid - jedna kolumna na mobile */
    .material-form-grid,
    .material-form-grid-3col {
        grid-template-columns: 1fr !important;
    }
}

/* Dark mode - Footer */
[data-theme="dark"] .footer {
    background: var(--md-background);
    border-top-color: var(--md-border);
    color: var(--md-text-secondary);
}

[data-theme="dark"] .footer a {
    color: var(--md-primary);
}

[data-theme="dark"] .footer a:hover {
    color: #64b5f6;
}

/* ========================================
   MONTH PICKER CUSTOM DROPDOWN
======================================== */

.month-picker-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--md-surface);
  border: 1px solid var(--md-border);
  padding: 8px;
  z-index: 1000;
  box-shadow: var(--md-shadow-md);
  min-width: 200px;
  border-radius: var(--md-radius);
  margin-top: 4px;
}

.month-picker-header {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
  align-items: center;
}

.month-picker-nav {
  padding: 4px 8px;
  border: 1px solid var(--md-border);
  background: var(--md-surface-container);
  color: var(--md-text-primary);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.month-picker-nav:hover {
  background: var(--md-surface-container-high);
}

.month-picker-year {
  flex: 1;
  text-align: center;
  font-weight: bold;
  color: var(--md-text-primary);
}

.month-picker-months {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.month-picker-btn {
  padding: 8px;
  cursor: pointer;
  border: 1px solid var(--md-border);
  background: var(--md-surface-container);
  color: var(--md-text-primary);
  border-radius: 4px;
  transition: background 0.2s, color 0.2s;
}

.month-picker-btn:hover {
  background: var(--md-primary);
  color: #fff;
  border-color: var(--md-primary);
}

/* Dark mode dla month picker */
[data-theme="dark"] .month-picker-dropdown {
  background: var(--md-surface);
  border-color: var(--md-border);
}

[data-theme="dark"] .month-picker-nav {
  background: var(--md-surface-container);
  border-color: var(--md-border);
  color: var(--md-text-primary);
}

[data-theme="dark"] .month-picker-nav:hover {
  background: var(--md-surface-container-high);
}

[data-theme="dark"] .month-picker-year {
  color: var(--md-text-primary);
}

[data-theme="dark"] .month-picker-btn {
  background: var(--md-surface-container);
  border-color: var(--md-border);
  color: var(--md-text-primary);
}

[data-theme="dark"] .month-picker-btn:hover {
  background: var(--md-primary);
  color: #fff;
  border-color: var(--md-primary);
}

/* ========================================
   STAT CARDS Z TĹEM (BANK2)
======================================== */

/* Karta z czerwonym tĹ‚em dla ostrzeĹĽeĹ„ */
.stat-card-danger {
  background: rgba(244, 67, 54, 0.05) !important;
}

[data-theme="dark"] .stat-card-danger {
  background: rgba(229, 115, 115, 0.15) !important; /* JaĹ›niejsze tĹ‚o w dark mode */
}

/* ========================================
   HISTORIA ODCZYTĂ“W WODY - ROZSZERZONA TABELA
======================================== */

.history-extended {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.history-header, 
.history-row-extended {
  display: grid;
  gap: 1px;
  background: white;
  align-items: center;
  font-size: 0.85em;
}

/* DOMYŚLNIE - Widok rezydenta - 14 kolumn */
.history-header {
  grid-template-columns: 60px 50px 70px 70px 65px 60px 65px 65px 100px 65px 75px 65px 75px 65px !important;
  min-width: 1000px;
  background: #f5f5f5;
  font-weight: 700;
}

.history-row-extended {
  grid-template-columns: 60px 50px 70px 70px 65px 60px 65px 65px 100px 65px 75px 65px 75px 65px !important;
  min-width: 1000px;
}

/* Widok admina - 15 kolumn (z kolumną Akcje) */
body.is-admin .history-header,
body.is-admin .history-row-extended {
  grid-template-columns: 60px 50px 70px 70px 65px 60px 65px 65px 100px 65px 75px 65px 75px 65px 110px !important;
  min-width: 1100px;
}

.history-header > div, 
.history-row-extended > div {
  padding: 8px 6px;
  text-align: center;
}

.history-month {
  text-align: left !important;
}

.history-thumbnail {
  max-width: 50px;
  max-height: 50px;
  border-radius: 4px;
  cursor: pointer;
  transition: transform 0.2s;
}

.history-thumbnail:hover {
  transform: scale(1.1);
}

.no-photo {
  opacity: 0.3;
  font-size: 1.5em;
}

.delete-btn {
  background: #f44336;
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1em;
  transition: background 0.2s;
}

.delete-btn:hover {
  background: #d32f2f;
}

/* Dark mode dla historii */
[data-theme="dark"] .history-extended {
  background: #404040;
}

[data-theme="dark"] .history-header,
[data-theme="dark"] .history-row-extended {
  background: var(--md-surface);
}

[data-theme="dark"] .history-header {
  background: var(--md-surface-container);
}

/* Responsive - średnie ekrany */
@media (max-width: 1200px) {
  .history-header,
  .history-row-extended {
    grid-template-columns: 65px 50px 75px 75px 75px 75px 75px 75px 110px 80px 80px 80px 80px;
    font-size: 0.7rem;
    gap: 4px;
    min-width: 1050px;
  }
  
  body.is-admin .history-header,
  body.is-admin .history-row-extended {
    grid-template-columns: 65px 50px 75px 75px 75px 75px 75px 75px 110px 80px 80px 80px 80px 60px;
    min-width: 1110px;
  }
}

/* Mobile - KARTY zamiast tabeli (zwiększono do 1500px wg życzenia) */
@media (max-width: 1500px) {
    .history-extended {
        max-height: 400px !important; /* Limit wysokoĹ›ci - scrollowanie */
        padding: 4px;
        overflow-y: auto; /* Przewijanie pionowe */
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch; /* PĹ‚ynne przewijanie iOS */
    }
    
    /* Ukryj nagĹ‚Ăłwek tabeli na mobile */
    .history-header {
        display: none !important;
    }
    
    /* PrzeksztaĹ‚Ä‡ wiersze w karty */
    .history-row-extended {
        display: block !important;
        background: var(--md-surface);
        border: 1px solid var(--md-border);
        border-radius: 8px;
        padding: 12px;
        margin-bottom: 12px;
        min-width: 0 !important; /* RESET SZEROKOŚCI - krytyczne dla responsywności! */
        width: 100% !important; /* Wymuś pełną szerokość kontenera */
    }
    
    .history-row-extended > div {
        display: flex !important;
        justify-content: space-between !important;
        padding: 6px 0;
        border-bottom: 1px solid var(--md-border-light);
        font-size: 0.85rem;
        text-align: left; /* Reset text-align: center from global */
        width: 100%;
        align-items: center;
    }
    
    .history-row-extended > div:last-child {
        border-bottom: none;
    }
    
    /* Dodaj etykiety przed wartościami - Ujednolicony Styl (AI Fix) */
    
    /* Reset i styl bazowy - Zastosuj do wszystkich divów w wierszu historii */
    .history-row-extended > div::before {
        font-weight: 700 !important;
        color: var(--md-text-primary) !important;
        font-size: 0.85rem !important;
        text-transform: uppercase;
        display: inline-block;
        min-width: 90px;
    }

    /* Upewnij się, że wartości tekstowe też są w kolorze primary (czarny/biały) */
    .history-row-extended > div {
        color: var(--md-text-primary);
    }

    /* Konkretne treści etykiet */
    .history-row-extended .history-month::before { content: "Miesiąc:"; }
    .history-row-extended .history-photo::before { content: "Zdjęcie:"; }
    .history-row-extended .history-reading::before { content: "Odczyt:"; }
    .history-row-extended .history-ocr-status::before { content: "Status OCR:"; }
    .history-row-extended .history-prev::before { content: "Poprzedni:"; }
    .history-row-extended .history-usage::before { content: "Zużycie:"; }
    .history-row-extended .history-price::before { content: "Cena/m³:"; }
    .history-row-extended .history-cost::before { content: "Koszt:"; }
    .history-row-extended .history-correction::before { content: "Korekta:"; }
    .history-row-extended .history-correction-desc::before { content: "Opis kor.:"; }
    
    /* Wyjątki - Saldo Przeniesienia i Do Zapłaty (zachowanie starych stylów) */
    .history-row-extended .history-carry::before { 
        content: "Saldo przen.:"; 
        text-transform: none; 
        color: var(--md-text-secondary) !important; 
        font-weight: 600 !important; 
    }
    .history-row-extended .history-due::before { 
        content: "Do zapłaty:"; 
        text-transform: none; 
        color: #f44336 !important; 
        font-weight: 700 !important; 
    }
    .history-row-extended .history-paid::before { 
        content: "Zapłacono:"; 
        text-transform: none; 
        color: var(--md-text-secondary) !important; 
        font-weight: 600 !important;
    }
    .history-row-extended .history-balance::before { content: " Saldo: "; font-weight: 600; }
    .history-row-extended .history-actions::before { content: " Akcje: "; font-weight: 600; }

    /* Specjalne traktowanie dla zdjęcia - aby thumbnail nie rozciągał wiersza */
    .history-row-extended > div.history-content {
        align-items: flex-start;
    }
    
    .history-thumbnail {
        margin-top: 8px;
        max-width: 100px;
        max-height: 100px;
    }
}

/* Bardzo maĹ‚e ekrany - dostosuj karty */
@media (max-width: 480px) {
    .history-row-extended {
        padding: 10px;
        margin-bottom: 8px;
    }
    
    .history-row-extended > div {
        font-size: 0.75rem;
        padding: 5px 0;
    }
    
    .history-thumbnail {
        max-width: 80px;
        max-height: 80px;
    }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   USERS.PHP - RESPONSIVE STYLES
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* Wrapper z overflow dla szerokiej tabeli */
.u-overflow-auto {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
}

@media (max-width: 768px) {
    /* Grid layout - jednkolumnowy na mobile */
    [style*="grid-template-columns: 400px 1fr"] {
        display: flex !important;
        flex-direction: column !important;
        gap: 16px !important;
    }
    
    /* Lewa kolumna - formularze */
    [style*="grid-template-columns: 400px 1fr"] > div:first-child {
        width: 100% !important;
    }
    
    /* Tabela uĹĽytkownikĂłw - dodaj scroll */
    .u-overflow-auto {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .u-overflow-auto .material-table {
        min-width: 800px; /* Zapobiegaj zgnieceniu kolumn */
        font-size: 0.8rem;
    }
    
    .u-overflow-auto .material-table th,
    .u-overflow-auto .material-table td {
        padding: 8px 6px;
        font-size: 0.75rem;
    }
    
    .u-overflow-auto .material-table input,
    .u-overflow-auto .material-table select {
        font-size: 0.7rem !important;
        padding: 2px 4px !important;
        min-width: 80px;
    }
    
    /* Przyciski akcji mniejsze */
    .u-overflow-auto .material-table button {
        font-size: 0.7rem !important;
        padding: 3px 6px !important;
        min-width: 32px;
    }
    
    /* Material-card na mobile - usuĹ„ dodatkowy margin */
    .material-content .material-card {
        margin-left: 0;
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    /* Bardzo maĹ‚e ekrany - jeszcze mniejsze czcionki */
    .u-overflow-auto .material-table {
        min-width: 700px;
        font-size: 0.7rem;
    }
    
    .u-overflow-auto .material-table th,
    .u-overflow-auto .material-table td {
        padding: 6px 4px;
        font-size: 0.65rem;
    }
    
    .u-overflow-auto .material-table input,
    .u-overflow-auto .material-table select {
        font-size: 0.65rem !important;
        padding: 1px 2px !important;
        min-width: 70px;
    }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   USERS TABLE - SZCZEGĂ“ĹOWA OPTYMALIZACJA
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */

/* Tabela uĹĽytkownikĂłw - desktop */
.u-overflow-auto .material-table th[style*="width: 40px"],
.u-overflow-auto .material-table th[style*="width: 120px"],
.u-overflow-auto .material-table th[style*="width: 80px"] {
    white-space: nowrap;
    font-size: 0.8rem;
    padding: 8px 4px;
}

/* Kolumna Rola - zmniejsz select */
.u-overflow-auto .material-table select[name="role"] {
    min-width: 95px !important; /* Mieszkaniec = 10 liter */
    width: 95px !important;
    font-size: 0.75rem !important;
    padding: 3px 4px !important;
}

/* Kolumna Dom - zmniejsz select */
.u-overflow-auto .material-table select[name="house_id"] {
    min-width: 60px !important;
    width: auto !important;
    max-width: 80px !important;
    font-size: 0.75rem !important;
    padding: 3px 4px !important;
}

/* Kolumna Email/Telefon */
.u-overflow-auto .material-table input[type="email"],
.u-overflow-auto .material-table input[name="phone"] {
    min-width: 100px !important;
    font-size: 0.75rem !important;
    padding: 3px 4px !important;
}

/* Kolumna Nowe hasĹ‚o - 2 inputy w pionie */
.u-overflow-auto .material-table input[name="new_password"],
.u-overflow-auto .material-table input[name="new_password2"] {
    min-width: 100px !important;
    width: 100% !important;
    font-size: 0.7rem !important;
    padding: 3px 4px !important;
    margin-bottom: 2px !important;
}

/* Przyciski đź’ľ đź—‘ď¸Ź */
.u-overflow-auto .material-table button[name="update_user"],
.u-overflow-auto .material-table button[name="delete_user"] {
    font-size: 0.8rem !important;
    padding: 4px 6px !important;
    min-width: 30px !important;
    height: 26px !important;
    line-height: 1;
}

@media (max-width: 1200px) {
    /* Ĺšrednie ekrany - zmniejsz tabelÄ™ */
    .u-overflow-auto .material-table {
        font-size: 0.75rem;
    }
    
    .u-overflow-auto .material-table th,
    .u-overflow-auto .material-table td {
        padding: 6px 3px;
        font-size: 0.7rem;
    }
    
    .u-overflow-auto .material-table select[name="role"] {
        min-width: 85px !important;
        width: 85px !important;
        font-size: 0.7rem !important;
    }
    
    .u-overflow-auto .material-table select[name="house_id"] {
        min-width: 50px !important;
        max-width: 70px !important;
        font-size: 0.7rem !important;
    }
    
    .u-overflow-auto .material-table input[name="new_password"],
    .u-overflow-auto .material-table input[name="new_password2"] {
        min-width: 90px !important;
        font-size: 0.65rem !important;
        padding: 2px 3px !important;
    }
    
    .u-overflow-auto .material-table button {
        font-size: 0.7rem !important;
        padding: 3px 5px !important;
        height: 24px !important;
    }
}

@media (max-width: 768px) {
    /* Mobile - maksymalna kompresja */
    .u-overflow-auto .material-table {
        min-width: 700px; /* Zmniejsz minimalnÄ… szerokoĹ›Ä‡ */
        font-size: 0.65rem;
    }
    
    .u-overflow-auto .material-table th,
    .u-overflow-auto .material-table td {
        padding: 5px 2px;
        font-size: 0.6rem;
    }
    
    .u-overflow-auto .material-table select[name="role"] {
        min-width: 75px !important;
        width: 75px !important;
        font-size: 0.6rem !important;
        padding: 2px 2px !important;
    }
    
    .u-overflow-auto .material-table select[name="house_id"] {
        min-width: 45px !important;
        max-width: 60px !important;
        font-size: 0.6rem !important;
        padding: 2px 2px !important;
    }
    
    .u-overflow-auto .material-table input[type="email"],
    .u-overflow-auto .material-table input[name="phone"] {
        min-width: 80px !important;
        font-size: 0.6rem !important;
        padding: 2px 2px !important;
    }
    
    .u-overflow-auto .material-table input[name="new_password"],
    .u-overflow-auto .material-table input[name="new_password2"] {
        min-width: 80px !important;
        font-size: 0.6rem !important;
        padding: 2px 2px !important;
        margin-bottom: 1px !important;
    }
    
    .u-overflow-auto .material-table button {
        font-size: 0.65rem !important;
        padding: 2px 4px !important;
        min-width: 26px !important;
        height: 22px !important;
    }
    
    /* ID kolumna - bardzo wÄ…ska */
    .u-overflow-auto .material-table td:first-child {
        font-size: 0.55rem;
        padding: 2px;
    }
}

@media (max-width: 480px) {
    /* Ekstra maĹ‚e telefony */
    .u-overflow-auto .material-table {
        min-width: 600px; /* Jeszcze bardziej zmniejsz */
        font-size: 0.6rem;
    }
    
    .u-overflow-auto .material-table th,
    .u-overflow-auto .material-table td {
        padding: 4px 1px;
        font-size: 0.55rem;
    }
    
    .u-overflow-auto .material-table select[name="role"] {
        min-width: 70px !important;
        width: 70px !important;
        font-size: 0.55rem !important;
    }
    
    .u-overflow-auto .material-table select[name="house_id"] {
        min-width: 40px !important;
        max-width: 55px !important;
        font-size: 0.55rem !important;
    }
    
    .u-overflow-auto .material-table input {
        min-width: 70px !important;
        font-size: 0.55rem !important;
        padding: 1px 2px !important;
    }
    
    .u-overflow-auto .material-table button {
        font-size: 0.6rem !important;
        padding: 2px 3px !important;
        min-width: 24px !important;
        height: 20px !important;
    }
}

/* â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•
   USERS TILES - KAFELKI UĹ»YTKOWNIKĂ“W (jak water.php)
   â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â•â• */


[data-theme="dark"] .water-comparison-warning-banner.critical .banner-icon,
.dark-theme .water-comparison-warning-banner.critical .banner-icon {
    color: #dc3545 !important;
    background: transparent !important;
}

/* ============================================
   MONTH PICKER - Custom Modal Picker
   ============================================ */

/* Modal Overlay */
.month-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    gap: 16px;
    padding: 20px;
}

.forecast-method-card {
    background: rgba(106, 92, 255, 0.03);
    border: 1px solid rgba(106, 92, 255, 0.1);
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}

.method-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 12px;
}

.method-icon {
    font-size: 1.5rem;
}

.method-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--md-primary) !important;
    margin-bottom: 8px;
}

.method-weight {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.forecast-calculation {
    padding: 16px;
    background: rgba(25, 118, 210, 0.05);
    border-radius: 12px;
    border-left: 4px solid var(--md-primary);
    margin: 16px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-size: 0.95rem;
}

.forecast-calculation div {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.forecast-final {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 2px solid var(--md-primary-light);
    font-size: 1.1rem !important;
    color: var(--md-primary) !important;
    font-weight: 600;
}

/* Alerty */
.water-forecast-alerts {
    margin-top: 24px;
    padding: 20px;
    background: rgba(255, 243, 205, 0.15);
    border-radius: 12px;
}

.water-forecast-alerts h3 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

.alert-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: white;
    border-left: 4px solid;
    border-radius: 8px;
    margin-bottom: 12px;
}

.alert-card:last-child {
    margin-bottom: 0;
}

.alert-critical {
    border-left-color: #f44336;
    background: rgba(244, 67, 54, 0.05);
}

.alert-warning {
    border-left-color: #ff9800;
    background: rgba(255, 152, 0, 0.05);
}

.alert-info {
    border-left-color: #2196f3;
    background: rgba(33, 150, 243, 0.05);
}

.alert-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.alert-content {
    flex: 1;
}

.alert-message {
    font-weight: 500;
    margin-bottom: 4px;
}

.alert-type {
    font-size: 0.75rem;
    text-transform: uppercase;
    opacity: 0.6;
}

/* Rekomendacje - Material Design */
.water-forecast-recommendations {
    margin-top: 24px;
    padding: 20px;
    background: var(--md-surface-variant);
    border-radius: 12px;
    border: 1px solid var(--md-outline-variant);
}

.water-forecast-recommendations h3 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    color: var(--md-on-surface);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.recommendation-card {
    padding: 16px;
    background: var(--md-surface);
    border-radius: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--md-outline-variant);
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.recommendation-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    transform: translateY(-1px);
}

.recommendation-card:last-child {
    margin-bottom: 0;
}

/* Priority colors - Material Design compliant (NO GRADIENTS) */
.recommendation-card.priority-high {
    border-left: 4px solid #d32f2f; /* Material Red 700 */
    background: rgba(244, 67, 54, 0.08); /* Solid subtle background */
}

.recommendation-card.priority-medium {
    border-left: 4px solid #f57c00; /* Material Orange 700 */
    background: rgba(255, 152, 0, 0.08); /* Solid subtle background */
}

.recommendation-card.priority-low {
    border-left: 4px solid #388e3c; /* Material Green 700 */
    background: rgba(76, 175, 80, 0.08); /* Solid subtle background */
}

.recommendation-card.priority-info {
    border-left: 4px solid #1976d2; /* Material Blue 700 */
    background: rgba(25, 118, 210, 0.08); /* Solid subtle background */
}

.rec-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.rec-title strong {
    color: var(--md-on-surface);
    font-weight: 600;
    font-size: 0.95rem;
}

.rec-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.rec-description {
    font-size: 0.9rem;
    color: var(--md-on-surface-variant);
    line-height: 1.4;
    margin-left: 32px; /* WyrĂłwnanie z tytuĹ‚em */
}

/* Dark mode specific adjustments */
@media (prefers-color-scheme: dark) {
    .recommendation-card {
        box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    }
    
    .recommendation-card:hover {
        box-shadow: 0 2px 8px rgba(0,0,0,0.4);
    }
    
    .recommendation-card.priority-high {
        background: rgba(244, 67, 54, 0.12); /* Solid background for dark mode */
    }
    
    .recommendation-card.priority-medium {
        background: rgba(255, 152, 0, 0.12); /* Solid background for dark mode */
    }
    
    .recommendation-card.priority-low {
        background: rgba(76, 175, 80, 0.12); /* Solid background for dark mode */
    }
    
    .recommendation-card.priority-info {
        background: rgba(25, 118, 210, 0.12); /* Solid background for dark mode */
    }
}

/* Manual dark mode class support */
.dark-theme .recommendation-card {
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.dark-theme .recommendation-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.dark-theme .recommendation-card.priority-high {
    background: rgba(244, 67, 54, 0.12); /* Solid background for dark mode */
}

.dark-theme .recommendation-card.priority-medium {
    background: rgba(255, 152, 0, 0.12); /* Solid background for dark mode */
}

.dark-theme .recommendation-card.priority-low {
    background: rgba(76, 175, 80, 0.12); /* Solid background for dark mode */
}

.dark-theme .recommendation-card.priority-info {
    background: rgba(25, 118, 210, 0.12); /* Solid background for dark mode */
}

/* Historia dokďż˝adnoďż˝ci */
.water-accuracy-history .material-table {
    margin: 0;
}

.water-accuracy-history .material-table th,
.water-accuracy-history .material-table td {
    padding: 12px;
    text-align: left;
}

.water-accuracy-history .material-table th:last-child,
.water-accuracy-history .material-table td:last-child {
    text-align: center;
}

/* Stara sekcja mobilna usuniÄ™ta - zastÄ…piona nowÄ… Material Design na koĹ„cu pliku */

@media (max-width: 480px) {
    .water-forecast-summary {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .forecast-calculation div {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
}

/* Wykres trendu wody */
.water-forecast-chart-container {
    margin-top: 24px;
    padding: 20px;
    background: rgba(33, 150, 243, 0.03);
    border-radius: 12px;
    border: 1px solid rgba(33, 150, 243, 0.1);
}

.water-forecast-chart-container h3 {
    margin: 0 0 16px 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* Kontrola nieszczelnoĹ›ci wody */
/* Alerty porĂłwnania - CZYTELNE kolory dla rĂłĹĽnych poziomĂłw */
.water-comparison-alert {
    margin: 16px 0;
    padding: 24px;
    border-radius: 12px;
    border: 2px solid;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* SUCCESS - zielony */
.water-comparison-alert.success {
    background: #d1e7dd;
    color: #0f5132;
    border-color: #198754;
}

.water-comparison-alert.success .water-comparison-header strong {
    color: #0f5132;
}

.water-comparison-alert.success .comparison-percentage {
    background: #198754;
    color: #fff;
}

/* WARNING - ĹĽĂłĹ‚ty */
.water-comparison-alert.warning {
    background: #fff3cd;
    color: #664d03;
    border-color: #ffc107;
}

.water-comparison-alert.warning .water-comparison-header strong {
    color: #664d03;
}

.water-comparison-alert.warning .comparison-percentage {
    background: #ffc107;
    color: #000;
}

/* DANGER - pomaraĹ„czowy */
.water-comparison-alert.danger {
    background: #ffe5d0;
    color: #984c0c;
    border-color: #fd7e14;
}

.water-comparison-alert.danger .water-comparison-header strong {
    color: #984c0c;
}

.water-comparison-alert.danger .comparison-percentage {
    background: #fd7e14;
    color: #fff;
}

/* CRITICAL - czerwony */
.water-comparison-alert.critical {
    background: #f8d7da;
    color: #721c24;
    border-color: #dc3545;
    border-width: 3px;
}

.water-comparison-alert.critical .water-comparison-header strong {
    color: #721c24;
    font-weight: 700;
}

.water-comparison-alert.critical .comparison-percentage {
    background: #dc3545;
    color: #fff;
    font-weight: 800;
}

/* Dark mode - WYMUSZAMY TEN SAM STYL co light mode */
[data-theme="dark"] .water-comparison-alert.success,
[data-theme="dark"] .water-comparison-alert.success *,
.dark-theme .water-comparison-alert.success,
.dark-theme .water-comparison-alert.success * {
    background: #d1e7dd !important;
    color: #0f5132 !important;
    border-color: #198754 !important;
}

[data-theme="dark"] .water-comparison-alert.warning,
[data-theme="dark"] .water-comparison-alert.warning *,
.dark-theme .water-comparison-alert.warning,
.dark-theme .water-comparison-alert.warning * {
    background: #fff3cd !important;
    color: #664d03 !important;
    border-color: #ffc107 !important;
}

[data-theme="dark"] .water-comparison-alert.danger,
[data-theme="dark"] .water-comparison-alert.danger *,
.dark-theme .water-comparison-alert.danger,
.dark-theme .water-comparison-alert.danger * {
    background: #ffe5d0 !important;
    color: #984c0c !important;
    border-color: #fd7e14 !important;
}

[data-theme="dark"] .water-comparison-alert.critical,
[data-theme="dark"] .water-comparison-alert.critical *,
.dark-theme .water-comparison-alert.critical,
.dark-theme .water-comparison-alert.critical * {
    background: #f8d7da !important;
    color: #721c24 !important;
    border-color: #dc3545 !important;
}

/* Nagłówek alertu porównania - mocne kolory */
.water-comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 2px solid currentColor;
    opacity: 0.8;
}

.water-comparison-header strong {
    font-size: 1.2rem;
    font-weight: 700;
}

.comparison-percentage {
    font-weight: 800;
    font-size: 1.3rem;
    padding: 8px 16px;
    border-radius: 8px;
}

/* WiadomoĹ›Ä‡ alertu */
.water-comparison-message {
    margin-bottom: 16px;
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.5;
    opacity: 0.95;
}

/* Breakdown elementĂłw - MOCNE kolory i kontrast */
.water-comparison-breakdown {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 16px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

.breakdown-label {
    font-size: 1rem;
    font-weight: 600;
    color: inherit;
    opacity: 0.9;
}

.breakdown-value {
    font-weight: 800;
    font-size: 1.2rem;
    color: inherit;
}

.breakdown-value.text-success {
    color: #198754;
}

.breakdown-value.text-danger {
    color: #dc3545;
}

/* Dark mode dla breakdown - WYMUSZAMY jasne tło */
[data-theme="dark"] .breakdown-item,
[data-theme="dark"] .breakdown-item *,
.dark-theme .breakdown-item,
.dark-theme .breakdown-item * {
    background: #f8f9fa !important;
    border-color: #dee2e6 !important;
    color: #212529 !important;
}

[data-theme="dark"] .breakdown-label,
.dark-theme .breakdown-label {
    color: #495057 !important;
}

[data-theme="dark"] .breakdown-value,
.dark-theme .breakdown-value {
    color: #212529 !important;
}

[data-theme="dark"] .breakdown-value.text-success,
.dark-theme .breakdown-value.text-success {
    color: #198754 !important;
}

[data-theme="dark"] .breakdown-value.text-danger,
.dark-theme .breakdown-value.text-danger {
    color: #dc3545 !important;
}

/* Nagłówek alertu porównania - mocne kolory */
.water-comparison-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.comparison-percentage {
    font-weight: bold;
    font-size: 1.1rem;
}

.water-comparison-message {
    margin-bottom: 12px;
    font-style: italic;
}

.water-comparison-breakdown {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 12px;
}

.breakdown-item {
    display: flex;
    justify-content: space-between;
    padding: 4px 8px;
    background: rgba(255,255,255,0.7);
    border-radius: 4px;
}

.breakdown-label {
    font-weight: 500;
}

.breakdown-value {
    font-weight: bold;
}

.breakdown-value.text-danger {
    color: #dc3545;
}

.breakdown-value.text-success {
    color: #28a745;
}

/* Legenda porĂłwnania */
.water-comparison-legend {
    margin-top: 16px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 6px;
}

.water-comparison-legend h4 {
    margin: 0 0 8px 0;
    font-size: 0.9rem;
    color: var(--md-text-muted);
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.legend-item {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.legend-item.success {
    background: #d4edda;
    color: #155724;
}

.legend-item.warning {
    background: #fff3cd;
    color: #856404;
}

.legend-item.danger {
    background: #f8d7da;
    color: #721c24;
}

/* Banner ostrzeĹĽeĹ„ nad wykresem */
.water-comparison-warning-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    margin: 16px 0;
    border-radius: 8px;
    border-left: 4px solid;
    font-weight: 500;
}

.water-comparison-warning-banner.warning {
    background: #fff3cd;
    border-left-color: #ffc107;
    color: #856404;
}

.water-comparison-warning-banner.danger {
    background: #f8d7da;
    border-left-color: #fd7e14;
    color: #721c24;
}

.water-comparison-warning-banner.critical {
    background: #f8d7da;
    border-left-color: #dc3545;
    color: #721c24;
    animation: pulse 2s infinite;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
}

.banner-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.banner-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.banner-content strong {
    font-size: 1.05rem;
}

.banner-content span {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Animacja dla krytycznych alertĂłw */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.8; }
    100% { opacity: 1; }
}

/* ======================
   MATERIAL DESIGN UPDATES 
   ====================== */

/* Selektor okresu porĂłwnania - Material Design */
.water-comparison-period-selector {
    display: flex;
    align-items: end;
    gap: 16px;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--md-surface);
    border: 1px solid var(--md-outline-variant);
    border-radius: 12px;
}

.period-input-container {
    flex: 1;
    position: relative;
}

.period-button-container {
    display: flex;
    align-items: flex-end;
}

.water-comparison-period-selector .material-label {
    color: var(--md-on-surface);
    font-weight: 500;
}

.water-comparison-period-selector .material-input {
    background: var(--md-surface-variant);
    border: 1px solid var(--md-outline);
    color: var(--md-on-surface);
}

.water-comparison-period-selector .material-input:focus {
    border-color: var(--md-primary);
    box-shadow: 0 0 0 2px rgba(25, 118, 210, 0.2);
}

.water-comparison-period-selector .material-btn.secondary {
    background: var(--md-surface-variant);
    color: var(--md-on-surface-variant);
    border: 1px solid var(--md-outline);
}

.water-comparison-period-selector .material-btn.secondary:hover {
    background: var(--md-primary);
    color: var(--md-on-primary);
    border-color: var(--md-primary);
}

/* Prognoza bazowa i finalna - Light Mode */
.forecast-calculation {
    padding: 16px;
    background: rgba(25, 118, 210, 0.05); /* Material Blue 500 alpha */
    border-radius: 12px;
    border-left: 4px solid var(--md-primary);
    margin: 16px 0;
}

.method-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--md-primary) !important; /* Material Blue zamiast fioletu */
    margin-bottom: 8px;
}

.forecast-final {
    margin-top: 8px;
    padding-top: 12px;
    border-top: 2px solid var(--md-primary-light);
    font-size: 1.1rem !important;
    color: var(--md-primary) !important; /* Material Blue zamiast fioletu */
    font-weight: 600;
}

/* Legenda porĂłwnania - Material Design */
.water-comparison-legend {
    margin-top: 16px;
    padding: 16px;
    background: var(--md-surface-variant);
    border-radius: 12px;
    border: 1px solid var(--md-outline-variant);
}

.water-comparison-legend h4 {
    margin: 0 0 12px 0;
    font-size: 1rem;
    color: var(--md-on-surface);
    font-weight: 500;
}

.legend-items {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Pastylki/Badge interpretacji - Material Design bez gradientĂłw */
.legend-item {
    padding: 6px 12px;
    border-radius: 20px; /* Rounded pills jak Badge */
    font-size: 0.8rem;
    font-weight: 600;
    border: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.legend-item.legend-success {
    background: #4caf50; /* Material Green 500 - solid color */
    color: white;
}

.legend-item.legend-warning {
    background: #ff9800; /* Material Orange 500 - solid color */
    color: white;
}

.legend-item.legend-danger {
    background: #f44336; /* Material Red 500 - solid color */
    color: white;
}

.legend-item.legend-critical {
    background: #d32f2f; /* Material Red 700 - darker for critical */
    color: white;
    animation: pulse-legend 2s infinite;
}

@keyframes pulse-legend {
    0%, 100% { box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(244, 67, 54, 0.1); }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .forecast-calculation {
        background: rgba(25, 118, 210, 0.1);
        border-left-color: var(--md-primary-light);
    }
    
    /* Dark mode pastylki - solid colors, readable */
    .legend-item.legend-success {
        background: #66bb6a; /* Material Green 400 - lighter but still solid */
        color: #1b5e20; /* Dark green text for contrast */
    }
    
    .legend-item.legend-warning {
        background: #ffb74d; /* Material Orange 300 - lighter but still solid */
        color: #e65100; /* Dark orange text for contrast */
    }
    
    .legend-item.legend-danger {
        background: #ef5350; /* Material Red 400 - lighter but still solid */
        color: #b71c1c; /* Dark red text for contrast */
    }
    
    .legend-item.legend-critical {
        background: #f44336; /* Material Red 500 - strong visibility */
        color: white;
    }
}

/* Manual Dark Mode Class Support */
.dark-theme .forecast-calculation {
    background: rgba(25, 118, 210, 0.1);
    border-left-color: var(--md-primary-light);
}

.dark-theme .legend-item.legend-success {
    background: #66bb6a; /* Material Green 400 */
    color: #1b5e20; /* Dark green text */
}

.dark-theme .legend-item.legend-warning {
    background: #ffb74d; /* Material Orange 300 */
    color: #e65100; /* Dark orange text */
}

.dark-theme .legend-item.legend-danger {
    background: #ef5350; /* Material Red 400 */
    color: #b71c1c; /* Dark red text */
}

.dark-theme .legend-item.legend-critical {
    background: #f44336; /* Material Red 500 */
    color: white;
}

@media (max-width: 768px) {
    .water-forecast-chart-container {
        padding: 16px;
    }
    
    .water-forecast-chart-container canvas {
        max-height: 250px !important;
    }
    
    .water-comparison-breakdown {
        grid-template-columns: 1fr;
    }
    
    .legend-items {
        flex-direction: column;
    }
    
    /* Rekomendacje mobile */
    .water-forecast-recommendations {
        padding: 16px;
        margin-top: 16px;
    }
    
    .recommendation-card {
        padding: 12px;
        margin-bottom: 8px;
    }
    
    .rec-description {
        margin-left: 0; /* UsuĹ„ wciÄ™cie na mobile */
        margin-top: 8px;
        font-size: 0.85rem;
    }
    
    .rec-title {
        gap: 8px;
        flex-wrap: wrap;
    }
    
    .rec-icon {
        font-size: 1.1rem;
    }
    
    /* Banner okresu mobile */
    .water-comparison-alert {
        padding: 16px;
    }
    
    .water-comparison-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .comparison-percentage {
        align-self: flex-end;
    }
    
    .breakdown-item {
        padding: 6px 10px;
        font-size: 0.85rem;
    }
}

/* =================== WATER COMPARISON BANNERS =================== */

/* Poprawione style banerĂłw ostrzeĹĽeĹ„ z CZYTELNYMI kolorami */
.water-comparison-warning-banner {
    padding: 14px 18px;
    border-radius: 8px;
    margin: 12px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    border: 2px solid;
    display: flex;
    align-items: flex-start;
    gap: 12px;
}

.water-comparison-warning-banner .banner-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    line-height: 1;
}

.water-comparison-warning-banner .banner-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.water-comparison-warning-banner .banner-content strong {
    font-size: 1.1rem;
    font-weight: 700;
}

.water-comparison-warning-banner .banner-content span {
    font-size: 0.95rem;
}

/* WARNING - ĹĽĂłĹ‚ty */
.water-comparison-warning-banner.warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #664d03;
}

.water-comparison-warning-banner.warning .banner-icon {
    color: #ffc107;
}

/* DANGER - pomaraĹ„czowy */
.water-comparison-warning-banner.danger {
    background: #ffe5d0;
    border-color: #fd7e14;
    color: #984c0c;
}

.water-comparison-warning-banner.danger .banner-icon {
    color: #fd7e14;
}

/* CRITICAL - czerwony z mocnym kontrastem */
.water-comparison-warning-banner.critical {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
    border-width: 3px;
}

.water-comparison-warning-banner.critical .banner-icon {
    color: #dc3545;
}

.water-comparison-warning-banner.critical strong {
    font-size: 1.15rem;
}

/* Dark mode dla banerów - WYMUSZAMY takie same kolory jak light mode */
[data-theme="dark"] .water-comparison-warning-banner.warning,
[data-theme="dark"] .water-comparison-warning-banner.warning *,
.dark-theme .water-comparison-warning-banner.warning,
.dark-theme .water-comparison-warning-banner.warning * {
    background: #fff3cd !important;
    border-color: #ffc107 !important;
    color: #664d03 !important;
}

[data-theme="dark"] .water-comparison-warning-banner.warning .banner-icon,
.dark-theme .water-comparison-warning-banner.warning .banner-icon {
    color: #ffc107 !important;
    background: transparent !important;
}

[data-theme="dark"] .water-comparison-warning-banner.danger,
[data-theme="dark"] .water-comparison-warning-banner.danger *,
.dark-theme .water-comparison-warning-banner.danger,
.dark-theme .water-comparison-warning-banner.danger * {
    background: #ffe5d0 !important;
    border-color: #fd7e14 !important;
    color: #984c0c !important;
}

[data-theme="dark"] .water-comparison-warning-banner.danger .banner-icon,
.dark-theme .water-comparison-warning-banner.danger .banner-icon {
    color: #fd7e14 !important;
    background: transparent !important;
}

[data-theme="dark"] .water-comparison-warning-banner.critical,
[data-theme="dark"] .water-comparison-warning-banner.critical *,
.dark-theme .water-comparison-warning-banner.critical,
.dark-theme .water-comparison-warning-banner.critical * {
    background: #f8d7da !important;
    border-color: #dc3545 !important;
    color: #721c24 !important;
}

[data-theme="dark"] .water-comparison-warning-banner.critical .banner-icon,
.dark-theme .water-comparison-warning-banner.critical .banner-icon {
    color: #dc3545 !important;
    background: transparent !important;
}

/* ============================================
   MONTH PICKER - Custom Modal Picker
   ============================================ */

/* Modal Overlay */
.month-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Picker Container */
.month-picker-content {
    background: var(--md-surface);
    border-radius: var(--md-radius);
    padding: 20px;
    box-shadow: var(--md-shadow-lg);
    min-width: 300px;
    max-width: 400px;
    border: 1px solid var(--md-border);
}

[data-theme="dark"] .month-picker-content {
    background: #2c2c2c;
    border-color: #444;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

/* Title */
.month-picker-title {
    margin: 0 0 20px 0;
    text-align: center;
    color: var(--md-text-primary);
    font-weight: 500;
    font-size: 1.1rem;
}

[data-theme="dark"] .month-picker-title {
    color: #e0e0e0;
}

/* Year Container */
.month-picker-year-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    gap: 10px;
}

/* Year Buttons (arrows) */
.month-picker-year-btn {
    border: 1px solid var(--md-border);
    background: var(--md-surface-variant);
    color: var(--md-text-primary);
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: background 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.month-picker-year-btn:hover {
    background: var(--md-surface-container);
}

.month-picker-year-btn:active {
    opacity: 0.7;
}

[data-theme="dark"] .month-picker-year-btn {
    border-color: #555;
    background: #3a3a3a;
    color: #e0e0e0;
}

[data-theme="dark"] .month-picker-year-btn:hover {
    background: #4a4a4a;
}

/* Year Display */
.month-picker-year-display {
    font-weight: bold;
    min-width: 60px;
    text-align: center;
    color: var(--md-text-primary);
    font-size: 18px;
}

[data-theme="dark"] .month-picker-year-display {
    color: #e0e0e0;
}

/* Month Grid */
.month-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

/* Month Buttons */
.month-picker-month-btn {
    border: 1px solid var(--md-border);
    background: var(--md-surface);
    color: var(--md-text-primary);
    padding: 10px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.month-picker-month-btn:hover {
    background: var(--md-surface-container);
}

.month-picker-month-btn:active {
    opacity: 0.7;
    transform: scale(0.95);
}

.month-picker-month-btn.selected {
    background: var(--md-primary);
    color: white;
    border-color: var(--md-primary);
}

[data-theme="dark"] .month-picker-month-btn {
    border-color: #555;
    background: #3a3a3a;
    color: #e0e0e0;
}

[data-theme="dark"] .month-picker-month-btn:hover {
    background: #4a4a4a;
}

[data-theme="dark"] .month-picker-month-btn.selected {
    background: #2196F3;
    color: white;
    border-color: #2196F3;
}

/* Action Buttons Container */
.month-picker-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Cancel Button */
.month-picker-btn-cancel {
    border: 1px solid var(--md-border);
    background: var(--md-surface);
    color: var(--md-text-primary);
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.month-picker-btn-cancel:hover {
    background: var(--md-surface-container);
}

.month-picker-btn-cancel:active {
    opacity: 0.7;
}

[data-theme="dark"] .month-picker-btn-cancel {
    border-color: #555;
    background: #3a3a3a;
    color: #e0e0e0;
}

[data-theme="dark"] .month-picker-btn-cancel:hover {
    background: #4a4a4a;
}

/* OK Button */
.month-picker-btn-ok {
    border: none;
    background: var(--md-primary);
    color: white;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.month-picker-btn-ok:hover {
    background: var(--md-primary-dark);
}

.month-picker-btn-ok:active {
    opacity: 0.85;
    transform: scale(0.98);
}

[data-theme="dark"] .month-picker-btn-ok {
    background: #2196F3;
}

[data-theme="dark"] .month-picker-btn-ok:hover {
    background: #1976D2;
}

/* ============================================
   ROZWIJANE KARTY DOMÓW (payments.php)
   ============================================ */

.expandable-houses-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-start; /* Prevent vertical stretching */
}

/* .expandable-house-card działa w normalnym flow - bez position: relative */

.house-card-header {
    display: inline-flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 6px 16px;
    border-radius: 4px;
    gap: 8px;
    font-weight: 500;
    transition: opacity 0.2s, transform 0.1s;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation; /* Zapobiegnij double-tap zoom */
}

.house-card-header:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.house-card-header:active {
    transform: translateY(0);
    opacity: 0.85;
}

.expand-icon {
    transition: transform 0.3s ease;
    font-size: 0.8em;
    display: inline-block;
}

.house-card-content {
    /* Normalny flow zamiast position: absolute - przesuwa inne elementy */
    margin-top: 8px;
    padding: 12px;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .house-card-content {
    background: #2a2a2a !important;
    color: #e0e0e0 !important;
    border-color: #444 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.house-items-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.house-items-list li {
    padding: 6px 0;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #1a1a1a;
    font-size: 0.85em; /* Mniejszy font */
}

[data-theme="dark"] .house-items-list li {
    border-bottom-color: #444;
    color: #e0e0e0;
}

/* Nowy layout: Tytuł | Kwota | Pastylka */
.house-item-row {
    display: flex;
    align-items: flex-start; /* Align do góry, żeby kwota i pastylka były na górze gdy tytuł się zawija */
    gap: 8px;
    flex-wrap: nowrap; /* Nie zawijaj całego wiersza */
}

.house-item-row .item-title {
    flex: 1; /* Zajmie dostępne miejsce */
    color: #333;
    font-size: 0.85em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal; /* Pozwól na zawijanie tekstu */
    word-wrap: break-word;
    line-height: 1.3;
    min-width: 0; /* Ważne dla flex-shrink */
}

[data-theme="dark"] .house-item-row .item-title {
    color: #ccc;
}

.house-item-row .item-amount {
    color: #1a1a1a;
    font-weight: 600;
    font-size: 0.85em;
    white-space: nowrap;
    min-width: 60px; /* Zmniejszone z 70px */
    text-align: right;
    flex-shrink: 0; /* Nie zmniejszaj kwoty */
}

[data-theme="dark"] .house-item-row .item-amount {
    color: #fff;
}

.house-item-row .material-badge {
    flex-shrink: 0; /* Nie zmniejszaj pastylki */
    font-size: 0.65em; /* Zmniejszone z 0.7em */
    padding: 3px 6px; /* Zmniejszone z 3px 8px */
    white-space: nowrap;
}

/* Responsywność dla małych ekranów */
@media (max-width: 480px) {
    .house-item-row {
        gap: 6px; /* Mniejszy odstęp */
    }
    
    .house-item-row .item-title {
        font-size: 0.8em; /* Jeszcze mniejszy */
    }
    
    .house-item-row .item-amount {
        font-size: 0.8em;
        min-width: 50px;
    }
    
    .house-item-row .material-badge {
        font-size: 0.6em;
        padding: 2px 5px;
    }
}

.house-items-list li:last-child {
    border-bottom: none;
}

.loading-indicator {
    text-align: center;
    color: #666;
    padding: 8px;
    font-size: 0.9em;
}

[data-theme="dark"] .loading-indicator {
    color: #999;
}

/* Hinty pod inputami */
.input-hint {
    font-size: 0.85em;
    color: var(--md-text-secondary);
    margin-top: 4px;
}

/* Akcje formularza (przyciski) */
.form-actions {
    grid-column: 1 / -1;
    text-align: right;
}

/* Komunikat o sukcesie zapisu odczytu wody */
.water-reading-success {
    background: #e8f5e8;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    border-left: 4px solid var(--md-success);
}

[data-theme="dark"] .water-reading-success {
    background: rgba(76, 175, 80, 0.15);
}

/* ============================================
   BANK2 STYLES
   ============================================ */

.bank-accounts-header,
.bank-statements-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.bank-accounts-header h3,
.bank-statements-header h3 {
    margin: 0;
}

/* ============================================
   HOUSES STYLES
   ============================================ */

.house-card-title {
    margin-top: 0;
    color: var(--md-primary);
}

.house-card-title .material-pill {
    margin-left: 8px;
}

/* ============================================
   CUSTOM MONTH PICKER - MODAL SYSTEM
   Ujednolicony picker dla water.php, bank2.php, dashboard.php
   ============================================ */

/* Input field z ikoną kalendarza */
.custom-month-picker {
    cursor: pointer;
    position: relative;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23666"><path d="M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.1 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 20px 20px;
    padding-right: 35px;
}

.custom-month-picker:hover {
    background-color: var(--md-surface-container, #f5f5f5);
}

.custom-month-picker:focus {
    outline: 2px solid var(--md-primary, #2196F3);
    outline-offset: 1px;
}

/* Dark mode - jaśniejsza ikona */
[data-theme="dark"] .custom-month-picker {
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="%23b3b3b3"><path d="M9 11H7v2h2v-2zm4 0h-2v2h2v-2zm4 0h-2v2h2v-2zm2-7h-1V2h-2v2H8V2H6v2H5c-1.1 0-1.99.9-1.99 2L3 20c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 16H5V9h14v11z"/></svg>');
}

/* Modal overlay */
.month-picker-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Modal content */
.month-picker-content {
    background: var(--md-surface, white);
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: var(--md-shadow-lg, 0 10px 40px rgba(0, 0, 0, 0.3));
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { 
        transform: translateY(20px); 
        opacity: 0; 
    }
    to { 
        transform: translateY(0); 
        opacity: 1; 
    }
}

/* Tytuł modala */
.month-picker-title {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 500;
    text-align: center;
    color: var(--md-text-primary, #333);
}

/* Kontener nawigacji roku */
.month-picker-year-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: 20px;
}

/* Przyciski nawigacji roku */
.month-picker-year-btn {
    background: var(--md-primary, #2196F3);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 18px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.month-picker-year-btn:hover {
    background: var(--md-primary-dark, #1976D2);
}

/* Wyświetlacz roku */
.month-picker-year-display {
    font-size: 24px;
    font-weight: 700;
    min-width: 80px;
    text-align: center;
    color: var(--md-text-primary, #333);
}

/* Grid miesięcy */
.month-picker-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

/* Przyciski miesięcy */
.month-picker-month-btn {
    padding: 12px;
    background: var(--md-surface-container, #f5f5f5);
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    color: var(--md-text-primary, #333);
    text-transform: capitalize;
}

.month-picker-month-btn:hover {
    background: var(--md-primary-lighter, #e3f2fd);
    border-color: var(--md-primary, #2196F3);
}

.month-picker-month-btn.selected {
    background: var(--md-primary, #2196F3);
    color: white;
    border-color: var(--md-primary, #2196F3);
    font-weight: 500;
}

/* Kontener przycisków akcji */
.month-picker-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

/* Przycisk Anuluj */
.month-picker-btn-cancel {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    background: var(--md-surface-container, #f5f5f5);
    color: var(--md-text-secondary, #666);
}

.month-picker-btn-cancel:hover {
    background: var(--md-surface-container-high, #e0e0e0);
}

/* Przycisk OK */
.month-picker-btn-ok {
    padding: 10px 24px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    background: var(--md-primary, #2196F3);
    color: white;
}

.month-picker-btn-ok:hover {
    background: var(--md-primary-dark, #1976D2);
}

/* Dark mode dla month pickera */
[data-theme="dark"] .month-picker-modal {
    background: rgba(0, 0, 0, 0.75);
}

[data-theme="dark"] .month-picker-content {
    background: var(--md-surface, #2d2d2d);
}

[data-theme="dark"] .month-picker-title,
[data-theme="dark"] .month-picker-year-display {
    color: var(--md-text-primary, #e0e0e0);
}

[data-theme="dark"] .month-picker-month-btn {
    background: var(--md-surface-elevated, #3a3a3a);
    color: var(--md-text-primary, #e0e0e0);
}

[data-theme="dark"] .month-picker-month-btn:hover {
    background: #1e3a5f;
    border-color: var(--md-primary, #42a5f5);
}

[data-theme="dark"] .month-picker-month-btn.selected {
    background: var(--md-primary-dark, #1976D2);
    color: white;
}

[data-theme="dark"] .month-picker-btn-cancel {
    background: var(--md-surface-elevated, #3a3a3a);
    color: var(--md-text-primary, #e0e0e0);
}

[data-theme="dark"] .month-picker-btn-cancel:hover {
    background: var(--md-surface-container-high, #4a4a4a);
}

[data-theme="dark"] .month-picker-btn-ok:hover {
    background: var(--md-primary-darker, #0d47a1);
}

/* Mobile responsywność */
@media (max-width: 480px) {
    .month-picker-content {
        padding: 20px;
        max-width: 95%;
    }
    
    .month-picker-title {
        font-size: 18px;
    }
    
    .month-picker-year-display {
        font-size: 20px;
        min-width: 70px;
    }
    
    .month-picker-year-btn {
        width: 36px;
        height: 36px;
        font-size: 16px;
    }
    
    .month-picker-grid {
        gap: 6px;
    }
    
    .month-picker-month-btn {
        padding: 10px;
        font-size: 13px;
    }
}

/* ============================================
   LEGACY ACCORDION STYLES (from app.css)
   Used by admin_water.php
   ============================================ */

/* Accordion */
.acc {
    background: var(--md-surface);
    border: 1px solid var(--md-outline);
    border-radius: 12px;
    margin-bottom: 12px;
    overflow: hidden;
}

.acc summary {
    padding: 24px;
    cursor: pointer;
    user-select: none;
    list-style: none;
    background: var(--md-surface-variant);
    transition: 0.2s;
}

.acc summary:hover { 
    background: var(--md-surface-variant); 
}

.acc summary::-webkit-details-marker { 
    display: none; 
}

.acc-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: var(--md-text-primary);
}

.acc .chev {
    display: inline-block;
    transition: transform 0.3s;
    font-size: 1.25rem;
    color: var(--md-text-secondary);
}

.acc[open] .chev { 
    transform: rotate(90deg); 
}

.acc-body { 
    padding: 24px; 
    border-top: 1px solid var(--md-outline); 
    background: var(--md-surface);
}

/* Deprecated - use .stats-grid instead */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

/* Deprecated - use .card-grid instead */
.hist-responsive { 
    display: grid; 
    gap: 12px; 
}

.hist-card {
    background: var(--md-surface-variant);
    border: 1px solid var(--md-outline);
    border-radius: 8px;
    padding: 12px;
}

.hist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
}

.hist-item { 
    display: flex; 
    flex-direction: column; 
    gap: 4px; 
}

.hist-label { 
    font-size: 0.75rem; 
    color: var(--md-text-secondary); 
    font-weight: 600; 
    text-transform: uppercase; 
}

.hist-value { 
    font-size: 0.875rem; 
    color: var(--md-text-primary); 
}

.hist-thumb {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
}

.hist-thumb:hover { 
    transform: scale(1.05); 
}

.hist-form { 
    display: flex; 
    gap: 4px; 
    flex-wrap: wrap; 
}

.hist-actions { 
    grid-column: 1 / -1; 
}

.is-estimated {
    background: rgba(245,158,11,0.05) !important;
    border-color: #f59e0b !important;
}

.js-estimate { 
    cursor: pointer; 
    transition: all 0.2s; 
}

.js-estimate.is-on { 
    background: rgba(14,165,233,0.1); 
    border-color: #0ea5e9; 
}

/* Dark mode overrides for legacy accordion */
[data-theme="dark"] .acc {
    background: var(--md-surface);
    border-color: var(--md-outline);
}

[data-theme="dark"] .acc summary {
    background: var(--md-surface-variant);
}

[data-theme="dark"] .acc-body {
    background: var(--md-surface);
    border-top-color: var(--md-outline);
}

[data-theme="dark"] .hist-card {
    background: var(--md-surface-variant);
    border-color: var(--md-outline);
}


/* ===== WYKRESY ZUŻYCIA WODY (Chart.js) ===== */
.water-usage-chart-container {
    position: relative;
    width: 100%;
    height: 250px;
    margin-top: 16px;
}

@media (min-width: 768px) {
    .water-usage-chart-container {
        height: 300px;
    }
}

@media (min-width: 1024px) {
    .water-usage-chart-container {
        height: 350px;
    }
}

/* =============================================================================
   DASHBOARD PAYMENTS TABLE - MOBILE LAYOUT - OSTATECZNA WERSJA V4
   Desktop: normalna tabela z kolumną Status
   Mobile + Tablet (<= 768px): Status inline w Pozycja, 3 kolumny flexbox
   ============================================================================= */

/* DESKTOP (> 768px): Status badge inline ukryty, kolumna Status widoczna */
@media (min-width: 769px) {
    .payments-table .status-mobile-inline {
        display: none !important;
    }
    
    .payments-table .status-desktop-column {
        display: table-cell !important;
    }
}

/* MOBILE + TABLET (<= 768px): Status badge inline widoczny, kolumna Status ukryta */
@media (max-width: 768px) {
    /* Ukryj kolumnę Status na mobile */
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table thead th:last-child,
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table tbody .status-desktop-column {
        display: none !important;
    }
    
    /* RESET dla dashboard payments - NAJWYŻSZA SPECYFICZNOŚĆ */
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table thead {
        display: none !important;
    }
    
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table tbody tr {
        display: flex !important;
        flex-wrap: wrap !important;
        margin-bottom: 12px !important;
        border: 1px solid var(--md-border) !important;
        border-radius: 8px !important;
        padding: 0 !important;
        background: var(--md-surface) !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.08) !important;
        overflow: hidden !important;
        width: 100% !important;
    }
    
    /* ROW 1: Pozycja (nazwa + status badge inline) - 100% szerokości */
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table tbody tr td[data-label="Pozycja"] {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 100% !important;
        padding: 12px !important;
        background: rgba(0,0,0,0.02) !important;
        font-weight: 600 !important;
        font-size: 0.95rem !important;
        border-bottom: 1px solid var(--md-border) !important;
        word-wrap: break-word !important;
        white-space: normal !important;
        flex: 0 0 100% !important;
        order: 1 !important;
    }
    
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table tbody tr td[data-label="Pozycja"]:before {
        display: none !important;
    }
    
    /* Status badge inline - mała spacja przed */
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table tbody tr td[data-label="Pozycja"] .status-mobile-inline {
        display: inline-block !important;
        margin-left: 8px !important;
        font-size: 0.7rem !important;
        padding: 3px 8px !important;
        vertical-align: middle !important;
    }
    
    /* ROW 2: FLEXBOX 3-kolumnowy - Do zapłaty | Zapłacono | Saldo */
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table tbody tr td[data-label="Do zapłaty"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 calc(33.333% - 1px) !important;
        min-width: calc(33.333% - 1px) !important;
        max-width: calc(33.333% - 1px) !important;
        padding: 12px 4px !important;
        text-align: center !important;
        box-sizing: border-box !important;
        font-weight: 700 !important;
        color: var(--md-text-primary) !important;
        border: none !important;
        border-right: 1px solid var(--md-border) !important;
        margin: 0 !important;
        order: 2 !important;
    }
    
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table tbody tr td[data-label="Zapłacono"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 calc(33.333% - 1px) !important;
        min-width: calc(33.333% - 1px) !important;
        max-width: calc(33.333% - 1px) !important;
        padding: 12px 4px !important;
        text-align: center !important;
        box-sizing: border-box !important;
        font-weight: 700 !important;
        color: var(--md-text-primary) !important;
        border: none !important;
        border-right: 1px solid var(--md-border) !important;
        margin: 0 !important;
        order: 3 !important;
    }
    
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table tbody tr td[data-label="Saldo"] {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
        flex: 0 0 calc(33.333% - 1px) !important;
        min-width: calc(33.333% - 1px) !important;
        max-width: calc(33.333% - 1px) !important;
        padding: 12px 4px !important;
        text-align: center !important;
        box-sizing: border-box !important;
        font-weight: 700 !important;
        color: var(--md-text-primary) !important;
        border: none !important;
        margin: 0 !important;
        order: 4 !important;
    }
    
    /* Labele nad wartościami */
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table tbody tr td[data-label="Do zapłaty"]:before,
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table tbody tr td[data-label="Zapłacono"]:before,
    body .material-card .table-responsive .payments-table.mobile-responsive.material-table tbody tr td[data-label="Saldo"]:before {
        content: attr(data-label) !important;
        display: block !important;
        position: static !important;
        width: auto !important;
        font-weight: 600 !important;
        font-size: 0.65rem !important;
        color: var(--md-text-secondary) !important;
        margin-bottom: 4px !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        line-height: 1.2 !important;
    }
    
    /* ===== UNIWERSALNY FALLBACK dla WSZYSTKICH tabel mobile-responsive ===== */
    /* Każdy TD z data-label który NIE jest obsłużony powyżej → display: block + label */
    body .material-card .table-responsive .material-table.mobile-responsive.payments-table tbody tr td[data-label]:not([data-label="Pozycja"]):not([data-label="Status"]):not([data-label="Do zapłaty"]):not([data-label="Zapłacono"]):not([data-label="Saldo"]) {
        display: block !important;
        flex: none !important;
        width: 100% !important;
        padding: 10px 12px !important;
        text-align: left !important;
        border: none !important;
        border-bottom: 1px solid rgba(0,0,0,0.05) !important;
        box-sizing: border-box !important;
    }
    
    /* Pokaż label przed wartością */
    body .material-card .table-responsive .material-table.mobile-responsive.payments-table tbody tr td[data-label]:not([data-label="Pozycja"]):not([data-label="Status"]):not([data-label="Do zapłaty"]):not([data-label="Zapłacono"]):not([data-label="Saldo"]):before {
        content: attr(data-label) ": " !important;
        display: inline-block !important;
        font-weight: 600 !important;
        font-size: 0.75rem !important;
        color: var(--md-text-secondary) !important;
        margin-right: 8px !important;
        min-width: 110px !important;
    }
    
    /* Pierwsza kolumna = nagłówek karty (bez labela) */
    body .material-card .table-responsive .material-table.mobile-responsive.payments-table tbody tr td[data-label]:first-child:not([data-label="Pozycja"]) {
        background: rgba(0,0,0,0.03) !important;
        font-weight: 600 !important;
        font-size: 0.95rem !important;
        padding: 12px !important;
        border-bottom: 2px solid var(--md-border) !important;
    }
    
    body .material-card .table-responsive .material-table.mobile-responsive.payments-table tbody tr td[data-label]:first-child:not([data-label="Pozycja"]):before {
        content: "" !important;
        display: none !important;
    }
}

/* ==========================================
   PAYMENTS PAGE - FILTRY NA MOBILE
   ========================================== */
/* Wymusza 2 kolumny dla filtrów płatności nawet na mobile */
@media (max-width: 768px) {
    #payments-filter-form.material-grid-2 {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
    }
    
    /* Miesiąc i Dom w formularzu księgowania obok siebie */
    #single-payment-month-house-row.material-grid-2 {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
    }
    
    /* Kwota i przycisk w jednym wierszu - grid layout */
    #single-payment-amount-submit-row.material-grid-2 {
        grid-template-columns: 0.8fr 1.2fr !important;
        gap: 8px;
        align-items: end !important;
    }
    
    #single-payment-amount-submit-row input {
        height: 44px !important;
    }
    
    #single-payment-submit-btn {
        font-size: 0.85rem !important;
        padding: 0 12px !important;
        white-space: nowrap !important;
        height: 44px !important;
    }
}

/* ==========================================
   INVOICES PAGE - STATYSTYKI
   ========================================== */
/* Zmniejszone kafle statystyk - 4 w rzędzie na desktop, 2x2 na mobile */
.invoice-stat-card {
    padding: 12px !important;
    min-height: auto !important;
}

/* Średnie ekrany (tablety) - 2x2 */
@media (max-width: 1024px) {
    #invoice-stats-grid.material-grid-4 {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
    }
}

/* Małe ekrany (mobile) - 2x2 z mniejszym paddingiem */
@media (max-width: 768px) {
    #invoice-stats-grid.material-grid-4 {
        grid-template-columns: 1fr 1fr !important;
        gap: 12px;
    }
    
    .invoice-stat-card {
        padding: 10px !important;
    }
}


/* ========================================
   UMOWA.PHP - STYLE DLA SEKCJI ZMIAN
======================================== */

/* Sekcja podświetlenia "Co się zmienia?" */
.umowa-highlight-box {
    margin-top: 24px;
    padding: 20px;
    background: var(--md-primary-container, #e3f2fd);
    border-radius: 8px;
    border-left: 4px solid var(--md-primary);
    color: var(--md-on-surface);
}

.umowa-highlight-box h3 {
    margin-top: 0;
    color: var(--md-primary);
    font-size: 1.3rem;
}

.umowa-highlight-box ol {
    line-height: 1.8;
    font-size: 1rem;
    margin: 12px 0;
    padding-left: 24px;
    color: var(--md-on-surface);
}

.umowa-highlight-box ol li {
    margin-bottom: 12px;
    color: var(--md-on-surface);
}

.umowa-highlight-box ol li strong {
    color: var(--md-on-surface);
    font-weight: 600;
}

.umowa-highlight-box ol li br + em {
    color: var(--md-primary);
    font-size: 0.9em;
}

.umowa-highlight-box p {
    margin: 16px 0 0 0;
    font-style: italic;
    color: var(--md-on-surface-variant);
    border-top: 1px solid var(--md-divider);
    padding-top: 12px;
}

/* Dark mode dla sekcji zmian */
[data-theme="dark"] .umowa-highlight-box {
    background: rgba(144, 202, 249, 0.15);
    border-left-color: var(--md-primary);
    color: var(--md-on-surface);
}

[data-theme="dark"] .umowa-highlight-box h3 {
    color: var(--md-primary-light, #90caf9);
}

[data-theme="dark"] .umowa-highlight-box ol {
    color: var(--md-on-surface);
}

[data-theme="dark"] .umowa-highlight-box ol li {
    color: var(--md-on-surface);
}

[data-theme="dark"] .umowa-highlight-box ol li strong {
    color: var(--md-on-surface);
}

[data-theme="dark"] .umowa-highlight-box ol li br + em {
    color: var(--md-primary-light, #90caf9);
}

[data-theme="dark"] .umowa-highlight-box p {
    color: var(--md-on-surface-variant);
    border-top-color: var(--md-divider);
}

/* =====================================================
   WATER READING STATUS BANNERS
   Bannery statusu odczytu wodomierza
   ===================================================== */

.water-reading-exists-banner {
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 16px;
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Dark mode dla bannerów odczytu - OVERRIDE INLINE STYLES */

/* Niebieski gradient - AI auto-verification (admin_verified=NULL, score≥91%) */
[data-theme="dark"] .water-reading-exists-banner.banner-ai-verified {
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%) !important;
    border: 1px solid #3b82f6 !important;
    color: #60a5fa !important;
}

/* Zielony gradient - Admin approved (admin_verified=1) */
[data-theme="dark"] .water-reading-exists-banner.banner-admin-approved {
    background: linear-gradient(135deg, #0f1f13 0%, #1a2e1f 100%) !important;
    border: 1px solid #22c55e !important;
    color: #4ade80 !important;
}

/* Żółty gradient - Pending verification (admin_verified=0 lub score<91) */
[data-theme="dark"] .water-reading-exists-banner.banner-pending {
    background: linear-gradient(135deg, #1c1917 0%, #292524 100%) !important;
    border: 1px solid #f59e0b !important;
    color: #fbbf24 !important;
}

/* Czerwony gradient - Rejected */
[data-theme="dark"] .water-reading-exists-banner.banner-rejected {
    background: linear-gradient(135deg, #1f1315 0%, #2d1a1f 100%) !important;
    border: 1px solid #ef4444 !important;
    color: #f87171 !important;
}

/* =====================================================
   HISTORY ROW DARK MODE HOVER FIX
   Naprawa koloru tła po najechaniu myszką w dark mode
   ===================================================== */
[data-theme="dark"] .history-row-extended:hover {
    background: var(--md-surface-container, #2c2c2c) !important;
    transition: background-color 0.2s ease;
}


/* Dark Mode Input Fixes */
[data-theme="dark"] input[type="date"],
[data-theme="dark"] input[type="month"],
[data-theme="dark"] input[type="datetime-local"] {
    background-color: var(--md-surface-container);
    color: var(--md-text-primary);
    border: 1px solid var(--md-border);
    color-scheme: dark;
}
