/* ───────── Shul System · Modern Design System ───────── */

/* ---------- Hebrew fonts (Google Fonts, sans-serif only) ---------- */
/* Loaded from <head>: Heebo + Rubik + Assistant + Noto Sans Hebrew */

:root{
  --bg:        #f7f8fa;
  --surface:   #ffffff;
  --border:    #e5e7eb;
  --border-2:  #f1f5f9;
  --text:      #0f172a;
  --text-2:    #475569;
  --text-3:    #94a3b8;
  --accent:    #4f46e5;       /* indigo-600 */
  --accent-2:  #6366f1;
  --accent-bg: #eef2ff;
  --success:   #10b981;
  --warn:      #f59e0b;
  --danger:    #ef4444;
  --radius:    12px;
  --radius-lg: 16px;

/* ── סעודות account: same look as main, just a green palette ────────── */
body.acct-seudos{
  --accent:     #059669;   /* emerald-600 */
  --accent-2:   #10b981;   /* emerald-500 */
  --accent-bg:  #d1fae5;   /* emerald-100 */
}
body.acct-seudos .sidebar nav a.active{ background:var(--accent); color:#fff }
body.acct-seudos .btn-primary{ background:var(--accent) }
body.acct-seudos .btn-primary:hover{ background:#047857 }
body.acct-seudos .input:focus,
body.acct-seudos .select:focus,
body.acct-seudos textarea.input:focus{ border-color:var(--accent); box-shadow:0 0 0 3px rgba(5,150,105,.18) }
body.acct-seudos .pill-indigo{ background:var(--accent-bg); color:var(--accent) }

/* ── Account switcher: clean segmented toggle (pill style) ───────────── */
.acct-switch{
  display:flex; padding:0 12px 12px; position:relative;
}
.acct-switch .acct-track{
  display:flex; width:100%; background:#eef2f7; border-radius:999px;
  padding:3px; gap:0; position:relative;
}
.acct-switch .acct-btn{
  flex:1; display:flex; align-items:center; justify-content:center; gap:6px;
  padding:7px 10px; border:none; background:transparent;
  border-radius:999px; cursor:pointer; text-decoration:none;
  font-size:12.5px; font-weight:600; color:var(--text-2);
  transition:color .18s ease; white-space:nowrap; z-index:1;
}
.acct-switch .acct-btn i{ width:14px; height:14px }
.acct-switch .acct-btn:hover{ color:var(--text) }
.acct-switch .acct-btn.on{
  background:#fff; color:var(--accent);
  box-shadow:0 1px 2px rgba(15,23,42,.08), 0 2px 6px rgba(15,23,42,.06);
}
body.acct-seudos .acct-switch .acct-btn.on{ color:var(--accent) }

/* LTR-isolated inline span — for phone numbers, emails, etc. */
.ltr-iso{ unicode-bidi:isolate; direction:ltr; display:inline-block; text-align:left }
  --shadow:    0 1px 2px rgba(15,23,42,.04), 0 1px 3px rgba(15,23,42,.06);
  --shadow-lg: 0 10px 30px rgba(15,23,42,.08);
}

/* ── Account-tinted page background ──────────────────────────────────── */
body.acct-main{   background:#eef2ff; }   /* very light indigo */
body.acct-seudos{ background:#ecfdf5; }   /* very light emerald */
body.acct-seudos .stat .ic{ background:var(--accent-bg); color:var(--accent) }
body.acct-seudos .card-h i{ color:var(--accent) }
body.acct-seudos .pill-indigo{ background:var(--accent-bg); color:var(--accent) }

/* ── Force our font on EVERY form control / button ───────────────────── */
button, input, select, textarea, .btn, .input, .select,
.choices, .choices__inner, .choices__input, .choices__list,
.flatpickr-input, .hdp-display{
  font-family:'Heebo','Rubik','Assistant','Noto Sans Hebrew',ui-sans-serif,system-ui,sans-serif !important;
}

/* ── All table columns center-aligned EXCEPT the first column ───────── */
.tbl th, .tbl td{ text-align:center; }
.tbl th:first-child, .tbl td:first-child{ text-align:start; }
html[dir="rtl"] .tbl th, html[dir="rtl"] .tbl td{ text-align:center; }
html[dir="rtl"] .tbl th:first-child, html[dir="rtl"] .tbl td:first-child{ text-align:right; }
.tbl .num, .tbl td.num, .tbl th.num{ text-align:center; font-variant-numeric:tabular-nums; }

/* ── Choices.js: chevron always pinned to the LEFT side ─────────────── */
.choices[data-type*="select-one"]::after{
  left:11px !important; right:auto !important;
  border-color:#475569 transparent transparent transparent !important;
}
html[dir="rtl"] .choices[data-type*="select-one"]::after{ left:11px !important; right:auto !important; }
.choices[data-type*="select-one"] .choices__inner{ padding-left:30px !important; padding-right:12px !important; }
html[dir="rtl"] .choices[data-type*="select-one"] .choices__inner{ padding-left:30px !important; padding-right:12px !important; text-align:right; }

/* ── Hebrew date picker: month/day are now Choices.js-styled selects ── */
.hdp-pop select.hdp-month, .hdp-pop select.hdp-day{
  -webkit-appearance:none; appearance:none;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat:no-repeat; background-position:left 9px center;
  padding-left:28px !important; padding-right:10px !important;
  border:1px solid var(--border); border-radius:10px;
}

/* ── Aliyos row: wider actions column so + ↑ ↓ ✕ don't overlap ──────── */
.row-grid{ grid-template-columns:160px 1fr 1fr 130px 110px 1fr 168px; }
.row-grid > *:last-child{ display:flex; gap:2px; justify-content:flex-end; align-items:center; }
@media(max-width:768px){ .row-grid{ grid-template-columns:1fr 1fr; } }

/* ── Parshiyos row: action buttons pinned to the left edge ──────────── */
.parsha-row .meta{ margin-left:0; margin-right:auto; }
html[dir="rtl"] .parsha-row .meta{ margin-left:auto; margin-right:0; }
.parsha-row .meta .btn, .parsha-row .meta .row-add-after{ order:99; }
.parsha-stats{ display:flex; gap:14px; flex-wrap:wrap; margin-left:auto; padding-inline-start:14px; }
html[dir="rtl"] .parsha-stats{ margin-left:0; margin-right:auto; }
.parsha-stats .ps{ display:inline-flex; flex-direction:column; align-items:center; min-width:62px; padding:2px 8px; border-radius:8px; background:#f8fafc; border:1px solid var(--border-2); }
.parsha-stats .ps .lbl{ font-size:10.5px; color:var(--text-3); text-transform:none; font-weight:600; direction:rtl; }
.parsha-stats .ps .val{ font-size:13px; font-weight:700; color:var(--text); font-variant-numeric:tabular-nums; margin-top:1px; }
.parsha-stats .ps.ps-paid .val{ color:#166534 }
.parsha-stats .ps.ps-open .val{ color:#b91c1c }

/* Wider modal default for date-picker dialogs */
.modal[data-size="lg"], .modal.modal--lg{ max-width:820px; width:96vw; }

*{box-sizing:border-box}
html,body{height:100%}
body{
  font-family:'Heebo','Rubik','Assistant','Noto Sans Hebrew',ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  font-size:14px; line-height:1.55; color:var(--text); background:var(--bg);
  -webkit-font-smoothing:antialiased; margin:0;
}
/* Headings — modern Hebrew sans-serif (Rubik) */
h1,h2,h3,.page-h h1,.modal-h h3,.card-h{font-family:'Rubik','Heebo','Noto Sans Hebrew',sans-serif; font-weight:700; letter-spacing:-.005em}
.heb{font-family:'Heebo','Rubik','Noto Sans Hebrew',sans-serif; direction:rtl; unicode-bidi:isolate}
.heb-frank{font-family:'Rubik','Heebo','Noto Sans Hebrew',sans-serif; font-weight:600; direction:rtl; unicode-bidi:isolate}

/* ---------- Layout ---------- */
.app{display:flex; min-height:100vh}
.sidebar{
  width:240px; background:#0f172a; color:#cbd5e1; padding:18px 14px;
  display:flex; flex-direction:column; flex-shrink:0; position:sticky; top:0; height:100vh;
}
.sidebar .brand{display:flex; align-items:center; gap:10px; padding:6px 8px 18px; border-bottom:1px solid #1e293b; margin-bottom:14px}
.sidebar .brand img{width:36px; height:36px; object-fit:contain}
.sidebar .brand b{font-size:15px; color:#fff; letter-spacing:.2px}
.sidebar nav{flex:1; display:flex; flex-direction:column; gap:2px}
.sidebar nav a{
  display:flex; align-items:center; gap:10px; padding:9px 12px; border-radius:8px;
  color:#cbd5e1; text-decoration:none; font-weight:500; font-size:13.5px;
  transition:background .12s,color .12s;
}
.sidebar nav a:hover{background:#1e293b; color:#fff}
.sidebar nav a.active{background:var(--accent); color:#fff}
.sidebar nav a i{width:18px;height:18px;flex-shrink:0}
.sidebar nav .section{font-size:11px; text-transform:uppercase; letter-spacing:.08em; color:#64748b; padding:14px 12px 4px}
.sidebar .me{margin-top:12px; padding-top:12px; border-top:1px solid #1e293b; font-size:12px}
.sidebar .me .n{color:#fff; font-weight:600}
.sidebar .me a{color:#94a3b8; text-decoration:none}
.sidebar .me a:hover{color:#fff}

.main{flex:1; min-width:0; display:flex; flex-direction:column}
.topbar{display:none}
.page{padding:24px 28px; max-width:1400px; margin:0 auto; width:100%}
.page-h{display:flex; align-items:center; justify-content:space-between; margin-bottom:20px; gap:12px; flex-wrap:wrap}
.page-h h1{font-size:22px; font-weight:700; margin:0; letter-spacing:-.01em}
.page-h .sub{color:var(--text-2); font-size:13px; margin-top:2px}

/* ---------- Cards ---------- */
.card{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); box-shadow:var(--shadow); padding:18px}
.card-h{font-size:14px; font-weight:600; color:var(--text); margin:0 0 14px; display:flex; align-items:center; gap:8px}
.card-h i{width:16px; height:16px; color:var(--accent)}

/* ---------- Stat tiles ---------- */
.stats{display:grid; grid-template-columns:repeat(auto-fit,minmax(190px,1fr)); gap:14px; margin-bottom:20px}
.stat{background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:16px 18px; box-shadow:var(--shadow); position:relative; overflow:hidden}
.stat .lbl{color:var(--text-2); font-size:12px; font-weight:500; text-transform:uppercase; letter-spacing:.04em}
.stat .val{font-size:26px; font-weight:700; margin-top:6px; letter-spacing:-.02em}
.stat .sub{font-size:12px; color:var(--text-3); margin-top:2px}
.stat .ic{position:absolute; top:14px; right:14px; width:34px; height:34px; border-radius:8px; background:var(--accent-bg); color:var(--accent); display:flex; align-items:center; justify-content:center}
.stat .ic i{width:18px;height:18px}

/* ---------- Buttons ---------- */
.btn{
  display:inline-flex; align-items:center; gap:6px; padding:8px 14px; border-radius:8px;
  font-weight:500; font-size:13.5px; cursor:pointer; border:1px solid transparent;
  transition:background .12s, border .12s, color .12s, transform .06s; text-decoration:none; line-height:1;
}
.btn:active{transform:translateY(1px)}
.btn i{width:15px;height:15px}
.btn-primary{background:var(--accent); color:#fff}
.btn-primary:hover{background:#4338ca}
.btn-soft{background:#f1f5f9; color:var(--text); border-color:#e2e8f0}
.btn-soft:hover{background:#e2e8f0}
.btn-ghost{background:transparent; color:var(--text-2)}
.btn-ghost:hover{background:#f1f5f9; color:var(--text)}
.btn-danger{background:#fee2e2; color:#b91c1c}
.btn-danger:hover{background:#fecaca}
.btn-sm{padding:5px 9px; font-size:12px}
.btn-icon{padding:7px; border-radius:8px}

/* ---------- Inputs ---------- */
.input, .select, textarea.input{
  width:100%; border:1px solid var(--border); background:#fff; border-radius:8px;
  padding:8px 11px; font-size:13.5px; color:var(--text); font-family:inherit;
  transition:border .12s, box-shadow .12s;
}
.input:focus, .select:focus, textarea.input:focus{
  outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(79,70,229,.12);
}
.input[readonly]{background:#f8fafc; color:var(--text-2)}
.lbl{display:block; font-size:12px; color:var(--text-2); font-weight:500; margin-bottom:5px}
.field{margin-bottom:14px}
.field-row{display:grid; grid-template-columns:1fr 1fr; gap:12px}
.hint{font-size:11.5px; color:var(--text-3); margin-top:4px}

/* ---------- Tables ---------- */
.tbl{width:100%; border-collapse:separate; border-spacing:0; background:#fff; border:1px solid var(--border); border-radius:var(--radius-lg); overflow:hidden}
.tbl th,.tbl td{padding:11px 14px; text-align:left; font-size:13.5px; border-bottom:1px solid var(--border-2)}
.tbl thead th{background:#f8fafc; font-weight:600; color:var(--text-2); font-size:12px; text-transform:uppercase; letter-spacing:.04em; position:sticky; top:0; z-index:1}
.tbl tbody tr{transition:background .1s}
.tbl tbody tr:hover{background:#fafbfc}
.tbl tbody tr:last-child td{border-bottom:none}
.tbl .num{text-align:right; font-variant-numeric:tabular-nums}
.tbl .actions{text-align:right; white-space:nowrap}
.tbl tfoot td{background:#f8fafc; font-weight:600; border-top:2px solid var(--border)}

/* ---------- Pills ---------- */
.pill{display:inline-flex; align-items:center; gap:4px; padding:2px 8px; border-radius:999px; font-size:11.5px; font-weight:600; line-height:1.4}
.pill-green{background:#dcfce7; color:#166534}
.pill-red{background:#fee2e2; color:#991b1b}
.pill-amber{background:#fef3c7; color:#92400e}
.pill-indigo{background:var(--accent-bg); color:var(--accent)}
.pill-gray{background:#f1f5f9; color:var(--text-2)}

/* ---------- Modal ---------- */
.modal-backdrop{position:fixed; inset:0; background:rgba(15,23,42,.55); backdrop-filter:blur(4px); z-index:60; display:flex; align-items:center; justify-content:center; padding:20px; animation:fadeIn .15s ease}
.modal{background:#fff; border-radius:var(--radius-lg); max-width:560px; width:100%; max-height:90vh; overflow:auto; box-shadow:0 30px 60px rgba(0,0,0,.25); animation:slideUp .18s ease}
.modal-h{display:flex; align-items:center; justify-content:space-between; padding:16px 20px; border-bottom:1px solid var(--border-2)}
.modal-h h3{margin:0; font-size:16px; font-weight:600}
.modal-b{padding:20px}
.modal-f{padding:14px 20px; border-top:1px solid var(--border-2); display:flex; justify-content:flex-end; gap:8px; background:#fafbfc; border-radius:0 0 var(--radius-lg) var(--radius-lg)}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
@keyframes slideUp{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:none}}

/* ---------- Flash ---------- */
.flash{display:flex; align-items:center; gap:10px; padding:11px 14px; border-radius:10px; margin-bottom:16px; font-size:13.5px; border:1px solid; animation:slideUp .2s ease}
.flash-success{background:#dcfce7; border-color:#bbf7d0; color:#166534}
.flash-error{background:#fee2e2; border-color:#fecaca; color:#991b1b}
.flash button{margin-left:auto; background:none; border:none; cursor:pointer; opacity:.6; color:inherit}
.flash button:hover{opacity:1}

/* ---------- Parsha grid (parshiyos.php) ---------- */
.year-block{margin-bottom:30px}
.year-h{display:flex; align-items:center; gap:10px; margin-bottom:12px; padding-bottom:8px; border-bottom:2px solid var(--border)}
.year-h .he{font-family:'Rubik','Heebo',sans-serif; font-size:26px; font-weight:700; direction:rtl}
.year-h .en{color:var(--text-3); font-size:13px}
.year-h .count{margin-left:auto; color:var(--text-2); font-size:12px}

.parsha-list{display:flex; flex-direction:column; gap:0}
.parsha-row{
  position:relative; background:#fff; border:1px solid var(--border); border-radius:10px;
  padding:12px 16px; display:flex; align-items:center; gap:14px; margin-bottom:6px;
  transition:border .12s, box-shadow .12s, transform .06s;
  cursor:pointer;
}
.parsha-row[data-href]:hover{border-color:#94a3b8; box-shadow:var(--shadow); background:#f9fafb}
.parsha-row[data-href]:focus{outline:2px solid var(--accent); outline-offset:2px}
.parsha-row .parsha-del{ order:-1; margin:0 }
.parsha-row .name{font-family:'Rubik','Heebo',sans-serif; font-size:20px; direction:rtl; font-weight:600; min-width:140px}
.parsha-row .date{color:var(--text-2); font-size:13px; direction:rtl; text-align:right}
.parsha-row .date .heb{font-family:'FB Toiren','Rubik',serif}
.parsha-row .meta{margin-left:auto; display:flex; align-items:center; gap:14px; color:var(--text-2); font-size:12.5px}
.parsha-row .badge{padding:2px 7px; border-radius:6px; font-size:10.5px; background:#f3f4f6; color:#1f2937; font-weight:600; text-transform:uppercase}
.parsha-row.is-yomtov{background:#fff}
.parsha-row.is-custom{border-style:dashed; background:#fafbfc}

/* Center the stat cards on the row */
.parsha-row .parsha-stats{ margin-inline:auto !important; }

/* End-of-row "insert after" button — always visible */
.parsha-row .row-add-after{
  display:inline-flex; align-items:center; justify-content:center;
  width:26px; height:26px; border-radius:50%; background:var(--accent-bg); color:var(--accent);
  border:none; cursor:pointer; transition:background .12s, color .12s, transform .08s;
}
.parsha-row .row-add-after:hover{background:var(--accent); color:#fff; transform:scale(1.08)}
.parsha-row .row-add-after i{width:14px;height:14px}

/* Hover "+" between rows is OFF — only the end-of-row + remains. */
.insert-slot, .row-add-slot { display:none !important; }

/* ---------- parsha_edit grid ---------- */
.row-grid{display:grid; grid-template-columns:160px 1fr 1fr 130px 110px 1fr 60px; gap:8px; align-items:center; padding:8px 6px; border-bottom:1px solid var(--border-2); position:relative}
.row-grid .type{font-family:'Rubik','Heebo',sans-serif; font-size:19px; direction:rtl; font-weight:600}
.row-grid .input{padding:6px 9px}

/* ---------- Login ---------- */
.login-wrap{min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px; background:linear-gradient(135deg,#eef2ff 0%,#f7f8fa 60%,#fafafa 100%)}
.login-card{background:#fff; border:1px solid var(--border); border-radius:18px; box-shadow:0 20px 50px rgba(15,23,42,.08); padding:32px; width:100%; max-width:400px}
.login-card .logo{text-align:center; margin-bottom:22px}
.login-card .logo img{width:64px;height:64px; object-fit:contain}
.login-card .logo h1{font-size:18px; font-weight:700; margin:10px 0 2px}
.login-card .logo p{font-size:12.5px; color:var(--text-2); margin:0}

/* ---------- Choices.js overrides ---------- */
.choices{margin-bottom:0; font-family:inherit}
.choices__inner{
  background:#fff !important; border:1px solid var(--border) !important; border-radius:8px !important;
  min-height:36px !important; padding:4px 10px !important; font-size:13.5px !important;
}
.choices.is-focused .choices__inner{border-color:var(--accent) !important; box-shadow:0 0 0 3px rgba(79,70,229,.12) !important}
.choices__list--dropdown{border-radius:10px !important; border:1px solid var(--border) !important; box-shadow:var(--shadow-lg) !important; margin-top:4px !important}
.choices__list--dropdown .choices__item--selectable.is-highlighted{background:var(--accent-bg) !important; color:var(--accent)}
.choices__placeholder{opacity:.6}

/* ---------- Flatpickr overrides ---------- */
.flatpickr-calendar{font-family:inherit !important; border-radius:12px !important; box-shadow:var(--shadow-lg) !important; border:1px solid var(--border) !important}
.flatpickr-day.selected,.flatpickr-day.startRange,.flatpickr-day.endRange{background:var(--accent) !important; border-color:var(--accent) !important}
.flatpickr-day:hover{background:var(--accent-bg) !important}

/* ---------- Footer ---------- */
.app-footer{text-align:center; padding:14px; color:var(--text-3); font-size:12px; border-top:1px solid var(--border-2); margin-top:auto}
.app-footer strong{color:var(--text-2); font-weight:600}

/* ---------- Mobile ---------- */
@media(max-width:768px){
  .sidebar{position:fixed; top:0; left:-260px; height:100vh; z-index:50; transition:left .2s}
  .sidebar.open{left:0}
  .topbar{display:flex; align-items:center; justify-content:space-between; padding:12px 16px; background:#fff; border-bottom:1px solid var(--border); position:sticky; top:0; z-index:40}
  .topbar button{background:none; border:none; cursor:pointer; padding:6px}
  .page{padding:16px}
  .row-grid{grid-template-columns:1fr 1fr; gap:6px}
  .field-row{grid-template-columns:1fr}
}

/* ---------- Print ---------- */
@media print{
  body{background:#fff}
  .sidebar,.topbar,.no-print,.btn{display:none !important}
  .page{padding:0; max-width:none}
  .card,.tbl{box-shadow:none; border:1px solid #e2e8f0}
  .app-footer{border:none; color:#666}
}

/* ---------- Top search bar ---------- */
.topbar-search{position:sticky;top:0;z-index:30;background:rgba(255,255,255,.92);backdrop-filter:saturate(180%) blur(10px);border-bottom:1px solid var(--border);padding:10px 24px;display:flex;align-items:center;gap:8px;position:relative}
.topbar-search > i{width:18px;height:18px;color:var(--text-soft);flex-shrink:0}
.topbar-search input{flex:1;border:none;outline:none;background:transparent;font:inherit;font-size:14px;color:var(--text);padding:4px 0}
.topbar-search input::placeholder{color:var(--text-soft)}
.gs-results{position:absolute;top:100%;left:24px;right:24px;background:#fff;border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow-lg);margin-top:6px;max-height:60vh;overflow:auto;padding:6px}
.gs-results .gs-group{font-size:11px;text-transform:uppercase;letter-spacing:.05em;color:var(--text-soft);padding:8px 10px 4px;font-weight:600}
.gs-results a{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:8px;color:var(--text);text-decoration:none}
.gs-results a:hover,.gs-results a.gs-active{background:var(--accent-bg);color:var(--accent)}
.gs-results a i{width:16px;height:16px;color:var(--text-soft);flex-shrink:0}
.gs-results .gs-empty{padding:16px;text-align:center;color:var(--text-soft);font-size:13px}

/* ---------- Hebrew date picker modal ---------- */
.hdp-wrap{position:relative;display:flex;gap:6px}
.hdp-wrap input.hdp-display{flex:1;cursor:pointer;background:#fff}
.hdp-wrap button.hdp-btn{background:var(--accent-bg);color:var(--accent);border:1px solid var(--border);border-radius:8px;padding:0 10px;cursor:pointer;display:flex;align-items:center;gap:4px}
.hdp-pop{position:absolute;top:calc(100% + 6px);left:0;z-index:1000;background:#fff;border:1px solid var(--border);border-radius:12px;box-shadow:var(--shadow-lg);padding:14px;width:320px}
.hdp-pop .row{display:grid;grid-template-columns:1fr 1fr 80px;gap:8px;margin-bottom:10px}
.hdp-pop select,.hdp-pop input{width:100%;padding:6px 8px;border:1px solid var(--border);border-radius:8px;font:inherit;font-size:13px}
.hdp-pop .preview{font-family:'Rubik','Heebo',sans-serif;direction:rtl;text-align:center;padding:8px;background:var(--bg);border-radius:8px;margin-bottom:10px;font-size:18px;font-weight:600}
.hdp-pop .actions{display:flex;gap:6px;justify-content:flex-end}
/* ---------- RTL (Yiddish) ---------- */
html[dir="rtl"] body{font-family:'Heebo','Rubik','Assistant','Noto Sans Hebrew',sans-serif}
html[dir="rtl"] .sidebar{border-right:none;border-left:1px solid var(--border)}
html[dir="rtl"] .me a{flex-direction:row-reverse}
html[dir="rtl"] .topbar-search > i{order:1}
html[dir="rtl"] .topbar-search input{text-align:right}
html[dir="rtl"] .gs-results a{flex-direction:row-reverse;text-align:right}
html[dir="rtl"] .row-add-slot,
html[dir="rtl"] .parsha-row .row-add-after{margin-right:auto;margin-left:0}
html[dir="rtl"] .stat,
html[dir="rtl"] .card,
html[dir="rtl"] .page-h,
html[dir="rtl"] .meta{text-align:right}
html[dir="rtl"] table th,
html[dir="rtl"] table td{text-align:right}
html[dir="rtl"] table th.num,
html[dir="rtl"] table td.num,
html[dir="rtl"] table th[class*="num"],
html[dir="rtl"] table td[class*="num"]{text-align:left}
html[dir="rtl"] .btn i{margin-left:0;margin-right:0}
html[dir="rtl"] .flash{flex-direction:row-reverse}
html[dir="rtl"] .modal-f{flex-direction:row-reverse}
html[dir="rtl"] .modal-h{flex-direction:row-reverse}
html[dir="rtl"] .row-grid .actions{flex-direction:row-reverse}
html[dir="rtl"] .hdp-pop{left:auto;right:0}
/* ============ Polish fixes (May 2026) ============ */
/* Stat tiles: icon column next to text rows (no overlap in RTL) */
.stat{display:grid;grid-template-columns:auto 1fr;column-gap:14px;align-items:center;padding:16px 18px;text-align:start}
.stat .ic{position:static;grid-column:1;grid-row:1 / span 3;width:46px;height:46px;border-radius:12px;background:var(--accent-bg);color:var(--accent);display:flex;align-items:center;justify-content:center;flex-shrink:0;align-self:center}
.stat .ic i{width:22px;height:22px}
.stat .lbl,.stat .val,.stat .sub{grid-column:2;text-align:start;min-width:0}
.stat .lbl{font-size:12px;color:var(--text-3);text-transform:uppercase;letter-spacing:.04em}
.stat .val{font-size:22px;font-weight:700;margin-top:2px}
.stat .sub{font-size:12px;color:var(--text-3)}
html[dir="rtl"] .stat{text-align:right;direction:rtl}

/* Card titles: icon left of text in LTR, right in RTL */
.card-h{text-align:start}
html[dir="rtl"] .card-h{flex-direction:row-reverse;justify-content:flex-end}

/* Larger modal variant */
.modal.modal--lg{max-width:720px}
.modal.modal--xl{max-width:920px}

/* Hebrew date picker: centered under field, never off-screen */
.hdp-pop{left:50%;right:auto;transform:translateX(-50%);width:360px;max-width:calc(100vw - 32px);padding:18px}
.hdp-pop .row{grid-template-columns:1fr 1fr 100px;gap:10px;margin-bottom:14px}
.hdp-pop select,.hdp-pop input{padding:9px 10px;font-size:14px;border-radius:10px}
.hdp-pop .preview{font-size:22px;padding:12px;margin-bottom:14px;border:1px solid var(--border)}
.hdp-pop .actions button{padding:7px 14px}
html[dir="rtl"] .hdp-pop{left:50%;right:auto;transform:translateX(-50%)}

/* Dropdown polish (Choices.js look bigger and modern) */
.choices__inner{min-height:42px !important;padding:6px 12px !important;font-size:14px !important;border-radius:10px !important}
.choices__list--dropdown .choices__item{font-size:13.5px !important;padding:9px 12px !important}

/* Inputs match */
.input{border-radius:10px;padding:9px 11px;font-size:14px}

/* RTL search results popover */
html[dir="rtl"] .gs-results{left:24px;right:24px}

/* ============ Modern print (Excel-sheet style) ============ */
@media print{
  @page{margin:14mm 12mm;size:A4}
  html,body{background:#fff !important;color:#000 !important;font-size:11pt}
  .sidebar,.topbar,.topbar-search,.no-print,.btn,.app-footer,.flash,form.card,
  .row-add-slot,.row-add-after,.insert-slot,.parsha-row .actions,
  .modal-backdrop{display:none !important}
  .page{padding:0 !important;max-width:none !important;margin:0 !important}
  .page-h{border-bottom:2px solid #000;padding-bottom:8px;margin-bottom:12px}
  .page-h h1{font-size:18pt !important;color:#000}
  .page-h .sub{color:#444;font-size:10pt}
  .card{box-shadow:none !important;border:none !important;padding:0 !important;margin-bottom:10px;background:transparent}
  .card-h{color:#000;border-bottom:1px solid #999;padding-bottom:4px;margin-bottom:8px}
  table.tbl{width:100%;border-collapse:collapse;font-size:10pt;page-break-inside:auto}
  table.tbl thead{display:table-header-group;background:#e8eef7 !important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  table.tbl tfoot{display:table-footer-group;background:#f0f3f8 !important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  table.tbl th,table.tbl td{border:1px solid #c0c8d4 !important;padding:5px 8px !important;background:#fff;color:#000}
  table.tbl th{background:#e8eef7 !important;font-weight:700;text-transform:none;letter-spacing:0;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  table.tbl tr{page-break-inside:avoid}
  table.tbl tr:nth-child(even) td{background:#fafbfd !important;-webkit-print-color-adjust:exact;print-color-adjust:exact}
  .pill{border:1px solid #999;background:#fff !important;color:#000 !important;padding:1px 6px;font-size:9pt}
  .parsha-row{border:1px solid #c0c8d4;border-radius:0;margin-bottom:2px;padding:6px 10px;background:#fff !important}
  .stat{border:1px solid #c0c8d4 !important;padding:8px;box-shadow:none !important;background:#fff !important}
  .stats{grid-template-columns:repeat(5,1fr) !important;gap:6px !important}
  .stat .ic{display:none !important}
  .stat .lbl{font-size:8pt;color:#666}
  .stat .val{font-size:14pt;margin:2px 0}
  .stat .sub{font-size:8pt;color:#888}
  /* Print-only header banner */
  .print-only{display:block !important}
  .print-banner{display:block;margin-bottom:14px;border-bottom:2px solid #000;padding-bottom:8px}
  .print-banner h2{margin:0;font-size:16pt}
  .print-banner .meta{font-size:10pt;color:#444;margin-top:2px}
  /* Sort indicator passthrough */
  .print-sort-info{font-size:10pt;color:#444;font-style:italic;margin-bottom:8px}
}
.print-only{display:none}
/* ============ Global search modal ============ */
.search-shell{display:flex;flex-direction:column;gap:14px;min-height:70vh}
.search-input-wrap{display:flex;align-items:center;gap:10px;padding:12px 16px;border:1px solid var(--border);border-radius:12px;background:var(--surface);box-shadow:0 1px 0 rgba(0,0,0,.02)}
.search-input-wrap i{width:20px;height:20px;color:var(--text-soft);flex-shrink:0}
.search-input-wrap input{flex:1;border:none;outline:none;background:transparent;font:inherit;font-size:16px;padding:4px 0}
.search-input-wrap kbd{font-family:ui-monospace,monospace;font-size:11px;padding:2px 6px;border:1px solid var(--border);border-radius:5px;color:var(--text-soft);background:#f8fafc}
.search-chips{display:flex;flex-wrap:wrap;gap:6px}
.search-chip{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;border:1px solid var(--border);background:#fff;color:var(--text-2);font:inherit;font-size:13px;cursor:pointer;transition:all .15s}
.search-chip i{width:14px;height:14px}
.search-chip:hover{transform:translateY(-1px);box-shadow:0 2px 6px rgba(15,23,42,.08)}
.search-chip.active{color:#fff;border-color:transparent;box-shadow:0 2px 8px rgba(15,23,42,.18)}

/* Per-category accent colors for the filter chips */
.search-chip[data-cat="members"]:hover     { background:#eef2ff; color:#3730a3; border-color:#c7d2fe; }
.search-chip[data-cat="members"].active    { background:#4f46e5; }
.search-chip[data-cat="parshiyos"]:hover   { background:#fef3c7; color:#92400e; border-color:#fde68a; }
.search-chip[data-cat="parshiyos"].active  { background:#d97706; }
.search-chip[data-cat="payments"]:hover    { background:#dcfce7; color:#166534; border-color:#bbf7d0; }
.search-chip[data-cat="payments"].active   { background:#16a34a; }
.search-chip[data-cat="invoices"]:hover    { background:#dbeafe; color:#1e40af; border-color:#bfdbfe; }
.search-chip[data-cat="invoices"].active   { background:#2563eb; }
.search-chip[data-cat="aliyos"]:hover      { background:#f3e8ff; color:#6b21a8; border-color:#e9d5ff; }
.search-chip[data-cat="aliyos"].active     { background:#9333ea; }
.search-chip[data-cat="years"]:hover       { background:#fce7f3; color:#9d174d; border-color:#fbcfe8; }
.search-chip[data-cat="years"].active      { background:#db2777; }
.search-chip[data-cat="all"].active        { background:#0f172a; }

/* Modern clear-X button inside the search input */
.search-input-wrap .search-clear,
.search-input-wrap button.clear,
.search-input-wrap .btn-clear{
  width:26px; height:26px; border-radius:50%; border:1px solid var(--border);
  background:#f1f5f9; color:#475569; display:inline-flex; align-items:center; justify-content:center;
  cursor:pointer; padding:0; flex-shrink:0; transition:all .12s;
}
.search-input-wrap .search-clear:hover,
.search-input-wrap button.clear:hover,
.search-input-wrap .btn-clear:hover{ background:#fee2e2; color:#b91c1c; border-color:#fecaca; transform:scale(1.05); }
.search-input-wrap .search-clear i,
.search-input-wrap button.clear i,
.search-input-wrap .btn-clear i{ width:14px; height:14px; }
.search-results{flex:1;overflow:auto;border-top:1px solid var(--border);padding-top:8px;min-height:200px;max-height:60vh}
.search-hint{padding:40px 16px;text-align:center;color:var(--text-soft);font-size:14px}
.search-group-h{display:flex;align-items:center;gap:6px;font-size:11px;text-transform:uppercase;letter-spacing:.06em;color:var(--text-soft);padding:14px 4px 6px;font-weight:700}
.search-group-h i{width:14px;height:14px}
.search-group-h .cnt{margin-left:auto;background:var(--accent-bg);color:var(--accent);padding:1px 7px;border-radius:99px;font-size:11px;letter-spacing:0}
.search-group-list{display:flex;flex-direction:column;gap:2px}
.search-row{display:flex;align-items:center;gap:12px;padding:9px 10px;border-radius:8px;text-decoration:none;color:var(--text);transition:background .1s}
.search-row .ico{width:36px;height:36px;border-radius:8px;background:var(--accent-bg);color:var(--accent);display:flex;align-items:center;justify-content:center;flex-shrink:0}
.search-row .ico i{width:18px;height:18px}
.search-row .info{flex:1;min-width:0}
.search-row .info .ttl{font-weight:600;font-size:14px}
.search-row .info .sub{font-size:12px;color:var(--text-soft);margin-top:1px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.search-row .amt{font-variant-numeric:tabular-nums;font-weight:700;color:var(--text);flex-shrink:0}
.search-row:hover,.search-row.active{background:var(--accent-bg)}
.modal.modal--xl{max-width:1100px;width:96vw}
html[dir="rtl"] .search-row{flex-direction:row-reverse;text-align:right}
html[dir="rtl"] .search-group-h .cnt{margin-left:0;margin-right:auto}

/* ============ Polish pass 2 (May 2026) ============ */
/* Force form controls + buttons to use our fonts (browsers reset to system font) */
button, input, select, textarea, .btn{
  font-family:'Heebo','Rubik','Assistant','Noto Sans Hebrew',ui-sans-serif,system-ui,sans-serif;
}
html[dir="rtl"] button, html[dir="rtl"] input, html[dir="rtl"] select, html[dir="rtl"] textarea{
  font-family:'Heebo','Rubik','Assistant','Noto Sans Hebrew',sans-serif;
}

/* Native <select> — custom chevron always pinned to LEFT, text stays clear */
select.input, select.select, select:not([multiple]):not([size]){
  -webkit-appearance:none; -moz-appearance:none; appearance:none;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat:no-repeat;
  background-position:left 11px center;
  padding-left:34px;
  padding-right:11px;
}
html[dir="rtl"] select.input, html[dir="rtl"] select.select, html[dir="rtl"] select:not([multiple]):not([size]){
  background-position:left 11px center; /* keep chevron on LEFT in RTL too */
  padding-left:34px; padding-right:11px;
}

/* Inputs with a leading icon (prepend lucide <i> before <input> inside a wrapper) */
.field-icon{position:relative}
.field-icon > i[data-lucide]{
  position:absolute; left:11px; top:50%; transform:translateY(-50%);
  width:16px; height:16px; color:var(--text-3); pointer-events:none;
}
.field-icon > input.input, .field-icon > .input{ padding-left:36px; }
html[dir="rtl"] .field-icon > i[data-lucide]{ left:11px; right:auto; } /* stay LEFT */
html[dir="rtl"] .field-icon > input.input, html[dir="rtl"] .field-icon > .input{ padding-left:36px; padding-right:11px; }

/* Top search: chevron/search icon stays on LEFT regardless of direction */
html[dir="rtl"] .topbar-search > i{ order:0; }

/* Hebrew date picker shell matches normal input field */
.hdp-wrap{ gap:0; }
.hdp-wrap input.hdp-display{
  border:1px solid var(--border); border-radius:10px; padding:9px 38px 9px 11px;
  font-size:14px; background:#fff; height:auto; line-height:1.4;
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='4' width='18' height='18' rx='2'/><line x1='16' y1='2' x2='16' y2='6'/><line x1='8' y1='2' x2='8' y2='6'/><line x1='3' y1='10' x2='21' y2='10'/></svg>");
  background-repeat:no-repeat; background-position:left 11px center;
}
.hdp-wrap input.hdp-display:hover{ border-color:var(--accent); }
.hdp-wrap button.hdp-btn{ display:none; } /* icon is now inside the input */

/* Popovers / dropdowns / pickers: always on top */
.hdp-pop{ z-index:2000; }
.choices__list--dropdown{ z-index:2000 !important; }
.flatpickr-calendar{ z-index:2000 !important; }
.gs-results{ z-index:2000; }
.modal-backdrop{ z-index:1500; }     /* modal still below picker when picker is opened inside modal */
.modal-backdrop .hdp-pop,
.modal-backdrop .choices__list--dropdown,
.modal-backdrop .flatpickr-calendar{ z-index:2100 !important; }

/* ============ Polish pass 3 (May 2026) ============ */
/* Sheet-style tables: flat, no card rounding, denser */
.card.sheet, .sheet-card{
  background:#fff; border:1px solid var(--border); border-radius:6px;
  padding:0; box-shadow:none;
}
.sheet-card > .sheet-h{
  display:flex; align-items:center; gap:10px; padding:10px 14px;
  border-bottom:1px solid var(--border); background:#f8fafc; font-weight:600;
}
.tbl.sheet, table.sheet{
  border-collapse:collapse; width:100%; border:1px solid var(--border);
  background:#fff; border-radius:0;
}
.tbl.sheet th, .tbl.sheet td{
  border:1px solid #e2e8f0; padding:6px 9px; border-radius:0 !important;
}
.tbl.sheet thead th{ background:#eef2ff; color:#3730a3; font-weight:700; }
.tbl.sheet tr:nth-child(even) td{ background:#fafbfd; }
.tbl.sheet tr:hover td{ background:#f1f5f9; }
.tbl.sheet input.input{ border-radius:0; border:1px solid transparent; background:transparent; }
.tbl.sheet input.input:focus{ border-color:var(--accent); background:#fff; box-shadow:0 0 0 2px rgba(79,70,229,.15); }

/* Modal: thicker backdrop blur + nicer close button */
.modal-backdrop{ background:rgba(15,23,42,.5) !important; backdrop-filter:blur(10px) saturate(140%) !important; -webkit-backdrop-filter:blur(10px) saturate(140%) !important; }
.modal-h .btn-icon{
  width:32px; height:32px; border-radius:50%; padding:0;
  display:inline-flex; align-items:center; justify-content:center;
  background:#f1f5f9; color:#475569; border:1px solid var(--border-2);
}
.modal-h .btn-icon:hover{ background:#fee2e2; color:#b91c1c; border-color:#fecaca; }
.modal-h .btn-icon i{ width:16px; height:16px; }

/* Search results: alternating subtle category tints */
.search-group-list .search-row:nth-child(odd){  background:#fafbff; }
.search-group-list .search-row:nth-child(even){ background:#fff; }
.search-group-list .search-row:hover, .search-group-list .search-row.active{ background:var(--accent-bg) !important; }
.search-group-h{ background:#f5f7fb; border-radius:6px; padding:8px 10px; margin-top:10px; }

/* Bigger payment modal */
.modal.modal--lg{ max-width:780px; width:96vw; }
.modal.modal--xl{ max-width:1100px; width:96vw; }
.modal--lg .modal-b, .modal--xl .modal-b{ padding:22px 24px; }
.modal--lg .field-row{ gap:14px; }
.modal--lg .input, .modal--lg .choices__inner{ font-size:14.5px !important; }
.modal--lg .hdp-pop{ position:absolute; }

/* Inputs/dropdowns: enough room for placeholder + chevron + leading icon */
.input, .choices__inner{ min-height:40px; }
.input::placeholder{ opacity:.55; font-size:13.5px; }

/* Sheet style for parsha rows + monthly dues + aliyos tables */
.parsha-row{ border-radius:4px !important; border:1px solid #e2e8f0 !important; box-shadow:none !important; margin-bottom:0 !important; border-top:none !important; }
.parsha-row:first-child{ border-top:1px solid #e2e8f0 !important; border-radius:4px 4px 0 0 !important; }
.parsha-row:last-child{ border-radius:0 0 4px 4px !important; }
.parsha-row:hover{ background:#f8fafc; }

/* Monthly dues compact */
.md-grid{ font-size:13px; }
.md-grid th, .md-grid td{ padding:4px 6px !important; }
.md-grid input.input{ padding:5px 6px !important; min-height:0; font-size:13px; min-width:62px; }
.md-grid th.mo{ font-size:13px; padding:8px 4px !important; min-width:72px !important; }
.md-grid .name-cell{ cursor:pointer; user-select:none; }
.md-grid .name-cell:hover{ background:#eef2ff !important; color:var(--accent); }
.md-grid .name-cell i{ width:12px; height:12px; opacity:.4; vertical-align:-1px; margin-inline-start:4px; }
@media(min-width:1400px){ .md-grid input.input{ min-width:54px; } .md-grid th.mo{ min-width:64px !important; } }

/* Year tab strip — flat sheet style */
.md-year-tabs{ display:flex; gap:0; flex-wrap:wrap; }
.md-year-tab{
  display:inline-flex; align-items:center; gap:5px;
  padding:7px 14px; border:1px solid var(--border); background:#fff;
  font-family:'Rubik','Heebo',sans-serif; font-size:17px; font-weight:600; color:var(--text);
  text-decoration:none; border-right:none;
}
.md-year-tab:first-child{ border-radius:6px 0 0 6px; }
.md-year-tab:last-of-type{ border-radius:0 6px 6px 0; border-right:1px solid var(--border); }
.md-year-tab.active{ background:var(--accent); color:#fff; border-color:var(--accent); }
.md-year-tab:hover:not(.active){ background:#eef2ff; color:var(--accent); }
.md-year-tab .star{ font-size:11px; opacity:.7; }
html[dir="rtl"] .md-year-tab:first-child{ border-radius:0 6px 6px 0; }
html[dir="rtl"] .md-year-tab:last-of-type{ border-radius:6px 0 0 6px; border-right:none; border-left:1px solid var(--border); }
html[dir="rtl"] .md-year-tab{ border-right:1px solid var(--border); border-left:none; }
.md-add-next{
  display:inline-flex; align-items:center; justify-content:center;
  width:34px; height:34px; border-radius:6px; margin-inline-start:6px;
  background:var(--accent-bg); color:var(--accent); border:1px dashed var(--accent);
  cursor:pointer;
}
.md-add-next:hover{ background:var(--accent); color:#fff; }

/* Print: Hebrew direction preserved + BiDi isolation */
@media print{
  html[dir="rtl"] body, html[dir="rtl"] .page, html[dir="rtl"] .card, html[dir="rtl"] table.tbl{ direction:rtl; }
  .heb, .heb-frank, td.heb, td.heb-frank, th.heb, th.heb-frank{
    direction:rtl !important; unicode-bidi:isolate !important;
  }
  /* Hebrew tables: text aligned to start (right in RTL) */
  html[dir="rtl"] table.tbl th, html[dir="rtl"] table.tbl td{
    text-align:right; direction:rtl; unicode-bidi:isolate;
  }
  html[dir="rtl"] table.tbl td.num, html[dir="rtl"] table.tbl th.num{
    direction:ltr; text-align:left; unicode-bidi:isolate;
  }
  /* Sheet tables in print: clean grid */
  table.tbl, table.sheet{ border:1px solid #888; }
  table.tbl th, table.tbl td, table.sheet th, table.sheet td{ border:1px solid #aaa; padding:4px 6px !important; }
}

/* Small popover (sort, confirm) used by app.js */
.popover-anchor{ position:relative; }
.popover{
  position:absolute; z-index:2050; background:#fff; border:1px solid var(--border);
  border-radius:10px; box-shadow:0 12px 32px rgba(15,23,42,.15);
  padding:10px; min-width:200px; animation:slideUp .12s ease;
}
.popover .pop-h{ font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--text-soft); padding:4px 6px 8px; font-weight:700; }
.popover button.pop-item{
  display:flex; align-items:center; gap:8px; width:100%; padding:8px 10px;
  border:none; background:transparent; cursor:pointer; border-radius:6px;
  text-align:start; font:inherit; color:var(--text);
}
.popover button.pop-item:hover{ background:var(--accent-bg); color:var(--accent); }
.popover button.pop-item i{ width:14px; height:14px; }
.popover button.pop-item.active{ background:var(--accent); color:#fff; }
