:root {
  --bg: #f7f1e3;
  --panel: #fffdf7;
  --ink: #3b2a1a;
  --muted: #8a7256;
  --border: #e6dcc3;
  --primary: #a3754a;
  --primary-dark: #815d3a;
  --sidebar-bg: #f0e2c0;
  --danger: #b3413a;
  --accent-bg: #f0e6d2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Rubik", "Segoe UI", "Arial Hebrew", Arial, sans-serif;
  font-weight: 400;
  background: var(--bg);
  color: var(--ink);
}

h1 { font-family: "Secular One", "Rubik", "Segoe UI", Arial, sans-serif; }

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

input[type="date"] {
  font-family: "Outfit", "Rubik", "Segoe UI", Arial, sans-serif;
}

.currency-symbol {
  font-family: "Segoe UI", Arial, "Arial Hebrew", sans-serif;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: max-content;
  background: var(--sidebar-bg);
  color: var(--ink);
  font-family: 'Rubik', sans-serif;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: width 0.15s ease;
  position: sticky;
  align-self: flex-start;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
  border-inline-end: 1px solid var(--border);
}

.sidebar.collapsed {
  width: 64px;
}
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-badge,
.sidebar.collapsed .brand-text {
  display: none;
}
.sidebar.collapsed .sidebar-collapse {
  transform: rotate(180deg);
}

.sidebar-header {
  position: relative;
  display: flex;
  justify-content: center;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}

.sidebar-collapse {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  background: rgba(59,42,26,0.08);
  border: none;
  color: var(--ink);
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  flex-shrink: 0;
}
.sidebar-collapse:hover { background: rgba(59,42,26,0.15); }

.sidebar .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  overflow: hidden;
}
.brand-logo {
  height: 48px;
  width: auto;
  max-width: 100%;
  border-radius: 4px;
  flex-shrink: 0;
  mix-blend-mode: multiply;
  filter: brightness(1.08);
}
.brand-text { max-width: 175px; line-height: 1.3; white-space: pre-line; }
.brand-emoji { font-size: 1.3rem; flex-shrink: 0; }

.nav-group {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
}

.nav-bottom {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 6px;
  padding-bottom: 10px;
}

.sidebar a {
  color: var(--ink);
  text-decoration: none;
  padding: 11px 16px;
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 12px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-icon {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(59,42,26,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.nav-icon svg { width: 16px; height: 16px; }
.sidebar.collapsed .nav-icon { margin: 0 auto; }
.nav-label { white-space: nowrap; }
.nav-badge {
  background: #eda100;
  color: #1f2430;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 20px;
  margin-inline-start: auto;
  flex-shrink: 0;
}

.sidebar a:hover {
  background: rgba(59,42,26,0.06);
}

.sidebar a.active {
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  border-inline-start: 4px solid var(--primary-dark);
}

.main-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  padding: 10px 24px;
}

.topbar-title {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.topbar-search {
  position: relative;
  flex: 1;
  max-width: 420px;
}
.topbar-search input {
  width: 100%;
  padding: 8px 36px 8px 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  background: var(--bg);
}
.topbar-search input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--accent-bg);
}
.topbar-search .search-icon {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  color: var(--muted);
}
.search-clear {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 4px;
  line-height: 1;
}
.search-clear:hover { color: var(--ink); }

.topbar-sync { margin: 0; }
.btn.btn-sync {
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 0.85rem;
  cursor: pointer;
  white-space: nowrap;
}
.btn.btn-sync:hover { background: var(--primary-dark); }

.icon-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--muted);
  padding: 4px 8px;
}

.topbar-user {
  margin-inline-start: auto;
  font-size: 0.88rem;
  color: var(--ink);
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 4px;
}
.topbar-user .chevron { color: var(--muted); font-size: 0.75rem; }

.content {
  flex: 1;
  padding: 28px 36px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.placeholder-panel {
  text-align: center;
  padding: 48px 24px;
  max-width: 520px;
  margin: 0 auto;
}
.placeholder-icon { font-size: 2.6rem; margin-bottom: 12px; }
.placeholder-panel h2 { margin-bottom: 10px; }
.placeholder-panel .hint { margin-bottom: 8px; }

h1 { font-size: 1.6rem; margin: 0 0 18px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 28px;
  overflow-x: auto;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  background: var(--accent-bg);
}
.icon-blue { background: #eaf1fb; }
.icon-aqua { background: #e6f7f0; }
.icon-violet { background: #eeecfb; }
.icon-green { background: #e6f7ea; }
.icon-orange { background: #fdf0e0; }
.icon-red { background: #fbe9e7; }

.card-value-success { color: #1b8a4c; }
.card-value-danger { color: var(--danger); }

.fund-header-card { display: flex; align-items: center; gap: 16px; }
.fund-header-icon {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #ece5f7;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  flex-shrink: 0;
}
.fund-header-info h2 { margin: 0 0 4px; }
.fund-header-info .hint { margin: 0; }

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

.fund-table td { font-size: 0.88rem; }
.fund-table td.card-value-success, .fund-table td.card-value-danger { font-weight: 700; }

.stat-body { min-width: 0; }
.card-label { color: var(--muted); font-size: 0.8rem; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-dark);
  font-variant-numeric: proportional-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Charts ---- */

.chart-panel { --chart-h: 240px; }

.bar-chart-plot {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: var(--chart-h);
  flex: 1;
  min-width: 0;
  border-bottom: 1px solid var(--baseline, #c3c2b7);
  background-image: repeating-linear-gradient(
    to top,
    var(--gridline, #e1e0d9) 0,
    var(--gridline, #e1e0d9) 1px,
    transparent 1px,
    transparent 25%
  );
}

.bar-chart-with-axis { display: flex; gap: 10px; }
.y-axis-labels {
  width: 40px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: var(--chart-h);
  padding-bottom: 1px;
  font-size: 0.72rem;
  color: var(--muted);
  text-align: left;
}
.y-axis-spacer { width: 50px; flex-shrink: 0; }

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  min-width: 0;
  position: relative;
  cursor: default;
}

.bar-col .bar {
  width: 100%;
  max-width: 24px;
  height: var(--bar-h, 0%);
  min-height: 0;
  background: #2a78d6;
  border-radius: 4px 4px 0 0;
  transition: filter 0.1s ease;
}

.bar-col:hover .bar,
.bar-col:focus-visible .bar {
  filter: brightness(0.88);
  outline: none;
}

.bar-value {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 3px;
  white-space: nowrap;
}

.bar-chart-axis {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.bar-axis-label {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  min-width: 0;
}

.stacked-bar {
  display: flex;
  height: 28px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--panel);
  gap: 2px;
  margin-bottom: 16px;
}
.stacked-seg {
  transition: filter 0.1s ease;
  cursor: default;
}
.stacked-seg:hover, .stacked-seg:focus-visible {
  filter: brightness(0.9);
  outline: none;
}

.chart-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 0.95rem;
}
.chart-legend .swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-left: 8px;
  vertical-align: middle;
}

.chart-tooltip {
  position: fixed;
  z-index: 50;
  background: var(--ink);
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.82rem;
  pointer-events: none;
  white-space: nowrap;
  transform: translate(-50%, -100%);
}
.chart-tooltip .tt-value { font-weight: 700; }
.chart-tooltip .tt-label { color: #cfd3da; margin-inline-start: 6px; }
.chart-tooltip[hidden] { display: none; }

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

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

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(60, 40, 10, 0.06), 0 1px 2px rgba(60, 40, 10, 0.04);
}

.autocomplete-dropdown {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(60, 40, 10, 0.15);
  max-height: 260px;
  overflow-y: auto;
  z-index: 60;
}
.autocomplete-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  font-size: 0.88rem;
  cursor: pointer;
}
.autocomplete-item:hover { background: var(--accent-bg); }
.autocomplete-item .autocomplete-sub { color: var(--muted); font-size: 0.8rem; white-space: nowrap; }

.autocomplete-item-avatar { justify-content: flex-start; align-items: center; }
.autocomplete-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  flex-shrink: 0;
}
.autocomplete-text { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.autocomplete-name { font-weight: 600; font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.autocomplete-item-avatar .autocomplete-sub { display: flex; gap: 8px; }

.settings-tabs { margin-bottom: 20px; }

.nedarim-header { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.nedarim-icon { font-size: 1.8rem; }
.nedarim-header h2 { margin: 0 0 2px; }
.nedarim-status { margin: 0; font-size: 0.85rem; }
.nedarim-status-ok { color: #1b8a4c; }
.nedarim-status-off { color: var(--muted); }
.nedarim-subpanel {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}
.nedarim-subpanel h3 { margin-top: 0; font-size: 0.95rem; }
.nedarim-export-actions { flex-direction: column; align-items: stretch; gap: 8px; }
.nedarim-export-actions .btn { text-align: center; }
.dash-tab-danger.active { background: var(--danger); }

.panel-danger { border-color: #f3c9c9; }
.danger-warning {
  background: #fdecec;
  color: #a12727;
  border: 1px solid #f3c9c9;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}
.danger-inline { display: inline-block; }
.danger-inline summary { list-style: none; }
.danger-inline summary::-webkit-details-marker { display: none; }
.danger-inline form { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.danger-inline input[type="text"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
}
.mgmt-list li.panel-danger-row { align-items: flex-start; flex-direction: column; gap: 8px; }

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.stat-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 1px 3px rgba(60, 40, 10, 0.06), 0 1px 2px rgba(60, 40, 10, 0.04);
}
.stat-box strong { font-size: 1.4rem; color: var(--primary-dark); }
.stat-box span { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.stat-box small { font-size: 0.76rem; color: var(--muted); }
@media (max-width: 700px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.detail-back-row { margin-bottom: 12px; }

.member-header-card { padding-top: 16px; }
.member-header-actions { display: flex; justify-content: flex-end; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.member-header-main { display: flex; align-items: center; gap: 12px; width: fit-content; max-width: 100%; }
.member-avatar {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--primary-dark);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  font-weight: 600;
  flex-shrink: 0;
}
.member-header-info h1 { margin: 0 0 4px; }
.member-header-sub { display: flex; gap: 16px; font-size: 0.85rem; color: var(--muted); margin-bottom: 8px; }
.member-header-sub-stacked { flex-direction: column; gap: 2px; }
.member-header-badges { display: flex; gap: 8px; }
.member-header-divider { border: none; border-top: 1px solid var(--border); margin: 14px 0 0; }
.member-auto-hint { margin: 10px 0 0; }

.member-stats-grid { margin-bottom: 20px; }
.member-stats-grid .stat-box span { line-height: 1.4; }
.stat-box-violet strong { color: #6d5a9e; }
.stat-box-blue strong { color: #3d6b96; }
.stat-box-teal strong { color: #1baf7a; }

.member-tabs-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }

.totals-row td { font-weight: 700; border-top: 2px solid var(--border); border-bottom: none; }

.pledge-mode-options, .date-type-toggle { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.radio-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 0.88rem;
  cursor: pointer;
}
.radio-chip:has(input:checked) { border-color: var(--primary); background: var(--accent-bg); font-weight: 600; }

.upload-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.upload-box {
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.upload-box label { font-size: 0.82rem; color: var(--muted); font-weight: 600; }
.upload-box-wide { grid-column: 1 / -1; margin-bottom: 14px; }
.upload-preview { max-width: 100%; max-height: 60px; object-fit: contain; margin: 0 auto; }
@media (max-width: 800px) { .upload-grid { grid-template-columns: repeat(2, 1fr); } }

table { width: 100%; border-collapse: collapse; }
table th, table td {
  text-align: right;
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
table th { color: var(--muted); font-weight: 600; }

.data-table { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; box-shadow: 0 1px 3px rgba(60, 40, 10, 0.06), 0 1px 2px rgba(60, 40, 10, 0.04); }
.data-table th { background: var(--accent-bg); }
.data-table td, .data-table th { padding: 10px 14px; }

.donations-table td, .donations-table th { font-size: 0.82rem; padding: 8px 10px; white-space: nowrap; }
.donations-table-wrap { overflow-x: auto; border-radius: 10px; }

.members-table td, .members-table th { font-size: 0.82rem; padding: 8px 10px; white-space: nowrap; }

.kv-table th { width: 160px; color: var(--muted); font-weight: 600; }

.row-actions { display: flex; gap: 10px; }
.row-actions form.inline-form { display: inline; margin: 0; }

a { color: var(--primary-dark); }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.92rem;
}
.btn-icon-text { display: inline-flex; align-items: center; gap: 6px; }
.btn-icon-text svg { width: 16px; height: 16px; }
.btn:hover { background: #f0f1f3; }
.btn-small { padding: 5px 10px; font-size: 0.82rem; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }

.inline-form { display: inline-block; margin: 16px 0; }

.form { max-width: 640px; }
.form-row { margin-bottom: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.form-row label { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
.form-row input, .form-row select, .form-row textarea {
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
}
.form-row-group { display: flex; gap: 16px; align-items: flex-end; }
.form-row-group .form-row { margin-bottom: 14px; }
.checkboxes { gap: 24px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 0.92rem; color: var(--ink); font-weight: 500; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }

.search-bar { display: flex; gap: 10px; margin-bottom: 16px; max-width: 480px; }
.search-bar input {
  flex: 1;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.92rem;
}

.summary-line { color: var(--muted); margin-bottom: 12px; }
.hint { color: var(--muted); font-size: 0.88rem; }
.empty { color: var(--muted); font-style: italic; }

.badge { padding: 3px 10px; border-radius: 20px; font-size: 0.8rem; }
.badge-active { background: var(--accent-bg); color: var(--primary-dark); }
.badge-inactive { background: #f1f1f1; color: var(--muted); }
.badge-pending { background: #fdf0e0; color: #a3641b; font-size: 0.72rem; margin-inline-start: 8px; }
.badge-independent { background: #eee6da; color: var(--primary-dark); font-size: 0.72rem; margin-inline-start: 8px; }

.badge-status { padding: 3px 10px; border-radius: 20px; font-size: 0.78rem; white-space: nowrap; }
.badge-status-ממתין { background: var(--accent-bg); color: var(--primary-dark); }
.badge-status-חלקי { background: #fdf0e0; color: #a3641b; }
.badge-status-שולם { background: #dff3e8; color: #0f6e56; }
.badge-status-בוטל { background: #f1f1f1; color: var(--muted); }

.pledge-remaining { font-weight: 700; color: var(--danger); }

.pledges-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.pledges-toolbar > .btn { flex-shrink: 0; }
.pledges-chip-row { margin-bottom: 0; flex-wrap: nowrap; flex-shrink: 0; }
.pledges-chip-row .chip { padding: 5px 10px; font-size: 0.8rem; }
.pledges-search { display: flex; gap: 6px; margin-inline-start: auto; flex-shrink: 0; }
.pledges-search input { padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.85rem; width: 140px; }

.category-row { display: flex; gap: 8px; align-items: center; }
.category-row select { flex: 1; }

.pledge-match-row td { padding: 0; border-bottom: 1px solid var(--border); }
.pledge-match-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: #fdf6e0;
  border-inline-start: 4px solid #eda100;
  padding: 10px 16px;
  font-size: 0.85rem;
  white-space: normal;
}
.pledge-match-actions { display: flex; gap: 8px; flex-shrink: 0; }

.mgmt-list { list-style: none; padding: 0; margin: 0; }
.mgmt-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
}
.mgmt-list li:last-child { border-bottom: none; }
.mgmt-list li.empty { color: var(--muted); justify-content: center; }
.mgmt-actions { display: flex; align-items: center; gap: 10px; }

/* ---- Members page ---- */

.members-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.members-search { display: flex; gap: 8px; margin: 0; }
.members-search input {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.88rem;
  min-width: 220px;
}
.members-panel-title {
  margin-inline-start: auto;
  font-weight: 600;
  font-size: 1.05rem;
}

.chip-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.chip-row-label { font-size: 0.85rem; color: var(--muted); margin-inline-end: 4px; }
.chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--ink);
  font-size: 0.85rem;
  text-decoration: none;
  white-space: nowrap;
}
.chip:hover { background: var(--bg); }
.chip.chip-active, .chip.chip-primary.chip-active {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}
.chip.chip-active-green {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.chip-warning { border-color: #eda100; color: #a3641b; }
.chip-new { border-color: #1baf7a; color: #0f6e56; }

.members-table .column-filters input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8rem;
}
.members-table .column-filters td { padding: 6px 14px; }

.flashes { margin-bottom: 18px; }
.flash { padding: 10px 16px; border-radius: 8px; margin-bottom: 8px; font-size: 0.92rem; }
.flash-success { background: #e6f4ea; color: #1e6b3c; }
.flash-error { background: #fbe9e7; color: #a3372e; }

/* ---- Dashboard header / filters ---- */

.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dash-tabs { display: flex; gap: 4px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; padding: 3px; }
.dash-tab { padding: 6px 16px; border-radius: 6px; font-size: 0.85rem; color: var(--muted); cursor: default; text-decoration: none; display: inline-block; }
.dash-tab.active { background: var(--primary-dark); color: #fff; font-weight: 600; }
a.dash-tab:hover { background: var(--bg); }

.filter-row {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
  flex-wrap: nowrap;
  overflow-x: auto;
}
.filter-item { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.filter-item label { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.filter-item .range-label { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.filter-item select {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  font-size: 0.88rem;
}
.filter-row > select,
.filter-row > input[type="text"],
.filter-row > input[type="number"] {
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  font-size: 0.82rem;
  flex-shrink: 0;
}
.filter-row > input[type="text"] { flex-shrink: 1; min-width: 140px; }
.hint-inline { font-size: 0.82rem; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

.year-nav {
  margin-inline-start: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
}
.year-label { font-weight: 700; color: var(--primary-dark); min-width: 40px; text-align: center; }

/* ---- Pie chart ---- */

.pie-row { display: flex; align-items: center; gap: 28px; flex-wrap: wrap; }
.pie-chart {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ---- Grouped bar chart (income vs expense) ---- */

.bar-chart-plot-grouped .bar-group {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  height: 100%;
  min-width: 0;
  cursor: default;
}
.bar-chart-plot-grouped .bar { width: 9px; max-width: 9px; border-radius: 3px 3px 0 0; min-height: 0; }
.bar-income { background: #2a78d6; }
.bar-expense { background: #e34948; }
.bar-chart-plot-grouped .bar-group:hover .bar,
.bar-chart-plot-grouped .bar-group:focus-visible .bar { filter: brightness(0.88); outline: none; }

.fund-chart .bar-chart-plot-grouped .bar { width: 100%; max-width: 70px; }
.fund-chart .bar-income { background: #1baf7a; }
.fund-chart .swatch-income { background: #1baf7a; }

.chart-legend-inline {
  display: flex;
  gap: 20px;
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--muted);
}
.chart-legend-inline .swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-inline-end: 6px;
  vertical-align: middle;
}
.swatch-income { background: #2a78d6; }
.swatch-expense { background: #e34948; }

/* ---- Line chart (YoY) ---- */

.line-chart-svg {
  width: 100%;
  height: 200px;
  display: block;
  overflow: visible;
}
.line-current {
  stroke: #2a78d6;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.line-prev {
  stroke: var(--muted);
  stroke-width: 2;
  stroke-dasharray: 8 6;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---- Auth pages (login / setup) ---- */

.auth-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}
.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.06);
}
.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 18px;
  text-align: center;
}
.auth-logo {
  height: 64px;
  width: auto;
  max-width: 100%;
  border-radius: 6px;
  mix-blend-mode: multiply;
  filter: brightness(1.08);
}
.auth-brand-text { white-space: pre-line; line-height: 1.3; }
.auth-card h1 { font-size: 1.25rem; text-align: center; margin-bottom: 14px; }

/* ---- Topbar user dropdown ---- */

.user-menu { position: relative; margin-inline-start: auto; }
.user-menu-trigger {
  background: none;
  border: none;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
}
.user-menu-trigger .chevron { color: var(--muted); font-size: 0.75rem; }
.user-menu-dropdown {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  min-width: 180px;
  padding: 6px;
  z-index: 40;
}
.user-menu-dropdown[hidden] { display: none; }
.user-menu-dropdown form { margin: 0; }
.user-menu-dropdown button {
  width: 100%;
  text-align: right;
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  color: var(--ink);
}
.user-menu-dropdown button:hover { background: var(--bg); }

/* ---- Notifications bell ---- */

.notif-menu { position: relative; }
.notif-badge {
  position: absolute;
  top: -2px;
  left: -2px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  border-radius: 20px;
  min-width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
}
.notif-dropdown {
  position: absolute;
  inset-inline-end: 0;
  top: calc(100% + 6px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
  width: 320px;
  max-height: 360px;
  overflow-y: auto;
  padding: 8px;
  z-index: 40;
}
.notif-dropdown[hidden] { display: none; }
.notif-dropdown h3 { font-size: 0.9rem; margin: 4px 8px 8px; }
.notif-item {
  display: block;
  padding: 8px 10px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--ink);
  font-size: 0.85rem;
}
.notif-item:hover { background: var(--bg); }
.notif-item-title { font-weight: 600; }
.notif-item-sub { color: var(--muted); font-size: 0.78rem; }
.notif-empty { padding: 16px; text-align: center; color: var(--muted); font-size: 0.85rem; }

/* ---- Recent payments panel ---- */

.recent-payments-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.recent-payments-header h2 { margin: 0; }
.view-all-link { font-size: 0.85rem; color: var(--primary-dark); text-decoration: none; }
.view-all-link:hover { text-decoration: underline; }

.payments-list { list-style: none; margin: 0; padding: 0; }
.payment-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.payment-item:last-child { border-bottom: none; padding-bottom: 4px; }

.payment-name { font-weight: 600; margin-bottom: 3px; }
.payment-sub { font-size: 0.8rem; color: var(--muted); }

.payment-amount { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.payment-icon {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: var(--accent-bg);
  color: var(--primary-dark);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.payment-amount-value { font-weight: 700; color: var(--primary-dark); }

/* ---- Reports page ---- */

.reports-filter-row { align-items: flex-end; }
.reports-filter-row select { min-width: 120px; }

.report-cards { display: flex; gap: 16px; margin-bottom: 24px; }
.report-card { flex: 1; border-radius: 10px; padding: 24px 28px; }
.report-card .card-label { font-size: 0.95rem; color: var(--ink); margin-bottom: 10px; }
.report-card .card-value { font-size: 1.7rem; font-weight: 700; }
.report-card-balance { background: #eaf1fb; }
.report-card-balance .card-value { color: #185fa5; }
.report-card-expenses { background: #fbe9e7; }
.report-card-expenses .card-value { color: #a3372e; }
.report-card-income { background: #e6f4ea; }
.report-card-income .card-value { color: #1e6b3c; }

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-header h2 { margin: 0; }
.export-link {
  font-size: 0.8rem;
  color: var(--primary-dark);
  text-decoration: none;
  white-space: nowrap;
}
.export-link:hover { text-decoration: underline; }

.export-buttons-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---- Member modal ---- */

.member-modal {
  border: none;
  border-radius: 14px;
  padding: 24px 28px;
  width: min(640px, 92vw);
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}
.member-modal::backdrop {
  background: rgba(20, 15, 10, 0.45);
}
.member-modal .modal-close {
  position: sticky;
  float: left;
  top: 0;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 8px;
  z-index: 5;
}
.member-modal .modal-close:hover { color: var(--ink); }
.member-modal .page-header { margin-inline-end: 32px; }

/* ---- Alerts popup (reminders + Nedarim Plus alerts) ---- */

.alerts-popup {
  border: none;
  border-radius: 14px;
  padding: 0;
  width: min(480px, 92vw);
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.18);
}
.alerts-popup::backdrop { background: rgba(20, 15, 10, 0.45); }
.alerts-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--accent-bg);
}
.alerts-popup-header h2 { margin: 0; font-size: 1.1rem; }
.alerts-popup-header .modal-close { background: none; border: none; font-size: 1.1rem; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.alerts-popup-header .modal-close:hover { color: var(--ink); }
.alerts-popup-body { padding: 16px 20px; overflow-y: auto; max-height: calc(85vh - 60px); display: flex; flex-direction: column; gap: 12px; }
.alert-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.alert-item-warning { background: #fdf0e0; border-color: #edcd94; }
.alert-item-reminder { background: var(--accent-bg); }
.alert-item-icon { font-size: 1.2rem; flex-shrink: 0; }
.alert-item-body { flex: 1; min-width: 0; }
.alert-item-title { font-weight: 600; margin-bottom: 3px; }
.alert-item-sub { font-size: 0.85rem; color: var(--muted); }
.alert-item-dismiss { flex-shrink: 0; }

/* ---- Donations (income) page ---- */

.unmatched-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fdf6e0;
  border: 1px solid #eda100;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.88rem;
  color: #7a5a00;
}

.donations-toolbar {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.donations-totals {
  display: flex;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
  white-space: nowrap;
}
.total-amount { color: var(--primary-dark); font-weight: 700; font-size: 0.92rem; }
.expense-amount { color: var(--danger); font-weight: 700; }
.expenses-quick-filter { margin: 0; }
.toolbar-buttons-stacked { flex-direction: column; align-items: stretch; gap: 6px; }
.toolbar-buttons-stacked .btn { text-align: center; }
.search-input-wrap { position: relative; display: inline-block; }
.search-input-wrap input { padding-inline-end: 26px; }
.search-icon-inline {
  position: absolute;
  top: 50%;
  inset-inline-end: 8px;
  transform: translateY(-50%);
  font-size: 0.72rem;
  color: var(--muted);
  pointer-events: none;
}
.toolbar-buttons { margin-inline-start: auto; display: flex; gap: 10px; flex-shrink: 0; }

.badge-source {
  background: var(--accent-bg);
  color: var(--primary-dark);
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 20px;
  white-space: nowrap;
  display: inline-block;
}
.linked-contact {
  background: var(--accent-bg);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.92rem;
}
.linked-contact a { margin-inline-start: 6px; text-decoration: none; }

.icon-btn-small {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  padding: 2px 4px;
  color: inherit;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.icon-btn-small svg { width: 16px; height: 16px; }

.fund-select {
  font-size: 0.85rem;
  padding: 3px 6px;
  border: 1px solid var(--border, #d8cdb8);
  border-radius: 6px;
  background: #fff;
  color: inherit;
  max-width: 140px;
}

.import-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}
.import-card {
  position: relative;
  display: block;
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 18px;
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s;
}
.import-card:hover { border-color: #b9ab86; }
.import-card.selected { border-color: var(--primary); }
.import-card input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.import-card-icon { font-size: 1.6rem; }
.import-card h2 { margin: 8px 0 4px; font-size: 1.05rem; }
.import-card .hint { margin: 0; }
.btn-template {
  position: absolute;
  top: 14px;
  left: 14px;
  font-size: 0.8rem;
  padding: 4px 10px;
}
.import-instructions ol { margin: 8px 0; padding-inline-start: 20px; }
.import-instructions li { margin-bottom: 4px; }

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

.reminder-section { margin-bottom: 20px; }
.reminder-section h2 { margin: 0 0 10px; font-size: 1.05rem; }
.reminder-row { align-items: flex-start; }
.reminder-row-body { min-width: 0; flex: 1; }
.reminder-row-title { font-weight: 600; display: flex; align-items: center; gap: 8px; }
.reminder-row-meta { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }
.reminder-row-warning { background: #fdf0e0; margin: 0 -4px; padding-inline: 8px; border-radius: 8px; }
.reminder-row-due { background: var(--accent-bg); margin: 0 -4px; padding-inline: 8px; border-radius: 8px; }
.alert-source { font-size: 0.72rem; font-weight: 700; color: var(--muted); text-transform: none; }
.reminder-row-note { font-size: 0.85rem; color: var(--ink); margin-top: 4px; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 16px;
}
.pagination-status { font-size: 0.85rem; color: var(--muted); }
