/* התצוגה החדשה (שלב 4). כל הכללים כאן חלים רק כש-<html data-ui="v2">, כלומר כשהשירות מופעל לתאגיד והמשתמש לא חזר לתצוגה הישנה.
   הרעיון: כותרת קבועה, תפריט צד מתקפל, ותוכן רגוע על רקע כהה-כחול. הצבעים מהלוגו: כחול #0FA4FD וטורקיז #02D1AE.
   העמודים הקיימים נשארים כמו שהם; כאן רק מחליפים להם את לוח הצבעים ומסירים את הקישוטים של העיצוב הקודם. */

/* ---- לוח הצבעים: אותם שמות משתנים שהעמודים כבר משתמשים בהם ---- */
html[data-ui="v2"] {
  --bg-void: #000717; --bg-mid: #030d22;
  --panel: #07162f; --panel-alt: #0c2040; --panel-dark: #020b1c; --input-bg: #020b1c; --header-bg: #030d22;
  --border-dim: #142b52; --border-bright: #27477c; --line: #142b52;
  --text-main: #e8e6ea; --text-sub: #a8b5cb; --text-muted: #8291ad;
  --cyan: #0fa4fd; --emerald: #02d1ae; --amber: #f2b13d; --crimson: #ff6166; --violet: #b991ff;
  --shadow-card: none;
  --v2-accent-ink: #00121f; --v2-scrim: rgba(0, 7, 23, 0.66); --v2-accent-2: var(--emerald);
  --font-ui: "Heebo", "Assistant", "Segoe UI", Arial, sans-serif;
}
html[data-ui="v2"][data-theme="light"] {
  --bg-void: #edf1f7; --bg-mid: #f8fafd;
  --panel: #ffffff; --panel-alt: #eef3fa; --panel-dark: #f7f9fc; --input-bg: #ffffff; --header-bg: #f8fafd;
  --border-dim: #d3dcea; --border-bright: #b3c2d8; --line: #d3dcea;
  --text-main: #0a1730; --text-sub: #3a4a65; --text-muted: #5d6d88;
  --cyan: #075a9c; --emerald: #005f52; --amber: #7d4b00; --crimson: #a50f28; --violet: #5a3fb8;
  --shadow-card: 0 1px 2px rgba(10, 23, 48, 0.06), 0 6px 18px rgba(10, 23, 48, 0.05);
  --v2-accent-ink: #ffffff; --v2-scrim: rgba(10, 23, 48, 0.42);
}

/* ---- מיתוג ללקוח: צבע מבטא מתוך לוח קבוע (src/branding.js). --cyan הוא צבע המבטא, ו---v2-accent-2 הצבע השני של הכפתור הראשי.
   הצבעים של המצבים (תקין, אזהרה, תקלה) לא משתנים. כל צבע נבדק לניגודיות בשתי התצוגות ב-test/branding.test.js ---- */
html[data-ui="v2"][data-accent="indigo"] { --cyan: #8fa8ff; --v2-accent-2: #6fd3ff; }
html[data-ui="v2"][data-accent="violet"] { --cyan: #b79cff; --v2-accent-2: #7cc4ff; }
html[data-ui="v2"][data-accent="magenta"] { --cyan: #f08be0; --v2-accent-2: #b79cff; }
html[data-ui="v2"][data-accent="graphite"] { --cyan: #c3cfe2; --v2-accent-2: #8fa3c2; }
html[data-ui="v2"][data-theme="light"][data-accent="indigo"] { --cyan: #3447c4; --v2-accent-2: #0669b8; }
html[data-ui="v2"][data-theme="light"][data-accent="violet"] { --cyan: #6a39bd; --v2-accent-2: #2f62c4; }
html[data-ui="v2"][data-theme="light"][data-accent="magenta"] { --cyan: #a0278f; --v2-accent-2: #6a39bd; }
html[data-ui="v2"][data-theme="light"][data-accent="graphite"] { --cyan: #3d4c66; --v2-accent-2: #5a6b88; }
/* לוגו של לקוח: על רקע לבן קבוע, כדי שלוגו כהה או שקוף ייראה בשתי התצוגות */
.v2-brand.own img { height: 34px; max-width: 170px; object-fit: contain; padding: 3px 8px; border-radius: 8px; background: #fff; }
.v2-swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.v2-swatch { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border: 1px solid var(--border-bright); border-radius: 8px; cursor: pointer; }
.v2-swatch:has(input:checked) { border-color: var(--cyan); background: var(--panel-alt); }
.v2-sw { flex: none; width: 36px; height: 14px; border-radius: 7px; }
.v2-sw-sea { background: linear-gradient(90deg, #0fa4fd, #02d1ae); }
.v2-sw-indigo { background: linear-gradient(90deg, #8fa8ff, #6fd3ff); }
.v2-sw-violet { background: linear-gradient(90deg, #b79cff, #7cc4ff); }
.v2-sw-magenta { background: linear-gradient(90deg, #f08be0, #b79cff); }
.v2-sw-graphite { background: linear-gradient(90deg, #c3cfe2, #8fa3c2); }
.v2-logo-now { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-block: 8px; }
.v2-logo-now img { height: 48px; max-width: min(100%, 220px); object-fit: contain; padding: 4px 10px; border-radius: 8px; background: #fff; border: 1px solid var(--line); }

/* ---- בלי הקישוטים של העיצוב הקודם ---- */
html[data-ui="v2"] body { background: var(--bg-void); font-size: 14px; line-height: 1.5; }
html[data-ui="v2"] .tactical-grid, html[data-ui="v2"] .scanline { display: none; }
html[data-ui="v2"] .panel::before, html[data-ui="v2"] .panel::after { display: none; }
html[data-ui="v2"] .panel { border-radius: 12px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow-card); }
html[data-ui="v2"] h2::before { display: none; }
/* העמודים הקיימים בתוך התצוגה החדשה: כרטיסי המספרים שקטים כמו בלוח הבקרה, כותרות הטבלאות בגופן הרגיל ובלי אותיות מרווחות,
   ופס הגלילה בלי זוהר. ההתנהגות של העמודים לא משתנה */
html[data-ui="v2"] .cards { gap: 12px; }
html[data-ui="v2"] .card { min-height: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-card); transition: none; }
html[data-ui="v2"] .card:hover { transform: none; box-shadow: var(--shadow-card); }
html[data-ui="v2"] .card .n { font: 700 20px/1.2 var(--font-ui); font-variant-numeric: tabular-nums; text-shadow: none; color: var(--text-main); }
html[data-ui="v2"] .card .n.small { font-size: 16px; line-height: 1.4; }
html[data-ui="v2"] .card .l { font-size: 12px; }
html[data-ui="v2"] th { background: var(--panel-dark); color: var(--text-sub); font: 600 12.5px/1.3 var(--font-ui); letter-spacing: 0; }
html[data-ui="v2"] .badge, html[data-ui="v2"] .lbl, html[data-ui="v2"] label { letter-spacing: 0; }
html[data-ui="v2"] ::-webkit-scrollbar-thumb { background: var(--border-bright); box-shadow: none; }
html[data-ui="v2"] ::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
html[data-ui="v2"] .btn.primary { color: var(--v2-accent-ink); background: linear-gradient(90deg, var(--cyan), var(--v2-accent-2)); border-color: transparent; box-shadow: none; text-shadow: none; }
/* בתצוגה הבהירה יש לכפתור הראשי כלל משלו (site.css); כאן הוא מקבל את הצבע השני של המיתוג, כמו בכהה */
html[data-ui="v2"][data-theme="light"] .btn.primary { color: var(--v2-accent-ink); background: linear-gradient(90deg, var(--cyan), var(--v2-accent-2)); border-color: transparent; }

/* ---- השלד ---- */
.v2-app { min-height: 100vh; display: flex; flex-direction: column; color: var(--text-main); }
.v2-grow { flex: 1 1 auto; }
.v2-app .ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[dir="rtl"] .v2-app .ic.flip { transform: scaleX(-1); }

.v2-hdr {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40; display: flex; align-items: center; gap: 12px; min-height: 56px;
  padding-block: 8px; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px));
  background: var(--header-bg); border-bottom: 1px solid var(--line);
}
.v2-brand { display: inline-flex; align-items: center; flex: none; }
.v2-brand img { height: 30px; width: auto; }
.v2-cust { display: inline-flex; flex-direction: column; line-height: 1.2; padding-inline-start: 12px; border-inline-start: 1px solid var(--border-bright); min-width: 0; }
.v2-cust small { font-size: 11px; color: var(--text-muted); }
.v2-cust b { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-hdr .clock { color: var(--text-sub); font: 500 12.5px var(--font-ui); font-variant-numeric: tabular-nums; letter-spacing: 0; white-space: nowrap; }
.v2-user { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.v2-avatar { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--panel-alt); border: 1px solid var(--border-bright); font: 700 11px/1 var(--font-ui); font-style: normal; }
.v2-uname { display: inline-flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.v2-uname b { font-weight: 500; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-uname small { font-size: 11px; color: var(--text-muted); }
.v2-logout { display: inline-flex; align-items: center; gap: 6px; }
.v2-iconbtn { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--text-sub); cursor: pointer; }
.v2-iconbtn:hover { border-color: var(--cyan); color: var(--text-main); }
.v2-iconbtn.sm { width: 30px; height: 30px; }
.v2-navtog { display: none; }
.v2-lnk { min-height: 24px; padding: 0; border: 0; background: transparent; color: var(--cyan); font: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.v2-lnk:hover { color: var(--text-main); }

.v2-body { display: flex; align-items: stretch; flex: 1 1 auto; position: relative; }
.v2-side { flex: none; width: 250px; background: var(--header-bg); border-inline-end: 1px solid var(--line); }
.v2-side-in { position: sticky; top: calc(env(safe-area-inset-top, 0px) + 57px); max-height: calc(100vh - 57px); overflow-y: auto; padding: 10px 8px 18px; display: flex; flex-direction: column; gap: 2px; }
.v2-side-top { display: flex; align-items: center; gap: 8px; padding: 2px 6px 10px; margin-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--text-muted); }
.v2-ngh { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--text-main); font: 700 13px/1 var(--font-ui); text-align: start; cursor: pointer; }
.v2-ngh:hover { background: var(--panel); }
.v2-ngh .ic { color: var(--text-muted); }
.v2-ng.on > .v2-ngh .ic { color: var(--v2-accent-2); }
.v2-ngh span { flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.v2-ngh .gchev { width: 14px; height: 14px; transform: rotate(90deg); transition: transform 0.15s; }
.v2-ngh[aria-expanded="false"] .gchev { transform: none; }
[dir="rtl"] .v2-ngh[aria-expanded="false"] .gchev { transform: scaleX(-1); }
.v2-ng ul { display: flex; flex-direction: column; gap: 1px; margin: 0 0 6px; padding: 0; padding-inline-start: 17px; list-style: none; }
.v2-ng li { border-inline-start: 1px solid var(--line); padding-inline-start: 10px; }
.v2-ni { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 4px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--text-sub); font: 400 13px/1.25 var(--font-ui); text-align: start; cursor: pointer; }
.v2-ni:hover { background: var(--panel); color: var(--text-main); }
.v2-ni.cur { background: var(--panel-alt); color: var(--text-main); font-weight: 500; box-shadow: inset 0 0 0 1px var(--border-bright); }
.v2-app.navmin .v2-side { width: 62px; }
.v2-app.navmin .v2-side-top { flex-direction: column; padding-inline: 0; }
.v2-app.navmin .v2-side-top span, .v2-app.navmin .v2-ngh span, .v2-app.navmin .v2-ngh .gchev, .v2-app.navmin .v2-ng ul { display: none; }
.v2-app.navmin .v2-ngh { justify-content: center; padding: 0; }
.v2-scrim { display: none; }

/* בצד של סוף השורה נשאר מקום לכפתורי הנגישות והתצוגה הצפים, כדי שלא יכסו פעולה בסוף שורה */
.v2-main { flex: 1 1 auto; min-width: 0; padding: 20px 24px 96px; padding-inline-end: 84px; display: flex; flex-direction: column; gap: 16px; }
.v2-pagehead h1 { margin: 0; font: 700 22px/1.25 var(--font-ui); text-wrap: balance; }
.v2-lead { margin: 4px 0 0; max-width: 70ch; color: var(--text-sub); }
.v2-crumbs { display: flex; align-items: center; gap: 4px; margin-bottom: 2px; font-size: 12px; color: var(--text-muted); }
.v2-crumbs .ic { width: 12px; height: 12px; }
.v2-page { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.v2-whatsnew { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--cyan) 38%, transparent); border-radius: 10px; background: color-mix(in srgb, var(--cyan) 9%, transparent); font-size: 13px; }
.v2-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--text-muted); }

/* ---- לוח הבקרה ---- */
.v2-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.v2-kpi { display: flex; flex-direction: column; gap: 4px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); box-shadow: var(--shadow-card); }
.v2-kpi .k { font-size: 12px; color: var(--text-sub); }
.v2-kpi .v { font: 700 20px/1.2 var(--font-ui); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.v2-kpi .d { font-size: 12px; color: var(--text-muted); min-height: 1.5em; }
.v2-kpi.ok .v { color: var(--emerald); }
.v2-kpi.warn .v { color: var(--amber); }
.v2-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.v2-steps li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-dark); }
.v2-step-mark { display: inline-grid; place-items: center; flex: none; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--border-bright); color: var(--emerald); }
.v2-steps li.ok .v2-step-mark { border-color: var(--emerald); }
.v2-step-text { display: flex; flex-direction: column; flex: 1 1 220px; min-width: 0; }
.v2-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; align-items: start; }
/* מצב השירותים: הסימן שונה גם בצורה ולא רק בצבע — עיגול (תקין), מעוין (תשומת לב), ריבוע (לא עובד), טבעת ריקה (לא בשימוש) */
.v2-svc { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 8px; }
.v2-svc-item { display: flex; align-items: flex-start; gap: 10px; min-width: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-dark); }
.v2-svc-dot { flex: none; box-sizing: border-box; width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; border: 2px solid var(--text-muted); }
.v2-svc-item.s-ok .v2-svc-dot { border-color: var(--emerald); background: var(--emerald); }
.v2-svc-item.s-warn .v2-svc-dot { border-color: var(--amber); background: var(--amber); border-radius: 1px; transform: rotate(45deg); }
.v2-svc-item.s-crit .v2-svc-dot { border-color: var(--crimson); background: var(--crimson); border-radius: 1px; }
.v2-svc-item.s-crit { border-color: rgba(255, 23, 68, 0.55); }
.v2-svc-item.s-off .v2-svc-text b { color: var(--text-sub); }
.v2-svc-text { display: flex; flex-direction: column; min-width: 0; overflow-wrap: anywhere; }
/* טקסט לקורא מסך בלבד */
.v2-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---- מסך צר: התפריט נפתח כמגירה ---- */
@media (max-width: 900px) {
  .v2-navtog { display: inline-grid; }
  .v2-side { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; width: min(290px, 86vw); transform: translateX(100%); transition: transform 0.18s; }
  [dir="ltr"] .v2-side { transform: translateX(-100%); }
  .v2-app.drawer .v2-side { transform: none; }
  .v2-side-in { top: 0; max-height: 100vh; padding-top: calc(10px + env(safe-area-inset-top, 0px)); }
  .v2-app.drawer .v2-scrim { display: block; position: fixed; inset: 0; z-index: 45; border: 0; background: var(--v2-scrim); }
  .v2-app.navmin .v2-side { width: min(290px, 86vw); }
  .v2-app.navmin .v2-side-top span, .v2-app.navmin .v2-ngh span, .v2-app.navmin .v2-ngh .gchev { display: revert; }
  .v2-app.navmin .v2-ng ul:not([hidden]) { display: flex; }
  .v2-app.navmin .v2-ngh { justify-content: flex-start; padding: 0 8px; }
  .v2-main { padding: 16px 16px 120px; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
  .v2-hdr .clock, .v2-uname { display: none; }
}
@media (max-width: 560px) {
  .v2-cust, .v2-user { display: none; }
  .v2-hdr { gap: 8px; }
  .v2-hdr .chips { flex-wrap: nowrap; gap: 4px; }
  .v2-hdr .chip { padding: 4px 8px; font-size: 12px; white-space: nowrap; }
  .v2-logout span { display: none; }
  .v2-brand img { height: 24px; }
}
@media (prefers-reduced-motion: reduce) { .v2-side, .v2-ngh .gchev { transition: none; } }

/* ---------- מסוף מנהל המערכת (שלב 5): שורת תפריטים למעלה, בלי תפריט צד ---------- */
.v2-atabs { display: flex; flex-wrap: wrap; gap: 4px 2px; padding-block: 8px 0; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); background: var(--header-bg); border-bottom: 1px solid var(--line); }
.v2-atab { min-height: 40px; padding: 8px 14px; border: 0; border-bottom: 3px solid transparent; border-radius: 8px 8px 0 0; background: transparent; color: var(--text-sub); font: 600 13.5px/1.2 var(--font-ui); cursor: pointer; }
.v2-atab:hover { color: var(--text-main); background: var(--panel-alt); }
.v2-atab.cur { color: var(--text-main); border-bottom-color: var(--cyan); background: var(--panel); }
.v2-admin-main { padding-inline-end: 24px; }
@media (max-width: 640px) { .v2-admin-main { padding-inline: 16px; } .v2-atab { padding-inline: 10px; } }
/* שירותים מנוהלים: במסך צר הטבלה נגללת לצדדים, והשם וההסבר לא נשברים לאות בשורה */
td.svc-name { min-width: 15rem; }
td.svc-note { min-width: 9rem; }

/* פס הזיהוי בראש לשונית לקוח של מנהל המערכת. הצבע קבוע לכל לקוח והוא תוספת בלבד: שם הלקוח כתוב תמיד */
.viewas { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding-block: 8px; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); border-bottom: 4px solid var(--amber); background: var(--panel-alt); color: var(--text-main); font-size: 13.5px; }
.viewas[data-c="1"] { border-bottom-color: var(--cyan); }
.viewas[data-c="2"] { border-bottom-color: var(--emerald); }
.viewas[data-c="3"] { border-bottom-color: var(--pink); }
.viewas[data-c="4"] { border-bottom-color: var(--violet); }
.viewas .v2-grow { flex: 1 1 auto; }

/* הודעה ממפעיל המערכת בראש המסך (בשתי התצוגות): הטקסט, וכפתור סגירה */
.alert.msg { display: flex; align-items: flex-start; gap: 10px; }
.alert.msg .msg-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.alert.msg .ic { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
