/* Modern Light Design System – WynajemNeo */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #2563EB;
  --primary-light: #3B82F6;
  --primary-soft: rgba(37, 99, 235, 0.08);
  --accent: #F97316;
  --accent-soft: rgba(249, 115, 22, 0.08);
  --accent-light: #FB923C;
  --accent-blue: #3B82F6;
  --accent-blue-soft: rgba(59, 130, 246, 0.1);
  --accent-green: #10B981;
  --accent-green-soft: rgba(16, 185, 129, 0.1);
  --accent-red: #EF4444;
  --accent-red-soft: rgba(239, 68, 68, 0.1);
  --bg: #F1F5F9;
  --bg-elevated: #FFFFFF;
  --text: #0F172A;
  --text-muted: #94A3B8;
  --text-secondary: #475569;
  --border-subtle: #E2E8F0;
  --border-hover: #CBD5E1;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-elevated: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
  --shadow-modal: 0 20px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.1);
  --transition-smooth: cubic-bezier(.4, 0, .2, 1);
}

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

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #F1F5F9;
}

::-webkit-scrollbar-thumb {
  background: #CBD5E1;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94A3B8;
}

::selection {
  background: rgba(37, 99, 235, 0.2);
  color: #0F172A;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
}

html {
  -webkit-text-size-adjust: 100%;
}

a {
  text-decoration: none;
  color: inherit;
}

button,
input,
select,
textarea {
  font-family: inherit;
}

/* ==================== */
/* Ekran logowania      */
/* ==================== */
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-elevated);
  padding: 2.5rem 2.25rem 2.25rem;
  animation: cardEntry .5s var(--transition-smooth);
}

@keyframes cardEntry {
  from { opacity: 0; transform: translateY(24px) scale(.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-card h1 {
  margin: 0 0 0.5rem;
  font-size: 1.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--primary);
}

.auth-subtitle {
  margin: 0 0 1.75rem;
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.auth-form label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 500;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.auth-form input,
.auth-form select {
  background: #FFFFFF;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 0.65rem 0.9rem;
  color: var(--text);
  outline: none;
  font-size: 0.88rem;
  transition: border .2s ease, box-shadow .2s ease, background .2s ease;
}

.auth-form input:focus,
.auth-form select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: #FFFFFF;
}

.auth-error {
  background: var(--accent-red-soft);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: var(--accent-red);
  font-size: 0.82rem;
  padding: 0.45rem 0.8rem;
}

.auth-form button {
  margin-top: 0.5rem;
  border: none;
  border-radius: 10px;
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: #FFFFFF;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: none;
  transition: transform .15s ease, background .15s ease, box-shadow .2s ease;
}

.auth-form button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: #EA6C0B;
  box-shadow: var(--shadow-elevated);
}

.auth-form button:active:not(:disabled) {
  transform: translateY(0);
}

.auth-form button:disabled {
  opacity: 0.6;
  cursor: default;
  box-shadow: none;
}

/* ==================== */
/* Panel po zalogowaniu */
/* ==================== */
.app-layout {
  min-height: 100vh;
  display: flex;
}

/* Sidebar */
.sidebar {
  width: 260px;
  padding: 1.5rem 1.25rem;
  background: #FFFFFF;
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.logo {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text);
}

.logo span {
  color: var(--primary);
}

.sidebar-section {
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: var(--primary-soft);
  border: 1px solid var(--border-subtle);
}

.sidebar-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.sidebar-admin-name {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-btn {
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  padding: 0.6rem 0.85rem;
  text-align: left;
  cursor: pointer;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  position: relative;
  overflow: hidden;
  transition:
    background .2s ease,
    color .2s ease,
    border .2s ease,
    box-shadow .2s ease,
    transform .12s ease;
  min-height: 44px;
  touch-action: manipulation;
}

.nav-btn .nav-icon {
  font-size: 1.1rem;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.nav-btn .nav-icon svg {
  display: block;
}

.nav-btn:hover {
  background: var(--primary-soft);
  border-color: transparent;
  color: var(--text);
  transform: translateX(2px);
}

.nav-btn.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.2);
  box-shadow: none;
  font-weight: 600;
}

/* === Support card (kompaktowy live chat trigger) === */
.support-card {
  margin-top: auto;
  margin-bottom: 0.6rem;
  padding: 1px;
  border-radius: 16px;
  background: linear-gradient(90deg, #4F46E5 0%, #7C3AED 100%);
  box-shadow: 0 6px 14px -6px rgba(99, 102, 241, 0.35);
}
.support-card-inner {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  cursor: pointer;
  border-radius: 15px;
  background: #FFFFFF;
  padding: 0.65rem 0.75rem;
  transition: background .2s ease;
}
.support-card-inner:hover { background: #F8FAFC; }
.support-card-row {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}
.support-card-icon {
  position: relative;
  flex-shrink: 0;
  width: 36px; height: 36px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  box-shadow: 0 2px 6px rgba(99, 102, 241, 0.35);
  color: #fff;
}
.support-card-icon::after {
  content: "";
  position: absolute;
  right: -2px; top: -2px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #94A3B8;
  border: 2px solid #fff;
  transition: background .2s;
}
.support-card.is-online .support-card-icon::after {
  background: #10B981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.18);
}
.support-card-body {
  min-width: 0;
  flex: 1;
}
.support-card-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: #0F172A;
  line-height: 1.1;
}
.support-card-desc {
  display: block;
  margin-top: 3px;
  font-size: 0.72rem;
  line-height: 1.35;
  color: #64748B;
}
.support-card-arrow {
  flex-shrink: 0;
  color: #94A3B8;
  display: flex; align-items: center;
  transition: transform .15s ease, color .15s ease;
}
.support-card-inner:hover .support-card-arrow {
  color: #475569;
  transform: translateX(2px);
}
.support-card.is-offline .support-card-inner { cursor: not-allowed; }
.support-card.is-offline .support-card-title { color: #64748B; }

/* === Chat window (floating panel) === */
.chat-window {
  position: fixed;
  right: 24px; bottom: 24px;
  width: 360px; max-width: calc(100vw - 32px);
  height: 520px; max-height: calc(100vh - 48px);
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 25px 60px -20px rgba(15, 23, 42, 0.35);
  border: 1px solid var(--border-subtle);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
}
.chat-window.is-open { display: flex; }
.chat-header {
  padding: 0.85rem 1rem;
  background: linear-gradient(135deg, #F97316, #3B82F6);
  color: #fff;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.chat-header-title { font-size: 0.95rem; font-weight: 600; }
.chat-header-sub { font-size: 0.72rem; opacity: 0.92; }
.chat-close {
  background: rgba(255,255,255,0.18);
  border: 0; color: #fff;
  width: 28px; height: 28px; border-radius: 8px;
  cursor: pointer; font-size: 1.1rem; line-height: 1;
}
.chat-close:hover { background: rgba(255,255,255,0.3); }
.chat-end-btn {
  background: rgba(255,255,255,0.18);
  border: 0; color: #fff;
  padding: 0 0.65rem; height: 28px;
  border-radius: 8px;
  cursor: pointer; font-size: 0.72rem; font-weight: 600;
}
.chat-end-btn:hover { background: rgba(239, 68, 68, 0.85); }
.chat-end-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.chat-body {
  flex: 1; overflow-y: auto; padding: 0.9rem;
  background: #F8FAFC;
  display: flex; flex-direction: column; gap: 0.5rem;
}
.chat-msg {
  max-width: 80%;
  padding: 0.5rem 0.75rem;
  border-radius: 14px;
  font-size: 0.85rem; line-height: 1.35;
  word-wrap: break-word;
}
.chat-msg.is-user {
  align-self: flex-end;
  background: #F97316; color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.is-admin {
  align-self: flex-start;
  background: #fff; color: #0F172A;
  border: 1px solid var(--border-subtle);
  border-bottom-left-radius: 4px;
}
.chat-msg.is-system {
  align-self: center; background: transparent;
  color: var(--text-muted);
  font-size: 0.72rem; font-style: italic;
  max-width: 100%; text-align: center;
}
.chat-msg-meta {
  display: block; font-size: 0.65rem; opacity: 0.75; margin-top: 2px;
}
.chat-form {
  display: flex; gap: 0.4rem;
  padding: 0.7rem;
  border-top: 1px solid var(--border-subtle);
  background: #fff;
}
.chat-form textarea {
  flex: 1; resize: none;
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.5rem 0.65rem;
  font-family: inherit; font-size: 0.85rem;
  min-height: 38px; max-height: 100px;
}
.chat-form button {
  padding: 0 0.9rem; border-radius: 10px;
  border: 0; background: #0F172A; color: #fff;
  cursor: pointer; font-size: 0.82rem; font-weight: 600;
}
.chat-form button:disabled { background: #94A3B8; cursor: not-allowed; }

.chat-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px;
  background: #EF4444; color: #fff;
  font-size: 0.7rem; font-weight: 700;
  margin-left: 0.3rem;
}

/* === Legacy support button (kept for backward compatibility) === */
.support-btn {
  margin-top: auto;
  margin-bottom: 0.5rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.25);
  background: rgba(59, 130, 246, 0.08);
  color: var(--accent-blue);
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background .2s, border-color .2s;
  min-height: 44px;
  text-align: left;
  line-height: 1.2;
}
.support-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.45);
}

.logout-btn {
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.15);
  background: var(--accent-red-soft);
  color: var(--accent-red);
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background .2s, border-color .2s, color .2s;
  min-height: 44px;
  touch-action: manipulation;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #DC2626;
}

/* Nav groups (collapsible) */
.nav-group {
  display: flex;
  flex-direction: column;
}

.nav-group-toggle {
  position: relative;
  width: 100%;
}

.nav-chevron {
  margin-left: auto;
  font-size: 1rem;
  transition: transform .2s ease;
  opacity: .5;
}

.nav-group.open .nav-chevron {
  transform: rotate(90deg);
}

.nav-group-items {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease;
}

.nav-group.open .nav-group-items {
  max-height: 320px;
}

.nav-sub {
  padding-left: 2.2rem;
  font-size: 0.83rem;
}

.nav-sub .nav-icon {
  font-size: 0.95rem;
}

/* Main content */
.main {
  flex: 1;
  padding: 1.6rem 1.8rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  min-width: 0;
  background: var(--bg);
}

.panel {
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  padding: 1.5rem 1.4rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  animation: panelFade .4s var(--transition-smooth);
}

@keyframes panelFade {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text);
}

.panel-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.panel-content {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.two-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1.1fr);
  gap: 1rem;
}

/* Cards */
.card {
  background: #FFFFFF;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  min-height: 200px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.list-card {
  background: #FFFFFF;
}

.card-header {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  background: #F8FAFC;
}

.card-header h3 {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.card-body {
  padding: 0.8rem 1rem 1rem;
}

.list-body {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 50vh;
  overflow-y: auto;
  padding: 0.6rem 0.8rem 0.8rem;
}

/* List Items */
.list-item {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: #FFFFFF;
  padding: 0.7rem 0.85rem;
  text-align: left;
  cursor: pointer;
  transition: background .15s ease, border .15s ease, transform .12s ease, box-shadow .15s ease;
}

.list-item:hover {
  background: #F8FAFC;
  border-color: var(--border-hover);
  box-shadow: var(--shadow-card);
  transform: translateX(2px);
}

.list-item.active {
  background: var(--primary-soft);
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: none;
}

.list-item.static {
  cursor: default;
}

.list-item.static:hover {
  transform: none;
}

.list-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
}

.list-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  line-height: 1.5;
}

.empty-state {
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 1.2rem 0.4rem;
  text-align: center;
  font-style: italic;
  opacity: 0.7;
}

/* ==================== */
/* Stats Grid           */
/* ==================== */
.stats-grid {
  margin-top: 0.7rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.stat-card {
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--primary-light);
  background: #FFFFFF;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow-card);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-elevated);
  border-color: var(--border-hover);
}

.stat-card.highlight {
  border-left-color: var(--accent-green);
  background: #FFFFFF;
}

.stat-card.highlight:hover {
  box-shadow: var(--shadow-elevated);
}

.stat-card.blue {
  border-left-color: var(--accent-blue);
}

.stat-card.orange {
  border-left-color: var(--accent);
}

.stat-icon {
  font-size: 1.4rem;
  margin-bottom: 0.25rem;
  color: var(--primary);
  display: flex;
  align-items: center;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-label {
  font-size: 0.76rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.3rem;
}

.stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

.stat-value.positive {
  color: var(--accent-green);
}

.stat-value.negative {
  color: var(--accent-red);
}

/* ==================== */
/* Formularz w panelach */
/* ==================== */
select {
  background: #FFFFFF;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 0.5rem 0.75rem;
  color: var(--text);
  outline: none;
  font-size: 0.85rem;
  transition: border .2s ease, box-shadow .2s ease;
}

select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.panel form input[type="text"],
.panel form input[type="number"],
.panel form input[type="date"],
.panel form input[type="email"],
.panel form input[type="tel"],
.panel form input[type="password"],
.panel form select,
.panel form textarea {
  background: #FFFFFF;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  padding: 0.55rem 0.9rem;
  color: var(--text);
  outline: none;
  font-size: 0.85rem;
  transition: border .2s ease, box-shadow .2s ease, background .2s ease;
}

.panel form input::placeholder {
  color: var(--text-muted);
}

.panel form input:focus,
.panel form select:focus,
.panel form textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  background: #FFFFFF;
}

.panel form button[type="submit"] {
  align-self: flex-start;
  border-radius: 10px;
  border: none;
  padding: 0.6rem 1.2rem;
  background: var(--accent);
  color: #FFFFFF;
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: transform .12s ease, background .12s ease, box-shadow .2s ease;
}

.panel form button[type="submit"]:hover {
  transform: translateY(-1px);
  background: #EA6C0B;
  box-shadow: var(--shadow-elevated);
}

.panel form button[type="submit"]:active {
  transform: translateY(0);
  box-shadow: none;
}

/* ==================== */
/* Modale               */
/* ==================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
  animation: backdropIn .25s ease;
  padding:
    env(safe-area-inset-top)
    env(safe-area-inset-right)
    env(safe-area-inset-bottom)
    env(safe-area-inset-left);
  overscroll-behavior: contain;
}

@keyframes backdropIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  width: 100%;
  max-width: 560px;
  background: #FFFFFF;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-modal);
  padding: 1.3rem 1.4rem 1.3rem;
  animation: modalIn .3s var(--transition-smooth);
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(20px) scale(.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}

.modal-close {
  border: none;
  background: #F1F5F9;
  color: var(--text-secondary);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
}

.modal-close:hover {
  background: var(--accent-red-soft);
  color: var(--accent-red);
}

.modal-body {
  max-height: min(85dvh, 85vh);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* ======================== */
/* Toolbar / Header Buttons */
/* ======================== */
.toolbar-btn {
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: #FFFFFF;
  color: var(--text);
  padding: 0.5rem 1rem;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  text-decoration: none;
  transition:
    background .2s ease,
    border .2s ease,
    box-shadow .2s ease,
    transform .12s ease;
  white-space: nowrap;
  min-height: 40px;
  touch-action: manipulation;
}

.toolbar-btn:hover {
  background: var(--primary-soft);
  border-color: rgba(37, 99, 235, 0.3);
  box-shadow: var(--shadow-elevated);
  transform: translateY(-1px);
  color: var(--primary);
}

.toolbar-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-card);
}

.toolbar-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Przycisk archiwizacji / Ukryj */
.btn-archive {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(239, 68, 68, 0.2);
  background: var(--accent-red-soft);
  color: var(--accent-red);
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, color .15s;
  min-height: 40px;
  touch-action: manipulation;
}

.btn-archive:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #DC2626;
}

/* List item row z przyciskiem */
.list-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.list-row .list-item {
  flex: 1;
  min-width: 0;
}

.list-row form {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* ==================== */
/* Badge / Status       */
/* ==================== */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-green {
  background: var(--accent-green-soft);
  color: var(--accent-green);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.badge-orange {
  background: var(--accent-soft);
  color: #EA580C;
  border: 1px solid rgba(249, 115, 22, 0.25);
}

.badge-red {
  background: var(--accent-red-soft);
  color: var(--accent-red);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-blue {
  background: var(--accent-blue-soft);
  color: var(--primary);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.badge-gray {
  background: rgba(148, 163, 184, 0.15);
  color: #64748b;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* ==================== */
/* Section divider      */
/* ==================== */
.section-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 0.5rem 0;
}

/* ==================== */
/* Tabela danych        */
/* ==================== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th,
.data-table td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table thead th {
  color: var(--text-secondary);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  background: #F8FAFC;
  border-bottom: 2px solid var(--border-subtle);
}

.data-table thead th:first-child {
  border-radius: var(--radius-md) 0 0 0;
}

.data-table thead th:last-child {
  border-radius: 0 var(--radius-md) 0 0;
}

/* Unit detail tabs */
.unit-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-subtle);
  margin: 0 1.5rem 1.2rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.unit-tabs::-webkit-scrollbar { display: none; }

.unit-tab {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .65rem 1rem;
  font-size: .84rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
}

.unit-tab:hover {
  color: var(--text);
}

.unit-tab.active {
  color: var(--accent-blue);
  border-bottom-color: var(--accent-blue);
  font-weight: 600;
}

.unit-tab-icon {
  display: flex;
  align-items: center;
  opacity: .6;
}

.unit-tab.active .unit-tab-icon {
  opacity: 1;
}

.unit-tab-label {
  display: inline;
}

@media (max-width: 640px) {
  .unit-tab { padding: .55rem .7rem; font-size: .78rem; }
  .unit-tab-label { display: none; }
  .unit-tab-icon { opacity: 1; }
  .unit-tabs { margin: 0 .8rem 1rem; }
}

.data-table tbody tr.clickable-row {
  cursor: pointer;
  transition: background .15s ease, box-shadow .15s ease;
}

.data-table tbody tr.clickable-row:hover {
  background: rgba(59, 130, 246, 0.12);
  box-shadow: inset 3px 0 0 var(--accent-blue);
}

.data-table tbody tr.prop-row {
  background: rgba(59, 130, 246, 0.04);
}

.data-table tbody tr.prop-row:hover {
  background: rgba(59, 130, 246, 0.08);
}

.data-table tbody tr.unit-row td:first-child {
  padding-left: 2.2rem;
  font-size: 0.82rem;
}

.data-table tbody tr.unit-row {
  opacity: 0.88;
}

.data-table tbody tr.unit-row:hover {
  background: #F8FAFC;
  opacity: 1;
}

.data-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--border-subtle);
  border-bottom: none;
  background: #F8FAFC;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.data-table .text-right {
  text-align: right;
}

.prop-name {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.prop-addr {
  display: block;
  font-size: 0.76rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 0.1rem;
}

/* Przycisk "Opłacono" */
.btn-paid {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(16, 185, 129, 0.3);
  background: var(--accent-green-soft);
  color: var(--accent-green);
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
  min-height: 40px;
  touch-action: manipulation;
}

.btn-paid:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.5);
}

/* ==================== */
/* Responsywność        */
/* ==================== */
@media (max-width: 1024px) {
  .main {
    padding: 1.2rem 1rem 1.5rem;
  }
}

/* ========================== */
/* Mobile navigation           */
/* ========================== */
.mobile-hamburger {
  display: none;
}
.sidebar-overlay {
  display: none;
}

@media (max-width: 880px) {
  .mobile-hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1200;
    width: 48px;
    height: 48px;
    background: var(--bg-elevated);
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    border-right: 1px solid var(--border-subtle);
    border-radius: 0 0 var(--radius-sm) 0;
    cursor: pointer;
    color: var(--text);
    box-shadow: var(--shadow-card);
    padding: 0;
  }

  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 270px !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 1100 !important;
    padding: 1.2rem 1rem !important;
    gap: 1rem !important;
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    border-right: 1px solid var(--border-subtle) !important;
    border-bottom: none !important;
    box-shadow: 4px 0 15px rgba(0,0,0,.12);
    background: #FFFFFF !important;
    transform: translateX(-100%);
    transition: transform .25s ease;
    will-change: transform;
  }

  .sidebar.sidebar-open {
    transform: translateX(0) !important;
  }

  .sidebar-overlay.overlay-visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 1099;
  }

  body.sidebar-active {
    overflow: hidden;
    touch-action: none;
  }

  .main {
    padding: 3.5rem 1rem 1.5rem;
  }

  .logout-btn {
    margin-top: auto;
    flex-shrink: 0;
  }

  .nav-group.open .nav-group-items {
    max-height: min(320px, 50vh);
  }

  .filter-bar .filter-check {
    min-height: 44px;
  }

  .filter-bar .filter-check input[type="checkbox"] {
    width: 22px;
    height: 22px;
  }

  .btn-archive,
  .btn-paid,
  .action-icon-btn,
  .toolbar-btn {
    min-height: 44px;
    min-width: 44px;
  }

  .panel form input[type="text"],
  .panel form input[type="number"],
  .panel form input[type="date"],
  .panel form input[type="email"],
  .panel form input[type="tel"],
  .panel form input[type="password"],
  .panel form select,
  .panel form textarea,
  .auth-form input,
  .auth-form select,
  .filter-bar input,
  .filter-bar select {
    font-size: 16px;
  }
}

@media (max-width: 720px) {
  .two-columns {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: .8rem .7rem;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .data-table td:nth-child(2) {
    white-space: normal;
    min-width: 100px;
  }

  .cell-owner-label {
    font-size: .78rem;
    color: var(--primary);
    font-weight: 500;
    opacity: .85;
  }

  /* Table horizontal scroll */
  .data-table {
    font-size: .78rem;
    min-width: 600px;
  }
  .data-table th,
  .data-table td {
    padding: .4rem .5rem;
  }

  .filter-bar {
    flex-direction: column;
    gap: .5rem;
  }
  .filter-bar label {
    width: 100%;
  }

  .toolbar-group {
    flex-wrap: wrap;
    gap: .4rem;
  }

  .tenant-cards-grid {
    grid-template-columns: 1fr;
  }

  .lease-grid {
    grid-template-columns: 1fr;
  }

  .chart-bar-label { width: 44px; font-size: .72rem; }
  .chart-bar-value { width: 80px; font-size: .75rem; }
  #statystyki .card > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  .modal {
    margin: .5rem;
    max-width: calc(100vw - 1rem);
  }
  .panel {
    padding: .6rem .5rem;
  }
  .stat-card {
    padding: .8rem;
  }
  .panel-header h2 {
    font-size: 1.1rem;
  }
}

/* ==================== */
/* Kolory wartości      */
/* ==================== */
.stat-value.positive { color: var(--accent-green); }
.stat-value.negative { color: var(--accent-red); }

/* ==================== */
/* Pasek filtrów        */
/* ==================== */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: .65rem;
  align-items: flex-end;
  font-size: .84rem;
  background: #F8FAFC;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: .9rem 1rem;
  margin-bottom: .2rem;
}
.filter-bar label {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  color: var(--text-secondary);
  font-size: .78rem;
  font-weight: 500;
  letter-spacing: .03em;
}
/* Etykieta z checkboxem wyrównana do dołu jak inne elementy */
.filter-bar .filter-check {
  flex-direction: row;
  align-items: center;
  gap: .4rem;
  padding-bottom: .38rem;
  color: var(--text-secondary);
  font-size: .82rem;
  font-weight: 400;
  letter-spacing: 0;
  cursor: pointer;
}
.filter-bar .filter-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary);
  border-radius: 3px;
  padding: 0;
  border: none;
  background: transparent;
}
.filter-bar input,
.filter-bar select {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  color: var(--text);
  border-radius: 10px;
  padding: .35rem .6rem;
  font-size: .84rem;
}
/* Przyciski w pasku filtrów wyrównane do dołu (do krawędzi inputów) */
.filter-bar .toolbar-btn,
.filter-bar > a.toolbar-btn {
  align-self: flex-end;
}

/* ==================== */
/* Wiersze tabeli       */
/* ==================== */
.data-table tbody tr.row-paid td {
  background: rgba(16, 185, 129, 0.04);
}
.data-table tbody tr.row-pending td {
  background: rgba(245, 158, 11, 0.05);
}
.data-table tbody tr.row-overdue td {
  background: rgba(239, 68, 68, 0.06);
}
.data-table tbody tr.row-overdue td:first-child {
  border-left: 3px solid var(--accent-red);
}
.data-table tbody tr.row-none td {
  background: rgba(239, 68, 68, 0.03);
}
.data-table tbody tr.row-partial td {
  background: rgba(249, 115, 22, 0.06);
}
.data-table tbody tr.row-partial td:first-child {
  border-left: 3px solid var(--accent);
}

/* Payment progress bar */
.payment-progress {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
}
.payment-progress-bar {
  flex: 1;
  height: 6px;
  background: var(--border-subtle);
  border-radius: 3px;
  overflow: hidden;
  min-width: 60px;
}
.payment-progress-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s ease;
}
.payment-progress-fill.fill-green { background: var(--accent-green); }
.payment-progress-fill.fill-orange { background: var(--accent); }
.payment-progress-fill.fill-red { background: var(--accent-red); }
.payment-progress-pct {
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  min-width: 32px;
  text-align: right;
}

/* Badge partial */
.badge-partial {
  background: rgba(249, 115, 22, 0.12);
  color: #C2410C;
  border: 1px solid rgba(249, 115, 22, 0.3);
}

/* Btn partial payment */
.btn-partial {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(249, 115, 22, 0.3);
  background: var(--accent-soft);
  color: #C2410C;
  padding: 0.3rem 0.65rem;
  font-size: 0.75rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
  min-height: 40px;
  touch-action: manipulation;
}
.btn-partial:hover {
  background: rgba(249, 115, 22, 0.18);
  border-color: rgba(249, 115, 22, 0.5);
}

/* ==================== */
/* Przyciski akcji      */
/* ==================== */
.action-icon-btn {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .3rem .65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(59, 130, 246, 0.25);
  background: var(--accent-blue-soft);
  color: var(--primary);
  font-size: .75rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s;
  text-decoration: none;
  vertical-align: middle;
  min-height: 40px;
  min-width: 40px;
  touch-action: manipulation;
}

.action-icon-btn svg {
  flex-shrink: 0;
}
.action-icon-btn:hover {
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.4);
}
.action-icon-btn.action-icon-danger {
  border-color: rgba(239, 68, 68, 0.25);
  background: var(--accent-red-soft);
  color: var(--accent-red);
}
.action-icon-btn.action-icon-danger:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
}
.action-icon-btn.action-icon-muted {
  border-color: var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
}
.action-icon-btn.action-icon-muted:hover {
  background: #F1F5F9;
}

/* Dashboard row buttons – consistent on desktop and mobile */
.dash-row-btn {
  font-size: .75rem;
  padding: .3rem .65rem;
  margin-left: .3rem;
}

/* Ikona dolara – status płatności */
.ico-paid-green {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.08);
  color: #10B981;
}
.ico-paid-green:hover {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.5);
}
.ico-paid-orange {
  border-color: rgba(245, 158, 11, 0.35);
  background: rgba(245, 158, 11, 0.08);
  color: #D97706;
}
.ico-paid-orange:hover {
  background: rgba(245, 158, 11, 0.18);
  border-color: rgba(245, 158, 11, 0.5);
}
.ico-paid-red {
  border-color: rgba(239, 68, 68, 0.35);
  background: rgba(239, 68, 68, 0.08);
  color: #EF4444;
}
.ico-paid-red:hover {
  background: rgba(239, 68, 68, 0.18);
  border-color: rgba(239, 68, 68, 0.5);
}
.ico-paid-muted {
  border-color: var(--border-subtle);
  background: transparent;
  color: var(--text-muted);
  opacity: .6;
}
.ico-paid-muted:hover {
  opacity: 1;
  background: rgba(100, 116, 139, 0.08);
}

/* Toggle widoczności kolumn/akcji w dashboardzie */
.dash-col-toggle {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .8rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: .2rem 0;
}
.dash-col-toggle input {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-blue);
}
.dash-col-hidden { display: none !important; }

/* Ikona wysyłki email/SMS */
.ico-send {
  border-color: rgba(99, 102, 241, 0.3);
  background: rgba(99, 102, 241, 0.06);
  color: #6366F1;
}
.ico-send:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: rgba(99, 102, 241, 0.45);
}

/* Owner/admin label in table rows */
.cell-owner-label {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .75rem;
  color: var(--text-muted);
  line-height: 1.3;
  margin-top: .15rem;
}
.cell-owner-label svg {
  flex-shrink: 0;
  opacity: .6;
}

/* ==================== */
/* Lokale – ikonki akcji*/
/* ==================== */
.unit-item {
  flex-direction: column;
  align-items: flex-start;
  gap: .6rem;
  padding: .85rem 1rem;
}
.unit-item-top {
  width: 100%;
}
.unit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding-top: .3rem;
  border-top: 1px solid var(--border-subtle);
  width: 100%;
  align-items: center;
}
.unit-actions-more {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  width: 100%;
  padding-top: .3rem;
  animation: panelFade .3s var(--transition-smooth);
}
.unit-more-toggle {
  margin-left: auto;
}

/* ==================== */
/* Karty najemców       */
/* ==================== */
.tenant-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}
.tenant-card {
  background: #FFFFFF;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: .65rem;
  box-shadow: var(--shadow-card);
  transition: border-color .2s, box-shadow .2s;
}
.tenant-card:hover {
  border-color: var(--border-hover);
  box-shadow: var(--shadow-elevated);
}
.tenant-card-header {
  display: flex;
  flex-direction: column;
  gap: .3rem;
}
.tenant-card-name {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text);
}
.tenant-card-contact {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  color: var(--text-muted);
  font-size: .78rem;
}
.tenant-card-lease {
  background: #F8FAFC;
  border-radius: var(--radius-sm);
  padding: .6rem .8rem;
  min-height: 2.5rem;
}
.lease-badge-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  margin-bottom: .4rem;
  flex-wrap: wrap;
}
.lease-location {
  font-size: .82rem;
  color: var(--primary);
  font-weight: 500;
}
.lease-details {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem .9rem;
  font-size: .8rem;
  color: var(--text-muted);
}
.lease-details strong { color: var(--text); }
.tenant-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  padding-top: .3rem;
  border-top: 1px solid var(--border-subtle);
}


/* ==================== */
/* Formularz sekcje     */
/* ==================== */
.form-section-label {
  font-size: .78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  margin-bottom: -.2rem;
}
.form-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: .3rem 0;
}
.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .7rem;
}
@media (max-width: 600px) {
  .form-row-2 {
    grid-template-columns: 1fr;
  }
  .form-row-3 {
    grid-template-columns: 1fr;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
}

/* ==================== */
/* Modal szeroki        */
/* ==================== */
.modal-wide {
  max-width: 720px;
  width: calc(100vw - 2rem);
}

/* ==================== */
/* Info grid (najemca)  */
/* ==================== */
.info-grid {
  display: flex;
  flex-direction: column;
  gap: .6rem;
}
.info-row {
  display: flex;
  gap: .7rem;
  font-size: .88rem;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: .5rem;
}
.info-label {
  color: var(--text-muted);
  min-width: 110px;
  flex-shrink: 0;
}
.info-value {
  font-weight: 500;
  color: var(--text);
}


/* ==================== */
/* Panel najemcy        */
/* ==================== */
.lease-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 1rem;
}

.lease-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin-top: .75rem;
  padding-top: .75rem;
  border-top: 1px solid var(--border-subtle);
}

.lease-info-label {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-muted);
  margin-bottom: .2rem;
}

.lease-info-value {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text);
}


/* ==================== */
/*   CHART BARS (tenant stats)  */
/* ==================== */
.chart-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chart-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chart-bar-label {
  width: 60px;
  flex-shrink: 0;
  font-size: .78rem;
  color: var(--text-muted);
}

.chart-bar-track {
  flex: 1;
  display: flex;
  height: 20px;
  background: #F1F5F9;
  border-radius: 4px;
  overflow: hidden;
}

.chart-bar-fill {
  height: 100%;
  min-width: 2px;
  border-radius: 4px;
  transition: width .4s var(--transition-smooth);
}

[style*="overflow-x:auto"] {
  -webkit-overflow-scrolling: touch;
}

.page-title {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
}

.section-title {
  margin: 1.5rem 0 0.8rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.text-muted {
  color: var(--text-muted);
}

.stat-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.chart-bar-rent {
  background: var(--accent);
}

.chart-bar-media {
  background: var(--accent-blue);
}

.chart-bar-value {
  width: 100px;
  flex-shrink: 0;
  text-align: right;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
}


/* ==================== */
/*   METER BADGES       */
/* ==================== */
.meter-badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  background: var(--accent-blue-soft);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: var(--radius-sm);
  padding: .2rem .45rem;
}

/* ========================== */
/* System subskrypcji         */
/* ========================== */

.sub-plans-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.2rem;
}

.sub-plan-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow .2s ease, transform .15s ease;
  display: flex;
  flex-direction: column;
}

.sub-plan-card:hover {
  box-shadow: var(--shadow-elevated);
  transform: translateY(-2px);
}

.sub-plan-card.plan-inactive {
  opacity: 0.55;
}

.sub-plan-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .6rem;
}

.sub-plan-header h3 {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
}

.sub-plan-desc {
  color: var(--text-secondary);
  font-size: .85rem;
  margin: 0 0 1rem;
  line-height: 1.5;
}

.sub-plan-prices {
  display: flex;
  gap: 1.2rem;
  margin-bottom: 1rem;
}

.sub-plan-price {
  display: flex;
  align-items: baseline;
  gap: .3rem;
}

.sub-plan-price .price-amount {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.sub-plan-price.price-yearly .price-amount {
  color: var(--primary);
  font-size: 1.1rem;
}

.sub-plan-price .price-period {
  font-size: .78rem;
  color: var(--text-muted);
}

.sub-plan-limits {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
  padding: .8rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
}

.sub-plan-limit {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--text-secondary);
}

.sub-plan-limit strong {
  color: var(--text);
}

.sub-plan-features {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: flex;
  flex-direction: column;
  gap: .35rem;
}

.sub-plan-features li {
  display: flex;
  align-items: center;
  gap: .4rem;
  font-size: .84rem;
  color: var(--text-secondary);
}

.sub-plan-footer {
  margin-top: auto;
  padding-top: .8rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sub-plan-subs {
  font-size: .78rem;
  color: var(--text-muted);
}

.sub-plan-actions {
  display: flex;
  gap: .4rem;
}

.form-row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: .7rem;
}

/* Paski użycia (miniaturowe) */
.usage-bar-mini {
  width: 60px;
  height: 6px;
  background: var(--bg);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: .2rem;
}

.usage-bar-mini .usage-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s ease;
}

.badge-muted {
  background: rgba(148, 163, 184, 0.15);
  color: var(--text-muted);
  font-size: .75rem;
  padding: .15rem .5rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* Checkboxy funkcji planów */
.features-checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .4rem;
  padding: .6rem .8rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  max-height: 260px;
  overflow-y: auto;
}

.feature-check {
  display: flex;
  align-items: center;
  gap: .45rem;
  cursor: pointer;
  padding: .35rem .5rem;
  border-radius: 6px;
  transition: background .15s ease;
  font-size: .84rem !important;
  color: var(--text) !important;
  font-weight: 400 !important;
  flex-direction: row !important;
}

.feature-check:hover {
  background: var(--primary-soft);
}

.feature-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.feature-check span {
  line-height: 1.3;
}

@media (max-width: 640px) {
  .sub-plans-grid {
    grid-template-columns: 1fr;
  }
  .form-row-3 {
    grid-template-columns: 1fr;
  }
  .features-checkbox-grid {
    grid-template-columns: 1fr;
  }
}

/* === Properties page: tabelaryczny redesign === */
.panel-content.properties-tables {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  padding: 1rem;
}
.properties-tables .card {
  width: 100%;
}
.properties-tables .card-body {
  overflow-x: auto;
}
.data-table .actions-cell {
  display: flex;
  gap: 0.35rem;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
}
.data-table .prop-name-link {
  color: var(--accent-blue, #0ea5e9);
  text-decoration: none;
  font-weight: 600;
}
.data-table .prop-name-link:hover {
  text-decoration: underline;
}
.data-table tbody tr.row-selected {
  background: rgba(59, 130, 246, 0.12);
  box-shadow: inset 3px 0 0 var(--accent-blue);
}
.properties-data-table td,
.units-data-table td {
  vertical-align: middle;
}
@media (max-width: 900px) {
  .panel-content.properties-tables {
    padding: 0.6rem;
  }
  .data-table .actions-cell {
    justify-content: flex-start;
  }
}

/* ============================================================
   manager permissions editor (settings.php tab=admins)
   ============================================================ */
.mgr-preset-row {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.mgr-preset-btn {
  appearance: none;
  background: rgba(255, 136, 0, 0.08);
  border: 1px solid rgba(255, 136, 0, 0.45);
  color: var(--accent-orange);
  padding: 0.55rem 0.9rem;
  border-radius: var(--radius-md);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 160ms ease-out, transform 120ms ease-out;
}
.mgr-preset-btn:hover {
  background: rgba(255, 136, 0, 0.16);
}
.mgr-preset-btn:active {
  transform: scale(0.97);
}

.mgr-scope-fieldset {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.9rem 1rem 1rem;
  margin-bottom: 1rem;
}
.mgr-scope-fieldset legend {
  padding: 0 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.mgr-scope-option {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-right: 1.2rem;
  margin-bottom: 0.5rem;
  font-size: 0.88rem;
  cursor: pointer;
}
.mgr-scope-picker {
  margin-top: 0.6rem;
  padding-top: 0.7rem;
  border-top: 1px dashed var(--border-subtle);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.mgr-unit-group {
  flex: 1 1 100%;
  margin-bottom: 0.6rem;
}
.mgr-unit-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 0.35rem;
}
.mgr-unit-group-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.mgr-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 140ms ease-out, border-color 140ms ease-out;
  user-select: none;
}
.mgr-chip:hover {
  background: rgba(255, 255, 255, 0.06);
}
.mgr-chip input[type="checkbox"] {
  margin: 0;
}
.mgr-chip input[type="checkbox"]:checked + span {
  color: var(--accent-blue);
  font-weight: 600;
}
.mgr-chip input[type="checkbox"]:checked {
  accent-color: var(--accent-blue);
}

.mgr-perm-matrix {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 0.7rem;
  margin-top: 0.4rem;
}
.mgr-perm-group {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.7rem 0.8rem 0.8rem;
  background: rgba(255, 255, 255, 0.02);
}
.mgr-perm-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.55rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--border-subtle);
}
.mgr-perm-group-head > span {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-strong, #fff);
}
.mgr-perm-group-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  cursor: pointer;
}
.mgr-perm-group-items {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.mgr-chip-perm {
  background: rgba(59, 130, 246, 0.05);
  border-color: rgba(59, 130, 246, 0.25);
}

@media (max-width: 720px) {
  .mgr-perm-editor form fieldset .mgr-scope-option {
    display: flex;
    margin-right: 0;
  }
}
