:root {
  --navy: #1e3a8a;
  --blue: #2563eb;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #bfdbfe;
  --head: #d6e6f8;
  --bg: #f4f8fd;
  --white: #fff;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: "Segoe UI", Arial, sans-serif; background: var(--bg); color: var(--ink); }
body { display: flex; flex-direction: column; }
.wrap { max-width: 720px; margin: 0 auto; padding: 28px 20px 40px; width: 100%; }
.wrap-wide { max-width: 980px; }
.brand { color: var(--navy); font-weight: 800; letter-spacing: .04em; margin: 0; font-size: 13px; text-transform: uppercase; }
h1 { margin: 8px 0 4px; font-size: 28px; color: var(--navy); }
.lead { margin: 0 0 24px; color: var(--muted); }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 10px; padding: 22px; }
.edit-card { margin-top: 16px; }
label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; color: #334155; margin-bottom: 14px; font-size: 14px; }
input { min-height: 44px; border: 1px solid #cbd5e1; border-radius: 6px; padding: 0 12px; font-size: 16px; }
input:focus { outline: none; border-color: #60a5fa; box-shadow: 0 0 0 3px #dbeafe; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
button, .btn { min-height: 44px; border: 0; border-radius: 6px; padding: 0 18px; font-weight: 700; cursor: pointer; font-size: 15px; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.primary { background: var(--blue); color: #fff; }
.dark { background: #1e3a8a; color: #fff; }
.soft { background: #fff; color: var(--navy); border: 1px solid var(--line); }
.status { margin: 14px 0 0; color: var(--muted); min-height: 1.2em; }
.err { color: #b91c1c; }
.ok { color: #166534; }
.token { font-size: 64px; font-weight: 800; letter-spacing: 3px; color: var(--navy); margin: 12px 0; }
.now { font-size: clamp(72px, 18vw, 160px); font-weight: 800; letter-spacing: 4px; color: var(--navy); margin: 12px 0 8px; line-height: 1; text-align: center; }
.display {
  min-height: 100vh;
  padding: 16px 22px 22px;
  display: flex;
  flex-direction: column;
  background: radial-gradient(1200px 700px at 50% -10%, #2563eb 0%, #1e3a8a 38%, #0b1d4a 100%);
  color: #fff;
}
.display h1 { text-align: center; font-size: clamp(22px, 3vw, 36px); color: #fff; margin: 4px 0 12px; }
.display .brand { color: #bfdbfe; text-align: center; font-size: 15px; }
.display .topbar { border-color: rgba(191, 219, 254, 0.25); }
.display .soft { background: rgba(255,255,255,.12); color: #fff; border-color: rgba(191,219,254,.35); }
.display .home { background: #fff; color: #1e3a8a; }
.display .lang-switch button.active { background: #fff; color: #1e3a8a; border-color: #fff; }
.board-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  flex: 1;
  min-height: 0;
}
.board-side {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(191,219,254,.28);
  border-radius: 18px;
  padding: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.board-side h2 {
  margin: 0;
  text-align: center;
  font-size: clamp(22px, 2.6vw, 34px);
  color: #fff;
  background: rgba(0,0,0,.18);
  padding: 14px 12px;
}
.serving-panel {
  margin: 16px 16px 12px;
  background: #fff;
  border-radius: 16px;
  padding: 14px 12px 18px;
  text-align: center;
}
.serving-panel .now-label {
  margin: 0;
  color: #64748b;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}
.display .now {
  font-size: clamp(64px, 9vw, 132px);
  font-weight: 800;
  letter-spacing: 3px;
  color: #1e3a8a;
  margin: 6px 0 4px;
  line-height: 1;
}
.display .now.idle {
  font-size: clamp(32px, 4vw, 52px);
  letter-spacing: 0;
  color: #334155;
  font-weight: 800;
}
.please-come {
  margin: 0;
  color: #2563eb;
  font-weight: 700;
  font-size: clamp(14px, 1.5vw, 18px);
}
.serving-panel.on-break {
  background: #fff7ed;
  border: 2px solid #f97316;
}
.serving-panel.on-break .now {
  color: #c2410c;
  animation: qmsNextBlink 1s ease-in-out infinite;
}
.serving-panel.on-break .please-come { color: #c2410c; visibility: visible !important; }
.board-side.on-break h2 { background: #c2410c; }
.break-btn { background: #c2410c; color: #fff; }
.break-btn.on { background: #166534; }
@keyframes qmsFlash {
  0% { box-shadow: 0 0 0 0 rgba(37,99,235,.7); transform: scale(1); }
  40% { box-shadow: 0 0 0 16px rgba(37,99,235,0); transform: scale(1.02); }
  100% { box-shadow: 0 0 0 0 rgba(37,99,235,0); transform: scale(1); }
}
.queue-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 20px 8px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #bfdbfe;
  font-size: 14px;
}
.queue-list {
  flex: 1;
  overflow: hidden;
  padding: 0 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.queue-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: clamp(22px, 2.4vw, 34px);
  font-weight: 800;
  color: #fff;
  min-width: 0;
}
.queue-row .pos {
  opacity: .85;
  font-size: 14px;
  letter-spacing: .08em;
  text-transform: uppercase;
  flex: 0 0 auto;
}
.queue-row span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.queue-row.is-next {
  background: #2563eb;
  flex-direction: column;
  align-items: stretch;
  padding: 16px;
  font-size: clamp(36px, 4.5vw, 64px);
  animation: qmsNextBlink 1s ease-in-out infinite;
}
@keyframes qmsNextBlink {
  0%, 100% { opacity: 1; filter: brightness(1); }
  50% { opacity: 0.35; filter: brightness(1.45); }
}
.queue-row.is-next .pos { font-size: 14px; text-align: center; }
.queue-row.is-next span:last-child {
  text-align: center;
  white-space: nowrap;
}
.queue-empty {
  text-align: center;
  color: #bfdbfe;
  font-size: 20px;
  padding: 24px 8px;
}
@media (max-width: 800px) {
  .board-grid { grid-template-columns: 1fr; }
}
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { background: var(--head); color: var(--navy); border: 1px solid #b7cce8; padding: 8px; text-align: left; }
.table td { border: 1px solid #d5e3f4; padding: 8px; }
.table tr:nth-child(even) td { background: #f4f8fd; }
.nav { display: flex; gap: 10px; margin: 0 0 20px; flex-wrap: wrap; }
.muted { color: var(--muted); font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 0 0 16px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.stat b { display: block; font-size: 22px; color: var(--navy); }
.stat span { color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.call-xl {
  width: 100%;
  min-height: 72px;
  font-size: 22px;
  letter-spacing: .04em;
  background: #1e3a8a;
  color: #fff;
  margin: 8px 0 12px;
}
.call-xl:disabled { opacity: .45; cursor: not-allowed; }
.table td.actions { white-space: nowrap; }
.table .call-row {
  min-height: 44px;
  padding: 0 14px;
  font-size: 15px;
  background: #1e3a8a;
  color: #fff;
  border: 0;
}
.pill { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 11px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.pill-served { background: #dcfce7; color: #166534; }
.pill-skip { background: #fee2e2; color: #991b1b; }
.ar { display: block; font-family: Tahoma, Arial, sans-serif; font-weight: 600; margin-top: 6px; direction: rtl; }
.display .pwa-bar { display: none; }
.lang-switch button { min-width: 108px; min-height: 48px; }
.pwa-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 0 0 16px; }
.pwa-bar .status { margin: 0; min-height: 0; }
@media (display-mode: standalone) {
  .pwa-install-only { display: none; }
}
.topbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin: 0 0 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.topbar .home { background: var(--navy); color: #fff; }
.display .topbar { justify-content: center; }
.lang-switch { display: inline-flex; gap: 6px; margin-inline-start: auto; }
.lang-switch button.active { background: var(--navy); color: #fff; border-color: var(--navy); }
.display .topbar .home { background: #fff; color: #1e3a8a; }
.display .lang-switch button.active { background: #fff; color: #1e3a8a; border-color: #fff; }
html[dir="rtl"] body { font-family: Tahoma, "Segoe UI", Arial, sans-serif; }
.portal-hero { margin-bottom: 8px; }
.portal-hero .brand { font-size: 14px; }
.how-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); margin: 0 0 24px; }
.portal-how h2, .wrap-wide > h2 { color: var(--navy); font-size: 18px; margin: 8px 0 12px; }
.school-list { display: grid; gap: 12px; margin: 18px 0; }
.admin-table { width: 100%; border-collapse: collapse; margin: 16px 0; background: #fff; }
.admin-table th { background: #d6e6f8; color: #1e3a8a; font-size: 11px; text-align: start; padding: 8px; border: 1px solid #b7cce8; }
.admin-table td { font-size: 12px; padding: 8px; border: 1px solid #d5e3f4; }
.check { flex-direction: row; align-items: center; gap: 10px; font-weight: 600; }
.school-card {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
}
.school-card b { display: block; color: var(--navy); font-size: 18px; }
.school-card span { color: var(--muted); font-size: 13px; }
.school-card .row { margin-top: 10px; }
.display:fullscreen,
.display:-webkit-full-screen {
  width: 100vw;
  height: 100vh;
  padding: 12px 16px 16px;
  background: radial-gradient(1200px 700px at 50% -10%, #2563eb 0%, #1e3a8a 38%, #0b1d4a 100%);
}
.display:fullscreen .topbar a,
.display:fullscreen .topbar [data-qms-back],
.display:-webkit-full-screen .topbar a,
.display:-webkit-full-screen .topbar [data-qms-back] {
  display: none;
}
.display:fullscreen .topbar,
.display:-webkit-full-screen .topbar {
  margin: 0 0 8px;
  padding: 4px 0;
  border: 0;
}
#fs-btn { min-width: 140px; }
.desk-alert {
  position: sticky;
  top: 0;
  z-index: 20;
  background: #1e3a8a;
  color: #fff;
  border-radius: 10px;
  padding: 14px 16px;
  margin: 0 0 16px;
}
.desk-alert p { margin: 0 0 10px; font-weight: 800; font-size: 18px; }
.desk-alert .call-xl { margin: 0; min-height: 52px; background: #2563eb; }
.desk-alert .primary { background: #fff; color: #1e3a8a; }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0 0 16px; }
.desk-choice {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-weight: 700;
  color: var(--navy);
  cursor: pointer;
}
.desk-choice:has(input:checked) { border-color: var(--blue); box-shadow: 0 0 0 3px #dbeafe; }
.choice-label { font-weight: 700; color: #334155; margin: 0 0 8px; font-size: 14px; }
@media (max-width: 640px) { .choice-row { grid-template-columns: 1fr; } }
