/* Room Builder - internal tool */
:root {
  --dark: #1E293B; --accent: var(--brand, #F59E0B); --accent-ink: var(--brand-ink, #1E293B); --page: #E4E7EC; --card: #fff; --line: #C9CFD8;
  --ink: #1B2533; --sub: #4A5A6C; --red: #D0342C; --green: #1E8E3E; --amber: #B7791F;
  --mono: Consolas, "Cascadia Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.4 "Segoe UI", system-ui, Arial, sans-serif; color: var(--ink); background: var(--page); display: flex; flex-direction: column; }
code { font-family: var(--mono); font-size: 12.5px; background: #eef1f5; padding: 0 4px; border-radius: 3px; }

/* ---- header ---- */
#top { background: var(--dark); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 18px; height: 52px; flex: 0 0 auto; }
.brand { font-size: 17px; font-weight: 600; letter-spacing: .02em; display: flex; align-items: center; gap: 10px; white-space: nowrap; flex: 0 0 auto; }
.pages { flex: 0 0 auto; }
.brand .logo-slot { display: block; height: 30px; width: 76px; border-radius: 4px; color: var(--accent); --logo-ph-size: 8px; flex: 0 0 auto; }   /* site logo slot (brand.js) */
.pages { display: flex; gap: 6px; }
.page-btn { font: inherit; font-size: 13px; background: transparent; border: 1px solid rgba(255, 255, 255, .4); color: #fff; border-radius: 999px; padding: 4px 14px; cursor: pointer; }
.page-btn:hover { border-color: var(--accent); }
.page-btn.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 14px; font-size: 13px; flex: 1 1 auto; justify-content: flex-end; min-width: 0; white-space: nowrap; }
.top-actions .open { min-width: 0; }
.top-actions select { flex: 0 1 220px; min-width: 120px; }
@media (max-width: 1300px) { .top-actions .open > span { display: none; } }
.top-actions .open { display: flex; flex-direction: row; align-items: center; gap: 8px; color: #fff; font-size: 13px; }
.top-actions select { background: #fff; color: var(--ink); border: 0; border-radius: 6px; padding: 5px 8px; font: inherit; max-width: 260px; }
.tools { color: #b9c6d6; font-size: 12px; }
.tools b { color: #fff; }
.tools .bad { color: #ffb4ae; }

/* ---- layout ---- */
#layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 44%); }
#form { overflow-y: auto; padding: 18px 22px 60px; }
#layout.preview { grid-template-columns: minmax(0, 1fr); }
.preview-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
label.check.dim { opacity: .5; }
#compact-block { margin-top: 8px; }
#preview-stage { margin: 0 auto; overflow: hidden; border-radius: 12px; box-shadow: 0 6px 24px rgba(0, 39, 76, .25); }
.preview-bar { justify-content: center; }
#preview-scale { width: 1280px; height: 800px; transform-origin: 0 0; }
#panel-frame { width: 1280px; height: 800px; border: 0; display: block; background: #00274C; }
#out { border-left: 1px solid var(--line); background: #f5f7fa; display: flex; flex-direction: column; min-height: 0; }

section { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 14px 18px 16px; margin-bottom: 14px; }
section h2 { margin: 0 0 12px; font-size: 16px; color: var(--dark); }
section h2 small.opt { font-size: 11px; font-weight: 500; color: var(--sub); text-transform: uppercase; letter-spacing: .06em; margin-left: 8px; }
.item input.ro, label > input.ro { background: #eef1f5; }
/* device rows: Box | MAC | Address | Hostname | Action - wider address column, captions never wrap */
.item.dev { row-gap: 4px; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1.2fr) minmax(0, 1.5fr) minmax(0, 1.1fr) minmax(0, .8fr); }
.item.dev label { white-space: nowrap; min-width: 0; }
.item.dev label > input, .item.dev label > select { min-width: 0; width: 100%; }
@media (max-width: 1300px) { .item.dev { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.devstat { grid-column: 1 / -1; display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 11.5px; color: var(--sub); min-width: 0; }
.devstat .txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.devstat .meta { margin-left: auto; color: var(--ink); white-space: nowrap; }
#job-log .lg-ok { color: var(--green); }
#job-log .lg-bad { color: var(--red); font-weight: 600; }
#job-log .lg-warn { color: #b26a00; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #c9cfd8; flex: 0 0 auto; vertical-align: middle; }
.dot.on { background: var(--green); box-shadow: 0 0 0 2px #d6efdc; }
.dot.off { background: var(--red); box-shadow: 0 0 0 2px #f6d5d3; }
#btn-deploy .dot { margin-right: 7px; box-shadow: 0 0 0 2px rgba(255,255,255,.35); }
#btn-deploy .dot.none { background: rgba(255,255,255,.35); box-shadow: none; }
#qsys-block { margin-top: 10px; }
section > p.hint { margin: 0 0 8px; }
/* the "how to use" box on the Device setup page */
.howto { background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; margin: 0 0 12px; font-size: 13px; }
.howto summary { cursor: pointer; font-weight: 600; color: var(--dark); }
.howto ol { margin: 8px 0 4px; padding-left: 22px; }
.howto li { margin: 0 0 6px; line-height: 1.45; }
.howto p.hint { margin: 6px 0 2px; }
#pv-confirm { background: color-mix(in srgb, var(--accent) 16%, white); border: 1px solid var(--accent); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
section h3 { margin: 14px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--sub); display: flex; align-items: center; gap: 10px; }
.grid2, .grid3 { display: grid; gap: 10px 16px; align-items: start; }
.grid2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1200px) { .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; color: var(--sub); }
label > input, label > select { font: inherit; font-size: 14px; color: var(--ink); padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; height: 34px; box-sizing: border-box; }
label > input:focus, label > select:focus, input.inline:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--dark); }
label small { color: var(--sub); font-size: 11.5px; }
label .unit { display: flex; align-items: center; gap: 6px; }
label .unit input { font: inherit; font-size: 14px; color: var(--ink); padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: #fff; height: 34px; box-sizing: border-box; }
label .unit input:focus { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--dark); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 13.5px; padding: 4px 0; }
label.check.small { font-size: 12.5px; }
label.check.full { grid-column: 1 / -1; white-space: nowrap; }
/* groups of checkboxes: one per line (.checks) or one inline row (.checks.row) - never crammed into grid cells */
.checks { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 6px; }
.checks.row { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 2px 22px; }
.checks.row label.check { white-space: nowrap; }
.checks-cap { font-size: 12.5px; color: var(--sub); padding: 4px 0; }
label.check small { color: var(--sub); font-size: 11.5px; margin-left: 4px; }
label.check input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--dark); flex: 0 0 16px; }
label.check.full.wrap { white-space: normal; flex-wrap: wrap; row-gap: 4px; }
input.hex { width: 60px; text-transform: uppercase; font-family: var(--mono); }
input.num { width: 80px; }
input.inline, select.inline { font: inherit; padding: 3px 6px; border: 1px solid var(--line); border-radius: 6px; margin: 0 4px; height: 28px; box-sizing: border-box; }
.hint { color: var(--sub); font-size: 12px; margin: 8px 0 0; display: block; }
.hidden { display: none !important; }
.feed { margin-top: 10px; padding: 8px 12px 10px; border: 1px dashed var(--line); border-radius: 8px; background: #f7f9fc; }
.feed .feed-fields { margin-top: 6px; }
.feed input.ro { background: #eef1f5; }

/* sub-lists (displays, encoders, cameras, mics, ceiling mics) */
.sublist { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.item { position: relative; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 10px; align-items: end; background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; padding: 8px 36px 8px 34px; }
.item .n { position: absolute; left: 12px; bottom: 15px; font-weight: 700; color: var(--dark); }
.item.nodel { padding-right: 10px; }
.item.subitem { margin: -4px 0 0 26px; background: #eef2f7; border-style: dashed; }
.item.subitem .n { color: var(--sub); font-weight: 400; }
.item label { font-size: 11.5px; white-space: nowrap; min-width: 0; }
.item label > input, .item label > select { min-width: 0; width: 100%; }
.item .del { position: absolute; right: 4px; bottom: 9px; background: none; border: 0; color: var(--sub); font-size: 18px; cursor: pointer; padding: 4px 6px; line-height: 1; }
.item .del:hover { color: var(--red); }
.item .wide { grid-column: span 2; }
/* encoder cards: the source strip runs across the top, the fields sit underneath */
.item.enc { row-gap: 6px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.item.dec { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.item.bound { border-color: var(--dark); box-shadow: inset 4px 0 0 var(--dark); }
.item.bound.seen { border-color: var(--green); box-shadow: inset 4px 0 0 var(--green); }
.item .bound-note { grid-column: 1 / -1; font-size: 11px; color: var(--sub); margin-top: -2px; }
.item .bound-note b { font-family: Consolas, "Courier New", monospace; font-weight: 600; color: var(--dark); }
.item.bound.seen .bound-note b { color: var(--green); }
section.bound { border-color: var(--dark); box-shadow: inset 4px 0 0 var(--dark); }
section.bound.seen { border-color: var(--green); box-shadow: inset 4px 0 0 var(--green); }
.bound-badge { font-size: 11px; font-weight: 400; color: var(--sub); margin-left: 10px; vertical-align: middle; }
.bound-badge b { font-family: Consolas, "Courier New", monospace; font-weight: 600; color: var(--dark); }
.bound-badge.seen b { color: var(--green); }   /* Name | IP-ID | Multicast: the chip strip spans the row, so auto-fit cannot collapse a spare track */
.item .enc-src { grid-column: 1 / -1; margin: 0; gap: 6px; padding-bottom: 6px; border-bottom: 1px dashed var(--line); display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.item .enc-src .chip { padding: 2px 6px; font-size: 12px; border-width: 1px; justify-content: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 1400px) { .item .enc-src { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
button.mini { font: inherit; font-size: 12px; border: 1px solid var(--dark); background: #fff; color: var(--dark); border-radius: 6px; padding: 3px 9px; cursor: pointer; margin-top: 8px; }
h3 button.mini { margin-top: 0; padding: 1px 9px; }
button.mini:hover { background: var(--accent); color: var(--accent-ink); }

/* chips (sources) */
/* every source pill the same width: an equal-column grid, text centred */
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin-bottom: 12px; }
.chip { display: inline-flex; flex-direction: row; align-items: center; justify-content: center; gap: 6px; border: 1.5px solid var(--dark); border-radius: 999px; padding: 5px 10px; font-size: 13px; cursor: pointer; user-select: none; background: #fff; color: var(--ink); white-space: nowrap; }
.chip input { display: none; }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.chip.on::before { content: "✓ "; }

/* ---- output ---- */
.out-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; }
.out-head h2 { margin: 0; font-size: 15px; color: var(--dark); font-family: var(--mono); }
.out-btns { display: flex; gap: 6px; }
button { font: inherit; }
button.ghost { background: #fff; border: 1px solid var(--line); color: var(--ink); border-radius: 6px; padding: 5px 12px; cursor: pointer; }
button.ghost:hover { border-color: var(--dark); }
.issues { list-style: none; margin: 0; padding: 0 16px; display: flex; flex-direction: column; gap: 4px; max-height: 30vh; overflow: auto; }
.issues li { font-size: 12.5px; padding: 5px 9px; border-radius: 6px; border-left: 4px solid; background: #fff; }
.issues li.error { border-color: var(--red); }
.issues li.warn { border-color: var(--amber); }
.issues li.ok { border-color: var(--green); color: var(--green); }
.issues li.jump { cursor: pointer; }
.issues li.jump:hover { background: #f5f7fa; text-decoration: underline; }
section.flash { animation: flash 1.6s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 3px var(--accent); background: color-mix(in srgb, var(--accent) 16%, white); } 100% { box-shadow: none; background: var(--card); } }
.flash:not(section) { animation: flash-el 1.6s ease-out; border-radius: 6px; }
@keyframes flash-el { 0% { box-shadow: 0 0 0 3px var(--accent); background: color-mix(in srgb, var(--accent) 16%, white); } 100% { box-shadow: none; } }
.json { flex: 1; min-height: 0; overflow: auto; margin: 8px 16px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 8px; font-family: var(--mono); font-size: 12px; line-height: 1.45; white-space: pre; color: #1b2a41; }
.actions { padding: 10px 16px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.actions .row { display: flex; gap: 8px; }
.actions .dist { font-size: 12px; color: var(--sub); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.actions .dist b { color: var(--ink); font-weight: 600; }
.actions .dist .bad { color: var(--red); }
.actions .dist button { margin-top: 0; }
.actions .row.wrap { flex-wrap: wrap; gap: 4px 14px; }
.actions .row > button { flex: 1; padding: 9px 10px; border-radius: 8px; border: 1.5px solid var(--dark); background: #fff; color: var(--dark); cursor: pointer; font-weight: 600; }
.actions .row > button:hover { background: #eef2f7; }
.actions .row > button.primary { background: var(--accent); color: var(--accent-ink); }
.actions .row > button.primary:hover { background: #063a6b; }
.actions .row > button:disabled { opacity: .5; cursor: not-allowed; }
#deploy-opts { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }

/* ---- job console ---- */
.job { position: fixed; inset: 0; background: rgba(0, 39, 76, .55); display: flex; align-items: center; justify-content: center; z-index: 50; }
.job-box { width: min(1000px, 94vw); height: min(80vh, 760px); background: #fff; border-radius: 12px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0, 0, 0, .35); }
.job-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--dark); color: #fff; }
.job-head h2 { margin: 0; font-size: 15px; }
.steps { list-style: none; margin: 0; padding: 10px 16px; display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 1px solid var(--line); }
.steps li { font-size: 12.5px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); background: #f5f7fa; cursor: pointer; }
.steps li.running { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, white); }
.steps li.ok { border-color: var(--green); color: var(--green); }
.steps li.failed { border-color: var(--red); color: var(--red); font-weight: 600; }
.steps li.skipped { opacity: .5; }
.steps li.sel { outline: 2px solid var(--dark); }
.log { flex: 1; margin: 0; padding: 12px 16px; overflow: auto; background: #0f1b2b; color: #d7e1ee; font-family: var(--mono); font-size: 12px; line-height: 1.45; white-space: pre-wrap; }

/* ---- updates: header chip + panel */
.verchip { font: inherit; font-size: 12px; border: 1px solid rgba(255, 255, 255, .4); color: #fff; background: transparent; border-radius: 999px; padding: 3px 10px; cursor: pointer; white-space: nowrap; }
.verchip:hover { border-color: var(--accent); }
.verchip.ok { border-color: rgba(255, 255, 255, .4); }
.verchip.upd { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.verchip.warn { border-color: #ffb4ae; color: #ffb4ae; }
.upd-box { max-width: 760px; }
.upd-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.upd-auth { font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.upd-auth input { font: inherit; font-size: 13px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; min-width: 300px; }
.upd-auth .code { font: 600 22px Consolas, monospace; letter-spacing: 3px; color: var(--dark); background: #f4f6f9; padding: 4px 12px; border-radius: 6px; }
.upd-table { border-collapse: collapse; width: 100%; font-size: 13px; }
.upd-table th, .upd-table td { text-align: left; padding: 6px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.upd-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #4a5a6c; }
.upd-table td.state-update { color: #b26a00; font-weight: 600; }
.upd-table td.state-same { color: var(--green); }
.upd-table td.state-missing { color: var(--red); font-weight: 600; }
.upd-actions { display: flex; align-items: center; gap: 10px; }
button.mini.primary { background: var(--accent); color: var(--accent-ink); }
button.mini.primary:disabled { opacity: .5; cursor: default; }

/* ---- "filled in for you": a derived default shown as the real value, grey until something else is typed */
input.auto { color: #5a6b7f; background: #f6f8fb; }
input.auto:focus { color: var(--ink); background: #fff; }
.upd-changes { font-size: 12.5px; max-height: 240px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 8px 12px; background: #f8fafc; }
.upd-changes h4 { margin: 0 0 6px; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #4a5a6c; }
.upd-changes .rel { margin: 0 0 10px; }
.upd-changes .rel small { color: #4a5a6c; margin-left: 6px; }
.upd-changes pre { margin: 2px 0 0; white-space: pre-wrap; font: inherit; color: var(--ink); }
