/* חמ״ל — לוח שליטה. סיכום קודם, פירוט אחר כך. מצב מוצג בצורה (תגית, פס) ולא רק במספר. */
body.hq { min-height: 100%; }
body.hq::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bar); }
.wrap { max-width: 1380px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }

.bar { background: var(--bar); color: var(--on-bar); position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; }
.bar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand svg { width: 34px; height: 34px; flex: none; }
.brand b { font-family: var(--font-display); font-weight: 900; font-size: 24px; line-height: 1; }
.brand span { display: block; font-size: 12px; color: var(--on-bar-muted); }
.nav { display: flex; gap: 2px; flex: 1; overflow-x: auto; scrollbar-width: none; min-width: 0; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: var(--on-bar-muted); text-decoration: none; padding: 9px 13px; border-radius: 10px; font-size: 14px; font-weight: 600; white-space: nowrap; min-height: 40px; display: flex; align-items: center; gap: 6px; }
.nav a:hover { color: var(--on-bar); }
.nav a[aria-current="page"] { background: var(--bar-2); color: var(--on-bar); }
.nav .count { background: var(--red); color: #fff; border-radius: 9px; font-size: 11px; padding: 0 6px; font-weight: 800; }
.bar-meta { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--on-bar-muted); white-space: nowrap; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coin); display: inline-block; animation: blink 2s infinite; }
@keyframes blink { 50% { opacity: .3; } }

.page { padding-block: 22px 60px; display: flex; flex-direction: column; gap: 18px; }
.page-head { text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.page-head h1 { font-family: var(--font-display); font-weight: 900; font-size: clamp(26px, 4vw, 34px); }
.page-head p { margin: 0; color: var(--muted); max-width: 640px; }

.panel { background: var(--surface); border-radius: var(--r-lg); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; border: 1px solid var(--line); }
.panel-title { text-align: center; font-size: 17px; font-weight: 800; }
.panel-sub { text-align: center; font-size: 13px; color: var(--muted); margin-top: -8px; }

/* מרכז החמ״ל */
.summit { background: var(--bar); color: var(--on-bar); border-radius: 22px; padding: 26px 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; position: relative; overflow: hidden; }
.summit small { color: var(--on-bar-muted); font-size: 14px; }
.summit .money { font-family: var(--font-display); font-weight: 900; font-size: clamp(46px, 8vw, 78px); line-height: 1; letter-spacing: -1px; }
.summit .track { width: min(640px, 100%); height: 12px; }
.summit .meta { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; font-size: 14px; color: var(--on-bar-muted); }
.summit .meta b { color: var(--on-bar); font-variant-numeric: tabular-nums; }
.proj { font-weight: 700; padding: 4px 12px; border-radius: 999px; font-size: 13px; }
.proj.ok { background: #1F4D38; color: #BFF0D6; }
.proj.low { background: #5B3A0C; color: #FFE2B0; }
.goal-tick { position: relative; }

.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; text-align: center; border: 1px solid var(--line); }
.kpi span { font-size: 13px; color: var(--muted); }
.kpi b { font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpi em { font-style: normal; font-size: 12px; color: var(--muted); }

.cols { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; }
.col-main { flex: 999 1 620px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.col-side { flex: 1 1 340px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }

/* טבלאות */
.tbl-box { overflow-x: auto; margin-inline: -4px; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.tbl th { text-align: right; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl .money, .tbl .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl b { font-weight: 700; }
.mini-track { display: flex; align-items: center; gap: 8px; min-width: 130px; }
.mini-track .track { flex: 1; height: 6px; }
.mini-track span { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.goal-line { position: relative; }

/* התראות */
.alerts { display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); font-size: 14px; }
.alert .sev { width: 4px; align-self: stretch; border-radius: 2px; flex: none; }
.alert.high .sev { background: var(--red); }
.alert.med .sev { background: var(--coin); }
.alert.low .sev { background: var(--blue); }
.alert .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.alert .t b { font-weight: 700; }
.alert .t span { color: var(--muted); font-size: 13px; }
.alert .acts { display: flex; flex-wrap: wrap; gap: 6px; }

.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.feed-row:first-child { border-top: 0; }
.feed-row .t { display: flex; flex-direction: column; min-width: 0; }
.feed-row .t b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-row .t span { font-size: 12px; color: var(--muted); }
.feed-row .amt { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.feed-row.new { animation: flash 1.6s ease; }
@keyframes flash { from { background: var(--gold-soft); } to { background: transparent; } }

/* גרפים */
.chart svg { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .area { fill: var(--gold-soft); }
.chart .line { fill: none; stroke: var(--gold-text); stroke-width: 2.5; }
.chart .goal { stroke: var(--muted); stroke-dasharray: 5 5; stroke-width: 1.5; }
.chart .proj-line { stroke: var(--gold-text); stroke-dasharray: 3 5; stroke-width: 2; fill: none; opacity: .7; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--font-body); }
.chart .end { fill: var(--gold-text); }
.bars { display: flex; flex-direction: column; gap: 10px; }
.barrow { display: grid; grid-template-columns: 110px 1fr auto; gap: 10px; align-items: center; font-size: 14px; }
.barrow .track { height: 10px; }
.barrow b { font-variant-numeric: tabular-nums; }

/* מגירה */
.drawer-back { position: fixed; inset: 0; background: rgba(9, 15, 21, .5); z-index: 40; }
.drawer { position: fixed; top: 0; bottom: 0; inset-inline-start: 0; width: min(520px, 100%); background: var(--ground); z-index: 41; overflow-y: auto; display: flex; flex-direction: column; animation: slide .2s ease; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head { background: var(--bar); color: var(--on-bar); padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; text-align: center; position: relative; }
.drawer-head h2 { font-family: var(--font-display); font-size: 26px; }
.drawer-head span { color: var(--on-bar-muted); font-size: 13px; }
.drawer-close { position: absolute; top: 10px; inset-inline-end: 10px; background: var(--bar-2); color: var(--on-bar); border: 0; border-radius: 10px; min-height: 40px; padding: 0 12px; font-weight: 600; }
.drawer-body { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

/* טפסים וסינון */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; }
.toolbar .input, .toolbar .select { width: auto; min-width: 140px; flex: 1 1 160px; max-width: 260px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.chip { min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: 13px; font-weight: 600; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.pager { display: flex; justify-content: center; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.ack-track { display: flex; gap: 3px; }
.ack-track i { width: 14px; height: 6px; border-radius: 3px; background: var(--surface-2); border: 1px solid var(--line); }
.ack-track i.on { background: var(--green); border-color: var(--green); }

.ins { display: flex; gap: 12px; padding: 14px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); }
.ins .sev { width: 5px; border-radius: 3px; flex: none; }
.ins.high .sev { background: var(--red); }
.ins.med .sev { background: var(--coin); }
.ins.low .sev { background: var(--blue); }
.ins .t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ins h3 { font-size: 16px; font-weight: 800; }
.ins p { margin: 0; color: var(--muted); font-size: 14px; }
.src { font-size: 12px; color: var(--muted); text-align: center; }

.login-box { max-width: 420px; margin: 8vh auto 0; display: flex; flex-direction: column; gap: 16px; text-align: center; }
.login-box .brand { justify-content: center; color: var(--ink); }
.login-box .brand span { color: var(--muted); }
.login-box .brand b { font-size: 34px; }
.preview { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-md); }
.preview table { min-width: 560px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
@media (max-width: 520px) {
  .barrow { grid-template-columns: 84px 1fr auto; }
  .summit { padding: 20px 14px; }
}

@media (max-width: 760px) {
  .nav { order: 3; flex-basis: 100%; }
  .bar-meta { margin-inline-start: auto; }
}

/* מפת סיירות */
.map-slot { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.hq-map { height: clamp(300px, 46vh, 480px); position: relative; }
.legend { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 16px; font-size: 12.5px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.legend i.ring { background: var(--surface); border: 2px solid var(--muted); width: 10px; height: 10px; }

/* מסך חי */
.mirror { display: flex; justify-content: center; }
.mirror-phone { width: min(320px, 100%); background: var(--bar); color: var(--on-bar); border-radius: 26px; padding: 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow); border: 3px solid var(--bar-2); }
.mirror-bar, .mirror-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--on-bar-muted); gap: 8px; }
.mirror-screen { background: var(--ground); color: var(--ink); border-radius: 16px; padding: 18px 14px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; min-height: 150px; justify-content: center; }
.mirror-view { font-size: 12px; font-weight: 800; color: var(--gold-text); background: var(--gold-soft); padding: 2px 10px; border-radius: 999px; }
.mirror-screen b { font-size: 17px; }
.mirror-amt { font-family: var(--font-display); font-weight: 900; font-size: 30px; }
.mirror-total { font-size: 13px; color: var(--muted); }
.diag { background: var(--surface-2); border-radius: var(--r-md); padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.diag > b { text-align: center; }
.diag > div { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.diag span { color: var(--muted); white-space: nowrap; }
.diag code { font-family: ui-monospace, Consolas, monospace; font-size: 12px; direction: ltr; text-align: left; overflow-wrap: anywhere; min-width: 0; }

/* תמונות */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.photo-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px; display: flex; flex-direction: column; gap: 4px; text-align: right; align-items: flex-start; font-size: 14px; }
.photo-card.fresh { border: 2px solid var(--ink); padding: 13px; }
.photo-card em { font-style: normal; color: var(--ink); }
.photo-card .muted { font-size: 12px; }
.photo-full { width: 100%; border-radius: var(--r-md); background: var(--surface-2); }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 8px; }
.opt-line { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--surface-2); font-size: 14px; cursor: pointer; }
.opt-line input { width: 20px; height: 20px; accent-color: var(--ink); flex: none; }
.ai-status { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; align-items: center; font-size: 14px; color: var(--muted); }
.ai-status b { color: var(--ink); font-variant-numeric: tabular-nums; }
