/* עיצוב חדש: סרגל צד כהה, מדורים מאוחדים עם לשוניות, כרטיסים רכים */
:root {
  --side: #141b2d; --side-ink: #aab4c8; --side-hover: #1f2940; --side-active: #2a3550;
  --top: #ffffff; --bg: #f5f6fa; --panel: #fff; --ink: #1b2233; --muted: #6c7489; --line: #e7e9f0;
  --brand: #4f46e5; --brand-dark: #4338ca; --accent: #0ea5a4; --ok: #16a34a; --warn: #ea8a0c; --bad: #e11d48; --violet: #7c6cf0;
  --radius: 14px; --shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 4px 14px rgba(16, 24, 40, .05);
}
body { font-family: "Rubik", "Segoe UI", Arial, sans-serif; }

/* פריסה: הסרגל לכל הגובה, הסרגל העליון רק מעל התוכן */
.shell { grid-template-columns: 216px 1fr; grid-template-rows: 60px 1fr; }
.shell.collapsed { grid-template-columns: 68px 1fr; }
.topbar { grid-column: 2; background: var(--top); border-bottom: 1px solid var(--line); padding: 0 22px; }
.topbar .room { min-width: 0; font-size: 15px; color: var(--ink); }
.topbar .burger { color: var(--muted); }
.topsearch input { border-radius: 999px; background: #f1f2f7; border-color: transparent; padding-inline: 16px; }
.topsearch input:focus { background: #fff; border-color: var(--brand); }
.badge-btn { color: var(--muted); }
.avatar { background: linear-gradient(135deg, var(--brand), var(--accent)); }

.side { grid-row: 1 / 3; background: var(--side); border: 0; padding: 0 10px 24px; }
.side .brand { display: flex; align-items: center; gap: 10px; height: 60px; padding: 0 8px; color: #fff; font-weight: 700; font-size: 15.5px; margin-bottom: 8px; border-bottom: 1px solid #222b40; }
.side .brand-mark { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--accent)); display: grid; place-items: center; font-size: 14px; flex: 0 0 30px; }
.side .item { padding: 10px 12px; border-radius: 10px; color: var(--side-ink); margin-bottom: 3px; font-size: 14.5px; position: relative; }
.side .item:hover { background: var(--side-hover); color: #fff; }
.side .item.on { background: var(--side-active); color: #fff; }
.side .item.on::before { content: ""; position: absolute; inset-inline-start: -10px; top: 9px; bottom: 9px; width: 4px; border-radius: 4px; background: var(--accent); }
.side .item .ico { font-size: 15px; opacity: .9; }
.side .item .cnt { background: var(--bad); border-radius: 999px; }
.side .support { border: 1px dashed #34405c; color: var(--side-ink); background: transparent; border-radius: 10px; font-weight: 500; display: flex; gap: 10px; justify-content: center; }
.side .support:hover { color: #fff; border-color: var(--accent); }
.shell.collapsed .side .brand .lbl { display: none; }

.main { padding: 0 26px 60px; }
.main > .page-title, .main > :not(.subnav):first-child { margin-top: 20px; }

/* לשוניות המדור */
.subnav { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; margin: 0 -26px 18px; padding: 10px 26px; background: rgba(245, 246, 250, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.subnav-sec { font-weight: 700; color: var(--ink); margin-inline-end: 12px; font-size: 15px; }
.subnav a { color: var(--muted); text-decoration: none; padding: 6px 14px; border-radius: 999px; font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; }
.subnav a:hover { background: #eceef6; color: var(--ink); }
.subnav a.on { background: var(--ink); color: #fff; }
.subnav .cnt { background: var(--bad); color: #fff; font-size: 11px; border-radius: 999px; padding: 0 6px; }
.subnav + .page-title { margin-top: 0; }

/* רכיבים */
.card { border-radius: var(--radius); border-color: var(--line); padding: 18px 20px; }
.btn { border-radius: 10px; border-color: #d9dcea; color: var(--ink); }
.btn:hover { background: #f3f4fa; border-color: #c9cde0; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.danger { border-color: #f6c3cf; color: var(--bad); }
.btn.ok { border-color: #bfe5cb; color: var(--ok); }
input, select, textarea { border-radius: 10px; border-color: #d9dcea; }
input:focus, select:focus, textarea:focus { box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.field .hint { border-inline-start-color: #dcdffa; }
.pill.blue { background: #eceafd; color: var(--brand); }

.tabs { border: 0; background: #eceef6; border-radius: 12px; padding: 3px; gap: 2px; }
.tabs button { border: 0 !important; background: transparent; color: var(--muted); border-radius: 9px; padding: 6px 16px; }
.tabs button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(16, 24, 40, .12); font-weight: 600; }

/* מדדים: כרטיס לבן עם עיגול סמל, בלי פסי צבע */
.kpi { display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--radius); }
.kpi .head { background: #eceafd !important; color: var(--brand); width: 46px; height: 46px; border-radius: 50%; font-size: 20px; }
.kpi.c2 .head { background: #dff5f4 !important; color: var(--accent); }
.kpi.c3 .head { background: #fdeee0 !important; color: var(--warn); }
.kpi.c4 .head { background: #e6f6ea !important; color: var(--ok); }
.kpi.c5 .head { background: #fde6ec !important; color: var(--bad); }
.kpi .body { justify-content: flex-start; gap: 22px; padding: 0; text-align: start; }
.kpi .v { font-size: 21px; }
.tile { border-radius: var(--radius); }
.tile .t { background: transparent !important; color: var(--ink); text-align: start; padding: 14px 16px 4px; font-size: 14.5px; position: relative; padding-inline-start: 30px; }
.tile .t::before { content: ""; position: absolute; inset-inline-start: 16px; top: 20px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.tile.navy .t::before { background: var(--accent); } .tile.violet .t::before { background: var(--violet); } .tile.sky .t::before { background: #38bdf8; } .tile.green .t::before { background: var(--ok); }
.tile .b { padding: 8px 16px 14px; }
.bars .bar { background: linear-gradient(180deg, var(--brand), #8b85f5); border-radius: 6px 6px 0 0; }

table { border-collapse: separate; border-spacing: 0; }
th { background: #f8f9fc !important; color: var(--muted); font-weight: 600; font-size: 12.5px; }
tr.sel td { background: #eef0ff !important; }

@media (max-width: 800px) {
  .main { padding: 0 14px 60px; }
  .subnav { margin: 0 -14px 14px; padding: 8px 14px; overflow-x: auto; flex-wrap: nowrap; }
  .subnav a { white-space: nowrap; }
}
@media (max-width: 860px) {
  .shell, .shell.collapsed { grid-template-columns: minmax(0, 1fr); }
  .topbar { overflow: hidden; }
  .topbar .room { display: none; }
  .topbar { grid-column: 1; }
  .side { inset-block: 60px 0; }
}
/* מצב כהה */
:root[data-theme=dark] {
  --side: #0d1220; --side-ink: #a3adc2; --side-hover: #19213a; --side-active: #222c48;
  --top: #141a2b; --bg: #0f1424; --panel: #161d30; --ink: #e6e9f2; --muted: #8f98ad; --line: #262f47;
  --brand: #7c74ff; --brand-dark: #6a61f5; --shadow: none; color-scheme: dark;
}
[data-theme=dark] .subnav { background: rgba(15, 20, 36, .92); }
[data-theme=dark] .subnav a:hover, [data-theme=dark] .tabs { background: #1d2540; }
[data-theme=dark] .subnav a.on, [data-theme=dark] .tabs button.on { background: var(--brand); color: #fff; }
[data-theme=dark] .topsearch input { background: #1b2238; }
[data-theme=dark] th { background: #1a2136 !important; }
[data-theme=dark] .kpi .head { background: #232b49 !important; }
[data-theme=dark] tr.sel td { background: #232b49 !important; }

/* טבלאות: חיפוש עגול, סינון מוסתר, כלים כסמלים, דפדוף קומפקטי */
.dt { border: 1px solid var(--line); overflow: hidden; }
.dt .bar-top { padding: 12px 14px; gap: 8px; border-bottom: 0; }
.dt-search { position: relative; display: inline-flex; align-items: center; }
.dt-search .ic { position: absolute; inset-inline-start: 12px; color: var(--muted); font-size: 16px; pointer-events: none; }
.dt-search input { width: 240px; border-radius: 999px; background: #f1f2f7; border-color: transparent; padding: 8px 14px; padding-inline-start: 34px; }
.dt-search input:focus { background: #fff; border-color: var(--brand); }
.tool-btn { border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 999px; padding: 7px 13px; display: inline-flex; gap: 6px; align-items: center; }
.tool-btn:hover { background: #f1f2f7; color: var(--ink); }
.tool-btn.on { background: #eceafd; color: var(--brand); }
.tool-btn .n:not(:empty) { background: var(--brand); color: #fff; border-radius: 999px; font-size: 11px; padding: 0 6px; }
.tool-group { display: inline-flex; background: #f1f2f7; border-radius: 10px; padding: 2px; }
.tool-group button { border: 0; background: transparent; width: 34px; height: 30px; border-radius: 8px; color: var(--muted); font-size: 15px; }
.tool-group button:hover { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(16,24,40,.1); }
.dt table { border-collapse: separate; border-spacing: 0; }
.dt th, .dt td { padding: 12px 14px; border-bottom: 1px solid #f0f1f6; }
.dt thead th { background: #fafbfd !important; color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .02em; border-bottom: 1px solid var(--line); }
.dt tr.filters th { background: #fff !important; top: 41px; padding: 8px 10px; }
.dt tr.filters input, .dt tr.filters select { border-radius: 8px; background: #f7f8fb; }
.dt tbody tr:hover td { background: #f8f8fe; }
.dt tbody tr:last-child td { border-bottom: 0; }
.dt td:first-child, .dt th:first-child { padding-inline-start: 18px; }
.dt .bar-bottom { border-top: 1px solid var(--line); padding: 10px 16px; gap: 10px; background: #fcfcfe; }
.dt .pg { display: inline-flex; align-items: center; gap: 8px; }
.pg-info { color: var(--muted); font-size: 13px; margin-inline-end: 6px; }
.pg-now { font-weight: 600; min-width: 46px; text-align: center; }
.pg-arrow { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line) !important; background: #fff !important; color: var(--ink) !important; display: grid; place-items: center; padding: 0 !important; }
.pg-arrow:disabled { opacity: .35; }
.pg-size { padding: 4px 8px; border-radius: 8px; margin-inline-start: 6px; }
.dt tfoot td { background: #f6f6fd; }
[data-theme=dark] .dt-search input, [data-theme=dark] .tool-group { background: #1d2540; }
[data-theme=dark] .dt thead th, [data-theme=dark] .dt .bar-bottom, [data-theme=dark] .dt tr.filters th, [data-theme=dark] .pg-arrow, [data-theme=dark] .dt tfoot td { background: var(--panel) !important; }
[data-theme=dark] .dt tbody tr:hover td { background: #1b2238; }
[data-theme=dark] .dt th, [data-theme=dark] .dt td { border-color: var(--line); }
@media (max-width: 860px) { .dt-search, .dt-search input { width: 100%; } .pg-info { display: none; } }

/* כפתורים רכים (מילוי עדין במקום מסגרת) */
.btn { border-color: transparent; background: #eef0f6; color: var(--ink); font-weight: 500; }
.btn:hover { background: #e3e6f0; border-color: transparent; }
.btn.danger { background: #fdecef; color: var(--bad); border-color: transparent; }
.btn.danger:hover { background: #fbdbe1; }
.btn.ok { background: #e7f6ec; color: var(--ok); border-color: transparent; }
.btn.primary { box-shadow: 0 2px 8px rgba(79, 70, 229, .25); }
[data-theme=dark] .btn { background: #1f2742; }
[data-theme=dark] .btn:hover { background: #283152; }
[data-theme=dark] .btn.danger { background: #3a1d29; }
[data-theme=dark] .btn.ok { background: #18322a; }

/* טפסים בכרטיסים: תווית והסבר מימין, השדה משמאל */
@media (min-width: 861px) {
  :is(.card.col, .card .col) > .field { display: grid; grid-template-columns: 250px minmax(0, 440px); column-gap: 28px; row-gap: 2px; align-items: start; padding: 12px 0; border-bottom: 1px solid #f0f1f6; max-width: none !important; }
  :is(.card.col, .card .col) > .field:last-child { border-bottom: 0; }
  :is(.card.col, .card .col) > .field > span { grid-column: 1; padding-top: 8px; }
  :is(.card.col, .card .col) > .field > :not(span):not(.hint) { grid-column: 2; grid-row: 1 / span 3; }
  :is(.card.col, .card .col) > .field > .hint { grid-column: 1; grid-row: 2; border: 0; padding: 0; }
  .card.col, .card .col { gap: 4px; }
}
.field > span { color: var(--ink); }
.field .hint { border-inline-start: 0; padding-inline-start: 0; }
[data-theme=dark] :is(.card.col, .card .col) > .field { border-color: var(--line); }
