/* ============================================================
   Ynex-style admin skin — local only (CSP-safe), RTL, dark mode.
   Palette + component reskin. All original class names preserved
   so every Jinja template keeps working.
   ============================================================ */

/* --- פונט Assistant (עברית) — vendored ל-static/fonts, תואם-CSP (font-src 'self')
   מ-@fontsource/assistant. hebrew+latin לכל משקל, font-display: swap. --------- */
@font-face { font-family: "Assistant"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/assistant-hebrew-400-normal.woff2") format("woff2");
  unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Assistant"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("fonts/assistant-latin-400-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Assistant"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/assistant-hebrew-600-normal.woff2") format("woff2");
  unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Assistant"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("fonts/assistant-latin-600-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Assistant"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/assistant-hebrew-700-normal.woff2") format("woff2");
  unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Assistant"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("fonts/assistant-latin-700-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Assistant"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("fonts/assistant-hebrew-800-normal.woff2") format("woff2");
  unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Assistant"; font-style: normal; font-weight: 800; font-display: swap;
  src: url("fonts/assistant-latin-800-normal.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  /* brand / accent (Ynex purple) */
  --accent: #845adf;
  --accent-rgb: 132, 90, 223;
  --accent-soft: rgba(132, 90, 223, 0.12);

  /* status colors — Ynex exact (rgb for soft tints) */
  --danger: #e6533c;  --danger-rgb: 230, 83, 60;
  --success: #26bf94; --success-rgb: 38, 191, 148;
  --info: #49b6f5;    --info-rgb: 73, 182, 245;
  --warn-rgb: 245, 184, 73;

  /* surfaces — neutral palette with a subtle violet cast toward --accent */
  --bg: #eef0f7;
  --panel: #ffffff;
  --panel-2: #f4f5fb;
  --line: #e7e9f2;
  --line-strong: #d8dbeb;

  /* text — darkened for comfortable AA contrast on light surfaces */
  --text: #23233d;
  --muted: #656a85;

  /* status */
  --signal: #22a06b;
  --warn: #c07a00;
  --warn-bg: #fdf6e9;
  --he: #22a06b;
  --en: #845adf;
  --ar: #c07a00;

  /* גלולת-שכבת-המרה (tier pill) — טקסט כהה-יותר מ-signal/warn/danger כדי לעמוד ב-AA
     (4.5:1) על משטח בהיר; signal/warn/danger עצמם נועדו לאייקונים/פסים, לא לטקסט-דק. */
  --tier-good: #0e6e47;
  --tier-warn: #8c5800;
  --tier-bad: #b02f1c;

  /* sidebar (white in light theme, dark in dark theme) */
  --side-bg: #ffffff;
  --side-bg-2: #f1f3f6;
  --side-text: rgba(26, 34, 48, 0.66);
  --side-text-strong: #1a2230;
  --side-line: #e6e9ef;

  /* header */
  --header-bg: #ffffff;

  /* shape */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --shadow: 0 1px 2px rgba(23, 25, 60, 0.05), 0 4px 14px rgba(23, 25, 60, 0.06);
  --shadow-soft: 0 1px 3px rgba(23, 25, 60, 0.06);
  --shadow-lg: 0 4px 12px rgba(23, 25, 60, 0.08), 0 18px 40px rgba(23, 25, 60, 0.10);
  --ring: 0 0 0 3px rgba(var(--accent-rgb), 0.35);

  /* spacing scale (4px base) — consistent rhythm across cards/sections */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 22px;
  --sp-6: 30px;
  --sp-7: 44px;

  /* type scale (Assistant) */
  --lh-tight: 1.2;
  --lh-snug: 1.35;
  --lh-body: 1.55;
  --ls-label: 0.06em;

  /* layout metrics */
  --sidebar-w: 250px;
  --header-h: 64px;
  /* גובה פס-גישת-האורח העליון: 0 כברירת-מחדל (אין פס) → אפס-השפעה על הפריסה.
     נדרך ל-34px רק ב-body.has-ksbar, ואז ההדר/סייד-בר/תוכן נדחפים למטה בהתאם. */
  --ksbar-h: 0px;
}
body.has-ksbar { --ksbar-h: 34px; }

html.dark {
  --bg: #14151f;
  --panel: #1c1d2b;
  --panel-2: #242539;
  --line: #2e3047;
  --line-strong: #3b3d57;
  --text: #dcdef0;
  --muted: #949ab6;
  --warn-bg: #2c2510;
  --warn: #f5b849;        /* בהיר יותר לקריאוּת על רקע כהה */
  --tier-good: #4ce0a0;   /* גרסאות-בהירות ל-tier pill, AA על משטח כהה */
  --tier-warn: #f5b849;
  --tier-bad: #ff8f7a;
  --side-bg: #16172a;
  --side-bg-2: #222440;
  --side-text: rgba(226, 230, 245, 0.66);
  --side-text-strong: #ffffff;
  --side-line: rgba(255, 255, 255, 0.09);
  --header-bg: #1c1d2b;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.34), 0 4px 16px rgba(0, 0, 0, 0.30);
  --shadow-soft: 0 1px 3px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 6px 16px rgba(0, 0, 0, 0.42), 0 22px 48px rgba(0, 0, 0, 0.40);
  --ring: 0 0 0 3px rgba(var(--accent-rgb), 0.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: "Assistant", "IBM Plex Sans Hebrew", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: var(--lh-body);
  font-weight: 400;
  letter-spacing: -0.003em;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.mono { font-family: "IBM Plex Mono", "SF Mono", ui-monospace, monospace; font-variant-numeric: tabular-nums; }
a { color: var(--accent); text-underline-offset: 2px; }

/* Type scale (Assistant weights: 400 / 600 / 700 / 800) */
h1, h2, h3, h4 { line-height: var(--lh-snug); font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 24px; font-weight: 800; line-height: var(--lh-tight); }
h2 { font-size: 20px; }
h3 { font-size: 17px; }
h4 { font-size: 15px; }
strong, b { font-weight: 700; }
small { font-size: 12.5px; }

/* generic muted text helper (used in templates, previously unstyled) */
.muted { color: var(--muted); }

/* keyboard focus fallback — zero specificity so component rings win */
:where(button, summary, [tabindex]):focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

/* ============================================================
   APP SHELL — fixed dark sidebar (right, RTL) + top header
   ============================================================ */

.sidebar {
  position: fixed;
  top: var(--ksbar-h);
  right: 0;
  left: auto;
  width: var(--sidebar-w);
  height: calc(100vh - var(--ksbar-h));
  background: var(--side-bg);
  border-left: 1px solid var(--side-line);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow-y: auto;
}
.sidebar-brand {
  height: var(--header-h);
  display: flex;
  align-items: center;
  padding: 0 22px;
  border-bottom: 1px solid var(--side-line);
  flex: 0 0 auto;
}
.sidebar-brand img { height: 34px; width: auto; display: block; }
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 16px 14px;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--side-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.006em;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar-nav a:hover { color: var(--side-text-strong); background: var(--side-bg-2); }
.sidebar-nav a.active { color: #fff; background: var(--accent); box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.32); }
.sidebar-nav a:focus-visible,
.sidebar-nav .nav-dd > summary:focus-visible { outline: none; box-shadow: var(--ring); }
.sidebar-nav a .ico {
  width: 18px; height: 18px; flex: 0 0 auto; opacity: 0.72;
}
.sidebar-nav a:hover .ico { opacity: 0.95; }
.sidebar-nav a.active .ico { opacity: 1; }
.sidebar-sep { height: 1px; background: var(--side-line); margin: 12px 6px; }
.sidebar-nav a.logout { color: #c0392b; margin-top: 4px; }
.sidebar-nav a.logout:hover { color: #fff; background: rgba(214, 60, 60, 0.85); }
html.dark .sidebar-nav a.logout { color: #ff9b9b; }
html.dark .sidebar-nav a.logout:hover { background: rgba(214, 60, 60, 0.5); }

/* sidebar dropdowns (Studio / Telegram) — <details>, CSS-only (CSP-safe),
   expand inline inside the dark sidebar (works on desktop + mobile drawer) */
.sidebar-nav .nav-dd > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 11px;
  color: var(--side-text); font-size: 14px; font-weight: 600;
  padding: 10px 14px; border-radius: var(--radius-sm);
}
.sidebar-nav .nav-dd > summary::-webkit-details-marker { display: none; }
.sidebar-nav .nav-dd > summary::after { content: "▾"; margin-inline-start: auto; font-size: 10px; opacity: 0.7; }
.sidebar-nav .nav-dd > summary:hover { color: var(--side-text-strong); background: var(--side-bg-2); }
.sidebar-nav .nav-dd[open] > summary { color: var(--side-text-strong); }
.sidebar-nav .nav-dd-menu { display: flex; flex-direction: column; gap: 2px; padding: 2px 0 4px; }
.sidebar-nav .nav-dd-menu a {
  color: var(--side-text); font-size: 13px; font-weight: 600;
  padding: 9px 14px 9px 40px; border-radius: var(--radius-sm); text-decoration: none;
}
.sidebar-nav .nav-dd-menu a:hover { color: var(--side-text-strong); background: var(--side-bg-2); }

.appheader {
  position: fixed;
  top: var(--ksbar-h);
  left: 0;
  right: var(--sidebar-w);
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 24px;
  z-index: 90;
}
.appheader .spacer { flex: 1; }
.appheader .who { font-size: 13px; color: var(--muted); }
.appheader .who strong { color: var(--text); font-weight: 700; }

/* header "current client" pill + generic badge (were unstyled in templates) */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; line-height: 1;
  padding: 6px 12px; border-radius: var(--radius-pill);
  color: var(--accent); background: var(--accent-soft);
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  white-space: nowrap;
}
.appheader select {
  background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 8px 11px; color: var(--text);
  font-size: 13px; font-family: inherit;
}
.appheader select:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }

/* dark / light toggle button */
.theme-toggle {
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--panel-2); color: var(--text);
  cursor: pointer; font-size: 18px; line-height: 1;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.theme-toggle:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
.theme-toggle:active { transform: translateY(1px); }
.theme-toggle .i-sun { display: none; }
.theme-toggle .i-moon { display: inline; }
html.dark .theme-toggle .i-sun { display: inline; }
html.dark .theme-toggle .i-moon { display: none; }

/* main content area clears the fixed sidebar + header */
.wrap {
  margin-right: var(--sidebar-w);
  margin-left: 0;
  max-width: none;
  padding: calc(var(--header-h) + var(--ksbar-h) + 26px) 30px 60px;
}

/* hamburger + drawer backdrop (mobile only) */
.hamburger { display: none; }
.navtoggle { display: none; }
.nav-overlay { display: none; }

/* ============================================================
   CARDS / GRID / SECTIONS
   ============================================================ */

.grid { display: grid; gap: var(--sp-5); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--sp-5);
  box-shadow: var(--shadow);
}
.card .label { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: var(--ls-label); font-weight: 700; }
.card .value { font-size: 30px; font-weight: 800; line-height: var(--lh-tight); letter-spacing: -0.02em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.card .value.cost { color: var(--warn); }
.card .sub { font-size: 13px; color: var(--muted); margin-top: 4px; }
.section-title { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: var(--ls-label); font-weight: 700; margin: var(--sp-6) 0 var(--sp-4); display: flex; align-items: center; gap: 9px; }
.section-title::before { content: ""; flex: 0 0 auto; width: 4px; height: 13px; border-radius: 2px; background: var(--accent); }

/* ============================================================
   TABLES
   ============================================================ */

table { width: 100%; border-collapse: collapse; }
th, td { text-align: start; padding: 12px 14px; font-size: 14px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: var(--ls-label); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--panel-2); }
tbody td { font-variant-numeric: tabular-nums; }
/* מספרים מיושרים לימין (start ב-RTL) — מתיישרים לפי מקום-הערך ומתחת לכותרת
   (שגם היא start); tabular-nums לרוחב-ספרה אחיד. תוקן: היה end (שמאל) → הכותרת
   והמספר נפלו על צדדים מנוגדים. */
td.num { text-align: start; font-variant-numeric: tabular-nums; font-weight: 600; }

.ltr { direction: ltr; text-align: start; unicode-bidi: isolate; }
.nowrap { white-space: nowrap; }
.table-scroll { overflow-x: auto; }

/* מיון-טבלה (sortable.js): כותרות לחיצות עם חץ קטן. ברירת-המחדל ↕, פעילה ▲/▼. */
.rtable.sortable th[data-sort] { cursor: pointer; user-select: none; white-space: nowrap; }
.rtable.sortable th[data-sort]:hover { color: var(--accent); }
.rtable.sortable th[data-sort]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sort-ind::after { content: "↕"; font-size: 11px; opacity: 0.45; margin-inline-start: 6px; }
.rtable.sortable th.sorted { color: var(--accent); }
.rtable.sortable th.sorted .sort-ind::after { content: "▲"; opacity: 0.95; }
.rtable.sortable th.sorted.desc .sort-ind::after { content: "▼"; }
/* טבלת לוח-הבקרה שיווק: 12 עמודות רחבות. בלי min-width הטבלה נדחסת ל-100%
   והעמודות (% סגירה / עלות-נרשם / עלות-ליד) נחתכות; עם min-width היא גולשת
   ונגללת אופקית בתוך .table-scroll במקום להיחתך. במובייל (≤760) היא הופכת
   לכרטיסים ולכן שם ה-min-width מתאפס (ראה בלוק ה-@media). */
.mk-table { min-width: 1080px; }
.posts-table { min-width: 720px; }
.posts-table td { vertical-align: top; line-height: 1.45; }
.posts-table .cell-he, .posts-table .cell-ar { max-width: 280px; }
.posts-table .cell-en { max-width: 280px; }
.posts-table td a { color: var(--accent); text-decoration: none; font-size: 13px; }
.posts-table td a:hover { text-decoration: underline; }
.posts-table .post-link { display: inline-block; margin-top: 6px; font-size: 12px; white-space: nowrap; }

/* ============================================================
   BAR CHART
   ============================================================ */

.bars { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding-top: 10px; }
.bars .bar { flex: 1; background: linear-gradient(var(--accent), rgba(var(--accent-rgb), 0.3)); border-radius: 5px 5px 0 0; min-height: 3px; position: relative; }
.bars .bar:hover::after { content: attr(data-val); position: absolute; top: -24px; inset-inline-start: 50%; transform: translateX(-50%); background: var(--text); color: var(--panel); padding: 2px 7px; border-radius: 4px; font-size: 11px; white-space: nowrap; }
.bars-x { display: flex; gap: 6px; margin-top: 6px; }
.bars-x span { flex: 1; text-align: center; font-size: 10px; color: var(--muted); }

/* ============================================================
   POSTS (cards w/ lang rows)
   ============================================================ */

.post { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 14px; box-shadow: var(--shadow); }
.post .meta { display: flex; gap: 12px; align-items: center; font-size: 12px; color: var(--muted); margin-bottom: 14px; }
.post .meta .id { font-family: "IBM Plex Mono", monospace; }
.post .langrow { display: grid; grid-template-columns: 30px 1fr; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); align-items: start; }
.post .langrow:first-of-type { border-top: none; }
.post .tag { font-size: 11px; font-weight: 700; padding: 3px 0; text-align: center; border-radius: 5px; }
.tag-he { background: rgba(34, 160, 107, 0.14); color: var(--he); }
.tag-en { background: var(--accent-soft); color: var(--en); }
.tag-ar { background: rgba(192, 122, 0, 0.14); color: var(--ar); }
.post .txt { font-size: 14px; line-height: 1.55; }
.post .txt.ltr { direction: ltr; text-align: left; }

/* ============================================================
   AUTH / PUBLIC (login, 2FA, forbidden, home)
   ============================================================ */

/* דף בית ציבורי — לוגו ממורכז בלבד (בלי סייד-בר/ניווט) */
.public-home { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.public-logo { display: block; width: 220px; max-width: 70%; height: auto; }

.login-screen { display: flex; min-height: 100vh; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 100%; max-width: 390px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 36px 32px; box-shadow: var(--shadow-lg); }
.login-card .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); margin: 0 auto 18px; }
.login-card h1 { font-size: 20px; text-align: center; margin-bottom: 4px; font-weight: 800; letter-spacing: -0.01em; }
.login-card p { text-align: center; color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }

label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 7px; font-weight: 600; }
input[type=password], input[type=text], input[type=email] { width: 100%; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 11px 13px; color: var(--text); font-size: 14px; font-family: inherit; transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease; }
input:focus, input:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--panel); }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 0.7; }
input.code { text-align: center; letter-spacing: 8px; font-size: 20px; font-family: "IBM Plex Mono", monospace; }

/* בוררי-תאריך נייטיביים (טווח בלוח-הבקרה שיווק וכו') — נייטיב לא-מעוצב נראה זר
   (mm/dd/yyyy אפור). מיישרים לשפת-העיצוב: רקע/גבול/רדיוס כמו שאר ה-inputs.
   רוחב אוטומטי (לא 100%) כי הם יושבים inline בשורת-פילטרים. focus/placeholder
   כבר מכוסים ע"י הכללים הגנריים למעלה. */
input[type=date], input[type=month] {
  background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 9px 13px; color: var(--text);
  font-size: 14px; font-family: inherit; line-height: var(--lh-body);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
input[type=date]:hover, input[type=month]:hover { border-color: var(--accent); }
/* אייקון פותח-הלוח (webkit) — בקצה, עמעום עדין, ומתהפך לבהיר במצב-כהה כדי
   שלא ייעלם על רקע כהה. */
input[type=date]::-webkit-calendar-picker-indicator,
input[type=month]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: 0.6; }
input[type=date]::-webkit-calendar-picker-indicator:hover,
input[type=month]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
html.dark input[type=date]::-webkit-calendar-picker-indicator,
html.dark input[type=month]::-webkit-calendar-picker-indicator { filter: invert(1); opacity: 0.75; }

/* כפתור הצג/הסתר-סיסמה (מוזרק ע"י forms.js). הכפתור יושב בקצה-הפנימי (שמאל ב-RTL);
   ריווח-פנימי לשדה כדי שהערך לא ייחתך מתחת לכפתור. */
.pw-wrap { position: relative; display: block; }
/* מיקום פיזי (ה-UI כולו RTL): העין תמיד בקצה השמאלי, והריווח משמאל — כך אין
   התנגשות עם תוכן-השדה בין אם הוא RTL (נקודות בימין) ובין אם dir=ltr (PIN/מפתחות,
   נקודות בשמאל). padding-inline-end לבדו נכשל בשדה dir=ltr. */
.pw-wrap input { padding-left: 44px; }
.pw-toggle { position: absolute; left: 8px; right: auto; top: 50%; transform: translateY(-50%); width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; background: transparent; border: none; color: var(--muted); cursor: pointer; border-radius: var(--radius-sm); line-height: 0; }
.pw-toggle svg { display: block; }
.pw-toggle:hover { color: var(--accent); background: var(--accent-soft); }
.pw-toggle:focus-visible { outline: none; box-shadow: var(--ring); color: var(--accent); }

/* Vertical form (minecraft provision / catalog): label-text above a full-width field,
   consistent spacing, constrained width so it reads as a form and not a stretched row.
   Selectors catch bare <input> too (no type=) which input[type=text] would miss. */
.form-grid { display: flex; flex-direction: column; gap: 18px; max-width: 480px; }
/* התווית היא block (לא flex-column): כך תווית-הטקסט ובועית-ה-? יושבות inline באותה
   שורה כפי שה-tip macro מצפה, והשדה יורד מתחת כ-block. (flex-column הפך את ה-? לשורה
   נפרדת שמרחפת — הבאג בצילום.) */
.form-grid label { display: block; margin-bottom: 0; }
.form-grid input, .form-grid select, .form-grid textarea { display: block; width: 100%; box-sizing: border-box; margin-top: 7px; }
.form-grid input:not([type=file]) { background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 11px 13px; color: var(--text); font-size: 14px; font-family: inherit; transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease; }
.form-grid .pw-wrap { margin-top: 7px; }
/* גובר על ה-padding של .form-grid input:not([type=file]) כדי לשמור מקום לעין משמאל. */
.form-grid .pw-wrap input { margin-top: 0; padding-left: 44px; }
.form-grid .btn { margin-top: 6px; }

.btn { width: 100%; background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); padding: 12px; font-size: 14px; font-weight: 700; letter-spacing: -0.006em; cursor: pointer; margin-top: 18px; font-family: inherit; box-shadow: 0 4px 12px rgba(var(--accent-rgb), 0.28); transition: filter 0.15s ease, box-shadow 0.15s ease, transform 0.06s ease; }
.btn:hover { filter: brightness(1.07); box-shadow: 0 6px 18px rgba(var(--accent-rgb), 0.36); }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.30); }
.btn:focus-visible { outline: none; box-shadow: var(--ring), 0 4px 12px rgba(var(--accent-rgb), 0.28); }
/* Alerts — Ynex soft style: tinted bg + matching border + full-color text (theme-agnostic) */
.error { background: rgba(var(--danger-rgb), 0.1); border: 1px solid rgba(var(--danger-rgb), 0.22); color: var(--danger); padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 18px; }
.notice { background: rgba(var(--success-rgb), 0.1); border: 1px solid rgba(var(--success-rgb), 0.22); color: var(--success); padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 18px; }
.warn-box { background: rgba(var(--warn-rgb), 0.1); border: 1px solid rgba(var(--warn-rgb), 0.28); color: var(--warn); padding: 11px 14px; border-radius: var(--radius-sm); font-size: 13px; margin-top: 18px; }
.empty { color: var(--muted); font-size: 14px; padding: 30px; text-align: center; }

.field-row { margin-bottom: 16px; }
.field-row .status { font-size: 12px; margin-inline-start: 8px; font-weight: 600; }
.status.set { color: var(--signal); }
.status.unset { color: var(--muted); }
.field-group { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: var(--sp-5); margin-bottom: 18px; box-shadow: var(--shadow); }
.field-group h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: var(--ls-label); color: var(--muted); margin-bottom: 16px; font-weight: 700; }
/* קישור "איפה משיגים את המפתח" מתחת לכותרת-הספק (עמוד הגדרות). */
.field-help { margin: -8px 0 16px; font-size: 13px; }
.field-help a { color: var(--accent); text-decoration: none; font-weight: 600; }
.field-help a:hover { text-decoration: underline; }

/* תת-ניווט לניהול-מיינקראפט (טאבים בראש מסכי-הניהול, כך שכל מסך נגיש מתפריט אחד). */
.mc-adminnav { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.mc-adminnav a { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); color: var(--muted); text-decoration: none; font-size: 13.5px; font-weight: 600; transition: background 0.15s ease, color 0.15s ease; }
.mc-adminnav a:hover { background: var(--panel-2); color: var(--text); }
.mc-adminnav a.active { background: var(--accent-soft); color: var(--accent); }

/* ============================================================
   HOME (logo only)
   ============================================================ */

.home-screen { display: flex; min-height: 100vh; align-items: center; justify-content: center; }
.logo-mark { width: 72px; height: 72px; border-radius: 20px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); display: flex; align-items: center; justify-content: center; }
.logo-dot { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); }
.home-logo { padding: 32px 40px; background: var(--panel); border-radius: 24px; box-shadow: var(--shadow); border: 1px solid var(--line); }
.home-logo img { width: 320px; max-width: 70vw; height: auto; display: block; }
.login-logo { display: block; width: 200px; max-width: 70%; height: auto; margin: 0 auto 20px; }

/* ============================================================
   CONSOLE (module cards)
   ============================================================ */

.module-card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); text-decoration: none; color: inherit; transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease; }
.module-card:hover:not(.disabled) { border-color: var(--accent); transform: translateY(-3px); box-shadow: 0 10px 28px rgba(var(--accent-rgb), 0.18); }
.module-card:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.module-card.disabled { opacity: 0.55; }
.module-name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.module-desc { font-size: 13.5px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.module-go { font-size: 13px; color: var(--accent); font-weight: 700; margin-top: 18px; }
.module-card.disabled .module-go { color: var(--muted); }

/* ============================================================
   BOOKS
   ============================================================ */

.books-opts { display: grid; grid-template-columns: 1fr 1fr auto; gap: 16px; align-items: end; margin: 16px 0; }
.books-opts select, .books-opts input[type=text] { width: 100%; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 11px 13px; color: var(--text); font-size: 14px; font-family: inherit; }
.cache-row { display: flex; align-items: center; gap: 8px; padding-bottom: 11px; }
.cache-row label { margin-bottom: 0; }
input[type=file] { width: 100%; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 10px 13px; font-size: 14px; font-family: inherit; color: var(--text); }

.book-table { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.book-row { display: grid; grid-template-columns: 80px 1fr 130px 200px; gap: 16px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.book-row:last-child { border-bottom: none; }
.book-head { background: var(--panel-2); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); font-weight: 600; }
.cover-thumb { width: 64px; height: 86px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--panel-2); }
.cover-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.book-title { font-weight: 600; font-size: 14px; display: block; margin-bottom: 8px; }
.book-pages { font-size: 12px; color: var(--muted); }
.job-bar { height: 6px; background: var(--panel-2); border-radius: 3px; overflow: hidden; margin: 6px 0; }
.job-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--he)); border-radius: 3px; transition: width 0.4s; }
.bc-status [data-status] { font-size: 13px; font-weight: 600; }
.job-err { color: #d63c3c; font-size: 11px; margin-top: 4px; }
.bc-links { display: flex; flex-direction: column; gap: 6px; }
.dl-link { font-size: 13px; text-decoration: none; padding: 5px 10px; border-radius: 6px; text-align: center; font-weight: 600; }
.dl-source { background: rgba(127, 132, 160, 0.14); color: var(--muted); }
.dl-source:hover { background: rgba(127, 132, 160, 0.24); }
.dl-he { background: var(--accent-soft); color: var(--accent); }
.dl-he:hover { background: rgba(var(--accent-rgb), 0.2); }

/* ============================================================
   ARTICLES
   ============================================================ */

textarea { width: 100%; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 11px 13px; color: var(--text); font-size: 14px; font-family: inherit; resize: vertical; line-height: 1.6; transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease; }
textarea:focus, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); background: var(--panel); }
/* generic select focus (books-opts / page-actions / field-row / inline) */
/* בסיס לכל בורר באתר: chrome אחיד של מערכת-העיצוב (panel-2/border/radius/padding),
   כדי ששום <select> לא ייפול ל-chrome-דיפולט-של-הדפדפן (raw = מכוער). הקשרים
   ספציפיים (appheader/page-actions/field-row/filter-bar/cycle-select…) דורסים גודל/
   רוחב לפי-צורך. בלי width כאן — כדי לא למתוח בוררים inline (הדר/page-actions). */
select {
  background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 9px 12px; color: var(--text);
  font-size: 14px; font-family: inherit; max-width: 100%;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

/* ============================================================
   ELEMENTOR
   ============================================================ */

.how-steps { margin: 0; padding-inline-start: 20px; }
.how-steps li { font-size: 13px; color: var(--text); margin-bottom: 8px; line-height: 1.6; }
.how-steps code { background: var(--panel-2); padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.pages-list { margin-top: 14px; }
.page-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 8px; flex-wrap: wrap; }
.page-title { font-size: 14px; font-weight: 500; }
.page-actions { display: flex; gap: 8px; align-items: center; }
.page-actions select { background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 6px; padding: 6px 8px; font-size: 13px; font-family: inherit; color: var(--text); }
.btn-sm { background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); padding: 8px 15px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block; transition: filter 0.15s ease, transform 0.06s ease, box-shadow 0.15s ease; }
.btn-sm:hover { filter: brightness(1.07); }
.btn-sm:active { transform: translateY(1px); }
.btn-sm:focus-visible { outline: none; box-shadow: var(--ring); }
/* כפתור משני (קו מתאר) — לפעולות מהשורה השנייה */
.btn-ghost { background: var(--panel); color: var(--accent); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 7px 14px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; text-decoration: none; display: inline-block; transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease; }
.btn-ghost:hover { background: var(--accent-soft); border-color: var(--accent); }
.btn-ghost:active { transform: translateY(1px); }
.btn-ghost:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--accent); }
/* כותרת מודול עם פעולות בצד */
.studio-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 32px 0 18px; }
.studio-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ============================================================
   USERS
   ============================================================ */

.modules-check { display: flex; flex-wrap: wrap; gap: 12px; margin: 10px 0; }
.check-item { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 0; cursor: pointer; }
.user-row { display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px; box-shadow: var(--shadow); }
.user-form { flex: 1; }
.user-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.user-name { font-weight: 700; font-size: 14px; }
.user-role { display: inline-block; font-size: 11px; padding: 3px 11px; border-radius: var(--radius-pill); font-weight: 700; letter-spacing: 0.01em; }
.role-super-admin { background: var(--accent-soft); color: var(--accent); }
.role-internal { background: rgba(34, 160, 107, 0.14); color: var(--he); }
.role-external { background: rgba(127, 132, 160, 0.14); color: var(--muted); }
.user-actions { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.pw-input { flex: 1; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: 6px; padding: 7px 10px; font-size: 13px; font-family: inherit; color: var(--text); }
.btn-del { background: rgba(var(--danger-rgb), 0.1); color: var(--danger); border: 1px solid rgba(var(--danger-rgb), 0.28); border-radius: var(--radius-sm); padding: 7px 14px; font-size: 13px; font-weight: 700; cursor: pointer; font-family: inherit; height: fit-content; transition: background 0.15s ease, border-color 0.15s ease; }
.btn-del:hover { background: rgba(var(--danger-rgb), 0.18); border-color: rgba(var(--danger-rgb), 0.4); }
.btn-del:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(var(--danger-rgb), 0.35); }
html.dark .btn-del { background: #3a1d1d; border-color: #5e2a2a; color: #ff9d9d; }
html.dark .btn-del:hover { background: #4a2424; }

/* ============================================================
   LOGO bits shared
   ============================================================ */

.brand-logo { height: 34px; width: auto; display: block; }
.brand-home { display: inline-flex; align-items: center; text-decoration: none; }

/* ============================================================
   SETTINGS (side-menu, panels)
   ============================================================ */

.settings-layout { display: grid; grid-template-columns: 210px 1fr; gap: 22px; align-items: start; }
.settings-nav { position: sticky; top: calc(var(--header-h) + var(--ksbar-h) + 20px); display: flex; flex-direction: column; gap: 4px; }
.settings-nav button { text-align: start; background: none; border: none; font: inherit; font-size: 14px; font-weight: 600; color: var(--muted); padding: 10px 14px; border-radius: var(--radius-sm); cursor: pointer; border-inline-start: 3px solid transparent; transition: background 0.15s ease, color 0.15s ease; }
.settings-nav button:hover { background: var(--panel-2); color: var(--text); }
.settings-nav button.active { background: var(--accent-soft); color: var(--accent); border-inline-start-color: var(--accent); font-weight: 700; }
.settings-nav button:focus-visible { outline: none; box-shadow: var(--ring); }
.settings-main { min-width: 0; }
.settings-main .panel { display: none; margin-bottom: 18px; }
.settings-main .panel.active { display: block; }
.add-gemini, .btn-add { background: var(--panel-2); color: var(--accent); border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); padding: 9px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; margin-top: 4px; }
.add-gemini:hover, .btn-add:hover { background: var(--accent-soft); }
.doc-link { font-size: 12px; margin: -8px 0 14px; }
.doc-link a { color: var(--accent); text-decoration: none; }
.doc-link a:hover { text-decoration: underline; }
.subhead { font-size: 13px; font-weight: 700; color: var(--text); margin: 20px 0 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.subhead:first-of-type { border-top: none; padding-top: 0; }
.site-card { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px 4px; margin-bottom: 14px; background: var(--panel-2); }
.site-card-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 12px; }
.field-row select { width: 100%; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 11px 13px; color: var(--text); font-size: 14px; font-family: inherit; }
.field-row select:focus, .field-row select:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
/* סרגל-סינון (לוגים וכו'): שדות label+select אחידים, מיושרים-לתחתית, בורר מעוצב
   כמו שאר המערכת (לא chrome-דיפולט של הדפדפן). כל שדה יחידה שלא נשברת בנפרד. */
.filter-bar { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filter-field { display: flex; flex-direction: column; gap: 5px; }
.filter-field > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.filter-bar select { min-width: 160px; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 9px 12px; color: var(--text); font-size: 14px; font-family: inherit; min-height: 40px; }
.filter-bar select:focus, .filter-bar select:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.filter-actions { display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) { .filter-field { flex: 1 1 100%; } .filter-bar select { width: 100%; } }

/* מתג-דמו per-מודל (מקור-הנתונים): select תלת-מצבי בראש כרטיס-הספק. */
.mock-select { width: 100%; background: var(--panel-2); border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 11px 13px; color: var(--text); font-size: 14px; font-family: inherit; }
.mock-select:focus, .mock-select:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
/* צבע-מצב למקור-דאטה: חי=ירוק · דמו=כתום · אוטומטי=ניטרלי. גוון-רך (rgba) + פס-צד
   בצבע-מלא, בעקבות דפוס-הסטטוסים (design-qa §3). משמש גם בחיווי-הכרטיס וגם בריכוז. */
.mock-select.is-off { border-inline-start: 3px solid var(--success); }
.mock-select.is-on  { border-inline-start: 3px solid var(--warn); }
/* תג-מצב לקריאה (כרטיס-ספק) + גלולת-מצב (ריכוז לשונית-מתגים) */
.mock-status { border-inline-start-width: 3px !important; }
.mock-status-off  { background: rgba(var(--success-rgb), .10); border-inline-start-color: var(--success) !important; }
.mock-status-on   { background: rgba(var(--warn-rgb), .12); border-inline-start-color: var(--warn) !important; }
.mock-status-auto { background: var(--panel-2); border-inline-start-color: var(--muted) !important; }
.mock-pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-inline-start: 6px; vertical-align: middle; }
.mock-pill-off  { background: rgba(var(--success-rgb), .14); color: var(--success); }
.mock-pill-on   { background: rgba(var(--warn-rgb), .16); color: var(--warn); }
.mock-pill-auto { background: rgba(var(--muted-rgb, 101,106,133), .14); color: var(--muted); }
/* בחירה-מרובה (הגבלת-לקוחות): listbox נקי — ריווח לכל שורה, סימון-נבחר בצבע-המותג. */
.field-row select[multiple] { padding: 5px; height: auto; }
.field-row select[multiple] option { padding: 7px 9px; border-radius: var(--radius-sm); }
.field-row select[multiple] option:checked { background: var(--accent-soft); color: var(--accent); font-weight: 700; }

/* ============================================================
   RESPONSIVE — sidebar becomes off-canvas drawer (from right, RTL)
   ============================================================ */

@media (max-width: 992px) {
  .grid.cols-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  :root { --sidebar-w: 0px; }

  .wrap { margin-right: 0; margin-left: 0; padding: calc(var(--header-h) + var(--ksbar-h) + 18px) 16px 48px; overflow-x: hidden; }
  .grid.cols-3, .grid.cols-2 { grid-template-columns: 1fr; }
  .appheader { left: 0; right: 0; }

  /* hamburger in header */
  .hamburger {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 42px; padding: 10px; border-radius: var(--radius-sm);
    cursor: pointer; flex: 0 0 auto; border: 1px solid var(--line); background: var(--panel-2);
  }
  .hamburger span { display: block; width: 100%; height: 2px; background: var(--text); border-radius: 2px; }

  /* off-canvas sidebar */
  .sidebar {
    width: 270px; max-width: 85vw;
    right: -300px; left: auto;
    transition: right 0.25s ease;
    box-shadow: -6px 0 24px rgba(20, 30, 50, 0.32);
  }
  .navtoggle:checked ~ .sidebar { right: 0; }

  /* clickable backdrop: a real <label for=navtoggle> so a tap closes the drawer */
  .nav-overlay {
    display: block; position: fixed; inset: 0;
    background: rgba(15, 18, 30, 0.5);
    opacity: 0; visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
    z-index: 95; cursor: pointer;
  }
  .navtoggle:checked ~ .nav-overlay { opacity: 1; visibility: visible; }

  /* responsive tables: row -> card */
  .rtable thead { display: none; }
  .rtable tr { display: block; margin-bottom: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; background: var(--panel); }
  .rtable tr:hover { background: var(--panel); }
  .rtable td { display: flex; justify-content: space-between; gap: 12px; padding: 6px 4px; border: 0; text-align: start; }
  .rtable td::before { content: attr(data-label); font-weight: 600; color: var(--muted); flex: 0 0 auto; }
  .rtable td.num { text-align: start; }
  /* במצב-כרטיסים אין צורך ברוחב-מינימום — הטבלה כבר עוברת ל-block, ו-min-width
     היה מחזיר גלילה אופקית מיותרת. */
  .mk-table { min-width: 0; }

  /* touch-friendly forms */
  .wrap input, .wrap select, .wrap textarea,
  .field-row input, .field-row select,
  .books-opts select, .books-opts input[type=text],
  input[type=password], input[type=text], input[type=file],
  input[type=date], input[type=month],
  .btn, .btn-sm, .btn-add, .add-gemini, form button {
    width: 100%; font-size: 16px; min-height: 44px;
  }
  .theme-toggle, .hamburger { width: 42px; min-height: 42px; }
  .cache-row input[type=checkbox], .check-item input[type=checkbox], .modules-check input[type=checkbox] { width: auto; min-height: 0; }
  .check-item, .cache-row { width: auto; }
  .user-actions, .page-actions { flex-wrap: wrap; }
  .pw-input { flex: 1 1 100%; }

  .settings-layout { grid-template-columns: 1fr; gap: 14px; }
  .settings-nav { position: static; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: 6px; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .settings-nav button { white-space: nowrap; border-inline-start: none; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; }
  .settings-nav button.active { border-inline-start: none; border-bottom-color: var(--accent); }

  .books-opts { grid-template-columns: 1fr; }
  .book-row { grid-template-columns: 56px 1fr; gap: 12px; }
  .bc-status, .bc-links { grid-column: 2; }
  .book-head { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ============================================================
   THEME SWITCHER — design options (CSP-safe; driven by switcher.js)
   ============================================================ */

/* Sidebar section labels (MAIN / PAGES style) + nav badges */
.sidebar-label { color: rgba(255,255,255,.4); font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 14px 16px 6px; }
.nav-badge { margin-inline-start: auto; font-size: 10px; font-weight: 700; padding: 1px 8px; border-radius: 999px; line-height: 1.6; }
.nav-badge.new { background: rgba(73,182,245,.22); color: #49b6f5; }

/* Switcher panel (slides in from the inline-end) */
.switcher { position: fixed; top: 0; inset-inline-end: -360px; width: 330px; max-width: 90vw; height: 100vh; background: var(--panel); border-inline-start: 1px solid var(--line); box-shadow: -8px 0 40px rgba(20,30,50,.18); z-index: 1200; transition: inset-inline-end .28s ease; overflow-y: auto; }
.switcher.open { inset-inline-end: 0; }
.switcher-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; }
.switcher-head h3 { font-size: 16px; font-weight: 700; color: var(--text); }
.switcher-head .x { cursor: pointer; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 8px; color: var(--muted); font-size: 20px; border: none; background: none; }
.switcher-head .x:hover { background: var(--panel-2); color: var(--text); }
.switcher-sec { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.switcher-sec h4 { font-size: 12px; font-weight: 700; color: var(--text); margin-bottom: 12px; text-transform: uppercase; letter-spacing: .5px; }
.sw-row { display: flex; flex-wrap: wrap; gap: 10px; }
.sw-opt { cursor: pointer; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--text); border-radius: 8px; padding: 8px 14px; font-size: 13px; font-weight: 600; }
.sw-opt:hover { border-color: var(--accent); }
.sw-opt.sel { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.sw-color { width: 34px; height: 34px; border-radius: 50%; cursor: pointer; border: 2px solid var(--panel); box-shadow: 0 0 0 1px var(--line-strong); }
.sw-color.sel { box-shadow: 0 0 0 2px var(--accent); }
.sw-overlay { position: fixed; inset: 0; background: rgba(20,30,50,.4); opacity: 0; visibility: hidden; transition: opacity .28s, visibility .28s; z-index: 1199; cursor: pointer; }
.sw-overlay.open { opacity: 1; visibility: visible; }

/* ============================================================
   CONSOLE HOME — "mission control" (hero + KPIs + tool cards)
   ============================================================ */
.hero {
  display: flex; align-items: center; justify-content: space-between; gap: 22px;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(255,255,255,.16), transparent 55%),
    linear-gradient(120deg, var(--accent) 0%, rgba(var(--accent-rgb), 0.86) 100%);
  color: #fff; border-radius: var(--radius); padding: 28px 32px;
  box-shadow: 0 10px 30px rgba(var(--accent-rgb), 0.28); margin-bottom: 22px; position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; inset-inline-start: -40px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero-text { position: relative; z-index: 1; }
.hero-text h1 { font-size: 25px; font-weight: 800; letter-spacing: -0.02em; line-height: var(--lh-tight); margin-bottom: 8px; }
.hero-text p { font-size: 14.5px; opacity: .94; max-width: 560px; line-height: 1.55; }
.hero-actions { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; }
.hero-badge { position: relative; z-index: 1; display: inline-flex; align-items: center; gap: 8px; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.hero-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: #41e0a3; box-shadow: 0 0 0 4px rgba(65,224,163,.25); }

.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
.kpi { display: flex; align-items: center; gap: 14px; }
.kpi-ico { width: 46px; height: 46px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.kpi-ico svg { width: 22px; height: 22px; }
.kpi .label { font-size: 11px; }
.kpi .value { font-size: 24px; margin-top: 2px; }

/* tool cards: module-card + leading icon */
.module-card .m-ico { width: 44px; height: 44px; border-radius: 11px; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; margin-bottom: 14px; transition: background .15s; }
.module-card .m-ico svg { width: 23px; height: 23px; }
.module-card:hover:not(.disabled) .m-ico { background: var(--accent); color: #fff; }

@media (max-width: 992px) { .grid.cols-4 { grid-template-columns: repeat(2, 1fr); } .hero { flex-direction: column; align-items: flex-start; } }
@media (max-width: 760px) { .grid.cols-4 { grid-template-columns: 1fr; } }

/* ===== תווית "סביבת פיתוח" (מוצגת רק כש-APP_ENV=dev) ===== */
.env-badge-dev {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: 6px;
  padding: 7px 16px;
  border-radius: 8px;
  background: repeating-linear-gradient(45deg, #f5b020, #f5b020 10px, #e09a00 10px, #e09a00 20px);
  color: #1a1200;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.4px;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(224, 154, 0, 0.4);
}
/* פס עליון כתום על כל הכותרת ב-dev — אי-אפשר לפספס באיזו סביבה אתה */
.appheader:has(.env-badge-dev) { border-top: 4px solid #e09a00; }
@media (max-width: 760px) {
  .env-badge-dev { font-size: 13px; padding: 5px 11px; }
}

/* ============================================================
   אישור-מחיקה דו-שלבי (CSP-safe, בלי JS) + הדפסה
   ============================================================ */
.confirm-del { display: inline-block; }
.confirm-del > summary {
  list-style: none; cursor: pointer; display: inline-block;
}
.confirm-del > summary::-webkit-details-marker { display: none; }
.confirm-del[open] > summary { opacity: 0.6; }
.confirm-del .confirm-del-go { margin-top: 8px; }

/* הדפסה: להסתיר את הכרום הקבוע כדי שדוחות יודפסו נקי (בלי סיידבר/כותרת חוזרים) */
@media print {
  .sidebar, .appheader, .help-fab, .hamburger, .nav-overlay, .theme-toggle { display: none !important; }
  .wrap { margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; }
  .card { box-shadow: none !important; border: 1px solid #ccc; }
}

/* מדריך-הפעלה (בונה-מיינקראפט): תמונות-מסך מסודרות בתוך הכרטיסים */
.mc-guide-step ul, .mc-guide-step ol { margin: 8px 22px 4px; line-height: 1.9; }
.mc-guide-step code { background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; font-family: "IBM Plex Mono", monospace; font-size: 13px; }
.mc-guide-img { display: block; width: 100%; max-width: 900px; margin: 14px auto 2px; border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: var(--shadow); }
.mc-guide-img--phone { max-width: 300px; }
.mc-guide-row { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.mc-guide-row .mc-guide-img { margin-inline: 0; }

/* ── התראות in-app (פעמון/פאנל/טוסט) + פס-התקדמות ─────────────────────────── */
.notif-bell {
  position: relative; background: none; border: 0; cursor: pointer;
  font-size: 18px; line-height: 1; padding: 6px; border-radius: var(--radius-sm);
  color: var(--text); margin-inline-end: 4px;
}
.notif-bell:hover { background: rgba(var(--accent-rgb), 0.10); }
.notif-bell:focus-visible { outline: none; box-shadow: var(--ring); }
.notif-dot {
  position: absolute; top: 3px; inset-inline-end: 3px; width: 9px; height: 9px;
  background: var(--danger); border-radius: 50%; border: 2px solid var(--header-bg);
}
.notif-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.28); z-index: 60; }
.notif-panel {
  position: fixed; top: calc(var(--header-h) + var(--ksbar-h) + 8px); inset-inline-end: 12px; z-index: 61;
  width: min(360px, calc(100vw - 24px)); max-height: 70vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.notif-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line); position: sticky; top: 0;
  background: var(--panel);
}
.notif-close { background: none; border: 0; cursor: pointer; font-size: 15px; color: var(--muted); }
.notif-close:hover { color: var(--text); }
.notif-hint { margin: 0; padding: 8px 14px; font-size: 12px; color: var(--muted); background: var(--warn-bg); }
.notif-list { padding: 6px; }
.notif-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 20px 0; }
.notif-item {
  display: block; text-decoration: none; color: var(--text);
  padding: 10px 12px; border-radius: var(--radius-sm); border-inline-start: 3px solid var(--line);
}
.notif-item:hover { background: rgba(var(--accent-rgb), 0.08); }
.notif-item.notif-ok { border-inline-start-color: var(--signal); }
.notif-item.notif-err { border-inline-start-color: var(--danger); }
.notif-item-title { display: block; font-weight: 700; font-size: 13.5px; }
.notif-item-detail { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif-item-mod { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }

.notif-toasts {
  position: fixed; bottom: 16px; inset-inline-start: 16px; z-index: 70;
  display: flex; flex-direction: column; gap: 10px; max-width: min(340px, calc(100vw - 32px));
}
.notif-toast {
  position: relative; background: var(--panel); border: 1px solid var(--line);
  border-inline-start: 4px solid var(--signal); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 12px 34px 12px 14px; cursor: pointer;
  animation: notif-in .2s ease-out;
}
.notif-toast.notif-err { border-inline-start-color: var(--danger); }
.notif-toast-title { display: block; font-weight: 700; font-size: 13.5px; color: var(--text); }
.notif-toast-detail { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.notif-toast-x {
  position: absolute; top: 6px; inset-inline-end: 8px; background: none; border: 0;
  cursor: pointer; color: var(--muted); font-size: 13px;
}
.notif-toast-out { animation: notif-out .25s ease-in forwards; }
@keyframes notif-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes notif-out { to { opacity: 0; transform: translateY(8px); } }

/* פס-התקדמות גנרי (progress.js) */
.job-bar { margin: 0 0 16px; }
.job-bar-track {
  height: 8px; background: rgba(var(--accent-rgb), 0.14); border-radius: var(--radius-pill);
  overflow: hidden;
}
.job-bar-fill { height: 100%; width: 0; background: var(--accent); transition: width .4s ease; }
.job-bar-indeterminate { width: 35% !important; animation: job-slide 1.1s ease-in-out infinite; }
@keyframes job-slide { 0% { margin-inline-start: -35%; } 100% { margin-inline-start: 100%; } }
.job-bar-text { display: inline-block; margin-top: 6px; font-size: 12.5px; color: var(--muted); }

/* ============================================================
   הוספות סוכן-עיצוב (מעל main 0.78.6): פוטר · גווני-מותג (data-primary)
   · צד/רקע/מיקום-תפריט · נקודות-רמזור ללשוניות-הגדרות · השלמות-swatch.
   ============================================================ */
.app-footer { margin-top: 44px; padding: 16px; text-align: center; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }

/* צבע-ראשי (override של המותג; ברירת-מחדל בלי data-primary = מותג-הלקוח ב-:root) */
html[data-primary="red"]    { --accent: #e6533c; --accent-rgb: 230, 83, 60;  --accent-soft: rgba(230,83,60,.12); }
html[data-primary="green"]  { --accent: #28a745; --accent-rgb: 40, 167, 69;  --accent-soft: rgba(40,167,69,.12); }
html[data-primary="violet"] { --accent: #a155e8; --accent-rgb: 161, 85, 232; --accent-soft: rgba(161,85,232,.12); }
html[data-primary="teal"]   { --accent: #4d96b3; --accent-rgb: 77, 150, 179; --accent-soft: rgba(77,150,179,.12); }
html[data-primary="navy"]   { --accent: #3b5bdb; --accent-rgb: 59, 91, 219;  --accent-soft: rgba(59,91,219,.12); }

/* צד-תפריט (ברירת-מחדל ימין ל-RTL; "שמאל" הופך סייד-בר/הדר/תוכן) */
html[data-side="left"] .sidebar   { left: 0; right: auto; border-left: none; border-right: 1px solid var(--side-line); }
html[data-side="left"] .appheader { right: 0; left: var(--sidebar-w); }
html[data-side="left"] .wrap      { margin-right: 0; margin-left: var(--sidebar-w); }
html[data-side="left"] .sidebar-nav { direction: ltr; }
html[data-menubg="gradient"] .sidebar { background-image: linear-gradient(160deg, var(--accent), var(--side-bg) 78%); }
html[data-menubg="image"] .sidebar { background-image: linear-gradient(180deg, rgba(var(--accent-rgb),.14), transparent 40%), radial-gradient(120% 60% at 100% 0, rgba(var(--accent-rgb),.10), transparent 60%); }
/* "נגלל": הסייד-בר זורם עם העמוד (לא fixed, בלי גלילה-פנימית משלו). body יחסי כדי
   שה-absolute יימדד מול גובה-המסמך המלא → הסייד-בר משתרע לכל-הגובה ויורד עם הגלילה. */
html[data-menupos="scrollable"] body { position: relative; }
html[data-menupos="scrollable"] .sidebar {
  position: absolute; height: auto; min-height: 100%; overflow: visible;
}

/* נקודות-רמזור פר-לשונית בעמוד-ההגדרות */
.tab-dot { font-size: 10px; line-height: 1; vertical-align: middle; margin-inline-start: auto; }
.tab-dot-full { color: #22c55e; }
.tab-dot-partial { color: #f59e0b; }
.tab-dot-none { color: #ef4444; }
.settings-nav button { display: flex; align-items: center; gap: 6px; }
.settings-nav-sep { margin-top: 14px; padding: 6px 14px 2px; font-size: 11px; font-weight: 700; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; border-top: 1px solid var(--line); }
@media (max-width: 760px) { .settings-nav-sep { border-top: none; border-inline-start: 1px solid var(--line); margin-top: 0; white-space: nowrap; align-self: center; } }
.sw-color { padding: 0; }
.sw-opt { font-family: inherit; }

@media (max-width: 900px) {
  html[data-side="left"] .sidebar { left: -300px; right: auto; transition: left .25s ease; box-shadow: 6px 0 24px rgba(20,30,50,.32); }
  html[data-side="left"] .navtoggle:checked ~ .sidebar { left: 0; right: auto; }
  html[data-side="left"] .appheader { left: 0; right: 0; }
  html[data-side="left"] .wrap { margin-left: 0; }
}

/* ── עמוד אפיוני-לקוח (/brief/admin): פירוט + מחולל-קישור בשפת-העיצוב ── */
.section-title .back-link { font-size: 13.5px; font-weight: 500; color: var(--accent);
  text-decoration: none; margin-inline-end: 14px; }
.section-title .back-link:hover { text-decoration: underline; }

.brief-detail { margin-bottom: 16px; }
.kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px 20px; margin: 0; }
.kv-grid .kv { display: flex; flex-direction: column; gap: 3px; }
.kv-grid dt { font-size: 12px; letter-spacing: var(--ls-label); text-transform: none;
  color: var(--muted); font-weight: 600; }
.kv-grid dd { margin: 0; font-size: 15px; color: var(--text); }

.brief-section { margin-bottom: 14px; }
.brief-section h3 { margin: 0 0 12px; }
.answer-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.answer-list li { display: flex; gap: 14px; align-items: baseline;
  padding: 9px 0; border-bottom: 1px solid var(--line); }
.answer-list li:last-child { border-bottom: none; }
.answer-list .answer-label { flex: 0 0 34%; max-width: 240px; color: var(--muted);
  font-size: 14px; }
.answer-list .answer-value { flex: 1; color: var(--text); font-size: 14.5px; word-break: break-word; }

.badge { display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; line-height: 1.6; }
.badge-yes { background: rgba(var(--success-rgb), .14); color: var(--signal); }
.badge-start { background: var(--accent-soft); color: var(--accent); }

.brief-gen h3 { margin-top: 0; }
.inline-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 12px; max-width: 560px; }
.inline-form select { flex: 1 1 220px; min-width: 200px; background: var(--panel-2);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 11px 13px; color: var(--text); font-size: 14px; font-family: inherit; }
.inline-form select:focus, .inline-form select:focus-visible { outline: none;
  border-color: var(--accent); box-shadow: var(--ring); }
.inline-form .btn { width: auto; flex: 0 0 auto; margin-top: 0; padding: 11px 22px; }
.link-out { margin-top: 14px; }
.link-out label { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.link-out input { width: 100%; font-family: var(--mono, monospace); font-size: 13px; }
.brief-public { margin-top: 14px; }
.brief-public code { background: var(--panel-2); padding: 2px 7px; border-radius: var(--radius-sm); }

.row-link { color: var(--accent); text-decoration: none; font-weight: 500; white-space: nowrap; }
.row-link:hover { text-decoration: underline; }

/* ============================================================
   בורר-מחזור בלוח-הבקרה שיווק (#cycle-select)
   select נייטיבי → תואם-שפת-העיצוב: appearance:none, border/רדיוס/רקע
   כמו שאר ה-inputs, חץ-SVG (data-URI, CSP-safe) בקצה-הפנימי (שמאל ב-RTL),
   גובה תואם ל-.btn-sm שלצדו. הכל דרך טוקנים; מצב-כהה נתמך.
   ============================================================ */
/* התווית יורשת display:block+margin-bottom גלובליים שהפילו אותה מהשורה —
   מיישרים אותה inline בתוך ה-form flex לצד הבורר והכפתור. */
label[for="cycle-select"] { display: inline-flex; align-items: center; margin-bottom: 0; white-space: nowrap; }

#cycle-select {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  background-color: var(--panel-2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.6 6 6.4 11 1.6' stroke='%23656a85' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 11px center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  padding-inline-end: 34px; /* מקום לחץ בקצה-הפנימי (שמאל ב-RTL) */
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  line-height: var(--lh-body);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
}
#cycle-select:hover { border-color: var(--accent); }
#cycle-select:focus,
#cycle-select:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); background-color: var(--panel); }
#cycle-select option { background: var(--panel); color: var(--text); }
/* חץ בהיר יותר על רקע כהה (data-URI לא יכול לרשת var) */
html.dark #cycle-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.6 6 6.4 11 1.6' stroke='%23949ab6' stroke-width='1.7' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
@media (max-width: 760px) {
  /* עקבי עם שאר השדות במובייל: רוחב-מלא, מגע-נעים 44px */
  #cycle-select { width: 100%; font-size: 16px; min-height: 44px; background-position: left 14px center; }
}

/* ============================================================
   מודול תקציבים (budgets) — קומפוננטות read-only + טופס-קלט.
   משתמש במשתני-העיצוב הקיימים כדי שמצב-כהה יעבוד לבד.
   ============================================================ */

/* פס-סטטוס (בקצב/מקדים/מפגר · חסכוני/ביעד/יקר) */
.spill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap; }
.spill .b { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.spill.good { color: var(--signal); background: rgba(var(--success-rgb), 0.14); }
.spill.warn { color: var(--warn); background: var(--warn-bg); }
.spill.bad  { color: var(--danger); background: rgba(var(--danger-rgb), 0.12); }
.spill.mut  { color: var(--muted); background: var(--panel-2); }

/* כרטיס שורת-תקציב */
.balloc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 18px; }
.balloc .bhead { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 14px; }
.balloc .bhead h3 { margin: 0; font-size: 17px; font-weight: 800; margin-inline-end: auto; }
.bkpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.bkpi { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; }
.bkpi .l { font-size: 11px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: var(--ls-label); }
.bkpi .v { font-size: 22px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.bkpi .s { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* מד-הוצאה (יצא מתוך תקציב) */
.bmeter { margin: 4px 0 14px; }
.bmeter .track { height: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-pill); overflow: hidden; }
.bmeter .fill { height: 100%; background: var(--accent); border-radius: var(--radius-pill); }
.bmeter .fill.over { background: var(--danger); }
.bmeter .cap { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 5px; font-variant-numeric: tabular-nums; }

/* שורת מטריקות-משנה */
.bmetrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.bmetric { font-size: 13px; }
.bmetric .l { color: var(--muted); font-size: 11.5px; }
.bmetric .v { font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }

/* קופסת-צפי */
.bfc { background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 13px 16px; }
.bfc .row { display: flex; flex-wrap: wrap; gap: 18px; }
.bfc .cell .l { font-size: 11.5px; color: var(--muted); }
.bfc .cell .v { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.bfc .note { margin-top: 8px; font-size: 12.5px; color: var(--text); line-height: 1.5; }
.bfc .note b { color: var(--accent); }

/* טופס-קלט תקציב (סוכנות) */
.bform { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-soft); padding: 16px 18px; }
.bform .grid-in { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.bform label { display: block; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 4px; }
.bform input { width: 100%; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); padding: 8px 11px;
  font-size: 14px; font-family: inherit; color: var(--text); background: var(--panel); }
.bform input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.bform .hint { font-size: 11.5px; color: var(--muted); font-weight: 400; }
.bactions { display: flex; gap: 8px; align-items: center; }
.btn-inline { display: inline-block; width: auto; margin: 0; padding: 9px 18px; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit; text-decoration: none; }
.btn-inline:hover { filter: brightness(1.07); }
.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--line-strong); }
.notice { background: rgba(var(--success-rgb), 0.12); border: 1px solid rgba(var(--success-rgb), 0.28); color: var(--signal);
  padding: 10px 14px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; margin-bottom: 16px; }

@media (max-width: 760px) {
  .bkpis { grid-template-columns: repeat(2, 1fr); }
  .bmetrics { grid-template-columns: repeat(2, 1fr); }
  .bform .grid-in { grid-template-columns: 1fr 1fr; }
}

/* ============================================================
   מודולי דוחות-לקוח (newsletters/content/updates) — קומפוננטות
   read-only. משתמשות במשתני-העיצוב הקיימים כדי שמצב-כהה יעבוד לבד.
   ============================================================ */

/* פס-סטטוס (בוצע / מתוזמן / באוויר) */
.spill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  padding: 3px 10px; border-radius: var(--radius-pill); white-space: nowrap; }
.spill .b { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.spill.done, .spill.live { color: var(--signal); background: rgba(var(--success-rgb), 0.14); }
.spill.sched { color: var(--warn); background: var(--warn-bg); }

/* גרף-עמודות אופקי (לידים/מאמרים לפי קורס) */
.hbars { display: flex; flex-direction: column; gap: 11px; }
.hbar { display: grid; grid-template-columns: 130px 1fr 48px; align-items: center; gap: 12px; }
.hbar .nm { font-size: 13.5px; font-weight: 600; color: var(--text); }
.hbar .track { height: 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-pill); overflow: hidden; }
.hbar .fill { height: 100%; background: var(--accent); border-radius: var(--radius-pill); }
.hbar .n { font-weight: 800; font-size: 14.5px; text-align: start; font-variant-numeric: tabular-nums; color: var(--text); }
.hbar.pending .nm { color: var(--muted); }
.hbar.pending .n { color: var(--warn); font-size: 11.5px; font-weight: 700; }
.catbar .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-inline-end: 8px; vertical-align: -1px; }

/* קטגוריות: תווית מעל הפס (שמות ארוכים לא נחתכים) */
.catrows { display: flex; flex-direction: column; gap: 13px; }
.catrow .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.catrow .cl { font-size: 13px; font-weight: 600; color: var(--text); }
.catrow .cl .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-inline-end: 8px; vertical-align: -1px; }
.catrow .cn { font-weight: 800; font-size: 14px; font-variant-numeric: tabular-nums; color: var(--text); }
.catrow .track { height: 9px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-pill); overflow: hidden; }
.catrow .fill { height: 100%; border-radius: var(--radius-pill); }

/* צינור-תוכן (pipeline) */
.pipe { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pstage { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: var(--panel-2); }
.pstage .n { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.pstage .s { font-size: 12.5px; font-weight: 700; margin-top: 1px; color: var(--text); }
.pstage .h { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.pstage.live { background: rgba(var(--success-rgb), 0.12); border-color: rgba(var(--success-rgb), 0.28); }
.pstage.live .n, .pstage.live .s { color: var(--signal); }

/* פיד "מה עשינו עבורכם" — קבוצות */
.wgroups { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.wgroup { border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 17px; background: var(--panel); box-shadow: var(--shadow-soft); }
.wgroup h3 { margin: 0 0 10px; font-size: 14.5px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.wgroup h3 .ico { font-size: 16px; }
.wlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.wlist li { position: relative; padding-inline-start: 20px; font-size: 13px; color: var(--text); line-height: 1.5; }
.wlist li::before { content: ""; position: absolute; inset-inline-start: 4px; top: 8px; width: 6px; height: 6px;
  border-radius: 50%; background: var(--accent); }

/* פתקית-הסבר רכה (אסטרטגיה) */
.softnote { background: var(--accent-soft); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px; font-size: 13.5px; color: var(--text); line-height: 1.55; }
.softnote b { color: var(--accent); }

/* מסך "עדכונים" — מסגרת תצוגה-מקדימה של המייל */
.mailframe { border: 1px solid var(--line-strong); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-lg); background: #f4f7f6; }
.mailbar { display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 11px 16px; background: var(--panel-2); border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.mailbar .subj { font-weight: 700; color: var(--text); }

@media (max-width: 760px) {
  .pipe { grid-template-columns: repeat(2, 1fr); }
  .wgroups { grid-template-columns: 1fr; }
  .hbar { grid-template-columns: 104px 1fr 42px; }
}

/* ── דפדוף-רשימות (pagination.js): בורר 20/50/100 + הקודם/הבא + "X–Y מתוך Z" ── */
.pager { display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 4px 2px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.pager-perwrap { display: inline-flex; align-items: center; gap: 6px; }
.pager-per { background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 5px 9px; color: var(--text); font-family: inherit;
  font-size: 13px; }
.pager-per:focus-visible { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.pager-info { color: var(--muted); }
.pager-nav { display: inline-flex; align-items: center; gap: 10px; margin-inline-start: auto; }
.pager-page { color: var(--muted); min-width: 8.5em; text-align: center; }
.pager-btn { background: var(--panel); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 6px 14px; font-size: 13px; font-weight: 600;
  color: var(--text); font-family: inherit; cursor: pointer; transition: background .15s, border-color .15s; }
.pager-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pager-btn:disabled { opacity: .45; cursor: default; }
.pager-btn:focus-visible { outline: none; box-shadow: var(--ring); }
/* ── מתג חשבון-האורח (killswitch) — RTL-safe, אדום=פתוח (הדלת פתוחה) ── */
.ks-box { margin-bottom: 22px; }
.ks-toggle { display: inline-flex; align-items: center; gap: 10px; background: transparent;
  border: none; cursor: pointer; padding: 4px 2px; font-family: inherit; font-size: 13px;
  font-weight: 700; color: var(--muted); }
.ks-toggle .ks-track { width: 46px; height: 26px; border-radius: var(--radius-pill);
  background: var(--line-strong); position: relative; transition: background .2s; flex: 0 0 auto; }
.ks-toggle .ks-knob { position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.35);
  transition: inset-inline-start .2s; }
.ks-toggle .ks-state { min-width: 3.5em; text-align: start; }
.ks-toggle.on { color: var(--danger); }
.ks-toggle.on .ks-track { background: var(--danger); }
.ks-toggle.on .ks-knob { inset-inline-start: 23px; }
.ks-toggle:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }
.ks-toggle:hover .ks-track { filter: brightness(1.07); }
/* מתג גישת-אורח קומפקטי בהדר: אריח קטן יותר שנכנס לשורת-ההדר, ליד תג-ה-DEV. */
.ks-head-form { display: inline-flex; margin: 0; }
.ks-toggle-head { gap: 7px; padding: 4px 8px; border-radius: var(--radius-pill); }
.ks-toggle-head .ks-head-label { font-size: 12px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.ks-toggle-head.on .ks-head-label { color: var(--danger); }
.ks-toggle-head .ks-track { width: 38px; height: 21px; }
.ks-toggle-head .ks-knob { width: 15px; height: 15px; top: 3px; }
.ks-toggle-head.on .ks-knob { inset-inline-start: 20px; }
.ks-toggle-head:hover { background: var(--panel-2); }
@media (max-width: 640px) { .ks-toggle-head .ks-head-label { display: none; } }
/* פס גישת-אורח עליון (base.html) — חיווי בכל עמוד. פתוח=פס אדום בולט (אזהרה
   שחשבון-אורח חי, לבקשת אור), סגור=פס דק מרוסן. #fff על משטח-האזהרה האדום (דפוס
   באנר-התראה, מקביל לחריג "#fff על משטח-מותג"). */
.ks-bar { position: fixed; top: 0; inset-inline: 0; height: var(--ksbar-h); z-index: 101;
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 0 16px; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; }
.ks-bar-on { background: var(--danger); color: #fff; }
.ks-bar-off { background: var(--panel-2); color: var(--muted); font-weight: 500;
  border-bottom: 1px solid var(--line); }
.ks-bar-btn { background: transparent; border: 1px solid currentColor; border-radius: var(--radius-pill);
  padding: 3px 15px; font-family: inherit; font-size: 12px; font-weight: 700; color: inherit;
  cursor: pointer; width: auto; transition: background .15s, color .15s; }
.ks-bar-on .ks-bar-btn:hover { background: #fff; color: var(--danger); }
.ks-bar-off .ks-bar-btn:hover { border-color: var(--accent); color: var(--accent); }
.ks-bar-btn:focus-visible { outline: none; box-shadow: var(--ring); }
/* ── מודעות מקובצות (pivot / adset): תמונה-ממוזערת, שם-רעיון, מתג-קיבוץ ── */
.ad-thumb { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.ad-thumb-ph { background: hsl(var(--h, 210) 55% 92%); color: hsl(var(--h, 210) 45% 38%);
  font-size: 13px; font-weight: 800; letter-spacing: -0.02em; border: 1px solid hsl(var(--h,210) 45% 85%); }
.ad-group-name { font-weight: 600; }
.seg-toggle { display: inline-flex; gap: 0; border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill); overflow: hidden; margin-bottom: 16px; background: var(--panel); }
.seg { padding: 8px 18px; font-size: 13.5px; font-weight: 600; color: var(--muted);
  text-decoration: none; transition: background .15s ease, color .15s ease; }
.seg + .seg { border-inline-start: 1px solid var(--line-strong); }
.seg:hover { color: var(--accent); }
.seg-on, .seg-on:hover { background: var(--accent); color: #fff; }
/* ── גלולת-שכבת-המרה (leads.html, עמודת "% המרה") — גלולה-רכה מתויגת במקום
   צבע-טקסט-בלבד: --tier-* עומד ב-AA (4.5:1) גם על הרקע-הרך וגם על הכרטיס,
   באור ובחושך (ראו --tier-good/--tier-warn/--tier-bad ב-:root וב-html.dark). ── */
.tier-pill { display: inline-block; padding: 2px 9px; border-radius: var(--radius-pill); font-weight: 700; }
.tier-good { color: var(--tier-good); background: rgba(var(--success-rgb), 0.14); }
.tier-warn { color: var(--tier-warn); background: var(--warn-bg); }
.tier-bad  { color: var(--tier-bad); background: rgba(var(--danger-rgb), 0.12); }

/* פאנל מוכנות-לייצור (/app/system, super-admin). ממצאים בגוונים-רכים (design-qa §3):
   ok=ירוק · warn=כתום · fail=אדום. נקודת-סטטוס + תג-סיכום. */
.pf-badge { display: inline-block; font-size: 12px; font-weight: 700; padding: 2px 10px;
  border-radius: var(--radius-pill); margin-inline-start: 6px; vertical-align: middle; }
.pf-badge.pf-ok   { background: rgba(var(--success-rgb), .14); color: var(--success); }
.pf-badge.pf-warn { background: rgba(var(--warn-rgb), .16); color: var(--warn); }
.pf-badge.pf-fail { background: rgba(var(--danger-rgb), .14); color: var(--danger); }
.pf-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pf-item { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; line-height: 1.6; }
.pf-dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; margin-top: 5px; }
.pf-item.pf-ok   .pf-dot { background: var(--success); }
.pf-item.pf-warn .pf-dot { background: var(--warn); }
.pf-item.pf-fail .pf-dot { background: var(--danger); }

/* מסך גרסאות-והטמעה: תצוגת-גרסאות + תיבת-ממתין מסודרות (design-qa: מספרים tabular). */
.ver-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 6px; }
.ver-item { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ver-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.ver-num { font-size: 22px; font-weight: 800; color: var(--text); font-variant-numeric: tabular-nums;
  direction: ltr; text-align: start; letter-spacing: .3px; }
.ver-hint { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .ver-grid { grid-template-columns: 1fr; } }

.pending-box { margin-top: 14px; padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(var(--warn-rgb), .10); border: 1px solid rgba(var(--warn-rgb), .30); }
.pending-head { font-size: 12px; font-weight: 700; color: var(--warn); text-transform: uppercase;
  letter-spacing: .4px; margin-bottom: 8px; }
.pending-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; padding: 3px 0; }
.pending-spin { flex: 0 0 auto; }
.pending-act { font-weight: 600; color: var(--text); }
.pending-by { color: var(--muted); font-size: 13px; margin-inline-start: auto; }
