/* MS.BUZZ v1.1 - control-room dark, walnut + brass. */

:root {
  --bg: #14110f;
  --bg-2: #1b1713;
  --surface: #221c17;
  --surface-2: #2b241d;
  --line: rgba(232, 220, 192, .10);
  --line-2: rgba(232, 220, 192, .18);
  --text: #efe7d8;
  --muted: #b3a58d;
  --dim: #7f7361;
  --brass: #c9a55c;
  --brass-hi: #e4c678;
  --brass-lo: #8a6d31;
  --green: #5dbb63;
  --red: #d9534f;
  --amber: #e0b45c;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
  --radius: 18px;
  --radius-s: 12px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --serif: "Playfair Display", Georgia, serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background:
    radial-gradient(1400px 700px at 80% -20%, rgba(201, 165, 92, .10), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(201, 165, 92, .06), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
.linky { background: none; border: none; color: var(--brass); cursor: pointer; font: inherit; font-size: 13px; }
.linky:hover { color: var(--brass-hi); text-decoration: underline; }
[hidden] { display: none !important; }

/* ---------------- top bar ---------------- */
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px;
  padding: 12px 22px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-bell {
  width: 38px; height: 38px; border-radius: 50%; flex: none;
  background: radial-gradient(circle at 35% 30%, var(--brass-hi), var(--brass) 55%, var(--brass-lo));
  box-shadow: 0 4px 14px rgba(201,165,92,.35), inset 0 1px 2px rgba(255,255,255,.5);
}
.wordmark { font-family: var(--serif); font-size: 19px; letter-spacing: 1.5px; color: var(--text); line-height: 1.1; }
.site { font-size: 11.5px; color: var(--muted); letter-spacing: .4px; }
.brand-logo { max-height: 34px; max-width: 180px; display: block; }

.nav { display: inline-flex; background: var(--surface); border: 1px solid var(--line-2); border-radius: 999px; padding: 4px; gap: 4px; }
.nav-btn {
  border: none; background: none; cursor: pointer; color: var(--muted);
  padding: 8px 18px; border-radius: 999px; font-weight: 600; font-size: 13px; letter-spacing: .4px;
  display: inline-flex; align-items: center; gap: 8px; transition: background .15s, color .15s;
}
.nav-btn:hover { color: var(--text); }
.nav-btn.on { background: linear-gradient(160deg, var(--brass-hi), var(--brass) 60%, var(--brass-lo)); color: #1a140c; box-shadow: 0 4px 14px rgba(201,165,92,.3); }
.nav-ico { font-size: 14px; }

.statuszone { display: flex; justify-content: flex-end; align-items: center; gap: 8px; position: relative; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 500;
  padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--surface); color: var(--muted);
}
.chip.user { cursor: pointer; color: var(--text); padding: 5px 10px 5px 5px; }
.chip.user:hover { border-color: var(--brass); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(160deg, var(--brass-hi), var(--brass-lo)); color: #1a140c; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; }
.caret { font-size: 10px; color: var(--dim); }
.chip.doormic { display: none; color: #ffd27a; border-color: rgba(224,180,92,.5); background: rgba(224,180,92,.10); }
.chip.doormic.on { display: inline-flex; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); box-shadow: 0 0 0 3px rgba(127,115,97,.18); }
.dot.ok { background: var(--green); box-shadow: 0 0 0 3px rgba(93,187,99,.22); }
.dot.off { background: var(--red); box-shadow: 0 0 0 3px rgba(217,83,79,.22); }
.dot.warn { background: var(--amber); box-shadow: 0 0 0 3px rgba(224,180,92,.22); }

.deskmenu {
  position: absolute; right: 22px; top: 62px; z-index: 30; min-width: 280px;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 8px;
}
.dm-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; background: none; border: none; padding: 10px 12px; border-radius: 8px; cursor: pointer; color: var(--text); }
.dm-item:hover { background: var(--surface-2); }
.dm-item.danger { color: #f0a8a5; }
.dm-row { display: flex; align-items: center; gap: 8px; padding: 6px 12px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.dm-row label { display: inline-flex; align-items: center; gap: 6px; }
.dm-row select { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 6px; font: inherit; font-size: 12px; }
.dm-row input[type=range] { width: 80px; accent-color: var(--brass); }

/* ---------------- views ---------------- */
.view {
  flex: 1; display: grid; grid-template-columns: minmax(460px, 1.7fr) minmax(300px, 1fr);
  gap: 18px; padding: 18px 22px 8px; max-width: 1400px; width: 100%; margin: 0 auto;
}
@media (max-width: 960px) { .view { grid-template-columns: 1fr; } .topbar { grid-template-columns: 1fr auto; } .nav { grid-column: 1 / -1; justify-self: center; } }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column; min-height: 0;
}

/* ---------------- door camera ---------------- */
.cam-frame { position: relative; background: #0c0a08; aspect-ratio: 16 / 10; }
.cam-frame canvas { width: 100%; height: 100%; display: block; object-fit: cover; }
.cam-frame video, .cam-frame img#camMjpeg { display: none; width: 100%; height: 100%; object-fit: cover; background: #0c0a08; position: absolute; inset: 0; }
.cam-offline {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  color: #9a8d74; font-size: 13px; letter-spacing: 3px; text-transform: uppercase;
  background: repeating-linear-gradient(45deg, #0c0a08, #0c0a08 14px, #15110d 14px, #15110d 28px);
}
.cam-frame.offline .cam-offline { display: flex; }
.cam-frame.offline canvas, .cam-frame.offline video, .cam-frame.offline img { opacity: .12; }
.cam-badges { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; align-items: center; }
.badge { font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; padding: 5px 10px; border-radius: 8px; background: rgba(12,10,8,.62); color: #e8dfcc; border: 1px solid rgba(232,223,204,.18); backdrop-filter: blur(6px); }
.badge.rec { color: #ff9d8a; }
.btn-pip { margin-left: auto; cursor: pointer; }
.btn-pip:hover { border-color: var(--brass); color: var(--brass-hi); }

.controls { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 10px; padding: 14px; }
.ctl {
  position: relative; border: 1px solid var(--line-2); background: var(--surface-2); border-radius: 14px; cursor: pointer;
  padding: 14px 10px 12px; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--text);
  transition: transform .06s, background .15s, border-color .15s, box-shadow .15s; user-select: none; -webkit-user-select: none; touch-action: none;
}
.ctl:hover { border-color: rgba(201,165,92,.5); background: #332a22; }
.ctl:active { transform: translateY(1px) scale(.99); }
.ctl-icon { font-size: 22px; line-height: 1; }
.ctl-label { font-weight: 700; letter-spacing: 1.4px; font-size: 13px; }
.ctl-sub { font-size: 11px; color: var(--muted); }
.ctl.buzz { background: linear-gradient(160deg, var(--brass-hi), var(--brass) 60%, var(--brass-lo)); color: #1a140c; border-color: var(--brass-lo); box-shadow: 0 8px 24px rgba(201,165,92,.28); }
.ctl.buzz .ctl-sub { color: rgba(26,20,12,.7); }
.ctl.buzz:hover { filter: brightness(1.06); }
.ctl.buzz.fired { animation: fired .6s ease; }
@keyframes fired { 0% { box-shadow: 0 0 0 0 rgba(93,187,99,.8); } 100% { box-shadow: 0 0 0 22px rgba(93,187,99,0); } }
.ctl.active { background: #3a2b1e; border-color: var(--brass); }
.ctl.on { border-color: var(--brass); color: var(--brass-hi); }
.ctl-meter { position: absolute; left: 12px; right: 12px; bottom: 6px; height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
.ctl-meter i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--brass-hi)); transition: width .08s; }
.ctl.small { flex-direction: row; padding: 9px 14px; gap: 8px; border-radius: 10px; }
.ctl.small .ctl-icon { font-size: 16px; }
.ctl.small .ctl-label { font-size: 12px; }
.ctl.save { background: linear-gradient(160deg, var(--brass-hi), var(--brass) 60%, var(--brass-lo)); color: #1a140c; border-color: var(--brass-lo); }
.ctl.big { padding: 16px 22px; min-width: 150px; border-radius: 16px; }
.ctl.ghost { background: transparent; }

/* ---------------- activity feed ---------------- */
.feed-head { display: flex; align-items: baseline; justify-content: space-between; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.feed-head h2 { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.feed-stats { font-size: 12px; color: var(--dim); }
.feed { list-style: none; overflow: auto; flex: 1; padding: 8px 10px; }
.feed li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 9px 8px; border-radius: 10px; }
.feed li:hover { background: var(--surface-2); }
.feed .ico { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); font-size: 16px; }
.feed .what { font-size: 13px; }
.feed .who { color: var(--muted); font-size: 12px; }
.feed .when { font-size: 11.5px; color: var(--dim); white-space: nowrap; }
.feed .ev-thumb { width: 64px; height: 44px; object-fit: cover; border-radius: 6px; cursor: zoom-in; grid-column: 3; }
.feed li.press .ico { background: rgba(224,180,92,.18); }
.feed li.unlock .ico { background: rgba(93,187,99,.18); }
.feed li.system .ico, .feed li.device .ico { opacity: .7; }
.feed .empty { color: var(--dim); padding: 28px 10px; text-align: center; font-size: 13px; }

/* ---------------- cameras view ---------------- */
.cams-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 10px; border-bottom: 1px solid var(--line); }
.cams-head h2 { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); font-weight: 600; flex: 1; }
.cams-status { font-size: 12px; color: var(--muted); }
.cams-status.bad { color: #f0a8a5; }
.cams-status.tier { color: var(--dim); }
.cams-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 12px; }
.cam-tile { position: relative; aspect-ratio: 16 / 9; background: #0c0a08; border-radius: 12px; overflow: hidden; cursor: pointer; border: 1px solid var(--line); transition: border-color .15s, transform .1s; }
.cam-tile:hover { border-color: var(--brass); transform: translateY(-1px); }
.cam-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cam-tile .tile-label { position: absolute; left: 10px; bottom: 10px; font-size: 11px; letter-spacing: 1.2px; text-transform: uppercase; padding: 4px 9px; border-radius: 7px; background: rgba(12,10,8,.62); color: #e8dfcc; backdrop-filter: blur(6px); }
.cam-tile.off img { opacity: .12; }
.cam-tile.off::after { content: "camera offline"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #9a8d74; font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase; background: repeating-linear-gradient(45deg, #0c0a08, #0c0a08 14px, #15110d 14px, #15110d 28px); }
.cams-empty { grid-column: 1 / -1; padding: 48px 20px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; }
.cams-big { position: relative; margin: 12px; background: #0c0a08; border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; }
.cams-big img, .cams-big video { width: 100%; height: 100%; object-fit: contain; display: block; background: #0c0a08; }
.cams-big-label { position: absolute; left: 12px; bottom: 12px; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; padding: 5px 10px; border-radius: 8px; background: rgba(12,10,8,.62); color: #e8dfcc; backdrop-filter: blur(6px); }

.events { list-style: none; overflow: auto; flex: 1; padding: 8px 10px; }
.ev { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: center; padding: 8px; border-radius: 10px; cursor: pointer; }
.ev:hover { background: var(--surface-2); }
.ev img { width: 96px; height: 54px; object-fit: cover; border-radius: 8px; background: #0c0a08; }
.ev .ev-main { font-size: 13px; }
.ev .ev-sub { font-size: 11.5px; color: var(--muted); }
.ev.none { cursor: default; grid-template-columns: 1fr; color: var(--dim); font-size: 13px; padding: 28px 10px; text-align: center; }
.clip-wrap { border-top: 1px solid var(--line); padding: 10px; }
.clip-wrap video { width: 100%; border-radius: 10px; background: #000; }
.clip-meta { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); margin-top: 6px; }

/* ---------------- footer ---------------- */
.foot { padding: 8px 22px 12px; font-size: 11px; color: var(--dim); text-align: center; }

/* ---------------- sign in ---------------- */
.signin { position: fixed; inset: 0; z-index: 100; display: none; align-items: center; justify-content: center; background: radial-gradient(900px 600px at 50% 0%, rgba(201,165,92,.12), transparent 60%), var(--bg); padding: 24px; }
.signin.show { display: flex; }
.signin-card { width: min(520px, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 24px; box-shadow: var(--shadow); padding: 28px 30px 30px; }
.signin-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.signin h1 { font-family: var(--serif); font-weight: 600; font-size: 24px; margin-bottom: 16px; }
.people { display: flex; flex-wrap: wrap; gap: 10px; }
.people button { border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); border-radius: 14px; padding: 14px 18px; cursor: pointer; font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 10px; min-width: 140px; transition: border-color .15s, transform .1s; }
.people button:hover { border-color: var(--brass); transform: translateY(-1px); }
.people .avatar { width: 30px; height: 30px; font-size: 13px; }
.signin-hint { color: var(--muted); font-size: 13px; }
.back { margin-bottom: 10px; color: var(--muted); }
.pin-dots { display: flex; gap: 12px; justify-content: center; margin: 4px 0 18px; min-height: 16px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--brass); display: block; }
.pin-dots i.on { background: var(--brass); }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.pin-pad button { aspect-ratio: 1.35; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface-2); font-size: 22px; font-weight: 600; cursor: pointer; transition: background .1s, transform .06s; }
.pin-pad button:hover { background: #332a22; }
.pin-pad button:active { transform: scale(.97); }
.pin-pad button.soft { color: var(--muted); font-size: 18px; }
.pin-pad button.go { background: linear-gradient(160deg, var(--brass-hi), var(--brass) 60%, var(--brass-lo)); color: #1a140c; border-color: var(--brass-lo); }
.signin-err { min-height: 20px; text-align: center; color: #f0a8a5; font-size: 13px; margin-top: 12px; }
.signin-card.shake { animation: shake .35s; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }

/* ---------------- panels (systems / audio / admin) ---------------- */
.admin-wrap { position: fixed; inset: 0; z-index: 60; display: none; align-items: flex-start; justify-content: center; background: rgba(8,6,5,.72); backdrop-filter: blur(4px); padding: 36px 16px; overflow: auto; }
.admin-wrap.show { display: flex; }
.admin-panel { width: min(960px, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 20px; box-shadow: var(--shadow); padding: 20px 24px 26px; }
.admin-panel.mic-panel { width: min(620px, 100%); }
.admin-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.admin-head h2 { font-family: var(--serif); font-size: 20px; font-weight: 600; }
.admin-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 18px; }
.admin-card { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.admin-card .k { font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--dim); }
.admin-card .v { font-size: 14px; font-weight: 600; margin-top: 3px; }
.admin-card.bad .v { color: #f0a8a5; }
.admin-card.warn .v { color: #ffd27a; }
.admin-section { border-top: 1px solid var(--line); padding-top: 16px; margin-top: 16px; }
.admin-section h3 { font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.admin-note { font-size: 12px; color: var(--dim); letter-spacing: 0; text-transform: none; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.admin-settings { display: flex; flex-direction: column; gap: 10px; }
.setting { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--text); }
.setting.num { align-items: center; }
.setting input[type=checkbox] { accent-color: var(--brass); width: 16px; height: 16px; margin-top: 2px; }
.setting input[type=number], .setting input[type=text], .people-add input[type=text] { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; font: inherit; }
.setting input[type=number] { width: 80px; }
.setting input.wide { flex: 1; }
.setting-rule { border: none; border-top: 1px solid var(--line); margin: 4px 0; }
.brand-preview { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px dashed var(--line-2); border-radius: 10px; min-height: 52px; }
.brand-preview img { max-height: 40px; }
.doctor-list { list-style: none; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.doctor-list li { padding: 6px 10px; border-radius: 8px; background: var(--surface-2); }
.doctor-list li.bad { background: rgba(217,83,79,.15); }
.inbox-scroll { overflow: auto; max-height: 320px; border: 1px solid var(--line); border-radius: 10px; }
.inbox, .people-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.inbox th, .inbox td, .people-table th, .people-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.inbox th, .people-table th { font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--dim); position: sticky; top: 0; background: var(--surface); }
.inbox tr.bad td { color: #f0a8a5; }
.people-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.people-add input[type=text] { flex: 1; min-width: 140px; }
.tick { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.tick input { accent-color: var(--brass); }
.people-table .pill-role { font-size: 10.5px; letter-spacing: 1.2px; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.people-table .pill-role.admin { background: rgba(201,165,92,.18); color: var(--brass-hi); }
.people-table input[type=checkbox] { accent-color: var(--brass); }
.people-table .row-actions { display: flex; gap: 10px; justify-content: flex-end; white-space: nowrap; }
.people-table tr.inactive td { opacity: .5; }

.sys-overall { font-size: 14px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); margin-bottom: 10px; }
.sys-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.sys-list li { display: grid; grid-template-columns: 14px 1fr; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); font-size: 13px; }
.sys-list .say { color: var(--muted); }
.sys-list .fix { color: #ffd27a; font-size: 12px; margin-top: 3px; }
.sys-foot { display: flex; align-items: center; gap: 12px; margin-top: 12px; }

.mic-blurb { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.mic-sub { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--dim); margin: 12px 0 8px; }
.mic-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.mic-row select { flex: 1; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px; font: inherit; }
.mic-row.ring-row { gap: 16px; font-size: 13px; color: var(--muted); }
.mic-row.ring-row label { display: flex; align-items: center; gap: 8px; }
.mic-row.ring-row select { flex: none; }
.vol-label input { accent-color: var(--brass); }
.level-wrap { height: 8px; background: rgba(255,255,255,.06); border-radius: 4px; overflow: hidden; margin: 4px 0; }
.level-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--green), var(--brass-hi)); transition: width .08s; }
.level-bar.out { background: linear-gradient(90deg, var(--brass-lo), var(--brass-hi) 70%, #fff); }
/* v1.1.1: sound-check meters you cannot miss */
.level-row { display: flex; align-items: center; gap: 10px; margin: 6px 0 4px; }
.level-wrap.big { flex: 1; height: 18px; border-radius: 9px; border: 1px solid var(--line-2); background: rgba(255,255,255,.05); margin: 0; }
.level-pct { min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; color: var(--brass-hi); font-size: 15px; }
.ctl.small.test-btn { min-width: 150px; justify-content: center; font-weight: 700; letter-spacing: 1.2px; border-color: var(--brass); }
.ctl.small.test-btn.live { background: #3a2b1e; border-color: var(--brass-hi); color: var(--brass-hi); }
body.settings .mic-sub { font-size: 12px; color: var(--brass); }
body.settings .mic-row select { padding: 10px; font-size: 14px; }
/* v1.1.2: in the 520px settings window the TEST buttons ran off the right edge; stack them under the picker */
body.settings .mic-row:not(.ring-row) { flex-wrap: wrap; }
body.settings .mic-row:not(.ring-row) select { flex: 1 1 100%; min-width: 0; }
body.settings .mic-row .ctl.small.test-btn { flex: 1 1 100%; min-width: 0; margin-top: 2px; }
body.settings .mic-row.ring-row { flex-wrap: wrap; gap: 10px 16px; }
.mic-hint { font-size: 12px; color: var(--dim); margin-bottom: 6px; }

/* ---------------- ring overlay + modals ---------------- */
.ring-overlay { position: fixed; inset: 0; z-index: 80; display: none; align-items: center; justify-content: center; background: rgba(8,6,5,.8); backdrop-filter: blur(6px); padding: 20px; }
.ring-overlay.show { display: flex; }
.ring-box { width: min(560px, 100%); background: var(--surface); border: 1px solid var(--line-2); border-radius: 24px; box-shadow: var(--shadow); padding: 26px 28px 24px; text-align: center; position: relative; }
.ring-pulse { width: 18px; height: 18px; border-radius: 50%; background: var(--amber); margin: 0 auto 14px; position: relative; }
.ring-pulse2 { position: absolute; inset: -10px; border-radius: 50%; border: 2px solid var(--amber); animation: pulse 1.2s infinite; }
@keyframes pulse { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(2.2); opacity: 0; } }
.ring-title { font-family: var(--serif); font-size: 26px; font-weight: 600; }
.ring-sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.ring-flag { display: none; margin: 10px auto 0; padding: 6px 12px; border-radius: 8px; background: rgba(217,83,79,.18); color: #f0a8a5; font-size: 12px; }
.ring-flag.show { display: inline-block; }
.ring-snap { margin: 16px 0; border-radius: 14px; overflow: hidden; background: #0c0a08; aspect-ratio: 16 / 10; }
.ring-snap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ring-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ring-note { color: var(--dim); font-size: 12px; margin-top: 12px; }
.ring-answered { color: var(--green); font-size: 13px; margin-top: 8px; min-height: 18px; }
.name-box input { width: 100%; font: inherit; font-size: 22px; letter-spacing: 6px; text-align: center; padding: 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--text); margin: 16px 0; }
.name-box input:focus { outline: none; border-color: var(--brass); }
#lightbox img { max-width: 92vw; max-height: 88vh; border-radius: 12px; box-shadow: var(--shadow); }

.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px); background: var(--text); color: #1a140c; padding: 10px 16px; border-radius: 999px; font-weight: 600; font-size: 13px; opacity: 0; transition: opacity .2s, transform .2s; z-index: 200; pointer-events: none; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* hooks the existing app.js already emits */
.dot.on { background: var(--green); box-shadow: 0 0 0 3px rgba(93,187,99,.22); }
.feed .ev-icon { width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; background: var(--surface-2); font-size: 16px; }
.feed .ev-icon.press { background: rgba(224,180,92,.18); }
.feed .ev-icon.unlock { background: rgba(93,187,99,.18); }
.feed .ev-icon.device, .feed .ev-icon.system { opacity: .7; }
.feed .ev-main { min-width: 0; }
.feed .ev-line { font-size: 13px; }
.feed .ev-line b { font-weight: 600; color: var(--brass-hi); }
.feed .ev-when { font-size: 11.5px; color: var(--dim); margin-top: 2px; }
.feed-empty { color: var(--dim); padding: 28px 10px; text-align: center; font-size: 13px; }

.acard { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.acard .k { font-size: 10.5px; letter-spacing: 1.4px; text-transform: uppercase; color: var(--dim); }
.acard .v { font-size: 14px; font-weight: 600; margin-top: 3px; word-break: break-word; }
.acard.bad .v { color: #f0a8a5; }
.acard.warn .v { color: #ffd27a; }

/* logos are usually dark-on-light marks: give them a cream plate on the dark UI */
.brand-logo { background: #f5f1e8; padding: 4px 9px; border-radius: 7px; max-height: 34px; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.signin-brand .brand-logo { max-height: 46px; padding: 6px 12px; }
.brand-preview { background: #f5f1e8; }
.brand-preview img { max-height: 44px; }

/* Ms.Buzz mark (hive eye) next to the client logo */
.brand-mark { height: 40px; width: auto; flex: none; filter: drop-shadow(0 3px 8px rgba(201,165,92,.25)); }
.brand-mark.big { height: 64px; }
.brand-bell { display: none; }
.brand-mark.ringing { animation: markring .5s ease-in-out infinite alternate; }
@keyframes markring { from { transform: rotate(-8deg) scale(1.04); } to { transform: rotate(8deg) scale(1.04); } }

/* ---------------- history ---------------- */
.history-card { grid-column: 1 / -1; }
.h-pickers { display: flex; flex-wrap: wrap; gap: 12px 24px; padding: 12px 16px 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-weight: 600; cursor: pointer; }
.chips button:hover { color: var(--text); border-color: var(--brass); }
.chips button.on { background: linear-gradient(160deg, var(--brass-hi), var(--brass) 60%, var(--brass-lo)); color: #1a140c; border-color: var(--brass-lo); }
.chips button small { font-weight: 400; opacity: .7; margin-left: 4px; }
.tl-wrap { padding: 8px 16px 6px; }
.tl-hours { display: grid; grid-template-columns: repeat(24, 1fr); font-size: 10px; color: var(--dim); margin-bottom: 3px; }
.tl-hours span { text-align: left; }
.tl { width: 100%; height: 56px; display: block; border-radius: 8px; background: #0c0a08; cursor: crosshair; border: 1px solid var(--line); }
.tl-legend { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--dim); margin-top: 6px; }
.tl-legend .lg { display: inline-block; width: 12px; height: 8px; border-radius: 2px; }
.tl-legend .lg.motion { background: #5a4a33; }
.tl-legend .lg.person { background: var(--brass-hi); }
.tl-hint { margin-left: auto; }
.h-body { display: grid; grid-template-columns: minmax(380px, 1.6fr) minmax(240px, 1fr); gap: 14px; padding: 6px 16px 16px; }
@media (max-width: 960px) { .h-body { grid-template-columns: 1fr; } }
.h-player video { width: 100%; border-radius: 10px; background: #000; aspect-ratio: 16 / 9; }
.h-meta { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--muted); margin-top: 8px; flex-wrap: wrap; }
.h-meta span { flex: 1; text-align: center; color: var(--text); }
.h-people { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; align-content: start; max-height: 320px; overflow: auto; }
.h-people .hp { position: relative; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; cursor: pointer; background: #0c0a08; border: 1px solid var(--line); }
.h-people .hp:hover { border-color: var(--brass); }
.h-people .hp img { width: 100%; height: 100%; object-fit: cover; display: block; }
.h-people .hp span { position: absolute; left: 6px; bottom: 5px; font-size: 10.5px; padding: 2px 6px; border-radius: 5px; background: rgba(12,10,8,.7); color: #e8dfcc; }
.h-people .none { grid-column: 1 / -1; color: var(--dim); font-size: 13px; padding: 18px 6px; }

.h-body.one { grid-template-columns: 1fr; }
.h-people { max-height: 220px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.ring-overlay.hist { z-index: 90; }
.h-box { width: min(980px, 100%); text-align: left; padding: 18px 20px 20px; }
.h-top { display: flex; align-items: center; justify-content: space-between; font-size: 14px; color: var(--text); margin-bottom: 12px; }
.h-box video { width: 100%; border-radius: 12px; background: #000; aspect-ratio: 16 / 9; display: block; }
.h-box .h-meta { justify-content: center; margin-top: 14px; gap: 10px; }
.h-box .h-meta a { text-decoration: none; }

/* collapsible activity column */
.feed-head.collapsible { width: 100%; background: none; border: none; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; color: inherit; }
.feed-head.collapsible:hover { background: var(--surface-2); }
.feed-head .count { font-weight: 500; color: var(--brass-hi); margin-left: 6px; letter-spacing: 0; text-transform: none; }
.feed-head .chev { display: inline-block; margin-left: 6px; transition: transform .15s; }
.events-card.collapsed .chev { transform: rotate(-90deg); }
.events-card.collapsed .events, .events-card.collapsed .clip-wrap { display: none; }
.events-card .events { max-height: 360px; }
.events-card.collapsed { align-self: start; }
.cams { align-items: start; }
/* history sits directly under the Showroom card; activity column runs down the right */
.history-card { grid-column: 1; grid-row: 2; }
.events-card { grid-column: 2; grid-row: 1 / span 2; }
@media (max-width: 960px) { .history-card { grid-column: 1; grid-row: auto; } .events-card { grid-column: 1; grid-row: auto; } }
.cams { grid-template-rows: auto auto; }

/* ================= v1.1 intercom + desk app modes ================= */

/* "<name> is talking" chip (topbar, normal mode) */
.chip.talker { color: #ffb4a6; border-color: rgba(255,157,138,.45); background: rgba(217,83,79,.12); }
.chip.talker b { font-weight: 600; }

/* LIVE state on any TALK button: warm label + pulsing red dot */
.ctl.active .ctl-label { color: #ffb4a6; }
.ctl.active::after { content: ""; position: absolute; top: 9px; right: 11px; width: 8px; height: 8px; border-radius: 50%; background: #ff5b4d; box-shadow: 0 0 0 3px rgba(255,91,77,.22); animation: livedot .9s ease-in-out infinite alternate; }
@keyframes livedot { from { opacity: 1; } to { opacity: .35; } }

/* mode-only blocks stay invisible until the body carries the mode class */
.pop-only, .set-only { display: none; }

/* ---------------- POPUP mode (desk app window, 440 x 560, nothing scrolls) ---------------- */
body.popup { height: 100vh; overflow: hidden; background: var(--bg); }
body.popup .topbar, body.popup #deskMenu, body.popup .feed-card, body.popup .foot, body.popup #camsView,
body.popup #snoozeBtn, body.popup #muteBtn, body.popup .btn-pip, body.popup #ringOverlay { display: none !important; }
body.popup .pop-only { display: flex; }
body.popup #doorView { display: flex; flex-direction: column; flex: 1; min-height: 0; padding: 0; gap: 0; max-width: none; }
body.popup .cam-card { flex: 1; min-height: 0; border: none; border-radius: 0; box-shadow: none; background: transparent; }
body.popup .cam-frame { flex: 1; min-height: 0; aspect-ratio: auto; }
body.popup .cam-frame video, body.popup .cam-frame canvas, body.popup .cam-frame img#camMjpeg { object-fit: contain; }
body.popup .cam-badges { top: 8px; left: 8px; right: 8px; }
body.popup .badge { font-size: 10px; padding: 3px 7px; }
body.popup .controls { grid-template-columns: 1.6fr 1.1fr .85fr; gap: 8px; padding: 10px 12px 6px; }
body.popup .ctl { padding: 11px 6px 13px; border-radius: 12px; gap: 2px; }
body.popup .ctl-icon { font-size: 20px; }
body.popup .ctl-label { font-size: 12.5px; letter-spacing: 1.3px; }
body.popup .ctl-sub { font-size: 10px; }
body.popup .ctl.buzz .ctl-label { font-size: 14px; }
body.popup .ctl-meter { left: 10px; right: 10px; bottom: 5px; }

.pop-banner { align-items: center; gap: 10px; min-height: 46px; padding: 6px 14px; background: var(--surface); border-bottom: 1px solid var(--line); cursor: grab; user-select: none; -webkit-user-select: none; touch-action: none; transition: background .2s, color .2s; flex: none; }
.pop-banner:active { cursor: grabbing; }
.pb-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.pb-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12.5px; letter-spacing: .4px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(93,187,99,.2); flex: none; }
.pb-sub { font-size: 11px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pb-sub:empty { display: none; }
.pb-chip { flex: none; font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--muted); max-width: 140px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pop-banner.ring { background: linear-gradient(160deg, var(--brass-hi), var(--brass) 60%, var(--brass-lo)); border-bottom-color: var(--brass-lo); animation: popblink .75s ease-in-out infinite alternate; }
.pop-banner.ring .pb-title { color: #1a140c; font-size: 13.5px; letter-spacing: 2px; text-transform: uppercase; }
.pop-banner.ring .pb-dot { background: #1a140c; box-shadow: 0 0 0 3px rgba(26,20,12,.2); animation: livedot .75s ease-in-out infinite alternate; }
.pop-banner.ring .pb-sub { color: rgba(26,20,12,.75); }
.pop-banner.ring .pb-chip { display: none; }
@keyframes popblink { from { filter: brightness(1); } to { filter: brightness(.72); } }
.pop-banner.opened { background: rgba(93,187,99,.16); border-bottom-color: rgba(93,187,99,.45); }
.pop-banner.opened .pb-title { color: #bfe8c2; }
.pop-banner.opened .pb-dot { background: var(--green); }
.pop-banner.info .pb-title { color: var(--brass-hi); }
.pop-banner.info .pb-dot { background: var(--brass); box-shadow: 0 0 0 3px rgba(201,165,92,.22); }
.pop-banner.offline .pb-dot { background: var(--red); box-shadow: 0 0 0 3px rgba(217,83,79,.22); }

.pop-status { align-items: center; justify-content: center; min-height: 26px; padding: 0 12px 4px; font-size: 11.5px; letter-spacing: .3px; color: var(--muted); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: none; }
.pop-status.live { color: #ffb4a6; }
.pop-status.on, .pop-status.warn { color: #ffd27a; }
.pop-status.bad { color: #f0a8a5; }

.pop-foot { align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; padding: 0 12px; font-size: 11px; color: var(--dim); border-top: 1px solid var(--line); background: var(--bg-2); flex: none; }
.pf-desk { font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pf-links { display: flex; gap: 8px; flex: none; }
.pf-links .linky { font-size: 11px; }
/* v1.1.1: the two footer actions were 11px brass text and got missed; now real pill buttons */
body.popup .pop-foot { min-height: 46px; padding: 6px 10px; }
.pf-btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--brass); background: rgba(201,165,92,.14); color: var(--brass-hi); font: inherit; font-size: 11.5px; font-weight: 700; letter-spacing: 1.2px; cursor: pointer; white-space: nowrap; box-shadow: 0 2px 10px rgba(0,0,0,.35); }
.pf-btn:hover { background: linear-gradient(160deg, var(--brass-hi), var(--brass) 60%, var(--brass-lo)); color: #1a140c; }
.pf-btn:active { transform: translateY(1px); }

/* popup sign-in: the same #signin markup, squeezed to fit 440 x 560 */
body.popup .signin { padding: 12px; overflow: auto; }
body.popup .signin-card { padding: 14px 16px 16px; border-radius: 16px; width: 100%; }
body.popup .signin-brand { margin-bottom: 10px; gap: 10px; }
body.popup .signin-brand .brand-mark.big { height: 36px; }
body.popup .signin-brand .wordmark { font-size: 16px; }
body.popup .signin h1 { font-size: 17px; margin-bottom: 10px; }
body.popup .people { gap: 8px; }
body.popup .people button { padding: 9px 12px; min-width: 0; flex: 1 1 45%; font-size: 13px; border-radius: 11px; }
body.popup .people .avatar { width: 26px; height: 26px; font-size: 11px; }
body.popup .pin-dots { margin: 2px 0 10px; gap: 10px; }
body.popup .pin-dots i { width: 11px; height: 11px; }
body.popup .pin-pad { max-width: 230px; gap: 7px; }
body.popup .pin-pad button { aspect-ratio: 1.7; font-size: 18px; border-radius: 10px; }
body.popup .signin-err { margin-top: 8px; min-height: 16px; font-size: 12px; }
body.popup .back { margin-bottom: 6px; font-size: 12px; }

/* ---------------- SETTINGS mode (desk app window, 520 x 760) ---------------- */
body.settings { overflow: auto; background: var(--bg); }
body.settings .topbar, body.settings #deskMenu, body.settings #doorView, body.settings #camsView, body.settings .foot,
body.settings #popFoot, body.settings #ringOverlay { display: none !important; }
body.settings .set-only { display: block; }
.set-card { margin: 14px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); padding: 16px 18px 12px; }
.set-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.set-head .brand-mark { height: 36px; }
.set-head .wordmark { font-size: 18px; }
.set-head .set-talker { margin-left: auto; font-size: 11px; color: #ffb4a6; background: rgba(217,83,79,.12); border: 1px solid rgba(255,157,138,.4); border-radius: 999px; padding: 3px 9px; }
.set-sec { border-top: 1px solid var(--line); padding: 10px 0 8px; }
.set-sec h3 { font-size: 10.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--dim); margin: 0 0 8px; }
.set-sec h3 + .mic-row { margin-top: 0; }
.set-sec h3:not(:first-child) { margin-top: 10px; }
.set-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.set-row .mic-hint { margin: 0; flex: 1; min-width: 160px; }
.set-who { display: flex; align-items: center; gap: 10px; }
.set-who .avatar { width: 34px; height: 34px; font-size: 13px; }
.set-who-text { display: flex; flex-direction: column; line-height: 1.2; flex: 1; }
.set-who-text b { font-size: 15px; }
.set-who-text span { font-size: 11px; color: var(--dim); letter-spacing: 1px; text-transform: uppercase; }
.set-nobody { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.set-version { font-size: 11px; color: var(--dim); text-align: center; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 4px; }

/* settings: the existing audio panel and sign-in card render inline instead of as overlays */
body.settings #micPanel { position: static; display: block; background: none; backdrop-filter: none; padding: 0; overflow: visible; }
body.settings #micPanel .admin-panel { width: auto; background: none; border: none; box-shadow: none; border-radius: 0; padding: 0; }
body.settings #micPanel .admin-head, body.settings #micPanel .mic-blurb { display: none; }
body.settings #micPanel .mic-row.ring-row label { white-space: nowrap; }
body.settings .signin { position: static; inset: auto; background: none; padding: 0; display: none; }
body.settings .signin.show { display: block; }
body.settings .signin-card { width: 100%; padding: 4px 0 0; border: none; background: none; box-shadow: none; border-radius: 0; }
body.settings .signin-brand { display: none; }
body.settings .signin h1 { font-size: 16px; margin-bottom: 10px; }
body.settings .people button { padding: 9px 12px; min-width: 0; font-size: 13px; border-radius: 11px; }
body.settings .people .avatar { width: 26px; height: 26px; font-size: 11px; }
body.settings .pin-pad { max-width: 240px; gap: 7px; margin: 0; }
body.settings .pin-pad button { aspect-ratio: 1.7; font-size: 18px; border-radius: 10px; }
body.settings .pin-dots { justify-content: flex-start; margin: 2px 0 10px; }
body.settings .signin-err { text-align: left; }

/* Visible playback state and camera navigation. */
.camera-playback-status { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; padding:24px; background:rgba(12,10,8,.7); color:#fff3d6; font-size:16px; text-align:center; pointer-events:none; }
#camsGridBtn { display:inline-flex; align-items:center; min-height:44px; padding:10px 18px; border:1px solid #c5a86b; border-radius:9px; background:#54452b; color:#fff3d6; font-size:14px; font-weight:700; cursor:pointer; }
#camsGridBtn:hover { background:#6a5632; }
#camsGridBtn:focus-visible { outline:3px solid #e4c887; outline-offset:3px; }

.camera-listen {position:absolute;right:16px;bottom:16px;z-index:4;padding:12px 18px;min-height:44px;border:2px solid #b9d1e2;border-radius:9px;background:#173247;color:#fff;font:600 14px inherit;cursor:pointer;}
.camera-listen[aria-pressed="true"] {background:#186541;border-color:#adf2ca;}
.camera-listen[hidden] {display:none;}
