/* superv web — RTL, clean, company-themed (brand vars set at runtime). */
:root {
  --brand: #0F766E;
  --brand-accent: #10B981;
  --brand-soft: #0F766E1A;
  --ink: #0f172a; --ink-2: #475569; --muted: #94a3b8;
  --bg: #f1f5f9; --card: #ffffff; --line: #e2e8f0; --line-2: #cbd5e1;
  --danger: #dc2626; --ok: #16a34a;
  --radius: 14px; --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(15,23,42,.05), 0 6px 20px rgba(15,23,42,.06);
  --font: system-ui, -apple-system, "Segoe UI", "Heebo", "Noto Sans Hebrew", Roboto, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); color: var(--ink); background: var(--bg);
  direction: rtl; line-height: 1.55; font-size: 15.5px; min-height: 100vh;
}
a { color: inherit; }
h1 { font-size: 1.7rem; margin: 0 0 .15em; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1.02rem; margin: 0; }
.muted { color: var(--muted); font-size: .9rem; }
#view { min-height: 100vh; }

/* topbar */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 20px; background: #fff; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand b { display: block; font-size: 1rem; }
.brand small { color: var(--ink-2); font-size: .78rem; }
.fav { width: 34px; height: 34px; border-radius: 9px; background: var(--brand-soft); }
.tb-actions { display: flex; align-items: center; gap: 10px; }
.pill { font-size: .8rem; color: var(--ink-2); background: var(--bg); border: 1px solid var(--line); padding: 5px 12px; border-radius: 999px; transition: .2s; }
.pill.ok { color: #065f46; background: #ecfdf5; border-color: #a7f3d0; }

/* buttons */
.btn {
  appearance: none; border: 1px solid var(--line-2); background: #fff; color: var(--ink);
  padding: 9px 15px; border-radius: var(--radius-sm); font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.06); color: #fff; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: #fef2f2; color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 11px; font-size: .85rem; }
.btn.big { padding: 12px 22px; font-size: 1rem; }

/* home */
.home-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 26px 22px 8px; max-width: 1100px; margin: 0 auto; flex-wrap: wrap; }
.home-head p { color: var(--ink-2); margin: 0; }
.search-wrap { max-width: 1100px; margin: 0 auto 14px; padding: 0 22px; }
.search-wrap input { width: 100%; padding: 12px 15px; font: inherit; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; }
.grid { max-width: 1100px; margin: 0 auto; padding: 0 22px 20px; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.report-card {
  background: var(--card); border: 1px solid var(--line); border-right: 4px solid var(--card-accent, var(--brand));
  border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 9px;
}
.rc-top { display: flex; justify-content: space-between; align-items: center; }
.rc-status { font-size: .75rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.rc-status.done { background: #ecfdf5; color: #065f46; }
.rc-status.draft { background: #fffbeb; color: #92400e; }
.rc-meta { font-size: .8rem; color: var(--muted); }
.report-card h3 { font-size: 1.05rem; }
.rc-site { font-size: .85rem; color: var(--ink-2); }
.rc-row { display: flex; justify-content: space-between; gap: 10px; font-size: .82rem; color: var(--ink-2); }
.rc-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 2px; }
.empty { max-width: 520px; margin: 40px auto; text-align: center; padding: 34px; border: 2px dashed var(--line-2); border-radius: var(--radius); color: var(--ink-2); display: flex; flex-direction: column; gap: 16px; align-items: center; }
.sites-block { max-width: 1100px; margin: 8px auto 40px; padding: 0 22px; }
.sites-block h2 { font-size: 1.05rem; } .sites-block small { color: var(--muted); font-weight: 400; }
.sites { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 12px; }
.site-chip { background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 7px 14px; display: flex; flex-direction: column; line-height: 1.2; }
.site-chip small { color: var(--muted); }
.sites-empty { color: var(--muted); font-size: .9rem; }

/* editor */
.editor { max-width: 860px; margin: 0 auto; padding: 18px 16px 60px; display: flex; flex-direction: column; gap: 14px; }
.card.sec { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 18px 20px; box-shadow: var(--shadow); }
.sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.sec-head p { margin: 2px 0 0; color: var(--ink-2); font-size: .85rem; }
.sec-num { flex: none; width: 34px; height: 34px; border-radius: 10px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 1.1rem; }
.fgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 14px; }
.f { display: flex; flex-direction: column; gap: 5px; }
.f span { font-size: .82rem; color: var(--ink-2); font-weight: 600; }
.f input, .f select, .f textarea, .add-inline input, .add-inline select {
  font: inherit; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: #fff; color: var(--ink); width: 100%;
}
.f input:focus, .f select:focus, .f textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.f.wide { grid-column: 1 / -1; }
textarea { resize: vertical; }
.subblock { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 14px; }
.subhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.add-inline { display: flex; gap: 7px; flex-wrap: wrap; }
.add-inline input, .add-inline select { width: auto; min-width: 110px; }
.list { display: flex; flex-direction: column; gap: 6px; }
.listrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px 12px; }
.x { border: none; background: transparent; color: var(--danger); cursor: pointer; font-size: 1rem; padding: 2px 6px; border-radius: 6px; }
.x:hover { background: #fef2f2; }

/* findings */
.finding { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; margin-bottom: 12px; background: #fbfdff; }
.fd-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.fserial { font-weight: 800; color: var(--brand); }
.fd-head-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.descwrap, .instwrap { margin: 8px 0; }
.f-tools { display: flex; gap: 8px; margin-top: 7px; flex-wrap: wrap; }
.fd-photos { margin-top: 12px; }
.phgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px; }
.ph { position: relative; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; background: var(--bg); }
.ph img { width: 100%; height: 96px; object-fit: cover; display: block; }
.ph figcaption { font-size: .75rem; padding: 4px 7px; color: var(--ink-2); }
.ph .x { position: absolute; top: 3px; inset-inline-end: 3px; background: rgba(255,255,255,.9); border-radius: 6px; }
.ph.sm img { height: 72px; }
.ph-add { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ph-add input[type=file] { flex: 1; min-width: 200px; }
.plan-row { display: grid; grid-template-columns: 26px 1fr 90px 110px 34px; gap: 8px; align-items: center; margin-bottom: 8px; }
.plan-row .serial { font-weight: 800; color: var(--brand); text-align: center; }
.plan-row input { font: inherit; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); width: 100%; }
.editor-footer { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--line); }
.toggle { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--ink-2); cursor: pointer; }

/* modal */
.modal-back { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 50; display: grid; place-items: center; padding: 16px; backdrop-filter: blur(2px); }
.modal { background: #fff; border-radius: var(--radius); width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.m-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.m-head .x { font-size: 1.1rem; }
.m-filters { display: flex; gap: 8px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.m-filters input { flex: 1; font: inherit; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.m-filters select { font: inherit; padding: 8px 11px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); }
.m-list { padding: 8px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 8px; }
.clause-item { text-align: right; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; cursor: pointer; background: #fff; font: inherit; width: 100%; }
.clause-item:hover { border-color: var(--brand); background: var(--brand-soft); }
.ci-title { font-weight: 700; }
.ci-meta { font-size: .78rem; color: var(--brand); margin: 3px 0; }
.ci-desc { font-size: .84rem; color: var(--ink-2); }
.tag { font-size: .68rem; background: var(--brand); color: #fff; padding: 1px 7px; border-radius: 999px; margin-inline-start: 4px; }
.m-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); }
.muted { color: var(--muted); font-size: .85rem; }
.phr-orig { padding: 10px 18px; background: var(--bg); border-bottom: 1px solid var(--line); font-size: .85rem; }
.sugg { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 13px; display: flex; flex-direction: column; gap: 7px; }
.sugg-style { font-size: .78rem; font-weight: 700; color: var(--brand); }
.sugg-text { font-size: .92rem; }
.sugg .btn { align-self: flex-end; }

/* toast */
.toast { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(50%); background: #0f172a; color: #fff; padding: 11px 20px; border-radius: 999px; font-size: .9rem; z-index: 80; box-shadow: 0 10px 30px rgba(0,0,0,.3); opacity: 0; transition: .25s; }
.toast.warn { background: #b45309; }
.toast.out { opacity: 0; }

/* ---------- print (report preview / PDF) ---------- */
.report-print { max-width: 820px; margin: 16px auto 60px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 34px 38px; color: #0f172a; }
.rp-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; border-bottom: 3px solid var(--brand); padding-bottom: 14px; }
.rp-brand { display: flex; gap: 12px; align-items: center; }
.rp-logo { font-size: 2rem; }
.rp-brand h1 { font-size: 1.35rem; color: var(--brand); }
.rp-brand p { margin: 0; font-size: .82rem; color: var(--ink-2); }
.rp-stamp { font-size: .8rem; font-weight: 800; padding: 6px 14px; border-radius: 8px; white-space: nowrap; }
.rp-stamp.done { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.rp-stamp.draft { background: #fffbeb; color: #92400e; border: 1px solid #fde68a; }
.rp-title { text-align: center; margin: 18px 0 14px; font-size: 1.25rem; letter-spacing: .5px; }
.rp-meta { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-size: .9rem; }
.rp-meta td { border: 1px solid var(--line); padding: 7px 10px; }
.rp-meta td:nth-child(odd) { background: var(--bg); font-weight: 600; width: 16%; }
.rp-sec { margin: 16px 0; }
.rp-sec h3 { font-size: 1rem; color: var(--brand); border-bottom: 1px solid var(--line); padding-bottom: 5px; margin: 0 0 9px; }
.rp-p, .rp-sec p { margin: 6px 0; white-space: pre-wrap; }
.rp-finding { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; margin-bottom: 12px; }
.rp-finding h4 { margin: 0 0 6px; color: var(--ink); }
.rp-fmeta { font-size: .8rem; color: var(--brand); margin-bottom: 8px; }
.rp-photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.rp-photos img { width: 100%; border-radius: 6px; border: 1px solid var(--line); }
.rp-decision { background: var(--brand-soft); border-radius: 8px; padding: 14px; }
.rp-decision-text { font-size: 1.2rem; font-weight: 800; color: var(--brand); margin: 6px 0 0; }
.rp-foot { margin-top: 24px; border-top: 2px solid var(--line); padding-top: 14px; font-size: .82rem; color: var(--ink-2); display: flex; flex-direction: column; gap: 5px; }
.rp-sign { font-size: 1rem; color: var(--ink); }
.print-toolbar { max-width: 820px; margin: 12px auto; padding: 0 16px; display: flex; justify-content: flex-end; gap: 10px; }

@media (max-width: 620px) {
  .fgrid { grid-template-columns: 1fr; }
  .plan-row { grid-template-columns: 22px 1fr 70px 34px; } .plan-row .date { display: none; }
  .topbar { flex-direction: column; align-items: stretch; } .tb-actions { justify-content: space-between; }
  .rp-photos { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  body { background: #fff; }
  .topbar, .print-toolbar, .no-print { display: none !important; }
  .report-print { border: none; box-shadow: none; max-width: 100%; margin: 0; padding: 0; }
  .rp-sec, .rp-finding { break-inside: avoid; }
}
