/* ============================================================
   THEME V5 — fourth visual-only reskin attempt, following a
   literal design brief. Toggled via body.theme-v5 (cookie
   theme_variant=v5). Nothing here changes markup semantics,
   routes, or data — style.css / style-v2.css / style-v3.css /
   style-v4.css all stay fully intact and untouched.
   ============================================================ */

/* slightly larger base text across v5 — everything else in this file is
   sized in rem, so bumping the root size scales it all consistently
   without touching each declaration individually */
html:has(body.theme-v5) { font-size: 17px; }

.v5-header-row { display: none; }
/* nav-caret only lives inside .v2-topnav / .v5-header-row, both hidden by
   default already — but hide explicitly too, and only show it for v5's
   settings link specifically, so v2/v3/v4 keep their current plain look. */
.nav-caret { display: none; }
/* generic "only show under theme-v5" helper, used by additive v5-only
   sections (e.g. the reminders page "הודעות" category) added elsewhere */
.v5-only { display: none; }
body.theme-v5 .v5-only { display: block; }

body.theme-v5 .v5-header-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border-bottom: 1px solid #e3ebea;
  padding: 10px 22px;
  position: relative;
}

body.theme-v5 {
  --v5-bg: #f4f8f8;
  --v5-panel: #ffffff;
  --v5-border: #e3ebea;
  --v5-ink: #14302c;
  --v5-muted: #6d827e;
  --v5-teal: #0f766e;
  --v5-teal-dark: #0d5f58;
  --v5-teal-bg: #e3f4f1;
  --v5-green: #16a34a;
  --v5-green-bg: #e9f9ee;
  --v5-blue: #2563eb;
  --v5-blue-bg: #e7f0fb;
  --v5-radius: 14px;
  --v5-radius-sm: 10px;
  --v5-shadow: 0 1px 2px rgba(15, 118, 110, 0.05), 0 8px 20px rgba(15, 118, 110, 0.06);

  background: var(--v5-bg);
  color: var(--v5-ink);
  font-family: "Rubik", "Segoe UI", Arial, sans-serif;
}

/* ---- shell ---- */
body.theme-v5 .sidebar { display: none; }
body.theme-v5 .app-shell { display: block; min-height: 100vh; }
body.theme-v5 .main-col { display: block; width: 100%; }

/* ---- header row: everything merged into one row ---- */
body.theme-v5 .v2-topnav { display: none; }

body.theme-v5 .v5-header-institution {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
body.theme-v5 .v5-header-logo {
  height: 40px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  flex-shrink: 0;
}
body.theme-v5 .v5-header-icon { font-size: 1.6rem; flex-shrink: 0; }
body.theme-v5 .v5-header-institution-text {
  line-height: 1.3;
  white-space: pre-line;
  font-size: 1.02rem;
  font-weight: 700;
  text-align: center;
}

body.theme-v5 .v5-header-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  flex-wrap: wrap;
  flex: 1;
}
body.theme-v5 .v5-header-nav a {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 14px;
  border-radius: 999px;
  color: var(--v5-muted);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
body.theme-v5 .v5-header-nav a svg { width: 15px; height: 15px; }
body.theme-v5 .v5-header-nav a:hover { background: var(--v5-teal-bg); color: var(--v5-teal); }
body.theme-v5 .v5-header-nav a.active { background: var(--v5-teal); color: #fff; }
body.theme-v5 .v5-header-nav a[data-settings-link] .nav-caret,
body.theme-v5 .v5-header-nav a[data-dashboard-link] .nav-caret,
body.theme-v5 .v5-header-nav a[data-quickadd-url] .nav-caret { display: inline-block; font-size: 0.7rem; margin-inline-start: 2px; }
body.theme-v5 .v5-header-nav a[data-quickadd-url] .nav-caret { padding: 4px; margin: -4px -4px -4px 2px; border-radius: 6px; }
body.theme-v5 .v5-header-nav a[data-quickadd-url] .nav-caret:hover { background: rgba(255, 255, 255, 0.35); }
/* import + org-management move into the settings dropdown in v5 — the
   links stay in the shared nav_links() macro (still used by v2/sidebar),
   just hidden from this specific header row */
body.theme-v5 .v5-header-nav a[href="/import"],
body.theme-v5 .v5-header-nav a[href="/org-management"] { display: none; }

/* visual-only reorder of the top nav for v5 — DOM order in the shared
   nav_links() macro is untouched (v2/v3/v4/sidebar keep their own order),
   this just reflows the flex row here via `order` */
body.theme-v5 .v5-header-nav a[href="/"] { order: 1; }
body.theme-v5 .v5-header-nav a[href="/donations"] { order: 2; }
body.theme-v5 .v5-header-nav a[href="/expenses"] { order: 3; }
body.theme-v5 .v5-header-nav a[href="/pledges"] { order: 4; }
body.theme-v5 .v5-header-nav a[href="/members"] { order: 5; }
body.theme-v5 .v5-header-nav a[href="/reminders"] { order: 6; }
body.theme-v5 .v5-header-nav a[href="/fund-management"] { order: 7; }
body.theme-v5 .v5-header-nav a[href="/settings"] { order: 8; }
body.theme-v5 .v5-header-nav a[href="/import"] { order: 9; }
body.theme-v5 .v5-header-nav a[href="/org-management"] { order: 10; }

body.theme-v5 .v5-header-email-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
body.theme-v5 .v5-header-email-caption {
  font-size: 0.68rem;
  color: var(--v5-muted);
  font-weight: 600;
}
body.theme-v5 .v5-header-email {
  position: relative;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--v5-ink);
  background: var(--v5-bg);
  border: 1px solid var(--v5-border);
  border-radius: 999px;
  padding: 2px 14px;
  white-space: nowrap;
  cursor: pointer;
}
body.theme-v5 .v5-header-email:hover { background: var(--v5-teal-bg); border-color: var(--v5-teal); }

/* the real user-menu-dropdown gets reparented in here by JS */
body.theme-v5 .v5-header-email .user-menu-dropdown {
  inset-inline-end: 0;
  inset-inline-start: auto;
  font-weight: 400;
  white-space: normal;
  text-align: start;
}

body.theme-v5 .v5-settings-menu {
  /* position:fixed + top/inset-inline-start are set inline by JS,
     computed from the settings link's actual position */
  background: var(--v5-panel);
  border: 1px solid var(--v5-border);
  border-radius: var(--v5-radius-sm);
  box-shadow: var(--v5-shadow), 0 10px 26px rgba(15, 118, 110, 0.12);
  min-width: 200px;
  padding: 6px;
  z-index: 40;
}
body.theme-v5 .v5-settings-menu[hidden] { display: none; }
body.theme-v5 .v5-settings-menu a,
body.theme-v5 .v5-settings-menu .btn-sync {
  display: block;
  width: 100%;
  text-align: start;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.85rem;
  color: var(--v5-ink);
  text-decoration: none;
  cursor: pointer;
  margin: 0;
}
body.theme-v5 .v5-settings-menu a:hover,
body.theme-v5 .v5-settings-menu .btn-sync:hover { background: var(--v5-teal-bg); color: var(--v5-teal); }
body.theme-v5 .v5-settings-menu form.topbar-sync { margin: 0; }

body.theme-v5 .v2-theme-toggle { border: none; color: #fff; background: var(--v5-teal); border-radius: 999px; padding: 6px 14px; font-size: 0.78rem; font-weight: 600; cursor: pointer; }

body.theme-v5 .topbar {
  background: var(--v5-panel);
  border-bottom: 1px solid var(--v5-border);
  justify-content: center;
}
body.theme-v5 .topbar-search { max-width: 640px; margin: 0 auto; }
body.theme-v5 .topbar-search input { background: var(--v5-bg); border-color: var(--v5-border); border-radius: 999px; }
body.theme-v5 .user-menu { display: none; }

/* bell -> envelope, "התראות" -> "הודעות" (same real data, just relabeled) */
body.theme-v5 #notifTrigger { position: relative; }
body.theme-v5 .notif-icon { font-size: 0; }
body.theme-v5 .notif-icon::before { content: "✉️"; font-size: 1.1rem; }
body.theme-v5 .notif-dropdown-title { font-size: 0; }
body.theme-v5 .notif-dropdown-title::before { content: "הודעות"; font-size: 0.9rem; }

body.theme-v5 .content { max-width: 1280px; padding: 24px 32px 44px; }
body.theme-v5 h1 { font-size: 1.3rem; font-weight: 700; }
body.theme-v5 h2 { font-size: 1rem; font-weight: 700; }

/* ---- generic surfaces ---- */
body.theme-v5 .panel,
body.theme-v5 .card,
body.theme-v5 .stat-box {
  background: var(--v5-panel);
  border: 1px solid var(--v5-border);
  border-radius: var(--v5-radius);
  box-shadow: var(--v5-shadow);
}
body.theme-v5 .panel { padding: 20px 22px; }

/* ---- v5 dashboard stat cards (3-card row, new markup) ---- */
.v5-cards { display: none; }
body.theme-v5 .cards { display: none; }
body.theme-v5 .v5-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}
body.theme-v5 .v5-card {
  background: var(--v5-panel);
  border: 1px solid var(--v5-border);
  border-radius: var(--v5-radius);
  box-shadow: var(--v5-shadow);
  padding: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
body.theme-v5 .v5-card-income { background: var(--v5-blue-bg); border-color: #d3e3f7; }
body.theme-v5 .v5-card-expense { background: #fdeeea; border-color: #f6d5cb; }
body.theme-v5 .v5-card-body { flex: 1; min-width: 0; }
body.theme-v5 .v5-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--v5-teal);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
body.theme-v5 .v5-card-income .v5-card-icon { background: var(--v5-blue); }
body.theme-v5 .v5-card-expense .v5-card-icon { background: #dc2626; }
body.theme-v5 .v5-card-label,
body.theme-v5 .v5-card-value,
body.theme-v5 .v5-card-sub,
body.theme-v5 .v5-card-month-trigger { line-height: 1.4; }
body.theme-v5 .v5-card-label { color: var(--v5-muted); font-size: 0.82rem; font-weight: 600; min-height: 24px; display: flex; align-items: center; }
body.theme-v5 .v5-card-value { font-size: 1.5rem; font-weight: 800; color: var(--v5-ink); margin: 4px 0; }
body.theme-v5 .v5-card-sub { color: var(--v5-muted); font-size: 0.76rem; }
body.theme-v5 .v5-card-sub-lines { display: flex; flex-direction: column; gap: 2px; }
body.theme-v5 .v5-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
body.theme-v5 .v5-card-month-trigger {
  background: var(--v5-panel);
  border: 1px solid var(--v5-border);
  border-radius: 999px;
  color: var(--v5-ink);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 10px;
  cursor: pointer;
  white-space: nowrap;
}
body.theme-v5 .v5-card-month-trigger:hover { border-color: var(--v5-blue); }
body.theme-v5 .v5-card-month-menu {
  /* position:fixed + top/left are set inline by JS, computed from
     whichever month trigger was clicked */
  background: var(--v5-panel);
  border: 1px solid var(--v5-border);
  border-radius: var(--v5-radius-sm);
  box-shadow: var(--v5-shadow), 0 10px 26px rgba(15, 118, 110, 0.12);
  min-width: 160px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  z-index: 40;
}
body.theme-v5 .v5-card-month-menu[hidden] { display: none; }
body.theme-v5 .v5-card-month-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--v5-ink);
  text-decoration: none;
  white-space: nowrap;
}
body.theme-v5 .v5-card-month-menu a:hover { background: var(--v5-blue-bg); }
body.theme-v5 .v5-card-month-menu a.active { background: var(--v5-blue); color: #fff; }

/* row-list replaces the pie chart in v5 (same data, .v5-only handles the
   inverse visibility for the .payments-list version added in dashboard.html) */
body.theme-v5 .pie-row { display: none; }

/* ---- charts ---- */
body.theme-v5 .line-current { stroke: var(--v5-teal); }
body.theme-v5 .line-prev { stroke: var(--v5-border); }
body.theme-v5 .swatch-income { background: var(--v5-teal); }
body.theme-v5 .swatch-expense { background: #ef4444; }
body.theme-v5 .bar-income { background: var(--v5-teal); }
body.theme-v5 .bar-expense { background: #ef4444; }
body.theme-v5 .yoy-dot-current { fill: var(--v5-teal); }
body.theme-v5 .yoy-tooltip { border-radius: var(--v5-radius-sm); }

/* ---- buttons / forms / tables / chips (same treatment pattern) ---- */
body.theme-v5 .btn { border-radius: 10px; font-weight: 600; }
body.theme-v5 .btn-primary { background: var(--v5-teal); border-color: var(--v5-teal); }
body.theme-v5 .btn-primary:hover { background: var(--v5-teal-dark); }
body.theme-v5 .icon-btn-small,
body.theme-v5 .icon-btn { color: var(--v5-muted); border-radius: 8px; }
body.theme-v5 .icon-btn-small:hover,
body.theme-v5 .icon-btn:hover { background: var(--v5-teal-bg); color: var(--v5-teal); }
body.theme-v5 a:not(.btn) { color: var(--v5-teal); }

body.theme-v5 .data-table { background: var(--v5-panel); border-radius: var(--v5-radius); border-color: var(--v5-border); box-shadow: var(--v5-shadow); }
body.theme-v5 .data-table th { background: var(--v5-teal-bg); color: var(--v5-teal-dark); font-weight: 700; font-size: 0.76rem; border-bottom: none; }
body.theme-v5 .data-table tr:hover td { background: #f7fbfa; }

body.theme-v5 .form-row input,
body.theme-v5 .form-row select,
body.theme-v5 .form-row textarea,
body.theme-v5 .hebrew-cal-picker-btn {
  border-radius: 10px;
  border-color: var(--v5-border);
}
body.theme-v5 .form-row input:focus,
body.theme-v5 .form-row select:focus,
body.theme-v5 .form-row textarea:focus {
  border-color: var(--v5-teal);
  box-shadow: 0 0 0 3px var(--v5-teal-bg);
  outline: none;
}

body.theme-v5 .chip { border-radius: 999px; border-color: var(--v5-border); }
body.theme-v5 .chip.chip-active,
body.theme-v5 .chip.chip-primary.chip-active { background: var(--v5-teal); border-color: var(--v5-teal); }
body.theme-v5 .badge { border-radius: 999px; }

body.theme-v5 .flash { border-radius: var(--v5-radius-sm); }
body.theme-v5 .flash-success { background: var(--v5-green-bg); color: #15803d; }
body.theme-v5 .flash-error { background: #fde7e2; color: #c2410c; }

body.theme-v5 .notif-dropdown,
body.theme-v5 .user-menu-dropdown,
body.theme-v5 .autocomplete-dropdown {
  border-radius: var(--v5-radius-sm);
  border-color: var(--v5-border);
  box-shadow: var(--v5-shadow), 0 10px 26px rgba(15, 118, 110, 0.1);
}
body.theme-v5 dialog { border-radius: var(--v5-radius); border: none; box-shadow: 0 20px 50px rgba(15, 118, 110, 0.18); }

body.theme-v5 .member-avatar { background: var(--v5-teal); border-radius: var(--v5-radius-sm); }

/* ---- auth pages ---- */
body.theme-v5.auth-body { background: var(--v5-bg); }
body.theme-v5 .auth-card {
  background: var(--v5-panel);
  border-color: var(--v5-border);
  border-radius: var(--v5-radius);
  box-shadow: var(--v5-shadow);
}

/* ---- dashboard: fund picker lives in the site's top bar now ---- */
body.theme-v5 .filter-item:has(> select) { display: none; }

body.theme-v5 .dash-header {
  position: relative;
  justify-content: center;
}
body.theme-v5 .dash-header h1 {
  position: absolute;
  inset-inline-start: 0;
  top: 50%;
  transform: translateY(-50%);
  margin: 0;
}

body.theme-v5 .v5-fund-list {
  /* position:fixed + top/left are set inline by JS, computed from the
     fund trigger's actual position in the top bar */
  background: var(--v5-panel);
  border: 1px solid var(--v5-border);
  border-radius: var(--v5-radius-sm);
  box-shadow: var(--v5-shadow), 0 10px 26px rgba(15, 118, 110, 0.12);
  min-width: 170px;
  padding: 4px;
  z-index: 40;
}
body.theme-v5 .v5-fund-list[hidden] { display: none; }
body.theme-v5 .v5-fund-list a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--v5-ink);
  text-decoration: none;
}
body.theme-v5 .v5-fund-list a:hover { background: var(--v5-blue-bg); }
body.theme-v5 .v5-fund-list a.active { background: var(--v5-blue); color: #fff; }

body.theme-v5 .v5-quickadd-menu {
  /* position:fixed + top/left are set inline by JS, computed from the
     clicked nav word's caret position */
  background: var(--v5-panel);
  border: 1px solid var(--v5-border);
  border-radius: var(--v5-radius-sm);
  box-shadow: var(--v5-shadow), 0 10px 26px rgba(15, 118, 110, 0.12);
  min-width: 170px;
  padding: 4px;
  z-index: 40;
}
body.theme-v5 .v5-quickadd-menu[hidden] { display: none; }
body.theme-v5 .v5-quickadd-menu a {
  display: block;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--v5-teal);
  text-decoration: none;
  white-space: nowrap;
}
body.theme-v5 .v5-quickadd-menu a:hover { background: var(--v5-teal-bg); }

/* ---- dashboard: tabs + year merged into one centered row ---- */
body.theme-v5 .dash-tabs { background: var(--v5-panel); border-color: var(--v5-border); border-radius: 999px; }
body.theme-v5 .dash-tab.active { background: var(--v5-blue); border-radius: 999px; }
body.theme-v5 .dash-header .year-nav { background: var(--v5-panel); border-color: var(--v5-border); border-radius: 999px; margin: 0; }

/* ---- reminders page: side-by-side הודעות / בעיות, capped-height scroll ---- */
body.theme-v5 .reminders-top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: stretch;
  margin-bottom: 24px;
}
body.theme-v5 .reminders-top-grid .reminder-section { margin-bottom: 0; height: 100%; }
body.theme-v5 .reminder-rows-scroll { max-height: 320px; overflow-y: auto; }

/* ---- donations table: column-header filters replace the standalone selects ---- */
body.theme-v5 .filter-row select[name="source"],
body.theme-v5 .filter-row select[name="method"],
body.theme-v5 .filter-row select[name="fund"],
body.theme-v5 .filter-row select[name="category"] { display: none; }
body.theme-v5 .v5-col-filter-label { display: none; }
body.theme-v5 .v5-col-filter-trigger {
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  white-space: nowrap;
}
body.theme-v5 .v5-col-filter-trigger:hover { color: var(--v5-teal); }
body.theme-v5 .v5-col-filter-menu {
  /* position:fixed + top/left set inline by JS, computed from whichever
     column-header trigger was clicked */
  background: var(--v5-panel);
  border: 1px solid var(--v5-border);
  border-radius: var(--v5-radius-sm);
  box-shadow: var(--v5-shadow), 0 10px 26px rgba(15, 118, 110, 0.12);
  min-width: 160px;
  max-height: 260px;
  overflow-y: auto;
  padding: 4px;
  z-index: 40;
  white-space: nowrap;
}
body.theme-v5 .v5-col-filter-menu[hidden] { display: none; }
body.theme-v5 .v5-col-filter-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 400;
  color: var(--v5-ink);
  text-decoration: none;
}
body.theme-v5 .v5-col-filter-menu a:hover { background: var(--v5-blue-bg); }
body.theme-v5 .v5-col-filter-menu a.active { background: var(--v5-blue); color: #fff; }

/* date-range filter boxed to match the sort control's pill look */
body.theme-v5 .filter-row .filter-item:has(input[type="date"]) {
  background: var(--v5-panel);
  border: 1px solid var(--v5-border);
  border-radius: 999px;
  padding: 6px 14px;
}
