/* shaizik review viewer. Studio design: same tokens and fonts as the kickoff questionnaire
   (Figma "Questionnaire / Color, Space", 24.11). Square corners, no shadows. Raw values live only in :root.
   Severity colors are the one exception to the studio palette: they carry meaning (high / medium / low / keep). */
@font-face { font-family: 'Inconsolata'; font-weight: 400; font-display: swap; src: url(/fonts/inconsolata-latin-400-normal.woff2) format('woff2'); unicode-range: U+0030-0039, U+0041-005A, U+0061-007A; }
@font-face { font-family: 'Inconsolata'; font-weight: 700; font-display: swap; src: url(/fonts/inconsolata-latin-700-normal.woff2) format('woff2'); unicode-range: U+0030-0039, U+0041-005A, U+0061-007A; }
@font-face { font-family: 'Lato'; font-weight: 400; font-display: swap; src: url(/fonts/lato-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'IBM Plex Sans Hebrew'; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-hebrew-hebrew-400-normal.woff2) format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'IBM Plex Sans Hebrew'; font-weight: 700; font-display: swap; src: url(/fonts/ibm-plex-sans-hebrew-hebrew-700-normal.woff2) format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'Noto Sans Hebrew'; font-weight: 400; font-display: swap; src: url(/fonts/noto-sans-hebrew-hebrew-400-normal.woff2) format('woff2'); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: 'IBM Plex Sans Hebrew'; font-weight: 400; font-display: swap; src: url(/fonts/ibm-plex-sans-hebrew-latin-400-normal.woff2) format('woff2'); unicode-range: U+0020-007E, U+00A0; }
@font-face { font-family: 'IBM Plex Sans Hebrew'; font-weight: 700; font-display: swap; src: url(/fonts/ibm-plex-sans-hebrew-latin-700-normal.woff2) format('woff2'); unicode-range: U+0020-007E, U+00A0; }

:root {
  --ink: #000026; --bg: #F9FAFF; --surface: #FFFFFF; --primary: #0B1DFF; --muted: #5B5B7A;
  --line: #D7DAF0; --secondary: #ECEAFE; --highlight: #E4E8FF; --border: #7C8AE6; --error: #B42318;
  --sev-high: #F8B4AE; --sev-high-ink: #532423; --sev-medium: #FBD38D; --sev-medium-ink: #543608;
  --sev-low: #BFE3F8; --sev-low-ink: #173C58; --sev-good: #BDE5C8; --sev-good-ink: #164A2A;
  --s4: 4px; --s8: 8px; --s12: 12px; --s16: 16px; --s24: 24px; --s32: 32px; --s48: 48px;
  --hit: 48px;
  --voice: 'IBM Plex Sans Hebrew', 'Inconsolata', sans-serif;
  --body: 'Lato', 'Noto Sans Hebrew', sans-serif;
}
* { box-sizing: border-box; border-radius: 0; letter-spacing: 0; box-shadow: none; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 16px; line-height: 22px; min-width: 280px; }
h1, h2, h3, button, .btn, .ui { font-family: var(--voice); font-weight: 700; }
h1 { font-size: 36px; line-height: 42px; margin: 0 0 var(--s8); }
h2 { font-size: 22px; line-height: 28px; margin: 0 0 var(--s12); }
h3 { font-size: 16px; line-height: 22px; margin: 0 0 var(--s4); }
p { margin: 0 0 var(--s12); }
a { color: var(--primary); }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s8);
  min-height: 56px; padding: 0 var(--s24); font-size: 16px; border: 1px solid var(--ink);
  background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none;
}
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--surface); }
.btn.small { min-height: 40px; padding: 0 var(--s12); font-size: 14px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--error); border-color: var(--error); }
.btn[disabled] { opacity: .45; cursor: default; }

input[type=text], input[type=password], input[type=date], input[type=file], textarea, select {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); padding: var(--s12); min-height: var(--hit); display: block; appearance: none;
}
textarea { min-height: 140px; resize: vertical; font-family: var(--body); }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--primary); outline-offset: -2px; }
label.ui { display: block; font-size: 14px; margin-bottom: var(--s4); }

.studio-logo { display: inline-block; flex: none; }
.studio-logo img { display: block; width: 96px; height: auto; }

/* ---------- code screen and closed screens ---------- */
.gate-page { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s24) var(--s16); }
.gate { width: min(100%, 440px); background: var(--surface); border: 1px solid var(--line); padding: var(--s32) var(--s24); }
.gate .studio-logo img { width: 116px; }
.gate h1 { margin-top: var(--s24); font-size: 28px; line-height: 34px; }
.gate .muted { margin-bottom: var(--s24); }
.gate-form input { margin-bottom: var(--s16); text-align: left; letter-spacing: .04em; }
.gate-error { color: var(--error); font-weight: 700; margin: calc(-1 * var(--s8)) 0 var(--s16); }
.gate-help { margin: var(--s16) 0 0; font-size: 14px; }

/* ---------- viewer ---------- */
.preview-bar { background: var(--ink); color: var(--surface); padding: var(--s8) var(--s16); font-size: 14px; text-align: center; }
.preview-bar a { color: var(--surface); }
.top { height: 64px; border-bottom: 1px solid var(--line); background: var(--surface); }
.top-inner { height: 100%; max-width: 1500px; margin: auto; padding: 0 30px; display: flex; align-items: center; gap: var(--s12); }
.chip { display: grid; place-items: center; min-width: 36px; height: 36px; padding: 0 var(--s8); background: var(--highlight); color: var(--primary); font-family: var(--voice); font-weight: 700; font-size: 13px; }
.top-label { font-family: var(--voice); font-weight: 700; color: var(--ink); }
.viewer { max-width: 1500px; margin: auto; padding: 27px 30px 32px; }
.intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.viewer h1 { font-size: clamp(28px, 3.1vw, 48px); line-height: 1.1; }
.intro p { margin: var(--s8) 0 0; }
.counter { font-size: 14px; color: var(--muted); flex-shrink: 0; }
.workspace { display: grid; grid-template-columns: minmax(292px, 360px) minmax(0, 1fr); gap: 18px; align-items: start; }
.panel, .canvas-card { min-width: 0; background: var(--surface); border: 1px solid var(--line); }
.finding { padding: 22px 21px 18px; border-bottom: 1px solid var(--line); }
.finding:focus { outline: none; }
.marker-line { display: flex; align-items: center; gap: var(--s8); margin-bottom: var(--s12); }
.marker, .row-number { display: grid; place-items: center; flex: none; border-radius: 50%; font-family: var(--voice); font-weight: 700; }
.marker { width: 35px; height: 35px; }
.meta { font-family: var(--voice); font-weight: 700; color: var(--muted); font-size: 14px; }
.finding h2 { font-size: 20px; line-height: 27px; }
.finding p { color: var(--muted); line-height: 1.57; }
.action { padding: var(--s12) 13px; margin-top: 13px; background: var(--highlight); }
.action .ui { display: block; margin-bottom: 3px; color: var(--primary); font-size: 14px; }
.action p { margin: 0; color: var(--ink); }
.navigation { display: flex; gap: var(--s8); margin-top: var(--s16); }
.finding-index { padding: 15px 13px 13px; }
.finding-index summary { padding: 2px 8px; cursor: pointer; }
.finding-index[open] summary { margin-bottom: var(--s8); }
.finding-index ol { padding: 0; margin: 0; list-style: none; max-height: 35vh; overflow: auto; scrollbar-width: thin; }
.finding-index button { display: flex; width: 100%; gap: 9px; align-items: center; min-height: 45px; text-align: right; border: 1px solid transparent; padding: 5px 8px; background: transparent; font-family: var(--body); font-weight: 400; font-size: 15px; line-height: 1.3; color: var(--ink); cursor: pointer; }
.finding-index button:hover, .finding-index button[aria-current=true] { background: var(--highlight); }
.finding-index button[aria-current=true] { border-color: var(--border); font-weight: 700; }
.row-number { width: 29px; height: 29px; font-size: 13px; }
.canvas-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--s8); min-height: 57px; padding: 9px 15px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
.canvas-bar h2 { font-size: 16px; line-height: 22px; margin: 0; }
.legend { display: flex; gap: var(--s12); flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.legend span { display: inline-flex; gap: 5px; align-items: center; white-space: nowrap; }
.legend i { width: 11px; height: 11px; border-radius: 50%; }
.high { background: var(--sev-high); color: var(--sev-high-ink); }
.medium { background: var(--sev-medium); color: var(--sev-medium-ink); }
.low { background: var(--sev-low); color: var(--sev-low-ink); }
.good { background: var(--sev-good); color: var(--sev-good-ink); }
.canvas { height: clamp(480px, calc(100dvh - 249px), 950px); overflow: auto; overscroll-behavior: contain; background: var(--secondary); padding: var(--s12); direction: ltr; }
.stage { position: relative; width: 100%; max-width: 771px; margin: 0 auto; background: var(--surface); direction: ltr; }
.stage.zoomed { width: max(100%, 950px); max-width: none; }
.stage img { width: 100%; height: auto; display: block; }
.no-image { padding: var(--s48) var(--s24); text-align: center; direction: rtl; }
.pin { position: absolute; transform: translate(-50%, -50%); width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; z-index: 1; cursor: pointer; }
.pin span { display: grid; place-items: center; width: 32px; height: 32px; border: 2px solid var(--surface); border-radius: 50%; font-family: var(--voice); font-weight: 700; font-size: 14px; }
.pin:hover span, .pin[aria-pressed=true] span { outline: 3px solid var(--ink); outline-offset: 2px; }
.pin[aria-pressed=true] { z-index: 2; }
@media (max-width: 780px) {
  .stage.zoomed { width: max(100%, 650px); }
  .top { height: 52px; } .top-inner { padding: 0 15px; } .studio-logo img { width: 80px; }
  .viewer { padding: 17px 12px 24px; } .intro { margin-bottom: 14px; align-items: flex-start; gap: 8px; }
  .workspace { grid-template-columns: 1fr; gap: 12px; } .panel { grid-row: 2; } .canvas-card { grid-row: 1; }
  .canvas { height: clamp(215px, 38dvh, 420px); padding: 7px; } .canvas-bar { min-height: 48px; padding: 7px 10px; }
  .legend { gap: 7px; font-size: 12px; } .finding { padding: 16px; } .finding-index { padding: 12px; } .finding-index ol { max-height: none; }
  .pin span { width: 28px; height: 28px; }
}
@media (max-width: 360px) { .counter { display: none; } .legend { width: 100%; order: 3; } .canvas-bar h2 { margin-inline-end: auto; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; } }

/* ---------- back office ---------- */
.admin-wrap { max-width: 1000px; margin: 0 auto; padding: var(--s24) var(--s16) 64px; }
.admin-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s12); margin-bottom: var(--s24); }
.admin-head .studio-logo img { width: 96px; }
.row { display: flex; gap: var(--s8); flex-wrap: wrap; align-items: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s12) var(--s16); }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.card { background: var(--surface); border: 1px solid var(--line); padding: var(--s16); margin-bottom: var(--s16); }
.card h2 { font-size: 18px; line-height: 24px; }
.field { margin-bottom: var(--s12); }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); }
th, td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 14px; line-height: 20px; vertical-align: middle; }
th { font-family: var(--voice); font-weight: 700; background: var(--secondary); }
.table-wrap { overflow-x: auto; }
.badge { font-family: var(--voice); font-weight: 700; font-size: 13px; padding: 2px 8px; border: 1px solid var(--ink); display: inline-block; white-space: nowrap; }
.badge.sent { background: var(--secondary); }
.badge.opened { background: var(--primary); border-color: var(--primary); color: var(--surface); }
.badge.off { border-color: var(--error); color: var(--error); }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: var(--s8) var(--s16); margin: 0; }
.facts dt { font-family: var(--voice); font-weight: 700; font-size: 14px; color: var(--muted); }
.facts dd { margin: 0; }
.codebox { background: var(--highlight); padding: var(--s12) var(--s16); font-family: 'Inconsolata', monospace; font-size: 24px; letter-spacing: .08em; direction: ltr; text-align: left; margin: var(--s8) 0; }
.linkbox { background: var(--secondary); padding: 10px 12px; word-break: break-all; margin: var(--s8) 0; direction: ltr; text-align: left; }
.hint { font-size: 14px; line-height: 20px; color: var(--muted); margin: var(--s4) 0 var(--s12); }
.msg-err { color: var(--error); font-weight: 700; }
.toast { position: fixed; top: 12px; inset-inline: 16px; margin: 0 auto; max-width: 400px; background: var(--ink); color: var(--surface); padding: 12px 16px; text-align: center; font-family: var(--voice); font-weight: 700; z-index: 10; }
.opens { margin: 0; padding-inline-start: var(--s16); }
.gate-note { margin: var(--s24) 0 0; }
