/* Staff console: tabs, emergency form, token marker and print log */
.tabs{display:flex;gap:4px;background:var(--soft);border-radius:16px;padding:4px;margin-bottom:16px}
.tabs button,.tabs a{flex:1;display:flex;align-items:center;justify-content:center;gap:7px;border:0;background:transparent;color:var(--brand-d);font:inherit;font-size:14px;font-weight:600;padding:11px 6px;border-radius:12px;cursor:pointer;text-decoration:none;text-align:center}
.tabs i{font-style:normal}
.tabs .on{background:var(--card);box-shadow:0 1px 5px rgba(0,0,0,.14)}
.tabs button.hidden,.tabs a.hidden,.printer.hidden,.prbanner.hidden{display:none}
.who-line{font-size:13.5px;font-weight:600;color:var(--brand-d);margin-bottom:8px}
.printer{font-size:12.5px;font-weight:600;padding:4px 11px;border-radius:20px;background:#fdecea;color:#8a2a20}
.printer.ok{background:#e6f5ec;color:#136437}
.printer.warn{background:#fff4d6;color:#7a5200}
.prbanner{border-radius:14px;padding:12px 16px;margin-bottom:14px;background:#fdecea;border:2px solid #d9534a;color:#7a1f16}
.prbanner.warn{background:#fff4d6;border-color:#e2b33c;color:#6b4700}
.prbanner b{display:block;font-size:16px}
.prbanner span{font-size:13.5px}

/* printed emergency tokens: reception shows the latest, the pastor page the whole history */
.admin h2.section{font-size:16px;margin:4px 0 8px}
.admin .toolbar h2.section{margin:18px 0 0}
.count{font-size:13px;font-weight:600;color:#991b1b;background:#fee2e2;border-radius:20px;padding:3px 12px;margin-top:18px}
.etoken{display:flex;gap:14px;align-items:flex-start;background:var(--card);border:1px solid var(--line);border-left:6px solid #dc2626;border-radius:14px;padding:14px;margin-bottom:10px}
.etoken .no{flex:none;min-width:64px;padding:8px 6px;border-radius:12px;background:#fca5a5;color:#7f1d1d;font-size:28px;font-weight:600;text-align:center;font-variant-numeric:tabular-nums}
.etoken .what{flex:1;min-width:0;overflow-wrap:anywhere}
.etoken .head{display:flex;justify-content:space-between;gap:10px;align-items:baseline;flex-wrap:wrap}
.etoken .head b{font-size:17px;font-weight:600}
.etoken time{font-size:13px;color:var(--muted);white-space:nowrap}
.etoken .where{font-size:13.5px;color:var(--muted);white-space:pre-wrap}
.etoken .subject{margin-top:6px;font-size:15px;background:#fef2f2;border-radius:10px;padding:8px 11px;white-space:pre-wrap}
.etoken.big{border:2px solid #dc2626;border-left-width:8px;background:#fff5f5;padding:18px;margin-bottom:16px}
.etoken.big .no{min-width:104px;padding:16px 8px;font-size:52px;line-height:1.1}
.etoken.big .head b{font-size:21px}
.etoken.big .subject{font-size:17px;background:#fff}
.etoken.fresh{animation:fresh 1.2s ease 3}
@keyframes fresh{50%{box-shadow:0 0 0 6px #fca5a5}}
@media(prefers-reduced-motion:reduce){.etoken.fresh{animation:none;outline:3px solid #f59e0b}}
.pend{font-size:14px;font-weight:600;border-radius:10px;padding:8px 12px;margin-bottom:8px;background:#fff4d6;color:#7a5200}
.pend.failed{background:#fdecea;color:#8a2a20}
@media(max-width:480px){.etoken.big{flex-direction:column}.etoken.big .what{width:100%}.etoken.big .no{align-self:stretch}}

.emergency{border-top:5px solid #dc2626}
.admin .btn.pink{background:#dc2626}
.admin .btn.pink:hover:not(:disabled){background:#b91c1c}
.admin label.inline{display:inline-block;margin:0}
.toolbar input.narrow{width:auto;flex:0 1 160px;padding:9px 11px}

.counts{display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px}
.counts div{flex:1 1 90px;background:var(--card);border:1px solid var(--line);border-radius:12px;padding:10px 4px;text-align:center}
.counts b{display:block;font-size:22px;font-variant-numeric:tabular-nums}
.counts span{font-size:12px;color:var(--muted)}
.counts .c-tick b{color:#1e8a4c}.counts .c-mbox b{color:#6d28d9}.counts .c-emg b{color:#dc2626}

.tgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(78px,1fr));gap:8px;margin:12px 0}
.tgrid .empty{grid-column:1/-1}
.tok{background:var(--card);border:2px solid var(--line);border-radius:10px;display:flex;flex-direction:column;overflow:hidden;user-select:none}
.tok button{border:0;background:transparent;font:inherit;color:inherit;cursor:pointer}
.tok .num{position:relative;font-size:20px;font-weight:600;padding:13px 4px 9px;font-variant-numeric:tabular-nums}
.tok .mb{border-top:1px solid var(--line);font-size:12px;padding:6px 2px;color:var(--muted);background:#f7f8fa}
.tok.ticked{border-color:#1e8a4c;background:#e6f5ec}
.tok.ticked .num{color:#1e8a4c}
.tok.ticked .num::after{content:"\2713";position:absolute;top:2px;right:6px;font-size:14px}
.tok.mbox{border-color:#6d28d9}
.tok.mbox .mb{background:#6d28d9;color:#fff;font-weight:600}
/* emergency token: pink once printed, a dashed pink edge while it waits for the printer.
   These come last so pink stays visible on a number that is also ticked or M.Box. */
.tok.emg-waiting{border:2px dashed #ef4444}
.tok.emg-printed{background:#fca5a5;border-color:#ef4444}
.tok.emg-printed .num,.tok.emg-printed .num::after{color:#7f1d1d}
.tok.flash{outline:4px solid #f59e0b}

.admin textarea.hidden{display:none}
.job .num{font-size:22px;font-weight:600;min-width:52px;text-align:center}
.arr.printed{background:#e6f5ec;color:#136437}
.arr.failed{background:#fdecea;color:#8a2a20}
.arr.queued,.arr.printing{background:#fff4d6;color:#7a5200}
.kindtag.emg{background:#fee2e2;color:#991b1b}

.overlay{position:fixed;inset:0;z-index:30;background:rgba(0,0,0,.45);display:flex;align-items:center;justify-content:center;padding:16px}
.overlay.hidden{display:none}
.dialog{background:var(--card);border-radius:16px;padding:22px;width:100%;max-width:340px;text-align:center}
.dialog p{font-size:17px;margin-bottom:18px}
.dialog div{display:flex;gap:10px;justify-content:center}
.admin .dialog .btn{min-width:110px}

@media(max-width:640px){
  .tabs button,.tabs a{flex-direction:column;gap:2px;font-size:11.5px;line-height:1.25;padding:7px 2px}
  .tabs i{font-size:19px}
  #filters{display:flex;flex-wrap:wrap;width:100%}
  #filters button{flex:1 1 auto;padding:7px 10px}
}

/* history sheet */
.hsearch{margin-bottom:10px}
.admin .seg.hperiods{display:flex;flex-wrap:wrap;margin-bottom:10px}
.hperiods button{flex:1 1 auto}
.hpickers{display:flex;flex-wrap:wrap;gap:10px}
.hpickers .hfield{flex:1 1 200px;margin:0 0 10px}
.hpickers .hfield.hidden{display:none}
.hfield span{display:block;margin-bottom:4px;font-size:13px}
.hbar{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin:4px 0 10px}
.hbar .actions.hidden,.hmore.hidden{display:none}
.hcount{color:#991b1b;background:#fee2e2;border-radius:20px;padding:3px 12px;font-size:13px}
.hsheet{background:var(--card);border:1px solid var(--line);border-radius:12px;overflow:clip;margin-bottom:12px}
.htable{width:100%;border-collapse:collapse;font-size:14px;table-layout:fixed}
.htable th,.htable td{padding:9px 8px;text-align:left;vertical-align:top;border-bottom:1px solid var(--line);overflow-wrap:anywhere}
.htable thead th{background:#fecaca;color:#7f1d1d;font-size:12.5px;font-weight:600}
.htable .hdate th{background:var(--soft);color:var(--brand-d);font-size:13px;font-weight:600}
.htable tbody tr:not(.hdate):nth-child(even){background:#fafcfb}
.htable tbody tr:last-child td{border-bottom:0}
.htable .c-no{width:64px;text-align:center}
.htable td.c-no span{display:inline-block;min-width:38px;padding:3px 5px;border-radius:8px;background:#fca5a5;color:#7f1d1d;font-weight:600;font-variant-numeric:tabular-nums}
.htable .c-time{width:86px;white-space:nowrap;overflow-wrap:normal;font-size:13px}
.htable thead th:nth-child(2){width:21%}
.htable thead th:nth-child(3){width:18%}
.htable thead th:nth-child(4){width:82px}
.htable .c-subj{white-space:pre-wrap}
.htable .narrow-only{display:none}
.htable td b{font-weight:600}
.hmore{display:block;margin:0 auto 12px}
.hmore.hidden{display:none}
@media(max-width:720px){
  .htable .wide{display:none}
  .htable .narrow-only{display:block;color:var(--muted);font-size:12.5px;line-height:1.45}
  .htable .narrow-only.subj{color:var(--ink);white-space:pre-wrap;margin-top:2px}
  .htable th,.htable td{padding:9px 6px}
  .htable .c-no{width:56px}
  .htable .c-time{width:74px;font-size:12px}
  .htable thead th.c-name{width:auto}
}

/* waiting tab count, and the reprint buttons in the history sheet */
.badge-count{display:inline-block;min-width:20px;padding:0 6px;border-radius:20px;background:#d9534a;color:#fff;font-size:12px;line-height:20px;text-align:center}
.badge-count.hidden{display:none}
.hactions{display:flex;gap:8px;flex-wrap:wrap;align-items:center;margin-top:6px}
.htable .hactions button{font:inherit;font-size:12.5px;font-weight:600;border-radius:9px;cursor:pointer;min-height:34px;padding:5px 12px}
.htable .hreprint{border:1.5px solid #dc2626;background:#fff;color:#991b1b}
.htable .hreprint:disabled{border-color:#e2b33c;background:#fff4d6;color:#7a5200;cursor:default}
.htable .hremove{border:0;background:none;color:var(--danger);text-decoration:underline}
@media(max-width:640px){.tabs button{position:relative}.badge-count{position:absolute;top:2px;right:6px}}
#waiting{margin-top:12px}
#waiting .bkcard .bk:first-child{border-top:0}

/* correcting a printed token */
.htable .hedit{border:1.5px solid var(--brand);background:#fff;color:var(--brand-d)}
.htable .hedit:disabled{opacity:.5;cursor:default}
.hedited{display:inline-block;font-size:11px;font-weight:600;border-radius:20px;padding:0 8px;background:#fff4d6;color:#7a5200;vertical-align:middle}
#editBox{align-items:flex-start;overflow-y:auto}
.dialog.edit{max-width:480px;margin:auto;text-align:left}
.dialog.edit h2{font-size:18px}
.dialog.edit label{margin:12px 0 4px}
.dialog.edit .editbuttons{display:grid;grid-template-columns:1fr;gap:8px;margin-top:14px}
.dialog.edit p.hint{font-size:12.5px;margin:5px 0 0}
.dialog.edit #xMsg{display:block}
.dialog.edit #xMsg:empty{display:none}
.admin .dialog.edit .editbuttons .btn{margin:0;width:100%}
@media(min-width:721px){.htable .hactions{flex-direction:column;align-items:stretch;max-width:130px}}

/* free product slips on the pastor page: teal, so they are never mistaken for pink emergency tokens */
.htypes.hidden{display:none}
.admin .seg.htypes.hidden{display:none}
.htable tr.free td.c-no span,.etoken.freecard .no{background:#99f6e4;color:#134e4a}
.etoken.freecard{border-left-color:#0f766e}
.etoken.freecard .no{font-size:28px}
.admin .btn.sm.hmore{display:flex;margin:0 auto 12px}
.admin .btn.sm.hmore.hidden{display:none}

/* pastor page: the free product slip is the main action, at the top */
.admin .card.freemain{border:3px solid #db2777;margin-top:0}
.admin .card.freemain h2{font-size:22px;color:#9d174d;margin:0}
.freemain label{margin-top:10px}
.freemain input{font-size:22px;text-align:center}
.admin .card.freemain .btn{font-size:19px;padding:18px 20px;margin-top:14px}

/* pastor page: Waiting sits in the top bar */
.pastor .hright{flex-wrap:wrap;row-gap:8px}
.headtab{display:inline-flex;align-items:center;gap:6px;border:2px solid var(--line);background:#fff;color:var(--brand-d);font:inherit;font-size:13px;font-weight:600;padding:5px 12px;border-radius:20px;cursor:pointer;min-height:36px}
.headtab.hidden{display:none}
.headtab i{font-style:normal}
.headtab.on{background:var(--brand);border-color:var(--brand);color:#fff}
.headtab .badge-count{position:static}
@media(max-width:640px){.headtab .badge-count{position:static}}

/* pastor page: the printer warning is tappable, and Waiting shows the two devices */
.pastor .prbanner{cursor:pointer}
.prmore{display:block;margin-top:8px;border:0;background:none;color:inherit;font:inherit;font-size:13.5px;font-weight:600;text-decoration:underline;cursor:pointer;padding:4px 0;text-align:left}
.devices{margin-bottom:16px}
.devices:empty{display:none}
.device{display:flex;gap:12px;align-items:flex-start;border:2px solid var(--line);border-radius:14px;padding:12px 14px;margin-bottom:8px;background:var(--card)}
.device i{font-style:normal;font-size:22px;line-height:1.3}
.device b{display:block;font-size:15px}
.device span{display:block;font-size:14px;font-weight:600}
.device small{display:block;font-size:12.5px;color:var(--muted)}
.device.ok{border-color:#7fc79b;background:#e6f5ec}.device.ok span{color:#136437}
.device.bad{border-color:#d9534a;background:#fdecea}.device.bad span{color:#8a2a20}
.device.warn{border-color:#e2b33c;background:#fff4d6}.device.warn span{color:#6b4700}
.devices h3{font-size:15px;margin:10px 0 4px}
.devices ol{padding-left:22px;font-size:14px;line-height:1.6}

/* pastor page: Back button at the top left, in the bar that stays on screen */
.htitle{display:flex;align-items:center;gap:10px;min-width:0}
.backtop{flex:none;min-height:44px;padding:8px 14px;border:0;border-radius:12px;background:var(--brand);color:#fff;font:inherit;font-size:15px;font-weight:600;cursor:pointer;white-space:nowrap;touch-action:manipulation}
.backtop.hidden{display:none}
/* on a phone the title makes room for the button */
@media(max-width:480px){.admin.pastor.hasback .htitle strong{font-size:14px;white-space:normal;line-height:1.3}}
/* pastor booked slots: tower buttons in two columns on a phone */
#slotList .bkcard .bk:first-child{border-top:0}
@media(max-width:560px){.admin .seg.hperiods#slotTower{display:grid;grid-template-columns:1fr 1fr}}

/* shown inside the admin control centre */
.embed .page #logout,.embed .page #who,.embed body.admin:not(.pastor) header,.embed body.admin:not(.pastor) .page #tabs{display:none}
.embed body.admin .page{padding:12px 10px 30px}

/* token marker: a tab for each prayer tower */
.admin .seg.towertabs{display:flex;flex-wrap:wrap;margin-bottom:12px}
.towertabs button{flex:1 1 30%;min-height:44px}
[data-view="tokens"].no-pink .printonly{display:none}

/* pastor page: the marker is for looking only */
.pastor .kcell{display:grid;place-items:center;cursor:default}
.admin.pastor h2.pmarkerhead{margin-top:20px}

/* door login: the token marker and nothing else */
.door-only{display:none}
html.door .door-only{display:block}
html.door #tabs,html.door #towerTabs,html.door #currentControl,html.door .door-hide{display:none !important}
html.door #quick .narrow{flex:1 1 100%;font-size:22px;text-align:center}
html.door #quick .btn{flex:1;min-height:52px}

/* the emergency subject: large and easy to read everywhere */
.etoken .subject{font-size:20px;line-height:1.55}
.etoken.big .subject{font-size:25px;line-height:1.55;font-weight:500}
.htable .c-subj{font-size:17px;line-height:1.5}
.htable .narrow-only.subj{font-size:17px;line-height:1.5}
.wsubj{font-size:18px;line-height:1.5;margin:4px 0;white-space:pre-wrap;overflow-wrap:anywhere}
.admin textarea.subjectbox{font-size:20px;line-height:1.5}
.admin .btn.freebtn{background:#db2777}
.admin .btn.freebtn:hover:not(:disabled){background:#be185d}

/* an emergency number that is also marked: half green, half light red */
.tok.ticked.emg-printed{background:linear-gradient(135deg,#86efac 0,#86efac 50%,#fca5a5 50%,#fca5a5 100%);border-color:#16a34a}
.tok.ticked.emg-printed .num,.tok.ticked.emg-printed .num::after{color:#111827}
.tok.ticked.emg-printed:not(.mbox) .mb{background:rgba(255,255,255,.7);color:#374151}
