/* נספחים — אותה שפת עיצוב של מערכות אגם בשלכת: כחול-נייבי, זהב מאופק, כרטיסים לבנים על רקע אפרפר. */
@font-face { font-family: "Assistant"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/Assistant-hebrew-2.woff2) format("woff2"); unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: "Assistant"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url(fonts/Assistant-latin-3.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --navy: #1f3a5f; --navy-dark: #16293f;
  --accent: #a07f36; --accent-dark: #8a6b2e; --accent-lite: #d9b45c;
  --bg: #f2f4f7; --card: #fff; --line: #d5dce4; --text: #1d2733; --muted: #5b6a80;
  --ok: #157042; --err: #b3373d; --sel: #eef3fa;
  --topbar-h: 56px; --bar-h: 72px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: "Assistant", "Segoe UI", Arial, sans-serif; font-size: 16px; line-height: 1.5; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--navy); }
p { text-align: justify; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent-dark); outline-offset: 2px; }
.topbar :focus-visible { outline-color: var(--accent-lite); }
.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: 12px; top: -60px; z-index: 500; background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 0 0 8px 8px; font-weight: 700; text-decoration: none; }
.skip-link:focus { top: 0; }

/* ---------- סרגל עליון ---------- */
header.topbar { position: sticky; top: 0; z-index: 100; height: var(--topbar-h); background: var(--navy); color: #fff; border-top: 3px solid var(--accent); display: flex; align-items: center; gap: 20px; padding: 0 24px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 1.3rem; font-weight: 700; }
.topbar nav a { color: #dce6f2; text-decoration: none; font-weight: 600; padding: 6px 10px; border-radius: 6px; }
.topbar nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.topbar .who { margin-inline-start: auto; display: flex; align-items: center; gap: 12px; }
.topbar .uname { color: #dce6f2; }
.topbar form { margin: 0; }

/* ---------- לחצנים ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 8px 20px; border-radius: 8px; border: 2px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--navy); color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--navy-dark); border-color: var(--accent-lite); }
.btn-gold { background: var(--accent-dark); color: #fff; }
.btn-gold:hover { background: #75592a; }
.btn-secondary { background: #fff; color: var(--navy); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--navy); background: #f6f8fb; }
.btn-ghost { background: transparent; color: inherit; border-color: rgba(127,127,127,.35); min-height: 36px; padding: 4px 14px; }
.topbar .btn-ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.btn-danger-ghost { background: transparent; color: var(--err); border-color: #e7c3c5; }
.btn-sm { min-height: 36px; padding: 4px 14px; font-size: .95rem; }
.btn-lg { min-height: 48px; padding: 10px 34px; font-size: 1.1rem; }
.btn-block { width: 100%; }

/* ---------- טפסים ---------- */
.form label, .dlg label { display: block; font-weight: 600; margin: 14px 0 4px; }
input, select { font: inherit; color: inherit; }
.form input:not([type=checkbox]), .dlg input:not([type=checkbox]):not([type=radio]), .dlg select { width: 100%; min-height: 42px; padding: 6px 12px; border: 1px solid #7f8c9b; border-radius: 8px; background: #fff; }
input[aria-invalid="true"] { border-color: var(--err) !important; box-shadow: 0 0 0 2px rgba(179,55,61,.18); }
.field-err { color: var(--err); font-size: .92rem; margin: 4px 0 0; }
.err-box { background: #fbeaea; border: 1px solid #e7c3c5; color: var(--err); padding: 10px 14px; border-radius: 8px; }
.hint { color: var(--muted); font-size: .92rem; margin: 4px 0 0; }
.req { color: var(--err); }
label.check, label.radio { display: flex !important; align-items: flex-start; gap: 10px; font-weight: 400 !important; margin: 12px 0 0 !important; cursor: pointer; }
label.check input, label.radio input[type=radio] { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--navy); }
.flash { max-width: 760px; margin: 16px auto 0; padding: 10px 16px; background: #fdf3e3; border: 1px solid #e2c186; border-radius: 8px; }
.flash p { margin: 0; text-align: start; }

/* ---------- כניסה / הרשמה ---------- */
main.auth { flex: 1; display: grid; place-items: start center; padding: 48px 16px; }
.auth-card { width: 100%; max-width: 440px; background: #fff; border: 1px solid var(--line); border-top: 4px solid var(--navy); border-radius: 10px; padding: 32px; box-shadow: 0 8px 28px rgba(22,41,63,.06); text-align: center; }
.auth-card .form { text-align: start; }
.auth-card h1 { color: var(--navy-dark); margin: 12px 0 6px; font-size: 1.6rem; }
.auth-card .lead { color: var(--muted); text-align: center; margin: 0 0 8px; }
.auth-card .btn-block { margin-top: 22px; }
.auth-card .alt { text-align: center; margin: 18px 0 0; }
.auth-mark { margin: 0 auto; display: block; }

/* ---------- רשימת מסמכים ---------- */
main.page { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 28px 24px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.page-head h1 { margin: 0; color: var(--navy-dark); font-size: 1.7rem; }
.page-head form { margin: 0; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 28px rgba(22,41,63,.05); }
.list-card { padding: 18px 22px; }
.list-title { margin: 0 0 10px; font-size: 1.1rem; color: var(--navy-dark); }
.count { display: inline-block; min-width: 26px; padding: 0 8px; border-radius: 13px; background: #e8edf4; color: var(--navy); font-size: .85rem; text-align: center; font-weight: 700; }
.plist { list-style: none; margin: 0; padding: 0; max-height: 60vh; overflow-y: auto; }
.plist li a { display: flex; justify-content: space-between; gap: 16px; padding: 12px 10px; border-bottom: 1px solid #edf0f4; text-decoration: none; color: var(--text); border-radius: 6px; }
.plist li a:hover { background: var(--sel); }
.plist .meta { color: var(--muted); font-size: .92rem; white-space: nowrap; }
.empty { padding: 48px 24px; text-align: center; }
.empty img { margin: 0 auto 8px; display: block; }
.empty h2 { color: var(--navy-dark); margin: 8px 0; }
.empty p { color: var(--muted); max-width: 46ch; margin: 0 auto 22px; text-align: center; }
.empty form { margin: 0; }

/* ---------- עורך ---------- */
body.is-editor { height: 100vh; overflow: hidden; }
main.editor { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 14px; padding: 16px 24px 0; max-width: 1400px; width: 100%; margin: 0 auto; }
.ed-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.doc-title { flex: 1 1 320px; min-height: 46px; font-size: 1.25rem; font-weight: 700; color: var(--navy-dark); border: 1px solid transparent; border-bottom-color: var(--line); background: transparent; padding: 6px 4px; border-radius: 6px; }
.doc-title:hover, .doc-title:focus { border-color: var(--line); background: #fff; }
.ed-settings { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ed-settings label { color: var(--muted); font-weight: 600; }
.ed-settings select { min-height: 40px; padding: 4px 10px; border: 1px solid #7f8c9b; border-radius: 8px; background: #fff; }
.ed-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; }
.ed-lists { min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #edf0f4; }
.card-head h2 { margin: 0; font-size: 1.08rem; color: var(--navy-dark); display: flex; align-items: center; gap: 8px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.drop { position: relative; display: flex; flex-direction: column; min-height: 0; }
.drop.grow { flex: 1; }
.drop.is-over { outline: 3px dashed var(--accent); outline-offset: -6px; background: #fdf8ec; }
.drop-hint { margin: 0; padding: 18px 16px; color: var(--muted); text-align: center; border: 2px dashed #c8d4e2; border-radius: 8px; margin: 12px 16px; }
.rows { list-style: none; margin: 0; padding: 6px 8px; }
.rows.scroll { flex: 1; min-height: 110px; overflow-y: auto; }
.row { display: grid; grid-template-columns: 18px 76px minmax(0, 1fr) auto auto; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; border: 1px solid transparent; cursor: pointer; }
.row:hover { background: #f7f9fc; }
.row.is-selected { background: var(--sel); border-color: #c9d6e8; }
.row.dragging { opacity: .45; }
.row .grip { color: #9aa5b5; cursor: grab; font-size: 1.1rem; }
.row .lbl { font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .clabel { width: 100%; min-height: 34px; padding: 2px 8px; border: 1px solid #7f8c9b; border-radius: 6px; }
.row .main { min-width: 0; }
.row .title { width: 100%; min-height: 34px; padding: 2px 8px; border: 1px solid transparent; border-radius: 6px; background: transparent; font-weight: 600; }
.row .title:hover, .row .title:focus { border-color: #7f8c9b; background: #fff; }
.row .title::placeholder { color: #6b7a8f; font-weight: 400; }
.row .sub { display: flex; gap: 10px; padding-inline-start: 9px; font-size: .86rem; color: var(--muted); }
.row .err { color: var(--err); }
.row.is-error .title { color: var(--err); }
.row.is-ph .lbl::after { content: " ◌"; color: var(--accent); }
.row .comp { min-height: 34px; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: .88rem; color: var(--muted); }
.row .moves { display: flex; gap: 2px; }
.icon { width: 32px; height: 32px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: .8rem; }
.icon:hover:not(:disabled) { border-color: var(--line); background: #fff; color: var(--navy); }
.icon:disabled { opacity: .3; cursor: default; }
.icon.del:hover { color: var(--err); }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid #c8d4e2; border-top-color: var(--navy); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -1px; }
@keyframes spin { to { transform: rotate(360deg); } }
.preview { display: flex; flex-direction: column; min-height: 0; }
.pv-body { flex: 1; min-height: 0; display: grid; place-items: center; padding: 12px; background: #eef1f5; border-radius: 0 0 10px 10px; overflow: hidden; }
.pv-body img { max-width: 100%; max-height: 100%; object-fit: contain; box-shadow: 0 2px 10px rgba(0,0,0,.18); background: #fff; }
.pv-body .muted { color: var(--muted); text-align: center; }
.pv-nav { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-top: 1px solid #edf0f4; }

/* סרגל הפעולה — דביק בתחתית */
.actionbar { position: sticky; bottom: 0; z-index: 50; min-height: var(--bar-h); display: flex; align-items: center; gap: 14px; padding: 12px 0 14px; background: var(--bg); border-top: 1px solid var(--line); flex-wrap: wrap; }
.ab-status { flex: 1; min-width: 200px; color: var(--muted); }
.ab-status.is-error { color: var(--err); font-weight: 600; }
.ab-status.is-ok { color: var(--ok); font-weight: 700; }
.ab-status .pct { font-weight: 700; color: var(--navy); }
.ab-files { display: flex; gap: 8px; flex-wrap: wrap; }

/* דיאלוגים */
dialog { border: 0; border-radius: 12px; padding: 0; width: min(480px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(16,30,54,.3); color: var(--text); }
dialog::backdrop { background: rgba(22,41,63,.45); }
.dlg { padding: 24px 26px; }
.dlg h2 { margin: 0 0 10px; color: var(--navy-dark); font-size: 1.25rem; }
.dlg-row { margin-top: 6px; }
.dlg-actions { display: flex; gap: 10px; margin-top: 22px; justify-content: space-between; }
.choice { border: 0; margin: 0; padding: 0; }
.choice .sub { padding-inline-start: 30px; }
.choice .num { width: 80px !important; min-height: 34px !important; display: inline-block; margin: 0 4px; }

/* תחתית */
footer.sitefoot { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; padding: 16px 24px; font-size: .9rem; color: var(--muted); border-top: 1px solid var(--line); background: #fff; }
footer.sitefoot nav { display: flex; gap: 16px; flex-wrap: wrap; }
footer.sitefoot a { color: var(--muted); }

/* עמודי מידע */
.doc { max-width: 820px; margin: 0 auto; padding: 28px 32px; }
.doc h1 { text-align: center; color: var(--navy-dark); }
.doc h2 { color: var(--navy-dark); font-size: 1.15rem; margin: 24px 0 6px; }
.doc .updated { text-align: center; color: var(--muted); margin-top: -8px; }
.doc li { text-align: justify; margin-bottom: 4px; }

@media (max-width: 900px) {
  body.is-editor { height: auto; overflow: visible; }
  .ed-grid { grid-template-columns: 1fr; }
  .rows.scroll { max-height: 55vh; }
  .preview { min-height: 420px; }
}
@media (max-width: 640px) {
  header.topbar { padding: 0 12px; gap: 10px; }
  .topbar nav, .topbar .uname { display: none; }
  main.editor, main.page { padding-inline: 12px; }
  .row { grid-template-columns: 14px 56px minmax(0, 1fr) auto; }
  .row .comp { grid-column: 3 / 4; grid-row: 2; justify-self: start; }
  .actionbar .btn-lg { flex: 1; }
  .doc { padding: 20px 16px; }
}
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
