/* עיצוב לפי design/עיצוב מאושר.md */
:root {
  --navy: #1F3A5F;
  --navy-dark: #172C49;
  --bg: #F6F5F2;
  --card: #FFFFFF;
  --border: #E3E1DC;
  --text: #1E2430;
  --muted: #5F6672;
  --link: #1D5FC2;
  --danger-bg: #FDECEC;
  --danger: #B42318;
  --ok: #1E7B4A;

  /* צבעי שלב (רקע עדין לשורה) */
  --stage-potential: #EEF4FB;
  --stage-active: #EEF7F0;
  --stage-dormant: #F4F1EC;

  /* צבעי אחראים (תווית) */
  --owner-guterman: #1F3A5F;
  --owner-moti: #0E7C74;
  --owner-zeevi: #7A4FC9;
  --owner-ephraim: #A85A00;
  --owner-ozri: #357A31;
  --owner-david: #C2416A;
  --owner-eitan: #8A5A3C;

  --radius: 10px;
  font-size: 15px;
}

* { box-sizing: border-box; }
/* אלמנט מוסתר נשאר מוסתר, גם אם יש לו עיצוב משלו (למשל "טען גיבוי" למי שאינו מנהל) */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Heebo", "Assistant", Arial, system-ui, sans-serif;
  line-height: 1.5;
}

svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

button, select, input { font: inherit; }
:focus-visible { outline: 3px solid #F2B84B; outline-offset: 2px; }

/* פס עליון */
.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 1.45rem; font-weight: 700; }
.brand-icon { width: 30px; height: 30px; stroke: #F2B84B; }

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

.whoami {
  display: flex; align-items: center; gap: 6px;
  border: 1px solid rgba(255,255,255,.55); border-radius: 8px;
  padding: 4px 10px; background: rgba(255,255,255,.08);
}
.whoami select {
  background: transparent; color: #fff; border: 0; padding: 4px 2px; cursor: pointer;
}
.whoami select option { color: var(--text); }

.btn-outline {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent; color: #fff;
  border: 1px solid rgba(255,255,255,.55); border-radius: 8px;
  padding: 7px 12px; cursor: pointer;
}
.btn-outline:hover { background: rgba(255,255,255,.12); }

.lang { display: flex; align-items: center; gap: 6px; margin-inline-start: 6px; }
.lang button {
  background: none; border: 0; color: rgba(255,255,255,.75); cursor: pointer; padding: 4px 2px;
  border-bottom: 2px solid transparent;
}
.lang button[aria-pressed="true"] { color: #fff; font-weight: 700; border-bottom-color: #fff; }

/* תוכן */
.main { padding: 24px; max-width: 1400px; margin: 0 auto; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.card h1, .card #donors-title { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.6rem; color: var(--navy); }
.card h1 svg, .card #donors-title svg { width: 30px; height: 30px; }

.empty { color: var(--muted); padding: 32px 0 12px; margin: 0; }
.muted { color: var(--muted); }

/* הודעות */
.banner-error {
  background: var(--danger-bg); color: var(--danger);
  border-bottom: 1px solid #F5C2C0; padding: 12px 24px; font-weight: 600;
}

.toast {
  position: fixed; inset-inline: 0; bottom: 24px; margin: 0 auto;
  width: fit-content; max-width: min(640px, calc(100% - 32px));
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0,0,0,.18);
}
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }

dialog {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; max-width: 480px; width: calc(100% - 32px); color: var(--text);
}
dialog::backdrop { background: rgba(20,30,45,.45); }
dialog h2 { margin: 0 0 8px; font-size: 1.25rem; color: var(--navy); }
.dialog-actions { display: flex; gap: 10px; margin-top: 18px; }

.btn-primary {
  background: var(--navy); color: #fff; border: 0; border-radius: 8px; padding: 9px 18px; cursor: pointer; font-weight: 600;
}
.btn-primary:hover { background: var(--navy-dark); }
.btn-plain {
  background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 8px; padding: 9px 18px; cursor: pointer;
}

/* ===== שלב 2: רשימה וכרטיס ===== */
.icon { display: inline-flex; }
.title-icon svg { width: 30px; height: 30px; }
[dir="ltr"] .flip-rtl svg { transform: scaleX(-1); }

input[type="text"], input[type="search"], input[type="tel"], input[type="email"], input[type="date"], textarea {
  width: 100%; border: 1px solid #CFCCC5; border-radius: 8px; padding: 8px 10px; background: #fff; color: var(--text);
}
textarea { resize: vertical; }

.card h1 .count, .card #donors-title .count {
  font-size: .85rem; font-weight: 600; color: var(--muted);
  background: #EFEDE8; border-radius: 999px; padding: 2px 10px;
}
.btn-primary { display: inline-flex; align-items: center; gap: 6px; }
.btn-plain { display: inline-flex; align-items: center; gap: 6px; }
.btn-link {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; color: var(--link); cursor: pointer; padding: 6px 2px;
}

.toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin: 18px 0 12px; }
.search-box {
  display: flex; align-items: center; gap: 6px; flex: 1 1 280px; max-width: 460px;
  border: 1px solid #CFCCC5; border-radius: 8px; padding: 0 10px; background: #fff; color: var(--muted);
}
.search-box input { border: 0; padding: 9px 0; outline: none; }
.search-box:focus-within { outline: 3px solid #F2B84B; outline-offset: 2px; }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track { width: 38px; height: 22px; border-radius: 999px; background: #CFCCC5; position: relative; transition: background .15s; }
.switch-track::after {
  content: ""; position: absolute; top: 3px; inset-inline-start: 3px; width: 16px; height: 16px;
  border-radius: 50%; background: #fff; transition: inset-inline-start .15s;
}
.switch input:checked + .switch-track { background: var(--navy); }
.switch input:checked + .switch-track::after { inset-inline-start: 19px; }
.switch input:focus-visible + .switch-track { outline: 3px solid #F2B84B; outline-offset: 2px; }

.donor-table { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.donor-table th {
  text-align: start; font-weight: 700; color: var(--navy); background: #EEF1F5;
  padding: 10px 14px;
}
.donor-table th .icon { vertical-align: -4px; margin-inline-end: 4px; }
.donor-table th:first-child { border-start-start-radius: 8px; border-end-start-radius: 8px; }
.donor-table th:last-child { border-start-end-radius: 8px; border-end-end-radius: 8px; }
.donor-table td { padding: 10px 14px; background: #FAFAF8; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.donor-table td:first-child { border-inline-start: 1px solid var(--border); border-start-start-radius: 8px; border-end-start-radius: 8px; }
.donor-table td:last-child { border-inline-end: 1px solid var(--border); border-start-end-radius: 8px; border-end-end-radius: 8px; }
.donor-row { cursor: pointer; }
.donor-row:hover td { background: #F0F3F8; }
.empty-cell { color: var(--muted); text-align: center; padding: 28px !important; }

.name-cell { display: flex; align-items: center; gap: 12px; }
.type-icon {
  width: 38px; height: 38px; border-radius: 50%; background: #E8EDF4; color: var(--navy);
  align-items: center; justify-content: center;
}
.name-main { font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.05rem; }
.name-main:hover { text-decoration: underline; }
.name-other { color: var(--muted); font-size: .92rem; }

.badge { display: inline-block; font-size: .8rem; font-weight: 600; border-radius: 999px; padding: 2px 10px; border: 1px solid; white-space: nowrap; }
.badge-muted { color: var(--muted); border-color: #CFCCC5; background: #fff; }
.is-archived .name-main, .donor-card.is-archived h1 { color: var(--muted); }

.back-link { display: inline-flex; align-items: center; gap: 4px; color: var(--link); text-decoration: none; margin-bottom: 12px; }
.back-link:hover { text-decoration: underline; }

.donor-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.donor-title .title-icon {
  width: 52px; height: 52px; border-radius: 50%; background: #E8EDF4; color: var(--navy);
  align-items: center; justify-content: center;
}
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 20px 0 16px; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; cursor: pointer;
  padding: 10px 14px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tab[aria-selected="true"] { color: var(--navy); font-weight: 700; border-bottom-color: var(--navy); }

.details { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px 24px; margin: 0; }
.detail dt { color: var(--muted); font-size: .88rem; }
.detail dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.section-title { font-size: 1.05rem; color: var(--navy); margin: 22px 0 6px; }
.story { white-space: pre-wrap; margin: 0; max-width: 75ch; }
.family-list { margin: 0; padding-inline-start: 20px; }

.field { display: flex; flex-direction: column; gap: 4px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field > span, .field > legend { color: var(--muted); font-size: .9rem; padding: 0; }
.field-error { color: var(--danger); font-weight: 600; margin: 0; }

.contact-form { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: end; margin-bottom: 18px; }
.contact-form .field-error, .contact-form button { grid-column: 1 / -1; justify-self: start; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { border-inline-start: 3px solid #D7DEE8; padding: 6px 14px; margin-bottom: 10px; }
.timeline-meta { color: var(--muted); font-size: .88rem; }
.timeline-text { white-space: pre-wrap; }

.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-thumb { border: 1px solid var(--border); border-radius: 8px; padding: 0; overflow: hidden; cursor: zoom-in; background: #fff; aspect-ratio: 4 / 3; }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-dialog { max-width: min(1000px, calc(100% - 32px)); }
.photo-dialog img { max-width: 100%; max-height: 75vh; display: block; margin: 0 auto; }

.history-table { width: 100%; border-collapse: collapse; }
.history-table th, .history-table td { text-align: start; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.history-table th { color: var(--navy); }
.history-table td { overflow-wrap: anywhere; }

.donor-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; margin-top: 16px; }
.donor-form .wide, .donor-form .field-error { grid-column: 1 / -1; }
.radios { display: flex; gap: 18px; flex-wrap: wrap; }
.radio { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.family-edit { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.family-row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; width: 100%; }
.form-actions { display: flex; gap: 10px; }

@media (max-width: 720px) {
  .topbar { padding: 12px 16px; }
  .main { padding: 16px; }
  .card { padding: 16px; }
  .donor-form, .contact-form { grid-template-columns: 1fr; }
  .family-row { grid-template-columns: 1fr; }
  .history-table thead { display: none; }
  .history-table td { display: block; border: 0; padding: 2px 0; }
  .history-table tr { display: block; border-bottom: 1px solid var(--border); padding: 8px 0; }
}

/* ===== שלב 3: אחראים ופרטיות ===== */
.owner-pill {
  display: inline-flex; align-items: center; gap: 4px; color: #fff; font-weight: 600; font-size: .9rem;
  border-radius: 999px; padding: 3px 12px 3px 10px; white-space: nowrap; background: #6B7280;
}
.owner-pill svg { width: 16px; height: 16px; }
.owner-guterman { background: var(--owner-guterman); }
.owner-moti { background: var(--owner-moti); }
.owner-zeevi { background: var(--owner-zeevi); }
.owner-ephraim { background: var(--owner-ephraim); }
.owner-ozri { background: var(--owner-ozri); }
.owner-david { background: var(--owner-david); }
.owner-eitan { background: var(--owner-eitan); }

.owner-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.notice {
  display: flex; gap: 8px; align-items: flex-start; background: #F3F6FA; border: 1px solid #D7DEE8;
  border-radius: 8px; padding: 12px 14px; color: var(--navy); margin: 18px 0 0;
}
.details.limited { margin-top: 18px; }
#confirm-summary { white-space: pre-line; }
#transfer-dialog select { width: 100%; padding: 8px 10px; border: 1px solid #CFCCC5; border-radius: 8px; background: #fff; }

/* ===== שלב 4: שלבים, תרומות והגדרות ===== */
/* לשוניות בפס העליון: סמל מעל המילה, כמו בעיצוב */
.mainnav { display: flex; gap: 4px; margin-inline-end: auto; margin-inline-start: 24px; }
.navtab {
  display: flex; flex-direction: column; align-items: center; gap: 2px; color: rgba(255,255,255,.8);
  text-decoration: none; padding: 6px 16px; border-radius: 8px; font-size: .92rem;
}
.navtab:hover { background: rgba(255,255,255,.1); color: #fff; }
.navtab[aria-current="page"] { background: rgba(255,255,255,.14); color: #fff; font-weight: 700; box-shadow: inset 0 -3px 0 #fff; }

/* צבע רקע עדין לפי שלב (R27) — בשורה ובכרטיס */
.donor-row.stage-potential td { background: var(--stage-potential); }
.donor-row.stage-active td { background: var(--stage-active); }
.donor-row.stage-dormant td { background: var(--stage-dormant); }
.donor-row:hover td { filter: brightness(.97); }
.donor-card.stage-bg-potential { background: linear-gradient(var(--stage-potential), #fff 180px); }
.donor-card.stage-bg-active { background: linear-gradient(var(--stage-active), #fff 180px); }
.donor-card.stage-bg-dormant { background: linear-gradient(var(--stage-dormant), #fff 180px); }

.stage-pill { display: inline-block; border-radius: 999px; padding: 3px 14px; font-weight: 700; font-size: .9rem; white-space: nowrap; }
.stage-pill-potential { background: #D6E6F8; color: #1D4F8C; }
.stage-pill-active { background: #CDEBD6; color: #1E6B3A; }
.stage-pill-dormant { background: #E9E1D3; color: #6B5232; }

.legend { display: flex; gap: 18px; flex-wrap: wrap; color: var(--muted); font-size: .9rem; margin: 0 0 4px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 16px; height: 16px; border-radius: 4px; border: 1px solid #CFCCC5; }
.swatch.stage-potential { background: #D6E6F8; }
.swatch.stage-active { background: #CDEBD6; }
.swatch.stage-dormant { background: #E9E1D3; }

.badge { display: inline-flex; align-items: center; gap: 4px; }
.badge svg { width: 14px; height: 14px; }
.badge-missing { color: #8A5A00; border-color: #E0A43A; background: #fff; }
.badge-major { color: #7A5A00; border-color: #E8C35A; background: #FFF6D6; }
.marks { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.donor-table td.marks { display: table-cell; }
.donor-table td.marks .badge { margin: 2px 0; }

.flags { display: flex; gap: 10px 24px; flex-wrap: wrap; align-items: center; background: #FAFAF8; border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin-bottom: 16px; }

.totals { display: flex; gap: 12px; flex-wrap: wrap; align-items: stretch; margin-bottom: 14px; }
.total-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; min-width: 180px; background: #fff; }
.total-pledged { border-inline-start: 4px solid #6B8CC7; }
.total-received { border-inline-start: 4px solid #2E8B57; }
.total-label { color: var(--muted); font-size: .88rem; }
.total-value { font-size: 1.5rem; font-weight: 700; color: var(--navy); }
.totals .btn-primary { align-self: center; margin-inline-start: auto; }

.table-scroll { overflow-x: auto; }
.donations-table td.num { white-space: nowrap; }
.small { font-size: .82rem; }
.status-pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: .85rem; font-weight: 600; }
.status-received { background: #CDEBD6; color: #1E6B3A; }
.status-pledged { background: #E3E8F5; color: #2C4A86; }
.ok-mark { display: inline-flex; align-items: center; gap: 2px; color: var(--ok); white-space: nowrap; }
.ok-mark svg { width: 16px; height: 16px; }
.warn-inline { display: flex; align-items: flex-start; gap: 6px; color: #8A5A00; background: #FFF6E5; border: 1px solid #F0D29A; border-radius: 8px; padding: 8px 12px; margin: 0; }
.warn-inline[hidden] { display: none; }
.warn-text { color: #8A5A00; font-weight: 600; }
.checkline { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.donor-form select, .settings-form select { width: 100%; padding: 8px 10px; border: 1px solid #CFCCC5; border-radius: 8px; background: #fff; }

.settings-form { display: flex; flex-direction: column; gap: 18px; max-width: 620px; margin-top: 16px; }
.rate-row { display: grid; grid-template-columns: 180px 220px; gap: 6px 12px; align-items: center; margin: 8px 0; }
.rate-row .warn-inline { grid-column: 1 / -1; }
.rate-input { display: flex; align-items: center; gap: 8px; max-width: 220px; }
.rate-input input { text-align: end; }

@media (max-width: 720px) {
  .mainnav { order: 3; width: 100%; margin: 0; }
  .navtab { flex-direction: row; padding: 6px 10px; }
  .rate-row { grid-template-columns: 1fr; }
  .totals .btn-primary { margin-inline-start: 0; }
}

/* ===== שלב 5: מסך הבית, משימות ואירועים ===== */
.home-grid { display: grid; grid-template-columns: minmax(320px, 38fr) 62fr; gap: 20px; align-items: start; }
.home-grid > * { min-width: 0; }

.tasks-card { padding: 0 0 18px; overflow: hidden; }
.tasks-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--navy); color: #fff; padding: 14px 20px; border-radius: var(--radius) var(--radius) 0 0;
}
.tasks-head h1 { color: #fff; font-size: 1.4rem; }
.tasks-head .count { background: rgba(255,255,255,.18); color: #fff; border-radius: 999px; padding: 3px 12px; font-weight: 600; }
.today-line { padding: 10px 20px 0; margin: 0; }
.tasks-card .empty { padding: 24px 20px 8px; }

.task-list { list-style: none; margin: 12px 0 0; padding: 0 14px; display: flex; flex-direction: column; gap: 12px; }
.task-card {
  display: flex; gap: 12px; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; background: #fff;
}
.task-icon { flex: none; width: 46px; display: flex; align-items: flex-start; justify-content: center; padding-top: 2px; }
.task-icon svg { width: 30px; height: 30px; }
.task-main { flex: 1; min-width: 0; }
.task-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.task-title { margin: 0; font-size: 1.12rem; }
.task-line { margin-top: 4px; overflow-wrap: anywhere; }
.task-donor { color: var(--link); font-weight: 600; }
.task-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 10px; }
.task-actions .btn-primary, .task-actions .btn-plain { padding: 6px 14px; }
.draft-lang { padding: 5px 8px; border: 1px solid #CFCCC5; border-radius: 8px; background: #fff; }

.task-thanks { background: #FDF1F2; border-color: #F3C9CE; } .task-thanks .task-icon { color: #C2334A; }
.task-memorial { background: #FFF8EA; border-color: #F1DDB0; } .task-memorial .task-icon { color: #B7791F; }
.task-event { background: #EFF5FC; border-color: #CFE0F3; } .task-event .task-icon { color: #2C64B0; }
.task-manual { background: #F4F2FB; border-color: #DCD6F1; } .task-manual .task-icon { color: #6A4FB8; }

.badge-overdue { background: #D92D20; color: #fff; border-color: #D92D20; }
.draft-box { margin-top: 8px; }
.draft-box summary { cursor: pointer; color: var(--link); }
.draft { white-space: pre-wrap; font-family: inherit; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin: 6px 0 0; }

.btn-dashed {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: calc(100% - 28px); margin: 14px 14px 0;
  background: #fff; border: 2px dashed #A9B8CF; border-radius: 10px; color: var(--navy); font-weight: 700; padding: 12px; cursor: pointer;
}
.btn-dashed:hover { background: #F3F6FA; }

.event-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.event-item { display: flex; gap: 12px; align-items: flex-start; border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px; background: #fff; }
.event-item .event-icon svg { width: 26px; height: 26px; }
.event-memorial .event-icon { color: #B7791F; }
.event-birthday .event-icon, .event-anniversary .event-icon, .event-other .event-icon { color: #2C64B0; }
.event-body { flex: 1; min-width: 0; }
.event-title { font-weight: 700; }
.event-dates { display: flex; gap: 6px 18px; flex-wrap: wrap; margin-top: 2px; }
.date-pair { display: grid; grid-template-columns: 1fr 1.6fr; gap: 8px; }
.date-pair select, .dialog-form select { width: 100%; padding: 8px 10px; border: 1px solid #CFCCC5; border-radius: 8px; background: #fff; }
.dialog-form { display: flex; flex-direction: column; gap: 12px; }

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

/* ===== שלב 6: תמונת מצב וסינון ===== */
.filters { margin-top: 0; gap: 10px; color: var(--muted); }
.filter-select { padding: 7px 10px; border: 1px solid #CFCCC5; border-radius: 8px; background: #fff; color: var(--text); max-width: 200px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; border: 1px solid #CFCCC5; background: #fff; color: var(--text);
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.chip svg { width: 16px; height: 16px; }
.chip[aria-pressed="true"] { background: #FFF6E5; border-color: #E0A43A; color: #8A5A00; font-weight: 700; }

.dash { display: flex; flex-direction: column; gap: 18px; }
.dash-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.dash-head h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 1.6rem; color: var(--navy); }
.dash-head .title-icon svg { width: 30px; height: 30px; }
.dash-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.dash-grid > * { min-width: 0; }
.dash-title { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; color: var(--navy); margin: 0 0 12px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.stat-tile { border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; background: #FAFAF8; }
.stat-label { color: var(--muted); font-size: .9rem; }
.stat-value { font-size: 1.7rem; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.tile-pledged { border-inline-start: 4px solid #6B8CC7; }
.tile-received { border-inline-start: 4px solid #2E8B57; }
.tile-stage-potential { background: var(--stage-potential); }
.tile-stage-active { background: var(--stage-active); }
.tile-stage-dormant { background: var(--stage-dormant); }
.dash-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.dash-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 0; border-bottom: 1px solid var(--border); }
.dash-list li:last-child { border-bottom: 0; }
.dash-list li.is-zero { opacity: .75; }
.dash-num { margin-inline-start: auto; font-weight: 700; }
.dash-date { font-weight: 700; min-width: 90px; }

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

/* ===== שלב 7: שלטים ו-AI ===== */
.badge-review { color: #1D4F8C; border-color: #7FA6D9; background: #fff; }
.btn-review { border-color: #7FA6D9; color: #1D4F8C; }
.plaque-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.plaque { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.plaque figcaption { font-size: .9rem; overflow-wrap: anywhere; }
.plaques-preview h3 { font-size: 1rem; margin: 12px 0 4px; color: var(--navy); }
.plaques-preview ul { margin: 0; padding-inline-start: 20px; }
#plaques-dialog { max-width: 560px; }

/* ===== כניסה עם סיסמה (גרסה 1.1) ===== */
body.logged-out #mainnav,
body.logged-out .controls > :not(.lang),
body.logged-out #view { display: none !important; }
.login { display: flex; justify-content: center; padding: 48px 16px; }
.login[hidden] { display: none; }
.login-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 14px; }
.login-card h1 { margin: 0; font-size: 1.5rem; color: var(--navy); }
.login-card input { width: 100%; border: 1px solid #CFCCC5; border-radius: 8px; padding: 10px 12px; font-size: 1rem; }
.login-card .btn-primary { justify-content: center; padding: 12px; font-size: 1.05rem; }
.whoami strong { font-weight: 700; }
.signout { background: none; border: 0; color: #fff; text-decoration: underline; cursor: pointer; padding: 2px 4px; margin-inline-start: 4px; }

/* ===== טלפון: כל תורם ככרטיס, בלי גלילה הצידה (R38) ===== */
@media (max-width: 720px) {
  .table-scroll { overflow-x: visible; }
  .donor-table, .donor-table tbody { display: block; width: 100%; }
  .donor-table thead { display: none; }
  .donor-table tr { display: block; }
  .donor-table tr.donor-row {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px;
    margin: 0 0 8px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: #FAFAF8;
  }
  .donor-row.stage-potential { background: var(--stage-potential) !important; }
  .donor-row.stage-active { background: var(--stage-active) !important; }
  .donor-row.stage-dormant { background: var(--stage-dormant) !important; }
  .donor-table tr.donor-row td,
  .donor-table tr.donor-row td:first-child,
  .donor-table tr.donor-row td:last-child {
    display: block; padding: 0; border: 0; border-radius: 0; background: transparent; min-width: 0;
  }
  .donor-table tr.donor-row td:nth-child(1) { flex: 1 1 100%; }
  .donor-table tr.donor-row td:nth-child(2) { flex: 1 1 100%; color: var(--muted); font-size: .92rem; }
  .donor-table tr.donor-row td.marks { flex: 1 1 100%; display: flex; flex-direction: row; flex-wrap: wrap; gap: 4px; }
  .donor-table tr.donor-row td.marks:empty { display: none; }
  .donor-table tr.donor-row td.marks .badge { margin: 0; }
  .name-main, .name-other { overflow-wrap: anywhere; }
  .donor-table td.empty-cell { display: block; }
}

/* ===== שלב 12: התאמה לטלפון (R38, design/עיצוב מאושר.md) ===== */
/* במחשב: רישום מהיר והכפתור "תורם חדש" בפס התחתון לא מוצגים */
.quick-log, .navtab-new { display: none; }

@media (max-width: 720px) {
  /* פס עליון קומפקטי: שם ושפה בשורה אחת, ומתחת "מחובר" וכפתורי הגיבוי */
  .topbar { padding: 8px 16px; gap: 6px 10px; justify-content: flex-start; }
  .brand { font-size: 1.15rem; gap: 8px; }
  .brand-icon { width: 24px; height: 24px; }
  .controls { display: contents; }
  .lang { order: 1; margin-inline-start: auto; }
  .whoami { order: 2; flex: 1 1 auto; border: 0; background: none; padding: 0; font-size: .88rem; }
  .topbar .btn-outline { order: 3; padding: 4px 10px; font-size: .82rem; min-height: 36px; }
  .topbar .btn-outline svg { width: 16px; height: 16px; }

  /* פס תחתון קבוע: הלשוניות, סמל מעל מילה, וכפתור עגול "תורם חדש" */
  .mainnav {
    position: fixed; inset-inline: 0; bottom: 0; z-index: 20; width: auto; margin: 0;
    display: flex; gap: 4px; align-items: stretch;
    background: #fff; border-top: 1px solid var(--border); box-shadow: 0 -2px 10px rgba(0,0,0,.06);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  }
  .navtab {
    flex: 1 1 0; min-width: 0; min-height: 52px; flex-direction: column; justify-content: center; gap: 2px;
    padding: 4px 2px; color: var(--muted); font-size: .8rem; line-height: 1.2; text-align: center;
  }
  .navtab svg { width: 24px; height: 24px; }
  .navtab:hover { background: #F3F6FA; color: var(--navy); }
  .navtab[aria-current="page"] { background: #E8EEF6; color: var(--navy); font-weight: 700; box-shadow: none; }
  .navtab-new { display: flex; background: var(--navy); color: #fff; border-radius: 999px; font-weight: 700; }
  .navtab-new:hover { background: var(--navy-dark); color: #fff; }
  body { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  body.logged-out { padding-bottom: 0; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

  /* כרטיס תורם: רישום מהיר בראש הכרטיס, עם פס כחול בצד */
  .quick-log {
    display: block; margin: 16px 0 0; padding: 14px;
    background: #fff; border: 1px solid var(--border); border-inline-start: 4px solid var(--navy); border-radius: var(--radius);
  }
  .quick-log-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 1.1rem; color: var(--navy); }
  .quick-log .contact-form { margin: 0; }
  .quick-log .contact-form button { justify-self: stretch; justify-content: center; }
  .contact-form-tab { display: none; }
  .head-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; width: 100%; }
  .head-actions button { justify-content: center; padding: 8px 10px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .tab { flex: none; white-space: nowrap; }

  /* כפתורים ושדות בגובה נוח לאצבע; טקסט 16 כדי שהטלפון לא יגדיל את המסך בהקלדה */
  .btn-primary, .btn-plain, .btn-dashed, .btn-link, .chip, .filter-select, .search-box input,
  input[type="text"], input[type="search"], input[type="tel"], input[type="email"], input[type="date"],
  .donor-form select, .date-pair select, .dialog-form select { min-height: 44px; }
  input, select, textarea { font-size: 16px; }
}

/* ===== צפייה בלבד (26.11.2026): איתן רואה הכול, אבל לא משנה אצל אחרים. השרת אוכף; כאן רק מסתירים כפתורים ===== */
.view-only-note { display: flex; align-items: center; gap: 6px; margin: 12px 0 0; padding: 8px 12px; border-radius: 8px; background: #EEF1F5; color: var(--navy); font-weight: 600; }
.donor-card.read-only #btn-edit, .donor-card.read-only #btn-archive, .donor-card.read-only #btn-reviewed,
.donor-card.read-only .contact-form, .donor-card.read-only #btn-add-donation, .donor-card.read-only #btn-add-event,
.donor-card.read-only #btn-add-photos, .donor-card.read-only .edit-donation, .donor-card.read-only .edit-event { display: none !important; }
