:root {
  --bg: #b9c9d9;
  --panel: #f5f8fc;
  --primary: #2d5a8f;
  --primary-dark: #214a78;
  --text: #1a2433;
  --muted: #4c5f75;
  --border: #ccd7e3;
  --danger: #b22222;
  --success: #207a4c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  background: linear-gradient(135deg, #b9c9d9, #dfeaf7);
  color: var(--text);
}

.container {
  max-width: 1200px;
  margin: 24px auto;
  background: rgba(245, 248, 252, 0.95);
  border-radius: 0;
  box-shadow: 0 8px 18px rgba(32, 58, 86, 0.08);
  padding: 16px 18px;
}

.home-container {
  min-height: 60vh;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 24px;
}

.home-page-container {
  display: block;
}

.home-account-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-height: 40px;
  margin-bottom: 8px;
}

.home-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  text-align: center;
  margin-top: 0;
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  width: min(520px, 100%);
  margin-top: 16px;
}

.home-action-btn {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 12px 16px;
  border: 1px solid var(--primary-dark);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s ease, transform 0.2s ease;
}

.home-action-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.home-action-btn:focus-visible {
  outline: 3px solid #e2a829;
  outline-offset: 3px;
}

.home-action-btn[hidden] {
  display: none;
}

@media (max-width: 560px) {
  .home-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

.logo-image {
  width: 200px;
  height: auto;
  object-fit: contain;
  display: block;
}

.login-panel {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, 0.45);
  border: 1px solid var(--border);
  padding: 20px 18px;
  margin-top: 16px;
}

.login-panel h2 {
  margin: 0 0 16px;
  font-size: 1.4rem;
  text-align: center;
  color: var(--primary-dark);
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-form label {
  font-weight: 700;
  text-align: left;
}

.login-form input {
  width: 100%;
}

.login-button {
  margin-top: 8px;
  width: 100%;
  font-size: 0.95rem;
}

.login-status {
  min-height: 20px;
  margin: 12px 0 0;
  color: var(--primary-dark);
  font-weight: 600;
  text-align: center;
}

.page-container {
  min-height: 60vh;
}

.page-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.back-link {
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 700;
}

.back-link:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.brand-block {
  flex: 1;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.current-user {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.logout-button {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--danger);
  font-weight: 700;
}

.logout-button:hover {
  background: #fff0f0;
}

.home-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: #edf3fb;
  color: var(--primary-dark);
  text-decoration: none;
  font-weight: 700;
  transition: background 0.2s ease;
}

.home-link:hover {
  background: #dfeaf7;
}

h1, h2, h3 {
  margin-top: 0;
}

h1 {
  font-size: 2.4rem;
  text-align: center;
  letter-spacing: 0.04em;
  color: var(--primary-dark);
}

.member-form {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

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

.full-width {
  grid-column: 1 / -1;
}

.iban-field {
  grid-column: 1 / -1;
  max-width: 240px;
  width: 100%;
}

#cislo_uctu {
  width: 100%;
  max-width: 240px;
}

label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 0.82rem;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 7px 8px;
  font-size: 0.9rem;
}

.filters-row {
  display: grid;
  grid-template-columns: minmax(260px, 2fr) minmax(180px, 1fr);
  gap: 12px;
  align-items: end;
  margin: 10px 0 8px;
}

.search-box,
.filter-box {
  display: flex;
  flex-direction: column;
}

.search-box input,
.filter-box select {
  margin-top: 6px;
}

button {
  border: none;
  background: var(--primary);
  color: white;
  padding: 7px 10px;
  border-radius: 0;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  transition: background 0.2s ease;
}

button:hover {
  background: var(--primary-dark);
}

button:active:not(:disabled) {
  transform: translateY(1px);
  filter: brightness(0.9);
}

button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.inline-status {
  color: var(--success);
  font-weight: 600;
  font-size: 0.85rem;
}

.inline-status-error {
  color: var(--danger);
}

.status {
  min-height: 24px;
  color: var(--success);
  font-weight: 600;
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.toolbar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin: 8px 0 12px;
}

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

.secondary-btn {
  background: #dfeaf7;
  color: var(--text);
  border: 1px solid var(--border);
}

.secondary-btn:hover {
  background: #d2dfef;
}

.table-wrap {
  overflow-x: auto;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin: 12px 0 16px;
}

.stat-card {
  background: #edf3fb;
  border: 1px solid var(--border);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.stat-card strong {
  font-size: 1.7rem;
  color: var(--primary-dark);
}

select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0;
  padding: 7px 8px;
  font-size: 0.9rem;
  background: white;
}

table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 0.82rem;
  table-layout: fixed;
}

th, td {
  border: 1px solid var(--border);
  padding: 5px 7px;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.table-wrap {
  overflow-x: auto;
}

th {
  background: #eaf0f7;
  font-size: 0.78rem;
  cursor: pointer;
  user-select: none;
}

th:hover {
  background: #dfeaf7;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1;
  border-radius: 0;
}

.edit-btn {
  background: #7da7d9;
  margin-right: 4px;
}

.edit-btn:hover {
  background: #6990c5;
}

.delete-btn {
  background: #c44a4a;
  padding: 0;
  min-width: 24px;
}

.delete-btn:hover {
  background: #a83838;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 20px;
}

.user-management-section {
  margin: 24px 0;
}

.user-management-section h2 {
  margin-bottom: 12px;
  font-size: 1.25rem;
  color: var(--primary-dark);
}

.users-table {
  min-width: 680px;
}

.users-table .user-role {
  min-width: 150px;
}

.users-table .user-password {
  min-width: 190px;
}

.users-table .user-actions {
  white-space: nowrap;
}

.delete-user-button {
  margin-left: 6px;
  background: #c44a4a;
}

.delete-user-button:hover:not(:disabled) {
  background: #a83838;
}

.delete-user-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.member-form[hidden] {
  display: none;
}

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #475569;
  min-height: 1em;
}

/* ---------- Rozloženie na celú výšku okna ---------- */
html {
  min-height: 100%;
  background: #b9c9d9;
}

body {
  min-height: 100vh;
  background-attachment: fixed;
}

.container {
  min-height: calc(100vh - 48px);
}

@media (max-width: 1248px) {
  .container {
    margin: 0 auto;
    min-height: 100vh;
  }
}

/* ---------- Karty sekcií (Prehliadky) ---------- */
.page-title {
  margin: 8px 0 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--primary);
  color: var(--primary-dark);
}

.section-card {
  background: #fff;
  border: 1px solid var(--border);
  padding: 16px 18px;
  margin-bottom: 18px;
}

.section-card > h3 {
  margin: 0 0 12px;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.section-card .member-form {
  margin: 0;
}

.section-card .form-grid {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px 16px;
  align-items: start;
}

.section-card .form-grid label {
  display: block;
  margin-bottom: 4px;
}

.filters-row.filters-year {
  grid-template-columns: minmax(140px, 200px) 1fr;
  margin-top: 0;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.card-header h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--primary-dark);
}

.section-card .stats-grid {
  margin: 14px 0 6px;
}

.section-card table {
  width: 100%;
  table-layout: auto;
}

.section-card td.num,
.section-card th.num {
  text-align: right;
}

.status:empty {
  min-height: 0;
  margin: 0;
}

@media (max-width: 640px) {
  .filters-row.filters-year {
    grid-template-columns: 1fr;
  }
}

.section-card .span-2 {
  grid-column: span 2;
}

.section-card td.wrap {
  white-space: normal;
  min-width: 220px;
  max-width: 360px;
}

.section-card tfoot .total-row td {
  background: #eaf0f7;
  font-weight: 700;
  border-top: 2px solid var(--primary);
}

@media (max-width: 640px) {
  .section-card .span-2 {
    grid-column: auto;
  }
}

.filters-row.members-filters {
  grid-template-columns: 1fr minmax(180px, 240px);
  margin-top: 0;
}

.section-card .stats-grid .stat-card strong {
  font-variant-numeric: tabular-nums;
}

@media (max-width: 640px) {
  .filters-row.members-filters {
    grid-template-columns: 1fr;
  }
}

/* ---------- Vyplatenie AUVL ---------- */
.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin: 4px 0 8px;
  padding: 8px 10px;
  background: #edf3fb;
  border: 1px solid var(--border);
}

.bulk-bar label {
  margin: 0;
}

.bulk-bar input[type="date"] {
  width: auto;
}

.bulk-count {
  flex: 1;
  color: var(--muted);
  font-size: 0.85rem;
}

.bulk-bar button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.select-col {
  width: 28px;
  text-align: center;
}

.select-col input {
  width: auto;
}

.badge {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border);
  background: #f1f5f9;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.badge-ok {
  border-color: #a7d7bd;
  background: #e6f4ec;
  color: var(--success);
}

.badge-error {
  border-color: #efb4b4;
  background: #fdeeee;
  color: var(--danger);
}

.section-card tr.row-paid td {
  background: #f4faf6;
}

.print-only {
  display: none;
}

@media print {
  body,
  html {
    background: #fff;
  }

  .container {
    margin: 0;
    padding: 0;
    box-shadow: none;
    min-height: 0;
    max-width: none;
  }

  .no-print,
  .no-print * {
    display: none !important;
  }

  .print-only {
    display: inline;
  }

  .section-card {
    border: none;
    padding: 0;
  }

  .section-card tr.row-paid td {
    background: none;
  }

  table {
    font-size: 0.75rem;
  }
}
