/* מערכת המשימות – עיצוב בסיסי, RTL, מצב כהה, ללא תלות חיצונית */
:root {
  --ink: #1b2a4a;
  --ink-2: #243a66;
  --accent: #1f4fa3;
  --accent-hover: #183f84;
  --accent-soft: #e8eefb;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --border: #dde2ea;
  --border-strong: #c5ccd8;
  --text: #1d2433;
  --muted: #5d6678;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --danger-row: #fff5f4;
  --warn: #9a4b00;
  --warn-soft: #fff2df;
  --ok: #067647;
  --ok-soft: #e5f5ec;
  --info: #1f4fa3;
  --info-soft: #e8eefb;
  --violet: #5b3cc4;
  --violet-soft: #efeafd;
  --focus: #3b82f6;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --font: "Segoe UI", Arial, "Noto Sans Hebrew", "Arial Hebrew", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #0b1220;
    --ink-2: #16223b;
    --accent: #7ea6ff;
    --accent-hover: #a3c0ff;
    --accent-soft: #1b2944;
    --bg: #0f141d;
    --surface: #171d29;
    --surface-2: #1c2331;
    --border: #2a3344;
    --border-strong: #3a4558;
    --text: #e5e9f0;
    --muted: #9aa5b8;
    --danger: #ff8a80;
    --danger-soft: #3a1d1c;
    --danger-row: #2a1a1c;
    --warn: #ffc069;
    --warn-soft: #3a2a12;
    --ok: #6ad3a0;
    --ok-soft: #143326;
    --info: #8fb1ff;
    --info-soft: #1b2944;
    --violet: #b8a5ff;
    --violet-soft: #2a2347;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; font-weight: 700; color: var(--text); }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin-top: 1rem; }
p { margin: .4rem 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.num, .table td.num, .tabular { font-variant-numeric: tabular-nums; }
.small { font-size: .85rem; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.text-danger { color: var(--danger); }
.mt { margin-top: .75rem; }
.lead { font-size: 1.02rem; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: -999px; top: 0; background: var(--surface); padding: .5rem; z-index: 100; }
.skip-link:focus { inset-inline-start: .5rem; }
ul.plain, .list, .files, .dates, .candidates { list-style: none; padding: 0; margin: 0; }

/* ------------------------------------------------ topbar */
.topbar { background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 1px 0 rgba(255,255,255,.06); }
.topbar-inner { max-width: 1360px; margin: 0 auto; display: flex; align-items: center; gap: 1rem; padding: .45rem 1rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .55rem; color: #fff; font-weight: 700; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; background: #fff; color: #1b2a4a; font-weight: 800; }
.brand-mark.lg { width: 48px; height: 48px; font-size: 1.6rem; border-radius: 12px; background: var(--ink); color: #fff; }
.nav { display: flex; gap: .15rem; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #d6def0; padding: .45rem .7rem; border-radius: 8px; white-space: nowrap; font-size: .95rem; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.badge { display: inline-block; min-width: 1.35rem; padding: 0 .35rem; border-radius: 999px; background: #e5484d; color: #fff; font-size: .75rem; font-weight: 700; text-align: center; line-height: 1.35rem; font-variant-numeric: tabular-nums; }
.userbox { display: flex; align-items: center; gap: .6rem; white-space: nowrap; }
.who { color: #d6def0; font-size: .9rem; }
.on-dark { color: #fff !important; }

/* ------------------------------------------------ layout */
.container { max-width: 1360px; margin: 0 auto; padding: 1rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin: .25rem 0 1rem; }
.crumbs { margin: 0 0 .2rem; font-size: .85rem; color: var(--muted); }
.layout-2 { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; align-items: start; }
.col-main, .col-side { display: grid; gap: 1rem; min-width: 0; }
.section { margin: 1.5rem 0; }
.section > h2 { margin-bottom: .75rem; }
.narrow { max-width: 520px; margin: 2rem auto; }
.narrow-wide { max-width: 860px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 0; }
.section .card + .card { margin-top: .75rem; }
.card-title { font-size: 1.02rem; font-weight: 700; margin-bottom: .75rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: .75rem; flex-wrap: wrap; margin-bottom: .6rem; }
.card-head .card-title { margin: 0; }
.card-highlight { border-color: var(--violet); box-shadow: 0 0 0 3px var(--violet-soft); margin-bottom: 1rem; }

/* ------------------------------------------------ forms */
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; font-weight: 600; color: var(--muted); min-width: 0; }
label.check { flex-direction: row; align-items: center; gap: .45rem; font-weight: 500; color: var(--text); font-size: .92rem; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=date],
input[type=number], select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: .45rem .6rem;
  width: 100%; min-width: 0; min-height: 38px;
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: 2px solid var(--accent-soft); outline-offset: 0; }
input[type=checkbox] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); }
input[type=file] { font: inherit; font-weight: 400; color: var(--text); max-width: 100%; }
.hint { font-weight: 400; color: var(--muted); font-size: .78rem; }
.field { display: flex; flex-direction: column; gap: .25rem; min-width: 0; position: relative; }
.field-submit { justify-content: flex-end; flex-direction: row; align-items: flex-end; gap: .5rem; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .6rem .8rem; display: grid; gap: .5rem; }
.fieldset legend { font-weight: 700; font-size: .9rem; padding: 0 .3rem; }
.stack { display: grid; gap: .75rem; }
.grid { display: grid; gap: .75rem; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-qc { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr) auto; align-items: end; }
.grid-qc .span-2 { grid-column: span 1; }
.grid-cards { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline { display: inline; margin: 0; }
.inline-form { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; margin-top: .6rem; }
.inline-form .picker { flex: 1 1 260px; }
.w-sm { max-width: 8rem; }
.grow { flex: 1 1 260px; }

.fname { unicode-bidi: isolate; }
bdi[dir=ltr] { unicode-bidi: isolate; direction: ltr; }
.show-cards { display: none; }
/* פרטים מבחינים ללקוח (שם זהה): ת"ז, טלפון, עיר, סיוע משפטי, משימות פתוחות */
.facts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: .15rem .6rem; }
.facts > span:not(.pill) + span:not(.pill)::before, .facts > .pill + span:not(.pill)::before { content: "· "; color: var(--border-strong); }
.candidate .facts { display: flex; margin-bottom: .25rem; }
.matches, .dup-list { list-style: none; padding: 0; margin: .3rem 0 0; display: grid; gap: .2rem; }
.dup-list { padding-inline-start: .6rem; }
.group-summary { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .7rem; margin: 0 0 .2rem; }
.proposal-note { margin: .3rem 0 0; }
details.proposal-note > summary { font-weight: 400; list-style-position: inside; }
details.proposal-note[open] > summary { display: none; }
details.proposal-note > p { margin: 0; }
.filters { display: flex; flex-wrap: wrap; gap: .6rem .75rem; align-items: flex-end; margin-bottom: 1rem; padding: .75rem 1rem; }
.filters > label, .filters > .field { flex: 0 1 180px; }
.filters > label.grow { flex: 1 1 280px; }
.filters .picker { flex: 1 1 220px; }
.quick-create, .filters-box { margin-bottom: 1rem; }
details.card > summary.card-title { margin: 0; list-style-position: inside; }
details.card[open] > summary.card-title { margin-bottom: .6rem; }
.filters-box .filters { margin: 0; padding: 0; }

/* ------------------------------------------------ buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; font: inherit; font-weight: 600; font-size: .92rem;
  padding: .45rem .9rem; min-height: 38px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
@media (prefers-color-scheme: dark) { .btn-primary { color: #0b1220; } }
.btn-ok { color: var(--ok); border-color: var(--ok); }
.btn-ok:hover { background: var(--ok-soft); border-color: var(--ok); }
.btn-danger-outline { color: var(--danger); border-color: var(--danger); }
.btn-danger-outline:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { padding: .3rem .7rem; min-height: 32px; font-size: .85rem; }
.btn-xs { padding: .15rem .5rem; min-height: 26px; font-size: .78rem; font-weight: 600; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }
.btn-link:hover { text-decoration: underline; }

/* ------------------------------------------------ pills & chips */
.pills { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-top: .3rem; }
.pill { display: inline-flex; align-items: center; gap: .25rem; padding: .08rem .55rem; border-radius: 999px; font-size: .78rem; font-weight: 600;
  border: 1px solid transparent; white-space: nowrap; background: var(--surface-2); color: var(--muted); line-height: 1.5; }
.pill-muted { background: var(--surface-2); color: var(--muted); border-color: var(--border); }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-info { background: var(--info-soft); color: var(--info); }
.st-proposed { background: var(--violet-soft); color: var(--violet); }
.st-new { background: var(--info-soft); color: var(--info); }
.st-in_progress { background: #fff4cc; color: #7a5a00; }
.st-waiting { background: var(--warn-soft); color: var(--warn); }
.st-done { background: var(--ok-soft); color: var(--ok); }
.st-cancelled { background: var(--surface-2); color: var(--muted); text-decoration: line-through; }
@media (prefers-color-scheme: dark) { .st-in_progress { background: #3a3213; color: #f5d66b; } }
.pr-1 { background: var(--danger); color: #fff; }
.pr-2 { background: var(--warn-soft); color: var(--warn); }
.pr-3 { background: transparent; color: var(--muted); border-color: var(--border); }
.pr-4 { background: transparent; color: var(--muted); border-color: transparent; }
.an-done { background: var(--ok-soft); color: var(--ok); }
.an-pending { background: var(--info-soft); color: var(--info); }
.an-failed { background: var(--danger-soft); color: var(--danger); }
.an-skipped { background: var(--surface-2); color: var(--muted); }
.msg-sent { background: var(--ok-soft); color: var(--ok); }
.msg-draft { background: var(--violet-soft); color: var(--violet); }
.msg-failed { background: var(--danger-soft); color: var(--danger); }
.msg-approved { background: var(--info-soft); color: var(--info); }
.msg-cancelled { background: var(--surface-2); color: var(--muted); }
.src { font-size: .82rem; color: var(--muted); }
.src-whatsapp { color: #128c4a; }
@media (prefers-color-scheme: dark) { .src-whatsapp { color: #5fd38f; } }

.chips { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.chip { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .85rem; border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); color: var(--text); box-shadow: var(--shadow); font-weight: 600; font-size: .92rem; }
.chip:hover { border-color: var(--accent); text-decoration: none; }
.chip.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.chip-num { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--ink-2); }
@media (prefers-color-scheme: dark) { .chip-num { color: var(--text); } }
.chip-danger .chip-num { color: var(--danger); }
.chip-warn .chip-num { color: var(--warn); }
.chip-info .chip-num { color: var(--violet); }

/* ------------------------------------------------ alerts */
.alert { border-radius: var(--radius-sm); padding: .6rem .85rem; margin-bottom: .75rem; border: 1px solid transparent; }
.alert ul { margin: .3rem 0 0; padding-inline-start: 1.2rem; }
.alert-info { background: var(--info-soft); color: var(--info); }
.alert-success { background: var(--ok-soft); color: var(--ok); }
.alert-warning { background: var(--warn-soft); color: var(--warn); }
.alert-error { background: var(--danger-soft); color: var(--danger); border-color: var(--danger); }

/* ------------------------------------------------ tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: start; font-size: .78rem; font-weight: 700; color: var(--muted); background: var(--surface-2); padding: .55rem .6rem; border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; }
.table td { padding: .5rem .6rem; border-bottom: 1px solid var(--border); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table-compact td { padding: .35rem .55rem; }
.table .empty, .empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.title-cell { min-width: 220px; }
.task-link { font-weight: 600; color: var(--text); }
.task-link:hover { color: var(--accent); }
tr.overdue { background: var(--danger-row); }
tr.overdue td:first-child { box-shadow: inset -3px 0 0 var(--danger); }
tr.is-proposed td:first-child { box-shadow: inset -3px 0 0 var(--violet); }
tr.is-closed td, li.is-closed { color: var(--muted); }
tr.row-warn { background: var(--warn-soft); }
.due-overdue { color: var(--danger); font-weight: 700; }
.due-today { color: var(--warn); font-weight: 700; }
.row-actions { white-space: nowrap; }
.row-actions form + form { margin-inline-start: .25rem; }
tr.side-client td:first-child { box-shadow: inset -3px 0 0 var(--ok); }
tr.side-opposing td:first-child { box-shadow: inset -3px 0 0 var(--danger); }

/* ------------------------------------------------ lists, kv */
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: .35rem .9rem; margin: 0; font-size: .92rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-2 { margin-top: .75rem; }
.list > li { padding: .5rem 0; border-bottom: 1px solid var(--border); display: block; }
.list > li:last-child { border-bottom: 0; }
.files > li { padding: .4rem 0; border-bottom: 1px solid var(--border); }
.files > li:last-child { border-bottom: 0; margin-bottom: .6rem; }
.dates li { padding: .3rem 0; }
.pager { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 1rem 0; }

/* ------------------------------------------------ timeline */
.timeline { list-style: none; margin: 1rem 0 0; padding: 0; border-inline-start: 2px solid var(--border); }
.tl-item { position: relative; padding: .35rem 1rem .6rem; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: -6px; top: .75rem; width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.tl-comment::before { background: var(--accent); }
.tl-approved::before, .tl-created::before { background: var(--ok); }
.tl-rejected::before { background: var(--danger); }
.tl-status::before { background: var(--warn); }
.tl-viewed { opacity: .65; padding-top: .15rem; padding-bottom: .25rem; }
.tl-viewed::before { width: 6px; height: 6px; inset-inline-start: -4px; }
.tl-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; font-size: .88rem; }
.tl-kind { color: var(--muted); }
.tl-body { font-size: .92rem; margin-top: .15rem; overflow-wrap: anywhere; }
.tl-comment .tl-body p { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .7rem; margin: .25rem 0 0; }
.ch { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.ch-whatsapp { color: #128c4a; }
.ch-email { color: var(--info); }
.comment-form .actions { justify-content: flex-end; margin-top: .4rem; }

/* ------------------------------------------------ proposals, messages, candidates */
.proposal { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .65rem .8rem; margin-top: .6rem; background: var(--surface-2); }
.proposal-head { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
.proposal-title { font-weight: 700; color: var(--text); }
.proposal-form { margin-top: .45rem; }
.proposal-edit { margin-bottom: .5rem; }
.proposal-edit summary { cursor: pointer; color: var(--accent); font-size: .88rem; font-weight: 600; }
.proposal-edit[open] summary { margin-bottom: .5rem; }
.message { margin-bottom: .75rem; }
.message-head { display: flex; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .5rem; }
.message-head .pills { margin-top: 0; }
.message-body { white-space: pre-wrap; background: var(--surface-2); padding: .6rem; border-radius: var(--radius-sm); }
.message textarea { margin-bottom: .5rem; }
.candidate { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .5rem .7rem; margin-bottom: .5rem; }
.candidate-main { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; margin-bottom: .25rem; }
.score { font-weight: 800; padding: 0 .45rem; border-radius: 999px; }
.score-high { background: var(--ok-soft); color: var(--ok); }
.score-mid { background: var(--warn-soft); color: var(--warn); }
.score-low { background: var(--surface-2); color: var(--muted); }
.reasons { margin: 0 0 .4rem; padding-inline-start: 1.1rem; list-style: disc; }

/* ------------------------------------------------ picker (typeahead) */
.picker { position: relative; }
.picker-results { position: absolute; inset-inline: 0; top: 100%; z-index: 30; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); box-shadow: 0 8px 24px rgba(16,24,40,.16); list-style: none; margin: 2px 0 0; padding: .25rem; max-height: 280px; overflow-y: auto; }
.picker-results li { padding: .4rem .5rem; border-radius: 4px; cursor: pointer; display: flex; justify-content: space-between; gap: .5rem; font-size: .9rem; }
.picker-results li[aria-selected=true], .picker-results li:hover { background: var(--accent-soft); }
.picker-results li { flex-wrap: wrap; }
.picker-results .meta { color: var(--muted); font-size: .8rem; font-variant-numeric: tabular-nums; display: flex; flex-wrap: wrap; gap: 0 .5rem; }
.picker-results .meta > * + *::before { content: "· "; }
.picker-results .none { color: var(--muted); cursor: default; }

/* ------------------------------------------------ upload */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface-2); padding: 1.25rem; text-align: center; transition: border-color .15s, background .15s; }
.dropzone.dragover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone-label { align-items: center; gap: .4rem; color: var(--text); cursor: pointer; }
.dropzone-title { font-size: 1.05rem; font-weight: 700; }
.dropzone-list { list-style: none; padding: 0; margin: .6rem 0 0; text-align: start; }
.dropzone-list li { padding: .2rem 0; border-bottom: 1px solid var(--border); }

/* ------------------------------------------------ misc pages */
.page-login .container { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 100%; max-width: 400px; padding: 1.75rem; }
.login-brand { display: flex; gap: .85rem; align-items: center; margin-bottom: 1.25rem; }
.login-brand h1 { font-size: 1.25rem; margin: 0; }
@media (prefers-color-scheme: dark) { .brand-mark.lg { background: #2a3a66; } }
.error-card { text-align: center; }
.error-code { font-size: 3rem; font-weight: 800; color: var(--muted); margin: 0; }
pre.extracted { white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--font); font-size: .88rem; background: var(--surface-2); padding: .75rem; border-radius: var(--radius-sm); max-height: 520px; overflow-y: auto; }
details > summary { cursor: pointer; font-weight: 600; }
.dialog { border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; background: var(--surface); color: var(--text); max-width: min(420px, calc(100vw - 2rem)); box-shadow: 0 16px 40px rgba(0,0,0,.25); }
.dialog::backdrop { background: rgba(10, 16, 30, .45); }
.dialog .actions { justify-content: flex-start; margin-top: 1rem; }

/* ------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .grid-qc { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-qc .span-2 { grid-column: 1 / -1; }
  .hide-md { display: none; }
}
@media (max-width: 900px) {
  .layout-2 { grid-template-columns: minmax(0, 1fr); }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .container { padding: .75rem; }
  .topbar-inner { gap: .4rem; padding: .4rem .75rem; }
  .brand-text { display: none; }
  .nav { order: 3; flex-basis: 100%; }
  .userbox { margin-inline-start: auto; }
  .who { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
  .grid-2, .grid-3, .grid-4, .grid-qc { grid-template-columns: minmax(0, 1fr); }
  .span-2, .span-3 { grid-column: 1 / -1; }
  .filters > label, .filters > .field, .filters .picker { flex: 1 1 100%; }
  h1 { font-size: 1.3rem; }
  .chip { padding: .35rem .6rem; }
  .chip-num { font-size: 1.1rem; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: .1rem; }
  .kv dd { margin-bottom: .4rem; }
}

/* ------------------------------------------------ phones: nav wraps, task board as stacked cards */
@media (max-width: 640px) {
  /* כל הקישורים גלויים (שורה שנייה במקום גלילה נסתרת שחתכה את "לקוחות") */
  .nav { flex-wrap: wrap; overflow-x: visible; gap: .1rem; }
  .nav a { padding: .35rem .5rem; font-size: .9rem; }

  /* לוח המשימות: כל שורה הופכת לכרטיס, כך שאחראי/ת, יעד וסטטוס נראים בלי גלילה הצידה */
  .table-wrap:has(.tasks-table) { overflow-x: visible; }
  .tasks-table, .tasks-table tbody { display: block; width: 100%; }
  .tasks-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .tasks-table tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .9rem; padding: .65rem .75rem; border-bottom: 1px solid var(--border); }
  .tasks-table tbody tr:last-child { border-bottom: 0; }
  .tasks-table td { display: block; padding: 0; border: 0; min-width: 0; }
  .tasks-table td.hide-md { display: none; }
  .tasks-table td.id-cell { order: -2; }
  .tasks-table td.title-cell { order: -1; flex: 1 1 calc(100% - 3.5rem); font-weight: 600; }
  .tasks-table td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .78rem; font-weight: 400; }
  .tasks-table td.row-actions { flex-basis: 100%; }
  .tasks-table td.row-actions:empty { display: none; }
  .tasks-table td.empty { flex-basis: 100%; }
  .tasks-table tr.overdue td:first-child, .tasks-table tr.is-proposed td:first-child { box-shadow: none; }
  .tasks-table tr.overdue { box-shadow: inset -3px 0 0 var(--danger); }
  .tasks-table tr.is-proposed { box-shadow: inset -3px 0 0 var(--violet); }
}

/* ------------------------------------------------ phones: tables as stacked cards (לקוחות, צוות, יומן, דוח ייבוא, מסמכים) */
@media (max-width: 640px) {
  .table-wrap:has(.table-cards) { overflow-x: visible; }
  .table-cards, .table-cards tbody { display: block; width: 100%; }
  .table-cards thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .table-cards tbody tr { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .9rem; padding: .6rem .75rem; border-bottom: 1px solid var(--border); }
  .table-cards tbody tr:last-child { border-bottom: 0; }
  .table-cards td { display: block; padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .table-cards td.hide-md, .table-cards td.hide-cards, .table-cards td:empty { display: none; }
  .table-cards td.card-sub { order: -3; color: var(--muted); font-size: .8rem; }
  .table-cards td.card-title-cell { order: -2; flex: 1 1 60%; font-weight: 600; }
  .table-cards td.card-pill { order: -1; }
  .table-cards td.card-wide, .table-cards td.card-open { flex-basis: 100%; }
  .table-cards td.card-action { margin-inline-start: auto; }
  .table-cards td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .78rem; font-weight: 400; }
  .table-cards td.empty { flex-basis: 100%; }
  .table-cards td.nowrap { white-space: normal; }
  .table-cards .show-cards { display: inline; }
  .table-cards tr.overdue td:first-child { box-shadow: none; }
  .table-cards tr.overdue { box-shadow: inset -3px 0 0 var(--danger); }
  .team-table .reassign-open { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
  .team-table .reassign-open select { flex: 1 1 12rem; width: auto; }
  .clients-table td.card-title-cell .pill { font-weight: 600; }
}

@media print {
  .topbar, .filters, .quick-create, .row-actions, form { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .table-wrap { box-shadow: none; border-color: #999; }
}

/* ---------- אימות דו-שלבי וחשבון */
a.who:hover { color: #fff; }
.mfa-setup { max-width: 460px; }
.steps { margin: .5rem 0; padding-inline-start: 1.3rem; display: grid; gap: .35rem; }
.qr-box { margin: .5rem 0 1rem; display: grid; justify-items: center; gap: .4rem; text-align: center; }
.qr { width: 240px; height: 240px; max-width: 100%; background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--border); image-rendering: pixelated; }
.totp-secret { display: inline-block; font-size: 1rem; letter-spacing: .06em; padding: .35rem .6rem; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); overflow-wrap: anywhere; user-select: all; }
.code-input { font-size: 1.35rem; letter-spacing: .25em; text-align: center; font-variant-numeric: tabular-nums; }
.mfa-help { margin-top: 1rem; }
.mfa-help summary { cursor: pointer; color: var(--accent); font-size: .9rem; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .4rem 1.5rem; margin: .75rem 0; padding: .75rem 2.2rem; border: 1px dashed var(--border); border-radius: var(--radius-sm); background: var(--surface-2); }
.recovery-codes code { font-size: 1.02rem; letter-spacing: .05em; user-select: all; }
.account-grid { align-items: start; }
@media (max-width: 720px) { .recovery-codes { grid-template-columns: minmax(0, 1fr); } }
