/* Admin control centre */
.admin .nav{grid-template-columns:repeat(5,1fr)}
.kviews{display:flex;gap:6px;flex-wrap:wrap;margin-bottom:14px;scroll-margin-top:90px}
.kviews button{position:relative;display:flex;align-items:center;gap:6px;flex:1 1 auto;justify-content:center;border:2px solid var(--line);background:var(--card);color:var(--brand-d);font:inherit;font-size:13.5px;font-weight:600;border-radius:12px;padding:9px 10px;min-height:44px;cursor:pointer}
.kviews button i{font-style:normal}
.kviews button.on{background:var(--brand);border-color:var(--brand);color:#fff}
.kbadge{min-width:20px;padding:0 6px;border-radius:20px;background:#d9534a;color:#fff;font-size:12px;line-height:20px}
.kframebox.hidden,#kOverviewBox.hidden,#kWaitingBox.hidden{display:none}
/* the tools scroll inside their box, so their confirm boxes and edit form stay in view */
.kframe{display:block;width:100%;height:calc(100vh - 190px);min-height:520px;border:2px solid var(--line);border-radius:16px;background:var(--bg)}

.kdevices{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px}
.kdevice{border:2px solid var(--line);border-radius:14px;background:var(--card);padding:10px 12px}
.kdevice i{font-style:normal;margin-right:6px}
.kdevice b{font-size:14px}
.kdevice span,.kdevice small{display:block;font-size:13px}
.kdevice span{font-weight:600}
.kdevice small{color:var(--muted)}
.kdevice.ok{border-color:#7fc79b;background:#e6f5ec}
.kdevice.bad{border-color:#d9534a;background:#fdecea}
.kdevice.warn{border-color:#e2b33c;background:#fff4d6}

.kstats{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.kstat{border:1px solid var(--line);border-radius:14px;background:var(--card);padding:10px 6px;font:inherit;color:var(--ink);cursor:pointer;text-align:center}
.kstat b{display:block;font-size:22px;font-variant-numeric:tabular-nums}
.kstat span{display:block;font-size:12px;color:var(--muted);line-height:1.35}
.kstat.pink b{color:#dc2626}.kstat.red b{color:#b8322a}
.ktowers{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;margin-bottom:8px}
.ktowers button{border:2px solid var(--line);border-radius:12px;background:var(--card);color:var(--brand-d);font:inherit;font-size:13px;font-weight:600;padding:8px 4px;cursor:pointer;min-height:52px}
.ktowers button b{display:block;font-size:16px;color:var(--ink);font-variant-numeric:tabular-nums}
.ktowers button.on{background:var(--brand);border-color:var(--brand);color:#fff}
.ktowers button.on b{color:#fff}
.kcounts{font-size:13px;font-weight:600;margin-bottom:8px;white-space:pre-wrap}

.khead{display:flex;justify-content:space-between;align-items:center;gap:10px;margin:20px 0 8px}
.admin .khead h3{font-size:16px}
.klatest{display:flex;gap:14px;border:2px solid #dc2626;border-radius:14px;background:#fff5f5;padding:14px;overflow-wrap:anywhere}
.klatest b{display:block;font-size:18px}
.klatest small{display:block;color:var(--muted)}
.klatest p{font-size:15px;margin:4px 0}
.kno{flex:none;align-self:flex-start;min-width:52px;padding:6px;border-radius:10px;background:#fca5a5;color:#7f1d1d;font-weight:600;font-size:20px;text-align:center}
.klatest .kno{font-size:34px;min-width:76px;padding:12px 8px}
.ktime{white-space:nowrap}
#kOverviewBox .bkcard .bk:first-child,#kWaitingBox .bkcard .bk:first-child{border-top:0}

.kstatus{display:inline-block;font-size:12.5px;font-weight:600;border-radius:20px;padding:2px 10px;background:#fff4d6;color:#7a5200}
.kstatus.failed{background:#fdecea;color:#8a2a20}

/* every number for today: green tick, red M.Box strip, pink emergency */
.kgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(40px,1fr));gap:5px}
.kcell{position:relative;min-height:38px;border:2px solid var(--line);border-radius:8px;background:var(--card);color:var(--ink);font:inherit;font-size:13px;font-weight:600;cursor:pointer;font-variant-numeric:tabular-nums}
.kcell.ticked{border-color:#1e8a4c;background:#e6f5ec;color:#1e8a4c}
.kcell.ticked::after{content:"\2713";position:absolute;top:-1px;right:3px;font-size:10px}
.kcell.mbox{box-shadow:inset 0 -7px 0 #6d28d9}
.kcell.emg-printed.mbox{box-shadow:inset 0 -8px 0 #6d28d9,inset 0 -10px 0 #fff}
.kcell.emg-waiting{border:2px dashed #ef4444}
.kcell.emg-printed{background:#fca5a5;border-color:#ef4444;color:#7f1d1d}

@media(max-width:640px){
  .admin .nav{grid-template-columns:repeat(5,1fr)}
  .kdevices{grid-template-columns:1fr}
  .kviews button{flex:1 1 28%;flex-direction:column;gap:2px;font-size:11.5px;line-height:1.25;padding:7px 4px}
  .kbadge{position:absolute;top:3px;right:6px}
  .kframe{height:calc(100vh - 250px);height:calc(100dvh - 250px);min-height:420px}
}

.wsubj{font-size:17px;line-height:1.5;margin:4px 0;overflow-wrap:anywhere}
.klatest p{font-size:21px;line-height:1.5}

.kcell.ticked.emg-printed{background:linear-gradient(135deg,#86efac 0,#86efac 50%,#fca5a5 50%,#fca5a5 100%);border-color:#16a34a;color:#111827}
