/* Same design line as the donation site: navy brand, light page, white cards, Heebo */
@font-face {
  font-family: "Heebo";
  src: url("fonts/heebo-hebrew-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  unicode-range: U+0307-0308, U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F;
}
@font-face {
  font-family: "Heebo";
  src: url("fonts/heebo-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2212;
}

:root {
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --text: #1c2035;
  --muted: #6b7185;
  --border: #e3e6ef;
  --brand: #2b2a6e;
  --brand-hover: #3a3990;
  --brand-soft: #ecebf8;
  --success: #2e9d4f;
  --success-soft: #e3f4e8;
  --danger: #d64541;
  --danger-soft: #fbe6e5;
  --warning: #e09a12;
  --warning-soft: #fdf1da;
  --radius: 14px;
}

* { box-sizing: border-box; }
html { font-size: 15px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Heebo", "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}
a { color: var(--brand); }
h1 { font-size: 1.6rem; margin: 0 0 14px; }
h1 small { font-size: 1rem; color: var(--muted); font-weight: 400; margin-inline-start: 8px; }
h2 { font-size: 1.2rem; margin: 22px 0 10px; }
h3 { font-size: 1.05rem; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }
.hidden { display: none !important; }

/* ---------- frame ---------- */
.top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 20px;
  background: var(--brand);
  color: #fff;
  flex-wrap: wrap;
}
.top .brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.15rem; }
.top .brand small { font-weight: 400; opacity: 0.75; font-size: 0.8rem; }
.top nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.top nav a { color: #dcdcf5; text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.top nav a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.top nav a.on { background: rgba(255, 255, 255, 0.18); color: #fff; font-weight: 600; }
.top .who { font-size: 0.9rem; opacity: 0.9; }
.top .who .link { color: #fff; }
.wrap { max-width: 1280px; margin: 0 auto; padding: 20px 16px 60px; }
main.bare { padding: 16px; }

/* ---------- building blocks ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px rgba(20, 25, 50, 0.04), 0 4px 16px rgba(20, 25, 50, 0.04);
}
.pad { padding: 16px 18px; margin-bottom: 14px; }
.center-box { max-width: 420px; margin: 8vh auto; padding: 28px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.cols { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; }
.facts { display: flex; flex-direction: column; gap: 6px; }
.flash { background: var(--brand-soft); border-radius: 10px; padding: 10px 14px; margin-bottom: 14px; }
.flash.bad { background: var(--danger-soft); color: #8a1f1c; }
.big-code b { font-size: 1.6rem; letter-spacing: 3px; }

.field { display: flex; flex-direction: column; gap: 5px; font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.field .hint { font-weight: 400; }
.field input, .field select, .field textarea, .input {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 12px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
}
.field input:focus, .field select:focus, .field textarea:focus, .input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.input.mini { padding: 5px 8px; width: auto; }
.input.wide { min-width: min(420px, 100%); flex: 1; }
.input.huge, .big-input { font-size: 1.4rem; padding: 12px 14px; }
.code-input { letter-spacing: 6px; text-align: center; direction: ltr; }
textarea.ltr-nums { font-family: inherit; }
.check { display: flex; align-items: center; gap: 6px; font-size: 0.95rem; color: var(--text); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 16px; align-items: end; }
.form-grid h2 { grid-column: 1 / -1; margin: 0; }
.form-inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-actions { display: flex; gap: 8px; grid-column: 1 / -1; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
form.inline { display: inline; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-hover); }
.btn.danger { color: var(--danger); }
.btn.danger.primary, button.btn.danger:not(.mini) { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.mini { padding: 3px 9px; font-size: 0.85rem; border-radius: 8px; }
.btn.big { padding: 12px 20px; font-size: 1.1rem; }
.link { background: none; border: none; color: var(--brand); cursor: pointer; padding: 0 4px; font: inherit; text-decoration: underline; }

.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 0.8rem; background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.badge.ok { background: var(--success-soft); border-color: #bfe5ca; color: #1d6b35; }
.badge.warn { background: var(--warning-soft); border-color: #f2d6a0; color: #8a5a00; }
.badge.bad { background: var(--danger-soft); border-color: #f2c2c0; color: #8a1f1c; }
.badge.brand { background: var(--brand-soft); border-color: #d6d4f0; color: var(--brand); }

/* ---------- tables (same pattern everywhere: search + live count) ---------- */
.table-box { margin-bottom: 18px; }
.table-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.table-tools .search { min-width: 220px; }
.table-tools .count { background: var(--brand-soft); color: var(--brand); border-radius: 999px; padding: 2px 12px; font-weight: 600; }
.table-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
table.grid { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.grid th { position: sticky; top: 0; background: var(--surface-2); text-align: start; font-weight: 600; padding: 9px 10px; border-bottom: 1px solid var(--border); }
.grid td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.grid tbody tr:nth-child(even) { background: var(--surface-2); }
.grid tbody tr:hover { background: var(--brand-soft); }
.grid tfoot td { background: var(--brand-soft); font-weight: 700; }
.grid tr.dim { opacity: 0.55; }
.grid td.actions { white-space: nowrap; }
.grid .empty td { text-align: center; color: var(--muted); padding: 24px; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 3px 0; }
.warn-list { color: #8a5a00; margin: 6px 0 0; }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 16px; }
.tile { padding: 16px; text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 6px; }
.tile:hover { border-color: var(--brand); }
.tile-title { font-weight: 700; font-size: 1.1rem; }
.tile-sub { color: var(--muted); }
.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); }
.meter span { display: block; height: 100%; background: var(--brand); }

/* ---------- hall map ---------- */
.hall-map { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: flex-start; }
.strip { display: flex; flex-direction: column; gap: 6px; min-width: 190px; flex: 1; }
.strip-name { text-align: center; font-weight: 700; color: var(--muted); }
.ht { background: var(--bc); border-radius: 10px; border: 1px solid rgba(0, 0, 0, 0.06); font-size: 0.85rem; }
.ht.hi { outline: 3px solid var(--brand); }
.ht summary { list-style: none; display: grid; grid-template-columns: 34px 1fr auto; gap: 6px; padding: 6px 8px; cursor: pointer; align-items: center; }
.ht summary::-webkit-details-marker { display: none; }
.ht .tn { font-weight: 800; font-size: 1.05rem; text-align: center; background: rgba(255, 255, 255, 0.7); border-radius: 6px; }
.ht .tg { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ht .tu { color: #444; font-size: 0.8rem; }
.ht ul { margin: 0; padding: 4px 12px 8px 8px; list-style: none; background: rgba(255, 255, 255, 0.6); border-radius: 0 0 10px 10px; }
.ht li.in { color: var(--success); font-weight: 600; }
.block-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.group-list { columns: 3 260px; margin-top: 10px; }

/* ---------- gabbai ---------- */
.cards-list { display: flex; flex-direction: column; gap: 8px; }
.pcard { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.pc-main { flex: 1 1 260px; }
.pc-regs { display: flex; gap: 6px; flex-wrap: wrap; }
.pc-form { display: flex; gap: 6px; align-items: center; }
.live-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.live-table li.in { color: var(--success); font-weight: 600; }

/* ---------- counter + scanner ---------- */
.scanbar { display: flex; gap: 10px; margin-bottom: 16px; }
.scanbar .input { flex: 1; }
.counter-result { min-height: 260px; }
.hint-big { text-align: center; color: var(--muted); font-size: 1.4rem; padding: 60px 0; }
.who-big { font-size: 1.8rem; font-weight: 800; }
.reg-line { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-top: 10px; background: var(--surface-2); }
.reg-line .t { font-size: 1.3rem; font-weight: 700; min-width: 90px; }
.show-pick { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.show-pick .btn { min-width: 110px; flex-direction: column; }
.show-pick .btn small { color: var(--muted); font-size: 0.75rem; }
.show-pick .btn.sel { background: var(--brand); color: #fff; border-color: var(--brand); }
.show-pick .btn.sel small { color: #dcdcf5; }
.seats-pick { display: flex; gap: 6px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.seats-pick .btn.sel { background: var(--brand); color: #fff; }
.print-frame { position: absolute; width: 1px; height: 1px; border: 0; inset-inline-start: -10px; top: -10px; }
.dlg { border: none; border-radius: var(--radius); padding: 20px; width: min(560px, 94vw); }
.dlg::backdrop { background: rgba(20, 25, 50, 0.35); }
.people-pick button { display: block; width: 100%; text-align: start; margin-top: 6px; }

.scanner { max-width: 560px; margin: 0 auto; }
.scan-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 1.1rem; }
.cam { position: relative; background: #111; border-radius: var(--radius); overflow: hidden; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.cam video { width: 100%; height: 100%; object-fit: cover; }
.cam .btn { position: absolute; }
.verdict { border-radius: var(--radius); padding: 22px; text-align: center; min-height: 130px; display: flex; flex-direction: column; justify-content: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); }
.verdict .v-title { font-size: 2.2rem; font-weight: 800; }
.verdict .v-sub { font-size: 1.15rem; }
.verdict.ok { background: var(--success); color: #fff; }
.verdict.warn { background: var(--warning); color: #fff; }
.verdict.bad { background: var(--danger); color: #fff; }

/* ---------- public ---------- */
.public { max-width: 560px; margin: 0 auto; }
.public-head { text-align: center; padding: 18px 0 8px; }
.public-head h1 { color: var(--brand); margin: 0; }
.public-head p { margin: 4px 0 0; color: var(--muted); }

@media (max-width: 760px) {
  .cols { grid-template-columns: 1fr; }
  .top { padding: 8px 12px; gap: 6px 10px; }
  .top .brand small { display: none; }
  .top nav { order: 3; flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; }
  .top nav a { white-space: nowrap; padding: 4px 9px; }
  .top .who { margin-inline-start: auto; font-size: 0.8rem; }
  .wrap { padding: 14px 10px 50px; }
  h1 { font-size: 1.35rem; }
  .pc-form { width: 100%; }
}
