/* Shared styles – console + client signing page. Hebrew RTL first. */
:root {
  --bg: #F6F5F1; --card: #FFFFFF; --ink: #1C2430; --ink2: #3B4553; --muted: #5B6470; --line: #E4E2DC; --line2: #EEECE6; --field: #DAD7CF;
  --brand: #1F4E5F; --brand-d: #163A47; --brand-l: #E3ECEE; --brand-ll: #F1F6F7;
  --ok: #2F7D4F; --ok-bg: #EAF3EC; --ok-ink: #1F5E39;
  --warn: #C8891E; --warn-bg: #FBF1DE; --warn-ink: #7A4E0E;
  --bad: #B4471F; --bad-bg: #F8E6DF; --bad-ink: #8A3313;
  --info-bg: #E7EEF6; --info-ink: #1E4573; --violet-bg: #EFE9F6; --violet-ink: #4F2F7A;
  --radius: 12px;
  font-family: Heebo, "Segoe UI", Arial, "Noto Sans Hebrew", sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.5; }
a { color: var(--brand); } a:hover { color: var(--brand-d); }
h1 { font-size: 26px; margin: 0; font-weight: 700; }
h2 { font-size: 18px; margin: 0; font-weight: 600; }
h3 { font-size: 16px; margin: 0; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 900px) { .grid2, .grid3, .grid4 { grid-template-columns: minmax(0, 1fr); } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.card.tint { background: var(--brand-ll); border-color: #C9DCE0; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 10px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--brand-d); color: #fff; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.secondary { background: #fff; color: var(--ink); border-color: var(--field); font-weight: 500; }
.btn.secondary:hover { background: var(--bg); color: var(--ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--brand); padding: 0 8px; height: 36px; }
.btn.ghost:hover { background: var(--brand-l); }
.btn.danger { background: #fff; color: var(--bad-ink); border-color: #E7C3B5; font-weight: 500; }
.btn.ok { background: var(--ok); border-color: var(--ok); }
.btn.sm { height: 36px; padding: 0 12px; font-size: 14px; }
.btn.lg { height: 52px; font-size: 17px; padding: 0 24px; }

label.f { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 500; color: var(--ink2); }
input[type=text], input[type=email], input[type=tel], input[type=search], input[type=password], input[type=date], input[type=time], input[type=number], select, textarea {
  height: 44px; border: 1px solid var(--field); border-radius: 8px; padding: 0 12px; font: inherit; font-size: 15px; color: var(--ink); background: #fff; width: 100%;
}
textarea { height: auto; min-height: 80px; padding: 10px 12px; line-height: 1.6; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--brand); margin: 0; flex: none; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 500; white-space: nowrap; background: var(--line2); color: var(--ink2); }
.chip.ok { background: var(--ok-bg); color: var(--ok-ink); }
.chip.warn { background: var(--warn-bg); color: var(--warn-ink); }
.chip.bad { background: var(--bad-bg); color: var(--bad-ink); }
.chip.info { background: var(--info-bg); color: var(--info-ink); }
.chip.violet { background: var(--violet-bg); color: var(--violet-ink); }

table.t { width: 100%; border-collapse: collapse; }
table.t th { font-weight: 500; color: var(--muted); font-size: 13px; text-align: right; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.t td { padding: 12px 14px; border-bottom: 1px solid var(--line2); font-size: 14px; vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tr.click { cursor: pointer; } table.t tr.click:hover td { background: #FAFAF7; }
.tablebox { overflow-x: auto; }

.progress { width: 80px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; display: inline-block; vertical-align: middle; }
.progress > i { display: block; height: 100%; background: var(--warn); }
.progress.done > i { background: var(--ok); }

.toastbox { position: fixed; bottom: 20px; left: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: 420px; }
.toast { background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.18); display: flex; gap: 12px; align-items: flex-start; font-size: 14px; }
.toast.ok { background: var(--ok); }
.toast.err { background: var(--bad); }
.toast a { color: #fff; font-weight: 600; }

.modal-back { position: fixed; inset: 0; background: rgba(20, 24, 30, .45); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: #fff; border-radius: 16px; padding: 22px; width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; display: flex; flex-direction: column; gap: 16px; }

.empty { padding: 36px; text-align: center; color: var(--muted); }
.spinner { width: 18px; height: 18px; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* PDF pages with field overlays (shared by editor + signing) */
.pages { display: flex; flex-direction: column; gap: 16px; align-items: center; }
.page { position: relative; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 0 0 1px var(--line); max-width: 100%; }
.page canvas.pdf { display: block; width: 100%; height: auto; }
.page .layer { position: absolute; inset: 0; }
.fld { position: absolute; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: 12px; overflow: hidden; }

/* Intake questionnaire (public/qform.js) */
.qgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.qgrid .wide { grid-column: 1 / -1; }
@media (max-width: 700px) { .qgrid { grid-template-columns: minmax(0, 1fr); } }
.qreq { color: var(--bad); }
.qhint { font-weight: 400; color: var(--muted); font-size: 12px; }
fieldset.qchoice { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
fieldset.qchoice legend { font-size: 14px; font-weight: 500; color: var(--ink2); padding: 0; margin-bottom: 6px; }
.qopts { display: flex; flex-wrap: wrap; gap: 8px; }
.qopt { position: relative; }
.qopt input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.qopt span { display: inline-flex; align-items: center; height: 40px; padding: 0 14px; border: 1px solid var(--field); border-radius: 999px; background: #fff; font-size: 14px; }
.qopt input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; }
.qopt input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.qup { border: 1px solid #EBD9B4; background: var(--warn-bg); border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.qup .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.qup .btn { cursor: pointer; }
.qsign { border: 1px solid #C9DCE0; background: var(--brand-ll); border-radius: 10px; padding: 10px 14px; font-size: 14px; }

.sigpad { width: 100%; height: 200px; border: 1px dashed #9AA3AD; border-radius: 10px; background: #FCFCFA; touch-action: none; cursor: crosshair; display: block; }

/* console sign-in */
.auth .side { display: none; }
.authbox { max-width: 440px; margin: 6vh auto 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: flex; flex-direction: column; gap: 20px; }
.authbox .logo, .logo-sm { width: 40px; height: 40px; border-radius: 10px; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 21px; font-family: Georgia, serif; }
.qr { display: flex; justify-content: center; }
.qr svg { width: 220px; height: 220px; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.codes code { font: 600 15px/1.4 ui-monospace, Consolas, monospace; background: var(--bg); border-radius: 6px; padding: 6px 8px; text-align: center; letter-spacing: .5px; }
@media print { .authbox, .modal { border: 0; } .authbox .btn, .authbox label, .modal .btn, .modal label, .toastbox { display: none !important; } }

/* client link: privacy consent line */
.consent { display: flex; align-items: flex-start; gap: 10px; font-size: 15px; }
.consent input { width: 20px; height: 20px; margin-top: 2px; flex: none; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--brand); text-decoration: underline; cursor: pointer; }
.notice { white-space: pre-line; font-size: 14px; line-height: 1.6; background: var(--bg); border-radius: 10px; padding: 12px 14px; max-height: 340px; overflow: auto; }

/* letter editor: documents of an appendix */
.appfiles { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 4px 0 8px; font-family: Heebo, Arial, sans-serif; font-size: 13px; }

/* settings: letter types */
.ltype { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: #fff; }
.ltype > summary { cursor: pointer; list-style: none; }
.ltype > summary::-webkit-details-marker { display: none; }
.ltype[open] { border-color: var(--brand); }

/* client card: link PIN */
.pinrow .pin { font: 700 18px/1 ui-monospace, Consolas, monospace; letter-spacing: 3px; background: var(--bg); padding: 6px 10px; border-radius: 6px; }
/* client page: PIN entry */
.pininput { font: 700 28px/1 ui-monospace, Consolas, monospace; letter-spacing: 10px; text-align: center; direction: ltr; max-width: 260px; height: 56px; }
.previewbar { background: var(--warn-bg); border: 1px solid #EBD3A6; border-radius: 10px; padding: 10px 14px; font-size: 14px; }

/* console easter egg: a little crown pops up above the Z when you hover it
   (the SVG also carries style="position:absolute;opacity:0" so it stays hidden even before this sheet loads;
   the hover animation overrides that inline opacity) */
.side .logo { position: relative; cursor: default; }
.side .logo .crown { position: absolute; left: 50%; top: -17px; width: 26px; height: 18px; opacity: 0; pointer-events: none;
  transform: translate(-50%, 10px) scale(.3) rotate(-15deg); filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.side .logo:hover .crown { animation: crown-pop .6s cubic-bezier(.34, 1.56, .64, 1) forwards, crown-bob 1.8s ease-in-out .6s infinite; }
.side .logo:hover .crown .gem { animation: crown-gem 1.2s ease-in-out .6s infinite alternate; }
@keyframes crown-pop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.3) rotate(-15deg); }
  55% { opacity: 1; transform: translate(-50%, -5px) scale(1.2) rotate(8deg); }
  80% { transform: translate(-50%, 0) scale(.95) rotate(-3deg); }
  100% { opacity: 1; transform: translate(-50%, -2px) scale(1) rotate(0); }
}
@keyframes crown-bob { 0%, 100% { opacity: 1; transform: translate(-50%, -2px) rotate(0); } 50% { opacity: 1; transform: translate(-50%, -5px) rotate(-5deg); } }
@keyframes crown-gem { to { filter: brightness(1.6); } }
/* case form: upload requests (compact cards: tick to ask, "חובה" pill to require) */
.upsec { display: flex; flex-direction: column; gap: 10px; padding-top: 4px; }
.upsec h3 { font-size: 15px; }
.upgroup { display: flex; flex-direction: column; gap: 6px; }
.upgroup-t { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .2px; }
.upgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 760px) { .upgrid { grid-template-columns: minmax(0, 1fr); } }
.uprow { display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 8px 6px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; transition: background .15s, border-color .15s; }
.uprow:hover { border-color: var(--field); }
.uprow:has(.uplbl input:checked) { border-color: #C9DCE0; background: var(--brand-ll); }
.uprow.off { background: #FBFAF8; }
.uplbl { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; cursor: pointer; font-size: 14px; line-height: 1.35; }
.uprow.off .uplbl span { color: var(--muted); }
.reqtoggle { position: relative; flex: none; display: inline-flex; }
.reqtoggle input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.reqtoggle span, .reqdemo { display: inline-flex; align-items: center; height: 26px; padding: 0 11px; border-radius: 999px; border: 1px solid var(--field); background: #fff; color: var(--muted); font-size: 12px; font-weight: 500; transition: all .15s; }
.reqtoggle input:checked + span, .reqdemo { background: var(--bad-bg); border-color: #E7C3B5; color: var(--bad-ink); font-weight: 600; }
.reqtoggle input:checked + span::before, .reqdemo::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--bad); margin-inline-end: 6px; }
.reqtoggle input:disabled { cursor: default; }
.reqtoggle input:disabled + span { opacity: .35; }
.reqtoggle input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.reqdemo { height: 20px; padding: 0 8px; font-size: 11px; vertical-align: 1px; }

/* case form: insurer picker (a dropdown of insurers from earlier cases) */
.combo { position: relative; display: block; }
.combo > input { width: 100%; }
.combo-list { position: absolute; z-index: 30; inset-inline: 0; top: calc(100% + 4px); max-height: 280px; overflow: auto; background: #fff; border: 1px solid var(--field); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); padding: 4px; }
.combo-opt { display: flex; flex-direction: column; gap: 1px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; font: inherit; text-align: right; cursor: pointer; color: var(--ink); }
.combo-opt.on, .combo-opt:hover { background: var(--brand-ll); }
.combo-opt small { color: var(--muted); font-size: 12px; font-weight: 400; }
.combo-new { padding: 8px 10px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line2); margin-top: 4px; }
@media (prefers-reduced-motion: reduce) {
  .side .logo:hover .crown { animation: none; opacity: 1 !important; transform: translate(-50%, -2px); }
  .side .logo:hover .crown .gem { animation: none; }
}