/* Onsite screen skin only. Business controllers own visibility, modes and results.
   No iframe/template/physical print rules; no camera, polling or theme scripts. */
@media screen {
  body.system-studio.system-onsite {
    margin: 0;
    background: #faf7f0;
    color: #29372f;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang HK", "Microsoft JhengHei", sans-serif;
    font-size: 16px;
    line-height: 1.6;
  }
  body.system-onsite .hidden,
  body.system-onsite [hidden] { display: none !important; }
  body.system-onsite > header {
    position: static;
    background: #fffdf8;
    color: #29372f;
    border-bottom: 1px solid #deded1;
    box-shadow: none;
    gap: 12px;
    flex-wrap: wrap;
  }
  body.system-onsite header h1 { color: #29372f; font-size: 1.25rem; line-height: 1.4; }
  body.system-onsite header .mini { color: #556258; font-size: 1rem; overflow-wrap: anywhere; }
  body.system-onsite header a,
  body.system-onsite .onsite-links a {
    color: #255c50;
    background: #fff;
    border: 1px solid #c5d3c7;
    border-radius: 8px;
    padding: 10px 12px;
    min-height: 44px;
    font-size: 1rem;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  body.system-onsite header a:hover,
  body.system-onsite .onsite-links a:hover { background: #edf3e8; color: #193e36; transform: none; }
  body.system-onsite .wrap { width: 100%; padding: 20px 16px 40px; }
  body.system-onsite .card {
    background: #fffefb;
    color: #29372f;
    border: 1px solid #deded1;
    border-radius: 12px;
    box-shadow: none;
    padding: 20px;
    min-width: 0;
    scroll-margin-top: 16px;
  }
  body.system-onsite .card h2,
  body.system-onsite .onsite-heading { color: #29372f; font-size: 1.2rem; line-height: 1.5; margin-bottom: 12px; }
  body.system-onsite .onsite-note { font-size: 1rem; color: #556258; margin: 8px 0 16px; }
  body.system-onsite label,
  body.system-onsite .onsite-label { font-size: 1rem; color: #394c40; line-height: 1.5; margin: 12px 0 6px; }
  body.system-onsite .onsite-label { display: block; font-weight: 650; }
  body.system-onsite .muted { color: #556258; font-size: 1rem; line-height: 1.6; overflow-wrap: anywhere; }
  body.system-onsite input,
  body.system-onsite select,
  body.system-onsite textarea {
    min-width: 0;
    max-width: 100%;
    min-height: 48px;
    border: 1px solid #aab9ac;
    border-radius: 8px;
    background: #fff;
    color: #29372f;
    font-size: max(16px, 1rem);
    line-height: 1.5;
    padding: 10px 12px;
  }
  body.system-onsite input::placeholder { color: #657369; opacity: 1; }
  body.system-onsite button {
    min-height: 48px;
    max-width: 100%;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: max(16px, 1rem);
    line-height: 1.5;
    cursor: pointer;
    box-shadow: none;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  body.system-onsite button:hover { transform: none; box-shadow: none; }
  body.system-onsite button.gray { color: #33483d; background: #eaf0e6; }
  body.system-onsite :is(a, button, input, select, textarea):focus-visible {
    outline: 3px solid #805716;
    outline-offset: 3px;
    box-shadow: 0 0 0 5px #fffdf8;
  }
  body.system-onsite .row { gap: 10px; min-width: 0; }
  body.system-onsite .row > * { max-width: 100%; }
  body.system-onsite .pageLogo { margin: 0 0 16px; text-align: left; }
  body.system-onsite .pageLogo img {
    max-width: min(100%, 230px);
    max-height: 48px;
    opacity: 1;
    filter: none;
    /* Existing light-on-dark brand asset stays unmodified. */
    background: #253a35;
    padding: 6px 10px;
    border-radius: 6px;
  }
  body.system-onsite .onsite-links { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 16px; }

  /* Event-day: context strip, launch toolbar, then an unboxed statistics rail. */
  body.onsite-event .headerInner { max-width: 1280px; min-width: 0; gap: 12px; }
  body.onsite-event .headerBrand { min-width: 0; flex-wrap: wrap; }
  body.onsite-event header .topLogo { background: transparent; border-radius: 0; padding: 0; height: 42px; max-width: 190px; }
  body.onsite-event .wrap { max-width: 1280px; margin: 0 auto 32px; }
  body.onsite-event #loginCard { max-width: 560px; margin: 6vh auto; padding: 28px; }
  body.onsite-event #loginCard::after { content: none; }
  body.onsite-event #loginCard .row { align-items: stretch; }
  body.onsite-event #adminCode { flex: 1 1 220px; }
  body.onsite-event .card h2::before { background: #6f8564; box-shadow: none; }
  body.onsite-event .evbar {
    background: #eef2e5;
    color: #29372f;
    border: 1px solid #d2dbc6;
    border-left: 5px solid #6f8564;
    border-radius: 10px;
    box-shadow: none;
    overflow: visible;
  }
  body.onsite-event .evbar .muted { color: #4f5f51; }
  body.onsite-event #evSel { flex: 1 1 260px; min-width: 0; }
  /* Original JS emits pale inline text for a dark strip; readable on the new strip. */
  body.onsite-event #codeLine b { color: #78500d !important; font-size: 1rem !important; }
  body.onsite-event #codeLine a { color: #24594d !important; }
  body.onsite-event .toolBar { background: #fffdf8; box-shadow: none; border-color: #deded1; padding: 16px; }
  body.onsite-event .toolBar b { font-size: 1rem; color: #394c40; }
  body.onsite-event #statsCard { border: 0; background: transparent; padding: 20px 0; }
  body.onsite-event .stats { gap: 0; border-block: 1px solid #d6dccf; }
  body.onsite-event .stat,
  body.onsite-event .stat:nth-child(even) { background: transparent; border: 0; border-radius: 0; padding: 20px 12px; }
  body.onsite-event .stat small { color: #556258; font-size: 1rem; }
  body.onsite-event .stat b { font-size: 2.1rem; }
  body.onsite-event .sess { font-size: 1rem; }
  body.onsite-event .feats { background: #f6f7ef; border-color: #deded1; }
  body.onsite-event .feats label { white-space: normal; min-height: 48px; margin: 0; }
  body.onsite-event input[type="checkbox"] { min-height: 22px; width: 22px; height: 22px; flex-shrink: 0; padding: 0; }
  body.onsite-event .tplCard { width: 170px; }
  body.onsite-event .tplCard .lbl { font-size: 1rem; }

  /* Scan: narrow focused camera surface; supporting operations below it. */
  body.onsite-scan .wrap { max-width: 620px; }
  body.onsite-scan #setupCard { border-top: 4px solid #83936b; }
  body.onsite-scan #ctxCard { background: #eef2e5; border-color: #d2dbc6; }
  body.onsite-scan #reader { background: #101b18; }
  body.onsite-scan #manualCard,
  body.onsite-scan #searchCard,
  body.onsite-scan #logCard { border-radius: 0; border-width: 0 0 1px; background: transparent; padding: 16px 0; }
  body.onsite-scan #log { font-size: 1rem; color: #556258; max-height: 240px; overflow-wrap: anywhere; }
  body.onsite-scan #log div { border-color: #d6dccf; padding: 8px 0; }
  body.onsite-scan #logCard button { font-size: 1rem !important; }
  body.onsite-scan :is(.tierTag, .stickerTag) { font-size: 1rem; }
  body.onsite-scan #sres { overflow-wrap: anywhere; }
  body.onsite-scan #sres .muted span[style] { color: #805716 !important; }
  body.onsite-scan #kioskHint .big { color: #29372f; }
  body.onsite-scan #kioskHint .sub { color: #556258; font-size: 1rem; }
  body.onsite-scan #kioskHint .exit { color: #556258; font-size: 1rem; padding: 12px; }
  body.onsite-scan.kiosk .onsite-links { display: none !important; }

  /* ID selectors survive overlay.className replacement. Do not recolour statuses,
     sticker white/blue/pink or VIP/VVIP. Safe vertical scroll at enlarged fonts. */
  body.onsite-scan #overlay {
    padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    justify-content: flex-start;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    color: #fff;
    line-height: 1.35;
  }
  body.onsite-scan #overlay > div { flex-shrink: 0; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
  body.onsite-scan #overlay::before,
  body.onsite-scan #overlay::after { content: ""; margin-block: auto; }
  body.onsite-scan #ovSticker { min-width: 0; width: min(100%, 440px); padding: 12px; font-size: 1.8rem; }
  body.onsite-scan #ovTier { padding: 8px 16px; font-size: 1.6rem; letter-spacing: 2px; }
  body.onsite-scan #ovIcon { font-size: 3rem; }
  body.onsite-scan #ovTitle { font-size: 1.8rem; }
  body.onsite-scan #ovName,
  body.onsite-scan.kiosk #ovName { font-size: 2.5rem; }
  body.onsite-scan #ovSub,
  body.onsite-scan.kiosk #ovSub { font-size: 1.2rem; padding-bottom: 12px; }

  /* Badge: setup desk and queue rows, never a print-template restyle. */
  body.onsite-badge .wrap { max-width: 960px; }
  body.onsite-badge #setupCard { max-width: 640px; margin-inline: auto; border-top: 4px solid #83936b; }
  body.onsite-badge #main > .card { border-radius: 0; border-width: 0 0 1px; padding: 24px 0; background: transparent; }
  body.onsite-badge .tip { background: #f3eedb; border-color: #ddd2b6; color: #625131; font-size: 1rem; overflow-wrap: anywhere; }
  body.onsite-badge .person { flex-wrap: wrap; gap: 12px; border-color: #d6dccf; padding: 16px 4px; }
  body.onsite-badge .person .info { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }
  body.onsite-badge .person .info b { font-size: 1.2rem; }
  body.onsite-badge .person .info span:not(.tierTag) { color: #556258; font-size: 1rem; }
  body.onsite-badge .person .info .tierTag { font-size: 1rem; }
  body.onsite-badge .person .info .tierTag.vip { background: #d4af37; color: #3a2e00; }
  body.onsite-badge .person .info .tierTag.vvip { background: #0b1f3a; color: #d4af37; }
  body.onsite-badge .person .printed { color: #136b48; font-size: 1rem; }
  body.onsite-badge .toggle { min-height: 48px; padding: 8px 12px; border: 1px solid #c5d3c7; border-radius: 8px; background: #fffefb; }
  body.onsite-badge .toggle i { flex-shrink: 0; }

  @media (max-width: 480px) {
    body.system-onsite .wrap { padding: 12px 10px 28px; }
    body.system-onsite .card { padding: 16px 12px; }
    body.system-onsite > header { padding: 12px; }
    body.system-onsite .row > input,
    body.system-onsite .row > select { flex-basis: 100% !important; width: 100%; }
    body.onsite-event .headerInner { padding: 0; }
    body.onsite-event #loginCard { padding: 20px 14px; }
    body.onsite-event .toolBar button { width: 100%; }
    body.onsite-event .stat { min-width: 120px; }
    body.onsite-event .tplCard { width: calc(50% - 6px); min-width: 0; }
    body.onsite-badge .person > div:last-child { margin-left: auto; }
  }
  @media (prefers-reduced-motion: reduce) {
    body.system-onsite .person,
    body.system-onsite button,
    body.system-onsite .tplCard { animation: none; transition: none; }
  }
}
