:root {
  --red: #AF1611; --red-dark: #8c110d; --ink: #1d1b1a; --muted: #6b6662; --line: #e3dfdc;
  --bg: #f5f3f1; --card: #ffffff; --ok: #2E7D32; --warn: #b26a00;
}
* { box-sizing: border-box; }
[hidden], .check[hidden] { display: none !important; } /* .field / .row set display, which would otherwise beat the attribute */
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.45 "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; }
button, input, select { font: inherit; }
h2 { font-size: 1.25rem; margin: 0 0 .5rem; }
.muted { color: var(--muted); font-size: .95rem; margin: .2rem 0 .8rem; }
.hint { color: var(--muted); font-size: .95rem; }

.top { display: flex; flex-wrap: wrap; gap: .75rem 1.5rem; align-items: center; padding: .75rem 1.25rem; background: #3a3634; color: #fff; position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: .6rem; font-weight: 600; font-size: 1.2rem; }
.brand-logo { height: 28px; }
.tabs { display: flex; gap: .25rem; }
.tabs button { background: transparent; color: #ddd; border: 0; padding: .55rem .9rem; border-radius: 8px; cursor: pointer; font-size: 1rem; }
.tabs button.on { background: rgba(255,255,255,.15); color: #fff; }
.who { margin-left: auto; font-size: .95rem; color: #ddd; }
.link { background: none; border: 0; color: #ffb4b0; text-decoration: underline; cursor: pointer; padding: 0 .2rem; }

main { max-width: 1200px; margin: 0 auto; padding: 1rem; }
.tab { display: none; } .tab.on { display: block; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid2 .panel { margin-bottom: 0; }
.grid2 { margin-bottom: 1rem; }
.actions-row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; margin-bottom: 1rem; }
.count { color: var(--muted); font-weight: 400; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .35rem; padding: .55rem 1rem; min-height: 44px;
  border-radius: 10px; border: 1px solid #cfc9c5; background: #fff; color: var(--ink); cursor: pointer; font-size: 1rem; text-decoration: none; }
.btn:hover { background: #f1eeec; }
.btn.big { padding: .8rem 1.3rem; font-size: 1.08rem; font-weight: 600; min-height: 54px; }
.btn.primary { background: var(--red); border-color: var(--red); color: #fff; }
.btn.primary:hover { background: var(--red-dark); }
.btn.danger { color: var(--red); border-color: #e8b7b4; }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.small { min-height: 38px; padding: .35rem .7rem; font-size: .95rem; }

.tvbox { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: 10px; overflow: hidden; }
.tvimg { position: absolute; inset: 0; background: center / contain no-repeat; transition: opacity .4s; }
.tvlabel { position: absolute; left: .6rem; top: .6rem; background: rgba(0,0,0,.65); color: #fff; padding: .15rem .55rem; border-radius: 6px; font-size: .85rem; }
.tvidle { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; }
.tvidle img { max-width: 45%; max-height: 35%; }
.tvidle div { font-size: 2.2rem; font-weight: 200; margin-top: .4rem; }

.pincard { border: 2px solid var(--red); border-radius: 14px; padding: 1rem; background: #fff6f5; }
.pincard h2 { color: var(--red); }
.pinrow { display: flex; gap: 1rem; align-items: flex-start; }
.pinrow img { width: 42%; border-radius: 8px; background: #000; aspect-ratio: 16 / 9; object-fit: contain; }
.pinfacts { font-size: .97rem; }
.pinfacts div { margin-bottom: .2rem; }
.pinbtns { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: .9rem; }
.phase { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .85rem; font-weight: 600; color: #fff; background: var(--red); }
.phase.grace { background: var(--warn); } .phase.scheduled { background: #555; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .9rem; }
.card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; display: flex; flex-direction: column; }
.card.dragging { opacity: .4; }
.card.over { outline: 3px dashed var(--red); }
.card .thumb { aspect-ratio: 16 / 9; background: #000 center / contain no-repeat; position: relative; }
.card .thumb .prio { position: absolute; right: .4rem; top: .4rem; background: var(--red); color: #fff; font-size: .75rem; padding: .1rem .45rem; border-radius: 6px; }
.card .body { padding: .7rem .8rem; flex: 1; }
.card .title { font-weight: 600; margin-bottom: .25rem; word-break: break-word; }
.card .sched { font-size: .95rem; }
.card .by { font-size: .85rem; color: var(--muted); margin-top: .2rem; }
.card .btns { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 .8rem .8rem; }
.card .grip { cursor: grab; }
.tag { display: inline-block; color: #fff; font-size: .78rem; font-weight: 600; padding: .08rem .5rem; border-radius: 999px; margin-bottom: .35rem; }
.empty { color: var(--muted); padding: .5rem 0; }

.form { display: grid; gap: .8rem; max-width: 640px; }
.form label, .field { display: grid; gap: .25rem; font-weight: 600; font-size: .97rem; }
.form input, .form select, .field input, .field select, .modal input, .modal select { padding: .6rem .7rem; border: 1px solid #cfc9c5; border-radius: 9px; background: #fff; min-height: 46px; font-weight: 400; width: 100%; }
.check { display: flex !important; align-items: center; gap: .5rem; font-weight: 600; grid-template-columns: none; }
.check input { width: 22px !important; height: 22px; min-height: 0 !important; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .7rem; }
.linkbox { display: flex; gap: .5rem; } .linkbox input { flex: 1; padding: .6rem; border: 1px solid #cfc9c5; border-radius: 9px; font-family: Consolas, monospace; font-size: .9rem; }
.logo-preview { max-width: 320px; max-height: 140px; background: #000; padding: 12px; border-radius: 10px; }

.presets { display: flex; flex-wrap: wrap; gap: .45rem; }
.presets button { padding: .5rem .85rem; border-radius: 999px; border: 1px solid #cfc9c5; background: #fff; cursor: pointer; min-height: 42px; }
.presets button.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.weekdays { display: flex; flex-wrap: wrap; gap: .35rem; }
.weekdays label { display: inline-flex !important; align-items: center; gap: .3rem; border: 1px solid #cfc9c5; border-radius: 8px; padding: .35rem .6rem; font-weight: 400 !important; }
.weekdays input { width: auto !important; min-height: 0 !important; }
.schedbox { border: 1px solid var(--line); border-radius: 12px; padding: .8rem; display: grid; gap: .7rem; background: #faf9f8; }
.schedsum { font-weight: 600; color: var(--red); }
.datechips { display: flex; flex-wrap: wrap; gap: .35rem; }
.datechips span { background: #eee; border-radius: 999px; padding: .2rem .6rem; font-size: .9rem; }
.datechips button { border: 0; background: none; cursor: pointer; color: var(--red); }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 20; display: flex; align-items: flex-start; justify-content: center; overflow-y: auto; padding: 2rem 1rem; }
.modal[hidden] { display: none; }
.sheet { background: #fff; border-radius: 16px; width: 100%; max-width: 820px; padding: 1.3rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.sheet h2 { font-size: 1.4rem; }
.sheet .footer { display: flex; justify-content: flex-end; gap: .6rem; margin-top: 1.1rem; flex-wrap: wrap; }
.files { display: grid; gap: .6rem; margin: .7rem 0; }
.file { display: grid; grid-template-columns: 120px 1fr; gap: .7rem; border: 1px solid var(--line); border-radius: 10px; padding: .55rem; }
.file img { width: 120px; aspect-ratio: 16/9; object-fit: contain; background: #000; border-radius: 6px; }
.file .own { margin-top: .5rem; display: grid; gap: .6rem; }
.file .err { color: var(--red); font-size: .9rem; }

.drop { position: fixed; inset: 0; background: rgba(175,22,17,.85); color: #fff; z-index: 30; display: flex; align-items: center; justify-content: center; font-size: 2rem; font-weight: 600; pointer-events: none; }
.drop[hidden] { display: none; }
.toast { position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .8rem 1.2rem; border-radius: 12px; z-index: 40; max-width: 92vw; box-shadow: 0 8px 30px rgba(0,0,0,.3); }
.toast.error { background: var(--red); }

.act { display: flex; gap: .8rem; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); padding: .55rem 0; }
.act .when { color: var(--muted); font-size: .88rem; white-space: nowrap; }

@media (max-width: 760px) {
  html, body { font-size: 16px; }
  .grid2, .row, .row3 { grid-template-columns: 1fr; }
  .who { margin-left: 0; width: 100%; }
  .pinrow { flex-direction: column; } .pinrow img { width: 100%; }
  .file { grid-template-columns: 1fr; } .file img { width: 100%; }
  .actions-row .btn { flex: 1; }
  .linkbox { flex-direction: column; }
}

.role { background: rgba(255,255,255,.18); border-radius: 999px; padding: .05rem .55rem; font-size: .8rem; margin-right: .4rem; }
.users { width: 100%; border-collapse: collapse; }
.users th, .users td { text-align: left; padding: .6rem .5rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.users td .btn { margin: .15rem .2rem .15rem 0; }
.pw { font-family: Consolas, monospace; font-size: 1.5rem; letter-spacing: .06em; background: #f5f3f1; padding: .7rem 1rem; border-radius: 10px; text-align: center; user-select: all; }
.alarmcard .body .big { font-size: 1.15rem; font-weight: 700; }
.alarmcard .stripe { height: 8px; background: var(--red); }
.alarmcard.off { opacity: .6; } .alarmcard.off .stripe { background: #999; }
.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: .08rem .5rem; border-radius: 999px; background: #eee; margin-left: .3rem; }
.badge.live { background: var(--red); color: #fff; }

.callpeople { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: .2rem .8rem; max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: .5rem .7rem; font-weight: 400; }
.vidbadge { position: absolute; left: .4rem; bottom: .4rem; background: rgba(0,0,0,.75); color: #fff; font-size: .78rem; padding: .1rem .45rem; border-radius: 6px; }
.file video { width: 120px; aspect-ratio: 16/9; object-fit: contain; background: #000; border-radius: 6px; }
.nopreview { width: 120px; aspect-ratio: 16/9; background: #333; color: #ddd; font-size: .75rem; display: flex; align-items: center; justify-content: center; text-align: center; border-radius: 6px; padding: 4px; }
@media (max-width: 760px) { .file video, .nopreview { width: 100%; } }
.hms { display: inline-flex; align-items: center; gap: .35rem; flex-wrap: wrap; font-weight: 400; }
.hms select, .hms input { width: auto !important; min-width: 4.2rem; }
.warn { background: #fff4e5; border: 1px solid #f0b46a; border-radius: 10px; padding: .6rem .8rem; }
.tvbtn { min-width: 15rem; }
.txtthumb { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: .6rem; color: #1d1b1a; font-weight: 700; font-size: .95rem; overflow: hidden; }
.txtthumb.scroll::after { content: '⇠ scrolling'; position: absolute; right: .4rem; bottom: .3rem; font-size: .7rem; font-weight: 400; color: #777; }
.tvimg.tvtext { background: #fff !important; color: #1d1b1a; display: flex; align-items: center; justify-content: center; text-align: center; font-weight: 700; font-size: 1.3rem; padding: 1rem; }
#sendForm textarea { width: 100%; padding: .6rem .7rem; border: 1px solid #cfc9c5; border-radius: 9px; font: inherit; font-weight: 400; }
.quickmsg textarea { width: 100%; padding: .7rem .8rem; border: 1px solid #cfc9c5; border-radius: 10px; font: inherit; font-size: 1.1rem; }
.quickrow { display: flex; flex-wrap: wrap; gap: .8rem 1.2rem; align-items: flex-end; margin-top: .6rem; }
.quickrow select { padding: .6rem .7rem; border: 1px solid #cfc9c5; border-radius: 9px; min-height: 46px; }
.quickrow .hms input { padding: .55rem .6rem; border: 1px solid #cfc9c5; border-radius: 9px; min-height: 46px; }
.quickbtns { display: flex; gap: .6rem; flex-wrap: wrap; margin-left: auto; }
.cards.dropzone { outline: 2px dashed #cfc9c5; outline-offset: 6px; border-radius: 12px; min-height: 90px; }
.cards.dropover { outline: 3px dashed var(--red); background: #fff6f5; }
.quickgrid { display: grid; grid-template-columns: 1fr 1fr; gap: .9rem; align-items: start; }
@media (max-width: 760px) { .quickgrid { grid-template-columns: 1fr; } }
.pvwrap { display: grid; gap: .3rem; }
.pvlabel { font-size: .85rem; color: var(--muted); font-weight: 600; }
.pvscreen { position: relative; aspect-ratio: 16 / 9; background: #fff; border: 1px solid #cfc9c5; border-radius: 8px; overflow: hidden; }
.pvtxt { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; color: #1d1b1a;
  font-weight: 700; line-height: 1.25; box-sizing: border-box; overflow-wrap: break-word; overflow: hidden; }
.pvtxt.scroll { justify-content: flex-start; }
.pvtxt.scroll span { display: inline-block; white-space: nowrap; animation: pvmarquee linear infinite; }
@keyframes pvmarquee { from { transform: translateX(0); } to { transform: translateX(-100%); } }
.slider { display: flex; align-items: center; gap: .8rem; font-weight: 400; } .slider input[type=range] { flex: 1; min-height: 0 !important; padding: 0 !important; border: 0 !important; }
