/* ============ כימרה v2 — מערכת עיצוב ============
   שלושת ראשי הכימרה = שלושת הסטטוסים:
   אריה (זהב) = תומך · דרקון (ירקרק) = מתלבט · כנפיים (ארגמן) = מתנגד */
:root {
  --navy: #1B2433;
  --navy-2: #232F44;
  --navy-soft: #2A3850;
  --gold: #E8A212;
  --gold-deep: #C8890B;
  --gold-soft: #FBF1DC;
  --sage: #7E9382;
  --sage-soft: #ECF1ED;
  --maroon: #6E2230;
  --maroon-soft: #F6E8EA;
  --bg: #F3F5F8;
  --card: #FFFFFF;
  --line: #E4E8EF;
  --ink: #1B2433;
  --muted: #6B7484;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(27,36,51,.05), 0 4px 14px rgba(27,36,51,.06);
  --shadow-lift: 0 4px 8px rgba(27,36,51,.08), 0 12px 28px rgba(27,36,51,.12);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Heebo', system-ui, sans-serif;
  background:
    radial-gradient(900px 420px at 100% -10%, rgba(232,162,18,.07), transparent 60%),
    radial-gradient(700px 380px at -10% 110%, rgba(126,147,130,.08), transparent 60%),
    var(--bg);
  color: var(--ink);
  display: flex;
  min-height: 100vh;
  font-size: 15px;
}
h1, h2, h3, .brand-name { font-family: 'Secular One', 'Heebo', sans-serif; font-weight: 400; letter-spacing: .2px; }
h1 { font-size: 27px; margin: 0 0 4px; }
h2 { font-size: 17px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
h2::after { content: ""; flex: 1; height: 1px; background: linear-gradient(to left, var(--line), transparent); }
a { color: var(--navy); }

/* ---------- סרגל צד ---------- */
.sidebar {
  width: 234px; min-height: 100vh; position: sticky; top: 0;
  background: linear-gradient(180deg, var(--navy) 0%, #161d2a 100%);
  color: #fff; display: flex; flex-direction: column; flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 18px 16px; text-decoration: none; color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08); }
.brand img { max-width: 200px; width: 100%; height: auto; object-fit: contain;
  background: transparent; border-radius: 0; padding: 0; }
.brand-name { display: block; font-size: 20px; font-family: Georgia, 'Times New Roman', serif;
  font-weight: 700; letter-spacing: .5px; color: #fff; line-height: 1; }
.brand-sub { display: block; font-size: 9px; letter-spacing: .42em; color: var(--gold); font-weight: 700; margin-top: 2px; }
.brand-org { display: block; font-size: 11px; color: #8E9AAE; margin-top: 4px; }
.sidebar nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-sep { margin: 10px 12px 4px; font-size: 10.5px; color: #7A879B; letter-spacing: .08em; }
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  color: #C9D1DF; text-decoration: none; padding: 9px 12px; border-radius: 11px; font-size: 14.5px;
  transition: background .15s, color .15s, transform .1s;
}
.sidebar nav a:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar nav a.active { background: linear-gradient(90deg, var(--gold), var(--gold-deep)); color: var(--navy); font-weight: 700;
  box-shadow: 0 4px 12px rgba(232,162,18,.35); }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: 13px;
  display: flex; justify-content: space-between; align-items: center; }
.user-chip { color: #AEB8C9; }
.logout { color: var(--gold); text-decoration: none; }

main { flex: 1; padding: 26px clamp(14px, 3vw, 38px) 96px; max-width: 1280px; width: 100%; }

/* ---------- כרטיסים ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 980px) { .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); } .grid-2 { grid-template-columns: 1fr; } }

.kpi { padding: 16px 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow); position: relative; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.kpi::before { content: ""; position: absolute; inset-inline-start: 0; top: 0; bottom: 0; width: 4px; }
.kpi.gold::before { background: linear-gradient(var(--gold), var(--gold-deep)); }
.kpi.sage::before { background: var(--sage); }
.kpi.maroon::before { background: var(--maroon); }
.kpi.navy::before { background: var(--navy); }
.kpi .num { font-family: 'Secular One'; font-size: 31px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi .lbl { color: var(--muted); font-size: 13px; margin-top: 2px; }

/* ---------- סטטוסים ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; }
.pill.supporter { background: #E3F4E6; color: #1E6B33; } .pill.supporter::before { background: #2E9E4A; }
.pill.undecided { background: #FDF4D6; color: #8A6A00; } .pill.undecided::before { background: #E8B800; }
.pill.opponent { background: #FBE4E4; color: #A3241F; } .pill.opponent::before { background: #C8322B; }
.pill.unknown { background: #EEF0F4; color: var(--muted); } .pill.unknown::before { background: #B9C0CC; }
.pill.voted { background: var(--navy); color: var(--gold); } .pill.voted::before { background: var(--gold); }
.pill.seg { background: #E9EDF5; color: var(--navy); } .pill.seg::before { background: var(--navy-soft); }
.pill.goldb { background: linear-gradient(90deg, var(--gold-soft), #fff); color: #8a5f00; border: 1px solid var(--gold); }
.pill.goldb::before { background: var(--gold); }

/* ---------- טפסים ---------- */
input, select, textarea {
  font-family: inherit; font-size: 15px; width: 100%;
  padding: 10px 13px; border: 1.5px solid var(--line); border-radius: 11px; background: #fff; color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(232,162,18,.18); }
input[type="file"] { padding: 8px; background: var(--bg); }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 10px 0 5px; }
select[multiple] { min-height: 92px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: none; cursor: pointer; text-decoration: none; text-align: center; position: relative;
  font-family: inherit; font-size: 14.5px; font-weight: 700;
  padding: 10px 18px; border-radius: 11px; background: var(--navy); color: #fff;
  transition: transform .12s, box-shadow .15s, filter .15s;
}
.btn:hover { filter: brightness(1.12); box-shadow: 0 4px 12px rgba(27,36,51,.22); }
.btn:active, .btn.pressed { transform: scale(.96); }
.btn.gold { background: linear-gradient(135deg, var(--gold), var(--gold-deep)); color: var(--navy); }
.btn.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--line); }
.btn.ghost:hover { border-color: var(--navy); box-shadow: none; }
.btn.maroon { background: var(--maroon); }
.btn.sage { background: var(--sage); }
.btn.sm { padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn.lg { padding: 14px 26px; font-size: 16px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn:disabled { opacity: .65; cursor: wait; }

/* ספינר טעינה בתוך כפתור */
.btn.loading { color: transparent !important; pointer-events: none; }
.btn.loading::after { content: ""; position: absolute; width: 18px; height: 18px;
  border: 2.5px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%;
  animation: spin .7s linear infinite; }
.btn.gold.loading::after { border-color: rgba(27,36,51,.3); border-top-color: var(--navy); }
.btn.ghost.loading::after { border-color: rgba(27,36,51,.2); border-top-color: var(--navy); }
@keyframes spin { to { transform: rotate(360deg); } }

.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--gold);
  border-radius: 50%; animation: spin .7s linear infinite; }
.spinner.big { width: 44px; height: 44px; border-width: 4px; margin: 0 auto 14px; }
.upload-overlay { position: fixed; inset: 0; background: rgba(27,36,51,.55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; z-index: 200; }
.upload-box { background: #fff; border-radius: 18px; padding: 30px 36px; text-align: center;
  box-shadow: var(--shadow-lift); max-width: 320px; }
.upload-title { font-weight: 700; margin-bottom: 6px; }

/* בחירה מרובה כצ'יפים */
.pill-check { display: flex; flex-wrap: wrap; gap: 6px; }
.pill-check input { display: none; }
.pill-check label {
  display: inline-flex; margin: 0; cursor: pointer; user-select: none;
  padding: 6px 13px; border-radius: 999px; border: 1.5px solid var(--line);
  background: #fff; color: var(--ink); font-size: 13px; font-weight: 600;
  transition: all .15s;
}
.pill-check input:checked + label { background: var(--navy); border-color: var(--navy); color: #fff; }
.pill-check.goldish input:checked + label { background: var(--gold); border-color: var(--gold); color: var(--navy); }

/* ---------- טבלאות ---------- */
.table-wrap { overflow-x: auto; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: right; color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .03em;
  padding: 9px 10px; border-bottom: 2px solid var(--line); white-space: nowrap; background: #FAFBFD;
  position: sticky; top: 0; }
td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr { transition: background .12s; }
tr:hover td { background: #F7F9FC; }
td a.row-link { font-weight: 700; text-decoration: none; }
td a.row-link:hover { color: var(--gold-deep); }

.muted { color: var(--muted); font-size: 13px; }
.alert { padding: 11px 15px; border-radius: 11px; margin-bottom: 12px; font-size: 14px; border: 1px solid transparent; }
.alert.ok { background: var(--sage-soft); color: #2f4a38; border-color: #CBDCD1; }
.alert.err { background: var(--maroon-soft); color: var(--maroon); border-color: #E8C4CB; }

.page-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; align-items: end; }
.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 14px; }
.pagination a, .pagination span { padding: 6px 13px; border-radius: 9px; border: 1px solid var(--line);
  text-decoration: none; font-size: 13.5px; background: #fff; }
.pagination .cur { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ---------- כניסה ---------- */
.login-wrap {
  min-height: 100vh; width: 100vw; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(800px 500px at 75% -5%, rgba(232,162,18,.18), transparent 55%),
    radial-gradient(700px 480px at 10% 105%, rgba(110,34,48,.25), transparent 55%),
    linear-gradient(165deg, var(--navy-soft), var(--navy) 55%, #11161f);
}
.login-card { background: rgba(255,255,255,.97); border-radius: 24px; padding: 36px 32px;
  width: min(410px, 92vw); text-align: center;
  box-shadow: 0 24px 70px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.12); }
.login-card img { width: 150px; margin-bottom: 8px; border-radius: 30px;
  filter: drop-shadow(0 10px 24px rgba(232,162,18,.35)); }
.login-card h1 { font-size: 32px; }
.login-card .sub { color: var(--muted); margin-bottom: 18px; }
.login-card form { text-align: right; }
.login-card .btn { width: 100%; margin-top: 18px; }

/* ---------- כרטיס טלפניה ---------- */
.call-card { text-align: center; padding: 28px 22px; }
.call-card .name { font-family: 'Secular One'; font-size: 28px; margin-bottom: 4px; }
.call-card .phones { display: flex; flex-direction: column; gap: 8px; margin: 16px auto; max-width: 360px; }
.call-actions { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; max-width: 460px; margin: 18px auto 0; }
.status-trio { display: flex; gap: 10px; justify-content: center; margin: 14px 0; }
.status-trio .btn { font-size: 20px; padding: 12px 20px; }

/* ---------- ניווט תחתון (מובייל) ---------- */
.bottom-nav { display: none; }
@media (max-width: 860px) {
  .sidebar { display: none; }
  main { padding: 16px 14px 92px; }
  .bottom-nav {
    display: flex; position: fixed; bottom: 0; right: 0; left: 0; z-index: 50;
    background: rgba(27,36,51,.97); backdrop-filter: blur(8px);
    padding: 7px 4px calc(7px + env(safe-area-inset-bottom));
    justify-content: space-around; box-shadow: 0 -6px 22px rgba(0,0,0,.25);
  }
  .bottom-nav a { color: #C9D1DF; text-decoration: none; font-size: 19px; display: flex; flex-direction: column;
    align-items: center; gap: 1px; padding: 4px 9px; border-radius: 11px; }
  .bottom-nav a small { font-size: 10px; }
  .bottom-nav a.active { color: var(--gold); }
  .page-head h1 { font-size: 22px; }
  td, th { padding: 8px 6px; }
  .hide-mobile { display: none; }
  .call-actions { grid-template-columns: 1fr 1fr; }
}

/* לוח שבועי */
.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day-col { background: #FAFBFD; border: 1px solid var(--line); border-radius: 12px; padding: 8px; min-height: 120px; }
.day-col h4 { margin: 0 0 8px; font-size: 13px; text-align: center; color: var(--muted); }
.shift-chip { background: #fff; border: 1px solid var(--line); border-inline-start: 3px solid var(--gold);
  border-radius: 9px; padding: 6px 8px; font-size: 12px; margin-bottom: 6px; box-shadow: var(--shadow); }
.shift-chip .t { font-weight: 700; }
@media (max-width: 860px) { .week-grid { grid-template-columns: 1fr; } .day-col { min-height: auto; } }

.budget-bar { height: 12px; background: var(--line); border-radius: 999px; overflow: hidden; margin: 8px 0; }
.budget-bar > div { height: 100%; background: linear-gradient(90deg, var(--sage), var(--gold)); border-radius: 999px; }
.budget-bar.over > div { background: var(--maroon); }

.ai-seg { border: 1.5px solid var(--line); border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
  background: linear-gradient(180deg, #fff, #FCFCFE); transition: box-shadow .15s; }
.ai-seg:hover { box-shadow: var(--shadow-lift); }
.ai-seg .t { font-weight: 700; font-size: 15.5px; }
pre.ai-text { white-space: pre-wrap; font-family: 'Heebo'; background: #FAFBFD; border: 1px solid var(--line);
  border-radius: 12px; padding: 16px; font-size: 14px; line-height: 1.7; }

.chart-box { position: relative; height: 280px; }
@media (max-width: 860px) { .chart-box { height: 230px; } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }


/* ספירת תוצאות */
.results-count { font-size: 14px; color: var(--muted); margin: -4px 0 8px 0; padding-inline-start: 4px; }
.results-count strong { color: var(--ink); font-size: 16px; }

/* רדיו בתוך טבלת כפילויות */
td input[type="radio"] { width: 18px; height: 18px; accent-color: var(--gold-deep); cursor: pointer; }

/* details תסריט */
details summary::-webkit-details-marker { color: var(--gold-deep); }

/* כותרת עמוד עם פס מותג עדין */
.page-head { position: relative; padding-bottom: 12px; }
.page-head::after { content: ""; position: absolute; bottom: 0; right: 0; width: 64px; height: 3px;
  border-radius: 99px; background: linear-gradient(90deg, var(--gold), var(--maroon), var(--sage)); }


/* ---------- אייקוני SVG ---------- */
.ic { width: 19px; height: 19px; flex-shrink: 0; fill: none; stroke: currentColor;
  stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.bottom-nav .ic { width: 22px; height: 22px; }

/* כותרת לטינית בכניסה */
.login-card h1.latin { font-family: Georgia, 'Times New Roman', serif; letter-spacing: .5px; }
.login-card h1.latin span { color: var(--gold-deep); font-weight: 400; }
.login-card img { width: 110px; border-radius: 26px; }

/* מצבי ייבוא */
.import-modes { display: flex; flex-direction: column; gap: 8px; }
.mode-opt { display: flex; gap: 10px; align-items: flex-start; margin: 0; cursor: pointer;
  border: 1.5px solid var(--line); border-radius: 12px; padding: 11px 13px;
  font-size: 13.5px; font-weight: 400; color: var(--ink); transition: all .15s; }
.mode-opt:hover { border-color: var(--gold); }
.mode-opt:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); box-shadow: 0 0 0 3px rgba(232,162,18,.12); }
.mode-opt input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--gold-deep); flex-shrink: 0; }

/* ---------- מודרניזציה כללית v4 ---------- */
body { letter-spacing: .01em; }
.card { padding: 22px; border: 1px solid #E9ECF2;
  box-shadow: 0 1px 2px rgba(27,36,51,.04), 0 8px 24px -12px rgba(27,36,51,.10); }
h1 { font-size: 28px; letter-spacing: 0; }
.page-head .muted { font-size: 13.5px; }
th { background: transparent; border-bottom: 1.5px solid var(--line); font-size: 11.5px;
  text-transform: none; letter-spacing: .05em; }
tbody tr:last-child td { border-bottom: none; }
input, select, textarea { background: #FBFCFE; }
input:hover, select:hover, textarea:hover { border-color: #CBD2DE; }
.sidebar nav a { font-weight: 500; }
.sidebar nav a .ic { opacity: .85; }
.sidebar nav a.active .ic { opacity: 1; }
.kpi { border: 1px solid #E9ECF2; }
.kpi .num { font-size: 33px; }
.btn { letter-spacing: .01em; }
.alert.ok::before { content: "✓ "; font-weight: 700; }
.pagination a:hover { border-color: var(--navy); }
::selection { background: var(--gold-soft); }
.bottom-nav a { font-size: 0; }

/* רשימת בחירה מרובה עם חיפוש (דור-טו-דור) */
.list-search { width: 100%; margin-bottom: 6px; }
.check-list { max-height: 220px; overflow-y: auto; border: 1px solid var(--line);
  border-radius: 10px; padding: 6px; background: #fff; }
.check-list .check-item { display: flex; align-items: center; gap: 8px; padding: 7px 8px;
  border-radius: 8px; cursor: pointer; font-size: 14px; }
.check-list .check-item:hover { background: #F2F5F9; }
.check-list .check-item input { width: 18px; height: 18px; flex: none; }
