/* Poket – מערכת עיצוב */
:root {
  --ink: #0f1f2e;
  --ink-2: #1c3144;
  --side: #0f1f2e;
  --side-hover: #1a3045;
  --bg: #f4f6f8;
  --card: #ffffff;
  --line: #e3e8ee;
  --line-2: #cfd7e0;
  --muted: #5f6f80;
  --text: #13202d;
  --accent: #0d8a7f;
  --accent-strong: #0b7268;
  --accent-tint: #e6f5f3;
  --blue: #2563eb; --blue-tint: #eaf1ff;
  --amber: #b45309; --amber-tint: #fff4e0;
  --green: #15803d; --green-tint: #e8f6ec;
  --red: #b91c1c; --red-tint: #fdecec;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(15 31 46 / .05), 0 6px 18px -10px rgb(15 31 46 / .18);
  --font: "Heebo", "Assistant", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.55 var(--font); color: var(--text); background: var(--bg); }
a { color: var(--accent-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; text-wrap: balance; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--ink); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 100; }
.skip:focus { inset-inline-start: 8px; }
.ic { width: 20px; height: 20px; flex: none; }

/* מבנה */
.shell { display: flex; min-height: 100vh; }
.side { width: 248px; flex: none; background: var(--side); color: #c9d4de; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px 16px; }
.brand strong { display: block; color: #fff; font-size: 19px; font-weight: 800; letter-spacing: .2px; }
.brand span { display: block; font-size: 12.5px; color: #8fa3b5; max-width: 160px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side nav ul { list-style: none; margin: 0; padding: 6px 10px; display: grid; gap: 2px; }
.side nav a, .side-link { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: #c9d4de; font-weight: 500; text-decoration: none; width: 100%; background: none; border: 0; font: inherit; cursor: pointer; text-align: start; }
.side nav a:hover, .side-link:hover { background: var(--side-hover); color: #fff; }
.side nav a.active { background: var(--accent); color: #fff; }
.side-foot { margin-top: auto; padding: 12px 10px 16px; border-top: 1px solid #22384c; }
.me { display: flex; align-items: center; gap: 10px; padding: 6px 8px 10px; }
.me strong { display: block; color: #fff; font-size: 14px; }
.me span { font-size: 12.5px; color: #8fa3b5; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #23415a; color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 14px 28px; background: rgb(244 246 248 / .92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.page-title { font-size: 21px; font-weight: 800; flex: 1; min-width: 0; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.menu-btn { display: none; }
.content { padding: 24px 28px 48px; display: grid; gap: 18px; align-content: start; max-width: 1400px; width: 100%; }
.impersonate { background: #fff7d6; border-bottom: 1px solid #f1d983; padding: 8px 28px; font-size: 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.impersonate form { display: inline; }

/* כפתורים */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 9px; font: 600 14.5px/1 var(--font); border: 1px solid transparent; cursor: pointer; text-decoration: none !important; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn .ic { width: 18px; height: 18px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-strong); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--line-2); }
.btn-secondary:hover { border-color: var(--muted); }
.btn-ghost { background: transparent; color: var(--accent-strong); }
.btn-ghost:hover { background: var(--accent-tint); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 13.5px; }
.btn-block { width: 100%; }
.icon-btn { width: 40px; height: 40px; border-radius: 9px; border: 1px solid var(--line-2); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--text); }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent-strong); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }

/* כרטיסים */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.narrow { max-width: 720px; }
.card.highlight { border-color: var(--accent); background: var(--accent-tint); }
.card-title { font-size: 16px; font-weight: 700; margin-bottom: 12px; }
.card-title.pad, .pad { padding: 16px 20px 0; }
.card.flush .card-title.pad { margin-bottom: 12px; }
fieldset.card { margin: 0; }
legend.card-title { float: inline-start; width: 100%; padding: 0; }
legend.card-title + * { clear: both; }
.stack { display: grid; gap: 14px; align-content: start; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr)); gap: 18px; align-items: start; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 14px; }

/* KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.kpi-label { font-size: 13px; color: var(--muted); font-weight: 500; }
.kpi-value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.kpi-sub { font-size: 12.5px; color: var(--muted); }
.small-kpis .kpi-value { font-size: 21px; }
.now-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.now-strip a { background: var(--ink); color: #fff; border-radius: var(--radius); padding: 14px 18px; display: flex; align-items: baseline; gap: 10px; text-decoration: none; }
.now-strip a:hover { background: var(--ink-2); }
.now-strip strong { font-size: 28px; font-variant-numeric: tabular-nums; }
.now-strip span { color: #b9c8d6; font-size: 14px; }
.now-strip a.alert { background: var(--red); }
.now-strip a.alert span { color: #fde2e2; }

/* טבלאות */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.table th { text-align: start; font-weight: 600; font-size: 13px; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table.compact td, .table.compact th { padding: 8px 12px; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #f7fafb; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 340px; }
.dim td { opacity: .55; }
.text-end { text-align: end; }
.strong { font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.text-red { color: var(--red); font-weight: 600; }
.pre { white-space: pre-wrap; }

/* תגים */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.badge-slate { background: #eef1f4; color: #475569; }
.badge-blue { background: var(--blue-tint); color: var(--blue); }
.badge-amber { background: var(--amber-tint); color: var(--amber); }
.badge-green { background: var(--green-tint); color: var(--green); }
.badge-red { background: var(--red-tint); color: var(--red); }
.badge-dark { background: var(--ink); color: #fff; }
.tag { display: inline-block; background: var(--accent-tint); color: var(--accent-strong); border-radius: 6px; padding: 1px 8px; font-size: 12.5px; margin-inline-end: 4px; }
.count { display: inline-block; min-width: 22px; padding: 0 6px; border-radius: 999px; background: #e7ecf1; font-size: 12px; text-align: center; font-variant-numeric: tabular-nums; }
.count-red { background: var(--red); color: #fff; }

/* טפסים */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 14px 16px; }
.span-2 { grid-column: span 2; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .field .label { font-size: 13.5px; font-weight: 600; }
.req { color: var(--red); }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=number], input[type=date], input[type=time], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--line-2); border-radius: 9px; background: #fff; font: inherit; color: var(--text);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(13 138 127 / .15); }
input[readonly] { background: #f3f5f7; color: var(--muted); }
.hint { margin: 0; font-size: 12.5px; color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; font-size: 14.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.check.disabled { opacity: .45; cursor: not-allowed; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(to top, var(--bg) 70%, transparent); padding: 14px 0 6px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; }
form.toolbar { justify-content: flex-start; }
.toolbar select { width: auto; min-width: 150px; }
.search { position: relative; flex: 1 1 260px; max-width: 420px; display: block; }
.search .ic { position: absolute; inset-inline-start: 11px; top: 11px; color: var(--muted); }
.search input { padding-inline-start: 38px; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }
.perm-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; margin-top: 10px; }
.perm-group { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; display: grid; gap: 8px; align-content: start; }
.perm-group h3 { font-size: 14px; color: var(--accent-strong); }
.inline { display: inline; }

/* חיפוש לקוח בקליטה */
.lookup { border: 1px solid var(--line-2); border-radius: 10px; margin-top: 10px; overflow: hidden; }
.lookup button { display: flex; width: 100%; justify-content: space-between; gap: 10px; padding: 10px 14px; border: 0; border-bottom: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; text-align: start; }
.lookup button:hover, .lookup button:focus { background: var(--accent-tint); }
.picked { margin: 10px 0 0; padding: 10px 14px; background: var(--accent-tint); border-radius: 10px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* לשוניות */
.tabs { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.tabs a { padding: 9px 14px; border-radius: 9px 9px 0 0; color: var(--muted); font-weight: 600; white-space: nowrap; text-decoration: none; border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--accent-strong); border-bottom-color: var(--accent); }
.seg { display: inline-flex; background: #e9edf1; border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: none; padding: 7px 13px; border-radius: 8px; font: 600 13.5px var(--font); color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--text); box-shadow: 0 1px 3px rgb(0 0 0 / .1); }
.range { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.range-custom { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13.5px; }
.range-custom label { display: flex; align-items: center; gap: 6px; }
.range-custom input { width: auto; min-height: 36px; padding: 5px 8px; }

/* הודעות */
.notice { padding: 11px 16px; border-radius: 10px; font-size: 14.5px; }
.notice ul { margin: 0; padding-inline-start: 18px; }
.notice-green { background: var(--green-tint); color: #14532d; border: 1px solid #bfe6cb; }
.notice-red { background: var(--red-tint); color: #7f1d1d; border: 1px solid #f6c7c7; }
.notice-amber { background: var(--amber-tint); color: #78350f; border: 1px solid #f7d9a6; margin: 12px 28px 0; }
.empty { background: #fff; border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 40px 20px; text-align: center; display: grid; gap: 10px; justify-items: center; }
.empty h2 { font-size: 18px; }
.empty p { margin: 0; color: var(--muted); }

/* פרטים */
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
.kv dt { color: var(--muted); font-size: 13.5px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.repair-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.ticket { display: block; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.timeline li { border-inline-start: 2px solid var(--line); padding-inline-start: 14px; }
.timeline p { margin: 6px 0 2px; }
.tl-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.tl-head time { font-size: 12.5px; color: var(--muted); }
.plain { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.tasks li { display: flex; gap: 10px; align-items: flex-start; }
.tick { width: 22px; height: 22px; border-radius: 6px; border: 2px solid var(--line-2); background: #fff; cursor: pointer; margin-top: 2px; }
.tick:hover { border-color: var(--accent); background: var(--accent-tint); }

/* משמרות */
.week-nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 8px; }
.day { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px; min-height: 140px; display: grid; gap: 6px; align-content: start; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-tint); }
.day h3 { font-size: 14px; display: flex; justify-content: space-between; }
.day h3 span { color: var(--muted); font-weight: 500; }
.shift { position: relative; background: #f1f5f9; border-radius: 8px; padding: 7px 9px; display: grid; font-size: 13px; }
.shift.mine { background: var(--accent-tint); outline: 1px solid var(--accent); }
.shift em { color: var(--muted); font-style: normal; font-size: 12px; }
.shift form { position: absolute; top: 2px; inset-inline-end: 4px; }
.shift .x { border: 0; background: none; color: var(--muted); font-size: 17px; cursor: pointer; line-height: 1; padding: 2px 4px; }
.shift .x:hover { color: var(--red); }
.review { display: flex; gap: 6px; flex-wrap: wrap; }
.review input { min-height: 32px; padding: 4px 8px; width: 150px; }

/* גרפים */
.chart { position: relative; height: 260px; }
.chart-sm { height: 230px; }

/* כניסה */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 500px at 80% -10%, #d5efec 0%, transparent 60%), var(--bg); }
.auth-card { width: min(440px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 30px 28px; box-shadow: 0 20px 50px -25px rgb(15 31 46 / .35); display: grid; gap: 16px; }
.auth-brand { display: flex; align-items: center; gap: 12px; }
.auth-brand strong { display: block; font-size: 22px; font-weight: 800; }
.auth-brand span { color: var(--muted); font-size: 13.5px; }
.auth-title { font-size: 20px; }

/* מובייל */
@media (max-width: 1100px) {
  .grid-main { grid-template-columns: 1fr; }
  .week { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 860px) {
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; z-index: 50; transform: translateX(100%); transition: transform .2s; box-shadow: -10px 0 30px rgb(0 0 0 / .25); }
  .side.open { transform: none; }
  .menu-btn { display: grid; }
  .topbar { padding: 10px 16px; }
  .page-title { font-size: 18px; }
  .content { padding: 16px 16px 40px; }
  .impersonate { padding: 8px 16px; }
  .notice-amber { margin: 10px 16px 0; }
  .now-strip { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .kv.two, .kv { grid-template-columns: 1fr; gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }
  .top-actions .btn { height: 36px; padding: 0 12px; font-size: 13.5px; }
  .search { max-width: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* גרפים (SVG) */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.chart-fig { margin: 0; }
.svg-chart { width: 100%; height: auto; display: block; direction: ltr; }
.svg-chart .grid { stroke: #e9eef2; stroke-width: 1; vector-effect: non-scaling-stroke; }
.svg-chart .base { stroke: #cfd7e0; stroke-width: 1; vector-effect: non-scaling-stroke; }
.svg-chart .axis { font: 11px var(--font); fill: var(--muted); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 8px 0 0; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 6px; vertical-align: -1px; }
.legend.vertical { flex-direction: column; margin: 0; }
.legend b { color: var(--text); font-variant-numeric: tabular-nums; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; flex: none; }
.donut-num { font: 800 24px var(--font); fill: var(--text); }
.donut-lbl { font: 12px var(--font); fill: var(--muted); }
.hbars { list-style: none; margin: 0; padding: 0; display: grid; gap: 9px; }
.hbars li { display: grid; grid-template-columns: minmax(90px, 34%) 1fr 34px; align-items: center; gap: 10px; font-size: 13.5px; }
.hb-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hb-track { height: 12px; background: #eef2f5; border-radius: 6px; overflow: hidden; }
.hb-bar { display: block; height: 100%; border-radius: 6px; }
.hb-val { font-variant-numeric: tabular-nums; font-weight: 600; text-align: end; }
.icon-btn.menu-btn { display: none; }
@media (max-width: 860px) { .icon-btn.menu-btn { display: grid; } }
dd[dir=ltr], td[dir=ltr] { text-align: right; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
[hidden] { display: none !important; }
.form-grid { align-items: start; }
fieldset.card > :not(legend) + :not(legend) { margin-top: 14px; }

/* מובייל: תפריט המבורגר, כרטיסים, כפתור פעולה */
.backdrop { position: fixed; inset: 0; background: rgb(15 31 46 / .45); z-index: 40; }
body.menu-open { overflow: hidden; }
.fab { display: none; }
@media (max-width: 860px) {
  .side { width: min(290px, 84vw); }
  .side nav a, .side-link { padding: 12px 14px; font-size: 16px; }
  .btn { height: 44px; }
  .btn-sm { height: 38px; }
  .menu-btn { width: 44px; height: 44px; }
  .fab { display: grid; place-items: center; position: fixed; inset-inline-start: 18px; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); width: 58px; height: 58px; border-radius: 50%; background: var(--accent); color: #fff; box-shadow: 0 10px 24px -8px rgb(13 138 127 / .6); z-index: 30; }
  .fab .ic { width: 28px; height: 28px; }
  .content { padding-bottom: 96px; }
  .top-actions { gap: 6px; }
  .toolbar select, .search { flex: 1 1 100%; max-width: none; min-width: 0; }
}
@media (max-width: 640px) {
  .table:not(.report) thead { display: none; }
  .table:not(.report), .table:not(.report) tbody, .table:not(.report) tr, .table:not(.report) td { display: block; width: 100%; }
  .table:not(.report) tr { padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .table:not(.report) td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: start; }
  .table:not(.report) td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; flex: none; }
  .table:not(.report) td:first-child { font-size: 16px; }
  .table:not(.report) td:empty { display: none; }
  .table:not(.report) td > div { text-align: end; }
  .clamp { max-width: 60vw; }
  .row-link:hover td { background: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-value { font-size: 22px; }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; }
  .seg { width: 100%; }
  .seg button { flex: 1; padding: 9px 6px; }
  .copy-row { flex-direction: column; }
  .tabs a { padding: 10px 12px; }
  .review input { width: 100%; }
}

/* טופס התקנה */
fieldset.inst { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px 16px; margin: 0; min-width: 0; }
fieldset.inst > legend { font-weight: 700; font-size: 15px; padding: 0 6px; }
