/* ============================================================
   קופת רבי יהודה בר עילאי — מערכת ניהול
   עיצוב מוסדי פרימיום · RTL · בהיר/כהה
   ============================================================ */

:root {
  /* פלטת צבעים */
  --tzfat-blue: #1F3C68;
  --royal-blue: #2E5B96;
  --royal-blue-soft: #3d6ba8;
  --gold: #D4AF37;
  --gold-soft: #e6c869;
  --cream: #F7F2E8;

  /* בהיר */
  --bg: #F1ECDF;
  --bg-grad-1: #f4efe4;
  --bg-grad-2: #ece4d2;
  --surface: #FFFFFF;
  --surface-2: #FBF8F1;
  --surface-3: #f4f0e7;
  --ink: #1F2933;
  --ink-soft: #5F6673;
  --ink-faint: #8b929c;
  --border: #e7ddc8;
  --border-soft: #efe8d8;
  --line: #eee6d4;
  --shadow-sm: 0 1px 2px rgba(31,60,104,.06), 0 1px 3px rgba(31,60,104,.05);
  --shadow-md: 0 4px 14px rgba(31,60,104,.08), 0 2px 6px rgba(31,60,104,.05);
  --shadow-lg: 0 18px 50px rgba(31,60,104,.16), 0 6px 18px rgba(31,60,104,.08);
  --sidebar-bg: linear-gradient(180deg, #1F3C68 0%, #1a3258 100%);
  --sidebar-ink: #cdd8ea;
  --sidebar-ink-soft: #8da0c4;

  /* סמנטיקה */
  --ok: #2f8f5b; --ok-bg: #e7f4ec;
  --warn: #c9881f; --warn-bg: #fbf1d9;
  --danger: #c0392b; --danger-bg: #fae9e6;
  --info: #2E5B96; --info-bg: #e8eef7;
  --neutral: #6b7280; --neutral-bg: #eef0f3;

  --radius: 16px;
  --radius-sm: 11px;
  --radius-lg: 22px;
  --sidebar-w: 268px;
  --topbar-h: 70px;
  --font: "Heebo", "Assistant", "Segoe UI", Arial, sans-serif;
  --serif: "Frank Ruhl Libre", "Heebo", serif;
}

html[data-theme="dark"] {
  --bg: #10151f;
  --bg-grad-1: #121826;
  --bg-grad-2: #0d121b;
  --surface: #1a2230;
  --surface-2: #202a3a;
  --surface-3: #243044;
  --ink: #eaf0f8;
  --ink-soft: #9aa7bd;
  --ink-faint: #6c7894;
  --border: #2c3850;
  --border-soft: #28344a;
  --line: #273347;
  --cream: #1a2230;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 55px rgba(0,0,0,.55);
  --sidebar-bg: linear-gradient(180deg, #16203a 0%, #111a30 100%);
  --sidebar-ink: #c4d2ea;
  --sidebar-ink-soft: #7e8eac;
  --ok-bg: #16302280; --warn-bg: #3a2f1480; --danger-bg: #3a201c80;
  --info-bg: #1c2c4880; --neutral-bg: #232c3c;
  --gold: #e6c869;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(46,91,150,.07), transparent 60%),
    linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed;
  color: var(--ink);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 20px; }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }

/* ============================================================ TOPBAR */
.topbar {
  position: sticky; top: 0; z-index: 60;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.topbar-right { display: flex; align-items: center; gap: 14px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo {
  width: 46px; height: 46px; border-radius: 12px; object-fit: cover;
  border: 2px solid var(--gold); box-shadow: var(--shadow-sm); flex: 0 0 auto;
}
.brand-text { min-width: 0; }
.brand-text h1 {
  font-family: var(--serif); font-size: 19px; font-weight: 700; color: var(--tzfat-blue);
  line-height: 1.1; white-space: nowrap;
}
html[data-theme="dark"] .brand-text h1 { color: var(--gold-soft); }
.brand-text span { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }

.topbar-search {
  flex: 1; max-width: 520px; position: relative;
  display: flex; align-items: center;
}
.topbar-search .search-ico { position: absolute; right: 14px; width: 18px; height: 18px; color: var(--ink-faint); }
.topbar-search input {
  width: 100%; height: 42px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2);
  padding: 0 42px 0 16px; font-family: var(--font); font-size: 14px; color: var(--ink);
  transition: .2s;
}
.topbar-search input:focus { outline: none; border-color: var(--royal-blue); background: var(--surface); box-shadow: 0 0 0 4px rgba(46,91,150,.12); }

.topbar-left { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center; position: relative; transition: .15s;
}
.icon-btn:hover { background: var(--surface-3); color: var(--royal-blue); border-color: var(--royal-blue); }
.menu-toggle { display: none; }
.has-badge .badge-dot {
  position: absolute; top: -5px; left: -5px; min-width: 18px; height: 18px; padding: 0 4px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
  border-radius: 10px; display: grid; place-items: center; border: 2px solid var(--surface);
}
.ico-moon { display: none; }
html[data-theme="dark"] .ico-sun { display: none; }
html[data-theme="dark"] .ico-moon { display: block; }

.topbar-date {
  font-size: 12.5px; color: var(--ink-soft); text-align: center; line-height: 1.25;
  padding: 0 6px; white-space: nowrap;
}
.topbar-date strong { display: block; color: var(--ink); font-weight: 600; }

.user-chip {
  display: flex; align-items: center; gap: 9px; border: 1px solid var(--border);
  background: var(--surface-2); border-radius: 12px; padding: 5px 6px 5px 12px; cursor: pointer; transition: .15s;
}
.user-chip:hover { border-color: var(--royal-blue); }
.user-avatar {
  width: 34px; height: 34px; border-radius: 9px; background: linear-gradient(135deg, var(--royal-blue), var(--tzfat-blue));
  color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 15px;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.15; }
.user-meta strong { font-size: 13.5px; }
.user-meta small { font-size: 11px; color: var(--ink-soft); }

/* ============================================================ LAYOUT */
.layout { display: flex; align-items: stretch; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--sidebar-bg); color: var(--sidebar-ink);
  position: sticky; top: var(--topbar-h); height: calc(100vh - var(--topbar-h));
  display: flex; flex-direction: column; padding: 14px 12px; overflow-y: auto;
  border-inline-start: 1px solid rgba(255,255,255,.05);
}
.nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px;
  color: var(--sidebar-ink); cursor: pointer; font-size: 14.5px; font-weight: 500;
  border: 1px solid transparent; transition: .15s; position: relative; text-align: right;
}
.nav-item svg { width: 20px; height: 20px; flex: 0 0 auto; color: var(--sidebar-ink-soft); }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item:hover svg { color: var(--gold-soft); }
.nav-item.active {
  background: linear-gradient(90deg, rgba(212,175,55,.16), rgba(255,255,255,.05));
  color: #fff; font-weight: 600;
}
.nav-item.active svg { color: var(--gold); }
.nav-item.active::before {
  content: ""; position: absolute; right: -12px; top: 50%; transform: translateY(-50%);
  width: 4px; height: 26px; background: var(--gold); border-radius: 0 4px 4px 0;
}
.nav-item .nav-count {
  margin-inline-start: auto; background: rgba(255,255,255,.12); color: #fff;
  font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 20px;
}
.nav-item.urgent .nav-count { background: var(--danger); }

.sidebar-footer { margin-top: 14px; padding: 14px; border-radius: 12px; background: rgba(0,0,0,.18); }
.demo-flag {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .5px;
  color: #1a2230; background: var(--gold); padding: 3px 10px; border-radius: 20px; margin-bottom: 8px;
}
.sidebar-footer p { font-size: 11.5px; color: var(--sidebar-ink-soft); line-height: 1.4; }

.sidebar-scrim { display: none; }

.content { flex: 1; min-width: 0; padding: 26px 30px 60px; }

/* ============================================================ PAGE HEADERS */
.page-head { margin-bottom: 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h2 { font-family: var(--serif); font-size: 27px; font-weight: 700; color: var(--tzfat-blue); }
html[data-theme="dark"] .page-head h2 { color: var(--ink); }
.page-head .sub { color: var(--ink-soft); font-size: 14.5px; margin-top: 3px; }
.page-head-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.section-title {
  display: flex; align-items: center; gap: 9px; font-size: 16.5px; font-weight: 700;
  color: var(--ink); margin: 6px 0 14px;
}
.section-title .st-ico { width: 30px; height: 30px; border-radius: 9px; background: var(--info-bg); color: var(--royal-blue); display: grid; place-items: center; }
.section-title .st-ico svg { width: 17px; height: 17px; }
.section-title .st-count { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.section-title .st-link { margin-inline-start: auto; font-size: 13px; color: var(--royal-blue); font-weight: 600; cursor: pointer; }
.section-title .st-link:hover { text-decoration: underline; }

/* ============================================================ BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  height: 40px; padding: 0 16px; border-radius: 11px; font-family: var(--font);
  font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); transition: .15s; white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn:hover { box-shadow: var(--shadow-sm); border-color: var(--royal-blue); }
.btn-primary { background: linear-gradient(135deg, var(--royal-blue), var(--tzfat-blue)); color: #fff; border-color: transparent; }
.btn-primary:hover { box-shadow: 0 6px 18px rgba(46,91,150,.35); border-color: transparent; }
.btn-gold { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: #3a2f10; border-color: transparent; }
.btn-gold:hover { box-shadow: 0 6px 18px rgba(212,175,55,.4); }
.btn-ghost { background: transparent; }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.btn-danger:hover { background: var(--danger-bg); border-color: var(--danger); }
.btn-sm { height: 33px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn-block { width: 100%; }

/* ============================================================ CARDS */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px;
}
.grid { display: grid; gap: 16px; }

/* KPI */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 17px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden; transition: .18s;
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent, var(--royal-blue)); }
.kpi-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.kpi-label { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.kpi-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-bg, var(--info-bg)); color: var(--accent, var(--royal-blue)); }
.kpi-ico svg { width: 19px; height: 19px; }
.kpi-value { font-size: 27px; font-weight: 800; color: var(--ink); letter-spacing: -.5px; line-height: 1.1; }
.kpi-note { font-size: 12px; margin-top: 5px; display: flex; align-items: center; gap: 5px; color: var(--ink-soft); }
.kpi-note.up { color: var(--ok); } .kpi-note.down { color: var(--danger); } .kpi-note.warn { color: var(--warn); }
.kpi-note svg { width: 14px; height: 14px; }

/* ============================================================ TABLES */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data thead th {
  text-align: right; font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
  padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
}
table.data tbody td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.data tbody tr { transition: .12s; cursor: pointer; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: none; }
.cell-strong { font-weight: 600; color: var(--ink); }
.cell-sub { font-size: 12px; color: var(--ink-soft); }
.cell-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.cell-actions { display: flex; gap: 6px; justify-content: flex-start; }
.row-ico-btn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft); display: grid; place-items: center; cursor: pointer; }
.row-ico-btn:hover { color: var(--royal-blue); border-color: var(--royal-blue); }
.row-ico-btn svg { width: 15px; height: 15px; }
.row-ico-btn.del:hover { color: var(--danger); border-color: var(--danger); }

.avatar-cell { display: flex; align-items: center; gap: 11px; }
.mini-avatar { width: 36px; height: 36px; border-radius: 10px; background: var(--info-bg); color: var(--royal-blue); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: 0 0 auto; }
.mini-avatar.fam { background: var(--warn-bg); color: var(--warn); }

/* ============================================================ BADGES */
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  padding: 3px 10px; border-radius: 20px; white-space: nowrap; line-height: 1.6;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.badge.ok { color: var(--ok); background: var(--ok-bg); }
.badge.warn { color: var(--warn); background: var(--warn-bg); }
.badge.danger { color: var(--danger); background: var(--danger-bg); }
.badge.info { color: var(--info); background: var(--info-bg); }
.badge.neutral { color: var(--neutral); background: var(--neutral-bg); }
.badge.gold { color: #97751a; background: var(--warn-bg); }
html[data-theme="dark"] .badge.gold { color: var(--gold-soft); }
.badge.plain::before { display: none; }

.urg-pill { font-size: 11.5px; font-weight: 700; padding: 2px 9px; border-radius: 6px; }
.urg-3 { color: #fff; background: var(--danger); }
.urg-2 { color: #7a4d10; background: var(--gold-soft); }
.urg-1 { color: var(--ink-soft); background: var(--neutral-bg); }

/* ============================================================ FILTER BAR */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.filter-bar .search-box { position: relative; flex: 1; min-width: 220px; max-width: 360px; }
.filter-bar .search-box svg { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-faint); }
.filter-bar .search-box input {
  width: 100%; height: 40px; border-radius: 11px; border: 1px solid var(--border);
  background: var(--surface); padding: 0 40px 0 14px; font-family: var(--font); font-size: 14px; color: var(--ink);
}
.filter-bar .search-box input:focus { outline: none; border-color: var(--royal-blue); box-shadow: 0 0 0 4px rgba(46,91,150,.1); }
.select {
  height: 40px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface);
  padding: 0 32px 0 14px; font-family: var(--font); font-size: 13.5px; color: var(--ink); cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235F6673' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: left 12px center;
}
.select:focus { outline: none; border-color: var(--royal-blue); }
.chip-filters { display: flex; gap: 7px; flex-wrap: wrap; }
.chip {
  font-size: 13px; font-weight: 500; padding: 7px 14px; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--ink-soft); transition: .15s;
}
.chip:hover { border-color: var(--royal-blue); color: var(--royal-blue); }
.chip.active { background: var(--tzfat-blue); color: #fff; border-color: var(--tzfat-blue); }
.chip .c-num { font-weight: 700; opacity: .8; margin-inline-start: 3px; }

/* ============================================================ DASHBOARD GRID */
.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 18px; }
.dash-col { display: flex; flex-direction: column; gap: 18px; }

.urgent-row {
  display: flex; align-items: center; gap: 13px; padding: 13px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface-2); transition: .15s; cursor: pointer;
}
.urgent-row:hover { box-shadow: var(--shadow-sm); border-color: var(--royal-blue); }
.urgent-row + .urgent-row { margin-top: 9px; }
.ur-ico { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; flex: 0 0 auto; background: var(--danger-bg); color: var(--danger); font-weight: 700; }
.ur-main { flex: 1; min-width: 0; }
.ur-title { font-weight: 600; font-size: 14.5px; }
.ur-meta { font-size: 12.5px; color: var(--ink-soft); margin-top: 1px; }
.ur-side { text-align: left; display: flex; flex-direction: column; gap: 5px; align-items: flex-end; }
.ur-amt { font-weight: 800; font-size: 16px; }

.don-row { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.don-row:last-child { border-bottom: none; }
.don-main { flex: 1; min-width: 0; }
.don-name { font-weight: 600; font-size: 14px; }
.don-purpose { font-size: 12px; color: var(--ink-soft); }
.don-side { text-align: left; }
.don-amt { font-weight: 800; color: var(--ok); font-size: 15px; }

/* AI card */
.ai-card {
  background: linear-gradient(160deg, var(--tzfat-blue), #16294a);
  color: #eaf0fb; border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden;
  box-shadow: var(--shadow-md);
}
.ai-card::before { content: ""; position: absolute; top: -40px; left: -30px; width: 160px; height: 160px; background: radial-gradient(circle, rgba(212,175,55,.22), transparent 70%); }
.ai-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; position: relative; }
.ai-orb { width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--gold-soft), var(--gold)); display: grid; place-items: center; color: #3a2f10; box-shadow: 0 4px 14px rgba(212,175,55,.4); }
.ai-orb svg { width: 22px; height: 22px; stroke-width: 2; }
.ai-head h3 { font-size: 17px; font-weight: 700; color: #fff; }
.ai-head small { font-size: 12px; color: #aebfde; }
.ai-insight { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid rgba(255,255,255,.1); font-size: 13.5px; }
.ai-insight:last-of-type { border-bottom: none; }
.ai-insight .ai-bull { color: var(--gold-soft); flex: 0 0 auto; font-weight: 700; }
.ai-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; position: relative; }
.ai-actions .btn { height: 36px; font-size: 13px; background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.18); }
.ai-actions .btn:hover { background: rgba(255,255,255,.2); border-color: var(--gold); }

/* reminders */
.reminder { display: flex; align-items: flex-start; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.reminder:last-child { border-bottom: none; }
.rem-time { font-size: 12px; font-weight: 700; color: var(--royal-blue); background: var(--info-bg); padding: 3px 9px; border-radius: 7px; white-space: nowrap; flex: 0 0 auto; }
.rem-text { font-size: 13.5px; }
.rem-check { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border); cursor: pointer; flex: 0 0 auto; margin-top: 1px; display: grid; place-items: center; color: transparent; }
.rem-check:hover { border-color: var(--royal-blue); }
.reminder.done .rem-check { background: var(--ok); border-color: var(--ok); color: #fff; }
.reminder.done .rem-text { text-decoration: line-through; color: var(--ink-faint); }

/* ============================================================ CHARTS */
.chart-card { padding: 20px; }
.chart-legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12.5px; color: var(--ink-soft); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-legend { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 160px; }
.dl-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.dl-row i { width: 12px; height: 12px; border-radius: 4px; }
.dl-row .dl-val { margin-inline-start: auto; font-weight: 700; }

/* ============================================================ KANBAN */
.kanban { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 10px; }
.kan-col { flex: 0 0 270px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; }
.kan-head { display: flex; align-items: center; gap: 8px; margin-bottom: 11px; font-weight: 700; font-size: 14px; }
.kan-head .kan-dot { width: 10px; height: 10px; border-radius: 50%; }
.kan-head .kan-num { margin-inline-start: auto; font-size: 12px; background: var(--surface-3); color: var(--ink-soft); padding: 1px 9px; border-radius: 20px; font-weight: 700; }
.kan-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; cursor: pointer; transition: .15s; }
.kan-card + .kan-card { margin-top: 9px; }
.kan-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.kan-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; margin-bottom: 7px; }
.kan-fam { font-weight: 600; font-size: 14px; }
.kan-cat { font-size: 12px; color: var(--ink-soft); }
.kan-amt { font-weight: 800; font-size: 15px; }
.kan-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 9px; font-size: 11.5px; color: var(--ink-soft); }

/* ============================================================ DRAWER */
.drawer-scrim, .modal-scrim { position: fixed; inset: 0; background: rgba(15,22,35,.55); z-index: 80; }
.drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 440px; max-width: 92vw; z-index: 90;
  background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slideIn .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes slideIn { from { transform: translateX(40px); opacity: .3; } to { transform: translateX(0); opacity: 1; } }
.drawer-head { padding: 20px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: flex-start; gap: 14px; }
.drawer-head .big-avatar { width: 56px; height: 56px; border-radius: 14px; background: linear-gradient(135deg, var(--royal-blue), var(--tzfat-blue)); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 22px; flex: 0 0 auto; }
.drawer-head .big-avatar.fam { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: #3a2f10; }
.drawer-head .dh-main { flex: 1; min-width: 0; }
.drawer-head .dh-main h3 { font-size: 20px; font-weight: 700; }
.drawer-head .dh-main .dh-sub { font-size: 13px; color: var(--ink-soft); margin-top: 2px; }
.drawer-close { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; display: grid; place-items: center; color: var(--ink-soft); flex: 0 0 auto; }
.drawer-close:hover { color: var(--danger); border-color: var(--danger); }
.drawer-body { padding: 20px 22px; overflow-y: auto; flex: 1; }
.drawer-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 9px; flex-wrap: wrap; }

.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.field { }
.field .f-label { font-size: 12px; color: var(--ink-soft); margin-bottom: 2px; }
.field .f-val { font-size: 14.5px; font-weight: 600; }
.dr-section { margin-top: 22px; }
.dr-section h4 { font-size: 14px; font-weight: 700; color: var(--royal-blue); margin-bottom: 11px; display: flex; align-items: center; gap: 7px; }
.dr-section h4 svg { width: 16px; height: 16px; }
.timeline-item { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.timeline-item:last-child { border-bottom: none; }
.tl-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--royal-blue); margin-top: 6px; flex: 0 0 auto; }
.tl-main { flex: 1; }
.tl-title { font-size: 13.5px; font-weight: 600; }
.tl-meta { font-size: 12px; color: var(--ink-soft); }
.tl-amt { font-weight: 700; font-size: 13.5px; }

.privacy-note {
  display: flex; align-items: center; gap: 9px; padding: 10px 13px; border-radius: 11px;
  background: var(--warn-bg); color: var(--warn); font-size: 12.5px; font-weight: 600; margin-bottom: 16px;
}
.privacy-note svg { width: 18px; height: 18px; flex: 0 0 auto; }

.ai-mini {
  background: var(--info-bg); border: 1px dashed color-mix(in srgb, var(--royal-blue) 35%, transparent);
  border-radius: 12px; padding: 13px; margin-top: 14px;
}
.ai-mini .am-head { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--royal-blue); margin-bottom: 8px; }
.ai-mini .am-head svg { width: 16px; height: 16px; }
.ai-mini p { font-size: 13px; color: var(--ink); padding: 6px 0; border-bottom: 1px solid color-mix(in srgb, var(--royal-blue) 12%, transparent); }
.ai-mini p:last-child { border-bottom: none; }

/* ============================================================ MODAL */
.modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 540px; max-width: 94vw; max-height: 90vh; display: flex; flex-direction: column;
  animation: popIn .22s ease; z-index: 91;
}
@keyframes popIn { from { transform: translate(-50%, -46%); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }
.modal-head { padding: 18px 22px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 18px; font-weight: 700; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-foot { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; gap: 9px; justify-content: flex-start; }
.modal.confirm { width: 420px; }
.confirm-ico { width: 54px; height: 54px; border-radius: 14px; background: var(--danger-bg); color: var(--danger); display: grid; place-items: center; margin-bottom: 14px; }
.confirm-ico svg { width: 28px; height: 28px; }

.form-row { margin-bottom: 14px; }
.form-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-row label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-soft); margin-bottom: 5px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; height: 42px; border-radius: 11px; border: 1px solid var(--border); background: var(--surface-2);
  padding: 0 13px; font-family: var(--font); font-size: 14px; color: var(--ink);
}
.form-row textarea { height: auto; min-height: 84px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { outline: none; border-color: var(--royal-blue); background: var(--surface); box-shadow: 0 0 0 4px rgba(46,91,150,.1); }

/* ============================================================ TOASTS */
.toast-wrap { position: fixed; bottom: 22px; left: 22px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 11px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 13px 16px; box-shadow: var(--shadow-lg); min-width: 280px; max-width: 380px;
  animation: toastIn .3s ease; border-inline-start: 4px solid var(--ok);
}
@keyframes toastIn { from { transform: translateX(-30px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast.err { border-inline-start-color: var(--danger); }
.toast.info { border-inline-start-color: var(--royal-blue); }
.toast .t-ico { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--ok-bg); color: var(--ok); flex: 0 0 auto; }
.toast.err .t-ico { background: var(--danger-bg); color: var(--danger); }
.toast.info .t-ico { background: var(--info-bg); color: var(--royal-blue); }
.toast .t-main { flex: 1; }
.toast .t-title { font-size: 14px; font-weight: 600; }
.toast .t-sub { font-size: 12.5px; color: var(--ink-soft); }

/* ============================================================ NOTIF PANEL */
.notif-panel {
  position: fixed; top: calc(var(--topbar-h) + 8px); left: 18px; z-index: 70; width: 360px; max-width: 92vw;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  overflow: hidden; animation: popIn .2s ease;
}
.notif-panel .np-head { padding: 14px 18px; border-bottom: 1px solid var(--border); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.notif-panel .np-head a { font-size: 12.5px; color: var(--royal-blue); cursor: pointer; font-weight: 500; }
.np-item { padding: 13px 18px; border-bottom: 1px solid var(--line); display: flex; gap: 11px; cursor: pointer; }
.np-item:hover { background: var(--surface-2); }
.np-item:last-child { border-bottom: none; }
.np-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--royal-blue); margin-top: 6px; flex: 0 0 auto; }
.np-dot.warn { background: var(--gold); } .np-dot.danger { background: var(--danger); }
.np-txt { font-size: 13.5px; } .np-time { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }

/* ============================================================ EMPTY STATE */
.empty { text-align: center; padding: 50px 20px; color: var(--ink-soft); }
.empty .e-ico { width: 70px; height: 70px; border-radius: 18px; background: var(--surface-2); display: grid; place-items: center; margin: 0 auto 16px; color: var(--ink-faint); }
.empty .e-ico svg { width: 34px; height: 34px; }
.empty h4 { font-size: 16px; color: var(--ink); margin-bottom: 5px; }
.empty p { font-size: 13.5px; max-width: 340px; margin: 0 auto 16px; }

/* ============================================================ MISC LAYOUT HELPERS */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.muted { color: var(--ink-soft); }
.tabular { font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }

/* report tiles */
.report-tile { display: flex; flex-direction: column; gap: 11px; }
.report-tile .rt-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--info-bg); color: var(--royal-blue); display: grid; place-items: center; }
.report-tile h4 { font-size: 15px; }
.report-tile p { font-size: 12.5px; color: var(--ink-soft); flex: 1; }
.report-tile .rt-actions { display: flex; gap: 7px; flex-wrap: wrap; }

/* AI assistant page */
.ai-page { display: grid; grid-template-columns: 280px 1fr; gap: 18px; align-items: start; }
.ai-cap-list { display: flex; flex-direction: column; gap: 4px; }
.ai-cap { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 13.5px; }
.ai-cap:hover { background: var(--surface-2); }
.ai-cap .cap-n { width: 24px; height: 24px; border-radius: 7px; background: var(--info-bg); color: var(--royal-blue); display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: 0 0 auto; }
.chat-wrap { display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 130px); min-height: 460px; }
.chat-stream { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 4px 4px 14px; }
.msg { display: flex; gap: 11px; max-width: 88%; }
.msg.user { align-self: flex-start; flex-direction: row-reverse; }
.msg .m-av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: 0 0 auto; font-weight: 700; }
.msg.ai .m-av { background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: #3a2f10; }
.msg.user .m-av { background: linear-gradient(135deg, var(--royal-blue), var(--tzfat-blue)); color: #fff; }
.m-bubble { padding: 12px 15px; border-radius: 14px; font-size: 14px; line-height: 1.6; }
.msg.ai .m-bubble { background: var(--surface-2); border: 1px solid var(--border); border-top-right-radius: 4px; }
.msg.user .m-bubble { background: var(--tzfat-blue); color: #fff; border-top-left-radius: 4px; }
.m-bubble ul { margin: 7px 0; padding-inline-start: 18px; }
.m-bubble li { margin: 3px 0; }
.chat-input { display: flex; gap: 9px; padding-top: 12px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; height: 46px; border-radius: 13px; border: 1px solid var(--border); background: var(--surface-2); padding: 0 16px; font-family: var(--font); font-size: 14px; color: var(--ink); }
.chat-input input:focus { outline: none; border-color: var(--royal-blue); background: var(--surface); }
.prompt-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.prompt-chips .chip { font-size: 12.5px; }

/* settings */
.set-grid { display: grid; grid-template-columns: 220px 1fr; gap: 18px; align-items: start; }
.set-nav { display: flex; flex-direction: column; gap: 3px; }
.set-nav-item { padding: 11px 14px; border-radius: 11px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--ink-soft); }
.set-nav-item:hover { background: var(--surface-2); }
.set-nav-item.active { background: var(--info-bg); color: var(--royal-blue); font-weight: 600; }
.perm-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.perm-row:last-child { border-bottom: none; }
.perm-name { font-weight: 600; flex: 1; }
.toggle { width: 44px; height: 25px; border-radius: 20px; background: var(--border); position: relative; cursor: pointer; transition: .2s; flex: 0 0 auto; }
.toggle::after { content: ""; position: absolute; top: 3px; right: 3px; width: 19px; height: 19px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: var(--shadow-sm); }
.toggle.on { background: var(--ok); }
.toggle.on::after { right: calc(100% - 22px); }

/* progress bars (documents / standing orders) */
.pbar { height: 8px; border-radius: 20px; background: var(--surface-3); overflow: hidden; }
.pbar > i { display: block; height: 100%; border-radius: 20px; background: linear-gradient(90deg, var(--royal-blue), var(--gold)); }

/* ============================================================ פרטיות ואבטחה */
.trust-hero {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  background: linear-gradient(135deg, var(--tzfat-blue), #16294a); color: #eaf0fb;
  border-radius: var(--radius-lg); padding: 26px 28px; margin-bottom: 18px; box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.trust-hero::after { content: ""; position: absolute; left: -40px; bottom: -50px; width: 200px; height: 200px; background: radial-gradient(circle, rgba(212,175,55,.18), transparent 70%); }
.th-shield { width: 66px; height: 66px; border-radius: 18px; background: linear-gradient(135deg, var(--gold-soft), var(--gold)); color: #3a2f10; display: grid; place-items: center; flex: 0 0 auto; box-shadow: 0 6px 18px rgba(212,175,55,.4); }
.th-shield svg { width: 34px; height: 34px; stroke-width: 2; }
.th-main { flex: 1; min-width: 240px; position: relative; }
.th-main h3 { font-family: var(--serif); font-size: 22px; color: #fff; margin-bottom: 6px; }
.th-main p { font-size: 14px; color: #c6d3ec; line-height: 1.6; max-width: 640px; }
.th-badges { display: flex; flex-direction: column; gap: 8px; position: relative; }
.th-badges .badge { background: rgba(255,255,255,.12); color: #eafaf0; }
.sec-card { display: flex; flex-direction: column; gap: 10px; transition: .18s; }
.sec-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--royal-blue); }
.sec-ico { width: 48px; height: 48px; border-radius: 13px; background: var(--info-bg); color: var(--royal-blue); display: grid; place-items: center; }
.sec-ico svg { width: 24px; height: 24px; }
.sec-card h4 { font-size: 15.5px; font-weight: 700; }
.sec-card p { font-size: 13px; color: var(--ink-soft); line-height: 1.55; }

/* ============================================================ מצב הצגה */
.present-btn span { font-weight: 700; }
body.present-mode { --topbar-h: 70px; }
body.present-mode .content { padding-bottom: 230px; }
body.present-mode .kpi-value { font-size: 30px; }
#presentLayer {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 150; display: flex; justify-content: center;
  padding: 18px; pointer-events: none;
}
.present-card {
  pointer-events: auto; width: 720px; max-width: 94vw; background: var(--surface);
  border: 1px solid var(--border); border-top: 4px solid var(--gold); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 20px 24px; animation: popIn .25s ease;
}
.pc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.pc-step { font-size: 12.5px; font-weight: 700; color: var(--gold); background: var(--warn-bg); padding: 3px 11px; border-radius: 20px; }
html[data-theme="dark"] .pc-step { color: var(--gold-soft); }
.pc-exit { display: inline-flex; align-items: center; gap: 5px; background: none; border: none; cursor: pointer; color: var(--ink-soft); font-family: var(--font); font-size: 13px; font-weight: 600; }
.pc-exit:hover { color: var(--danger); }
.pc-exit svg { width: 15px; height: 15px; }
.present-card h3 { font-family: var(--serif); font-size: 21px; color: var(--tzfat-blue); margin-bottom: 5px; }
html[data-theme="dark"] .present-card h3 { color: var(--gold-soft); }
.present-card > p { font-size: 14.5px; color: var(--ink-soft); line-height: 1.65; }
.pc-progress { display: flex; gap: 6px; margin: 14px 0; }
.pc-progress i { height: 5px; flex: 1; border-radius: 20px; background: var(--border); transition: .2s; }
.pc-progress i.on { background: var(--gold); } .pc-progress i.done { background: var(--royal-blue); }
.pc-actions { display: flex; gap: 9px; justify-content: space-between; }
.pc-actions .btn:only-child { margin-inline-start: auto; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.bottom-nav { display: none; }

/* ============================================================ RESPONSIVE */
@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .three-col { grid-template-columns: 1fr 1fr; }
  .ai-page { grid-template-columns: 1fr; }
  .set-grid { grid-template-columns: 1fr; }
}

@media (max-width: 860px) {
  :root { --topbar-h: 62px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar-search { display: none; }
  .brand-text span { display: none; }
  .brand-text h1 { font-size: 16px; white-space: normal; }
  .topbar-date, .user-meta { display: none; }
  .menu-toggle { display: grid; }
  .content { padding: 18px 16px 90px; }

  /* sidebar -> slide menu */
  .sidebar {
    position: fixed; top: 0; right: 0; height: 100vh; z-index: 120; width: 280px;
    transform: translateX(100%); transition: transform .28s cubic-bezier(.2,.8,.2,1);
    padding-top: 18px;
  }
  body.nav-open .sidebar { transform: translateX(0); box-shadow: var(--shadow-lg); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; background: rgba(15,22,35,.5); z-index: 110; opacity: 0; pointer-events: none; transition: .25s; }
  body.nav-open .sidebar-scrim { opacity: 1; pointer-events: auto; }

  .two-col, .three-col, .set-grid { grid-template-columns: 1fr; }
  .field-grid { grid-template-columns: 1fr 1fr; }
  .page-head h2 { font-size: 22px; }

  /* bottom nav */
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; right: 0; left: 0; z-index: 100;
    background: var(--surface);
    border-top: 1px solid var(--border); padding: 7px 6px calc(7px + env(safe-area-inset-bottom));
    justify-content: space-around; box-shadow: 0 -4px 18px rgba(31,60,104,.08);
  }
  .bn-item { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 5px 9px; border-radius: 10px; color: var(--ink-soft); cursor: pointer; font-size: 10.5px; font-weight: 500; flex: 1; }
  .bn-item svg { width: 21px; height: 21px; }
  .bn-item.active { color: var(--royal-blue); }
  .bn-item.active svg { color: var(--royal-blue); }

  .drawer { width: 100%; max-width: 100%; }
  .modal { width: 94vw; }
  .present-btn span { display: none; }
  .present-btn { padding: 0 10px; }
  body.present-mode .bottom-nav { display: none; }
  body.present-mode .content { padding-bottom: 200px; }
  .trust-hero { padding: 20px; }
  .th-badges { flex-direction: row; flex-wrap: wrap; }

  /* tables -> cards on mobile */
  .responsive-cards table.data thead { display: none; }
  .responsive-cards table.data, .responsive-cards table.data tbody, .responsive-cards table.data tr, .responsive-cards table.data td { display: block; width: 100%; }
  .responsive-cards table.data tr {
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 13px; margin-bottom: 11px; box-shadow: var(--shadow-sm);
  }
  .responsive-cards table.data td { border: none; padding: 5px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
  .responsive-cards table.data td::before { content: attr(data-label); font-size: 12px; color: var(--ink-soft); font-weight: 600; flex: 0 0 auto; }
  .responsive-cards table.data td:first-child::before { display: none; }
  .responsive-cards table.data td.cell-actions { justify-content: flex-end; }

  /* mobile search overlay */
  body.search-open .topbar-search {
    display: flex; position: fixed; top: 0; right: 0; left: 0; z-index: 130; max-width: 100%;
    height: var(--topbar-h); background: var(--surface); padding: 11px 14px; box-shadow: var(--shadow-md); align-items: center;
  }
  body.search-open .topbar-search input { height: 42px; }
  .kpi-value { font-size: 23px; }
}

@media (max-width: 560px) {
  .present-btn { display: none; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .field-grid { grid-template-columns: 1fr; }
  .filter-bar .search-box { max-width: 100%; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn { flex: 1; }
}
