/* AllTechs Support - classic interface in the Chief Alltechs brand palette (chiefalltechs.com).
   Flat colours only: no gradients. Square-ish corners, plain borders, system-style controls. */
:root {
  /* brand tokens, same names and values as chiefalltechs.com */
  --navy: #0b1a2e;
  --navy-2: #12263f;
  --navy-3: #1a3456;
  --on-navy: #e6ecf4;
  --on-navy-muted: #9aa9bc;
  --blue: #2160d8;
  --blue-dark: #184bb0;
  --blue-light: #78a9ff;
  --blue-wash: #e8f0fe;
  --ink: #0e1726;
  --ink-2: #334155;
  --muted: #64748b;
  --rule: #e3e8f0;
  --rule-strong: #c5cfdc;
  --soft: #eef3fa;
  --soft-2: #e2eaf6;
  --well: #f5f7fb;
  --paper: #ffffff;
  --green: #1b7a4b;

  font-family: Inter, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: var(--soft);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { display: flex; flex-direction: column; user-select: none; }
.hidden { display: none !important; }
.web-card { display: none; }            /* shown only in the browser build (server/public/web.css) */
.muted { color: var(--muted); }
.small { font-size: 12px; }
.warn { color: var(--ink); font-weight: 600; }
button { font: inherit; color: inherit; cursor: default; }
h2 { font-size: 15px; font-weight: 600; color: var(--ink); }
h3 { font-size: 13px; }
a { color: var(--blue); }

/* ---------------------------------------------------------------- title bar (navy) */
#topbar { display: flex; align-items: center; justify-content: space-between; padding: 7px 12px; background: var(--navy); color: var(--on-navy); flex-shrink: 0; }
.brand { font-size: 14px; display: flex; align-items: center; gap: 8px; font-weight: 600; color: #fff; }
.brand b { font-weight: 700; color: var(--blue-light); }
.brand-logo { height: 28px; width: auto; display: block; }
.brand-divider { width: 1px; height: 22px; background: var(--navy-3); margin: 0 4px; }
.brand-product { font-weight: 600; color: var(--on-navy); letter-spacing: .2px; }
.hero-logo { height: 48px; width: auto; margin-bottom: 22px; }
.top-right { display: flex; align-items: center; gap: 10px; }
.status { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--on-navy-muted); }
.status i { width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--on-navy-muted); background: transparent; }
.status.ok { color: var(--on-navy); }
.status.ok i { background: #3fb27f; border-color: #3fb27f; }
.status.bad { color: #fff; font-weight: 600; }
.badge { font-size: 12px; padding: 1px 7px; border: 1px solid var(--navy-3); background: var(--navy-2); color: var(--on-navy); border-radius: 3px; }
.badge.admin { border-color: var(--blue-light); color: #fff; font-weight: 600; }
#topbar .btn { background: var(--navy-2); border-color: var(--navy-3); color: var(--on-navy); }
#topbar .btn:hover { background: var(--navy-3); }
#topbar .icon-btn { color: var(--on-navy); }
#topbar .icon-btn:hover { background: var(--navy-3); border-color: var(--navy-3); }

/* ---------------------------------------------------------------- controls */
.btn { background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 3px; padding: 4px 14px; min-height: 26px; white-space: nowrap; color: var(--ink); }
.btn:hover { background: var(--blue-wash); border-color: var(--blue-light); }
.btn:active { background: var(--soft-2); }
.btn:focus-visible, .icon-btn:focus-visible, .tab:focus-visible, .input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--navy-3); border-color: var(--navy-3); }
.btn.danger { background: var(--paper); border: 1px solid var(--navy); color: var(--navy); font-weight: 700; }
.btn.danger:hover { background: var(--navy); color: #fff; }
.btn.ghost { background: transparent; }
.btn.small { padding: 3px 10px; min-height: 24px; font-size: 12px; }
.btn.wide { width: 100%; margin-top: 14px; min-height: 32px; }
.btn.toggle.on { background: var(--blue); border-color: var(--blue); color: #fff; font-weight: 600; }
.btn.toggle.on:hover { background: var(--blue-dark); }
.btn:disabled { color: var(--muted); background: var(--well); }
.icon-btn { background: transparent; border: 1px solid transparent; color: var(--blue); font-size: 12px; padding: 2px 8px; border-radius: 3px; }
.icon-btn:hover { border-color: var(--rule-strong); background: var(--blue-wash); }
.input, .select { background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 3px; color: var(--ink); padding: 5px 7px; font: inherit; width: 100%; outline: none; user-select: text; }
.input:focus, .select:focus { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }
.input.big { font-size: 18px; letter-spacing: 1px; font-family: Consolas, "Courier New", monospace; }
.select { width: auto; padding: 3px 4px; font-size: 12px; }
.lbl { display: block; font-size: 12px; color: var(--ink-2); margin: 12px 0 4px; }
.msg { min-height: 18px; margin-top: 8px; font-size: 12px; }
.msg.err { color: var(--ink); font-weight: 600; }
.msg.ok { color: var(--green); font-weight: 600; }
.row { display: flex; gap: 6px; align-items: center; }
.row.end { justify-content: flex-end; margin-top: 16px; }
.check { display: flex; align-items: center; gap: 6px; }
input[type=checkbox] { accent-color: var(--blue); }

/* ---------------------------------------------------------------- home */
.view { flex: 1; min-height: 0; }
#view-home { overflow: auto; padding: 20px; display: flex; flex-direction: column; align-items: center; }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; width: 100%; max-width: 900px; }
.card { background: var(--paper); border: 1px solid var(--rule-strong); border-top: 3px solid var(--navy); border-radius: 3px; padding: 16px 18px; }
.card h2 { margin: 0 0 4px; padding-bottom: 6px; border-bottom: 1px solid var(--rule); }
.big-field { display: flex; align-items: center; justify-content: space-between; background: var(--well); border: 1px solid var(--rule-strong); border-radius: 3px; padding: 6px 6px 6px 10px; font-size: 24px; letter-spacing: 2px; color: var(--navy); user-select: text; }
.big-field span { flex: 1; font-family: Consolas, "Courier New", monospace; }
.sub { font-size: 12px; margin: 18px 0 6px; font-weight: 600; color: var(--ink-2); }
.recent { list-style: none; padding: 0; margin: 0; max-height: 160px; overflow: auto; border: 1px solid var(--rule); border-radius: 3px; }
.recent li { display: flex; justify-content: space-between; padding: 4px 8px; border-bottom: 1px solid var(--rule); }
.recent li:last-child { border-bottom: none; }
.recent li:hover { background: var(--blue-wash); }
.recent li span:last-child { color: var(--muted); font-family: Consolas, monospace; }
.footer { max-width: 900px; text-align: center; margin-top: 16px; }
.banner { width: 100%; max-width: 900px; display: flex; justify-content: space-between; align-items: center; gap: 12px; background: var(--blue-wash); border: 1px solid var(--blue); border-left: 4px solid var(--blue); padding: 8px 12px; margin-bottom: 14px; font-weight: 600; color: var(--navy); border-radius: 3px; }

/* ---------------------------------------------------------------- session */
#view-session { display: flex; flex-direction: column; }
#toolbar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; background: var(--well); border-bottom: 1px solid var(--rule-strong); flex-wrap: wrap; flex-shrink: 0; }
.tb-group { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.peer-label { font-weight: 600; margin-right: 6px; color: var(--navy); }
.stats { font-size: 11px; color: var(--muted); font-family: Consolas, monospace; }
.call-group { border: 1px solid var(--rule-strong); padding: 2px 4px; background: var(--paper); border-radius: 3px; }
.group-label { font-size: 11px; color: var(--muted); margin: 0 4px 0 2px; }
.live { font-size: 11px; font-weight: 700; color: #fff; background: var(--blue); padding: 1px 7px; letter-spacing: .5px; border-radius: 3px; }
#session-body { flex: 1; display: flex; min-height: 0; }
#screen-wrap { flex: 1; position: relative; background: var(--navy); overflow: hidden; display: flex; align-items: center; justify-content: center; }
#screen-wrap.actual { overflow: auto; display: block; }
#remote-screen { width: 100%; height: 100%; object-fit: contain; outline: none; cursor: default; }
#screen-wrap.actual #remote-screen { width: auto; height: auto; max-width: none; object-fit: none; }
#screen-overlay { position: absolute; inset: 0; display: grid; place-items: center; color: var(--on-navy-muted); pointer-events: none; }
body.fullscreen #topbar { display: none; }
body.fullscreen #toolbar { position: fixed; top: 0; left: 50%; transform: translate(-50%, -100%); z-index: 50; border: 1px solid var(--rule-strong); border-top: none; transition: transform .15s; padding-bottom: 8px; }
body.fullscreen #toolbar:hover, body.fullscreen #toolbar.peek { transform: translate(-50%, 0); }
body.fullscreen #side { display: none; }

#host-hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; background: var(--soft); }
#host-hero h2 { margin: 14px 0 4px; font-size: 18px; color: var(--navy); }
#host-hero p { max-width: 460px; }
.pulse { width: 16px; height: 16px; border-radius: 50%; background: var(--blue); animation: blink 1.4s steps(2, start) infinite; }
@keyframes blink { to { background: var(--blue-light); } }

body.role-viewer .host-only, body.role-host .viewer-only { display: none !important; }

#side { width: 320px; background: var(--paper); border-left: 1px solid var(--rule-strong); display: flex; flex-direction: column; flex-shrink: 0; }
#side.collapsed { display: none; }
.tabs { display: flex; background: var(--well); border-bottom: 1px solid var(--rule-strong); padding: 4px 4px 0; gap: 2px; }
.tab { flex: 1; background: var(--well); border: 1px solid var(--rule-strong); border-bottom: none; border-radius: 3px 3px 0 0; padding: 4px 0; color: var(--muted); position: relative; top: 1px; }
.tab.active { background: var(--paper); color: var(--navy); font-weight: 600; box-shadow: inset 0 2px 0 var(--blue); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--blue); vertical-align: middle; }
.tab-body { flex: 1; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.cam-box { position: relative; background: var(--navy); aspect-ratio: 4/3; overflow: hidden; border: 1px solid var(--rule-strong); border-radius: 3px; }
.cam-box.small { width: 55%; align-self: flex-end; }
.cam-box video { width: 100%; height: 100%; object-fit: cover; }
.cam-label { position: absolute; left: 0; bottom: 0; font-size: 11px; background: var(--navy); color: var(--on-navy); padding: 1px 6px; }
.cam-off { position: absolute; inset: 0; display: grid; place-items: center; color: var(--on-navy-muted); font-size: 12px; background: var(--navy-2); }
.call-state { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.quality { display: inline-flex; align-items: flex-end; gap: 2px; }
.quality i { width: 4px; border-radius: 1px; background: var(--rule-strong); }
.quality i:nth-child(1) { height: 5px; } .quality i:nth-child(2) { height: 8px; } .quality i:nth-child(3) { height: 11px; } .quality i:nth-child(4) { height: 14px; }
.quality.q1 i:nth-child(-n+1), .quality.q2 i:nth-child(-n+2) { background: var(--ink-2); }
.quality.q3 i:nth-child(-n+3), .quality.q4 i:nth-child(-n+4) { background: var(--green); }
.quality b { font-weight: 400; font-size: 11px; margin-left: 4px; color: var(--ink); }
.devices { display: flex; flex-direction: column; gap: 6px; }
.devices label { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--ink-2); }
.devices .select, .form-grid .select { width: 100%; }
.grow { flex: 1; }
.chat-log { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 4px; user-select: text; border: 1px solid var(--rule); border-radius: 3px; padding: 6px; background: var(--paper); }
.bubble { max-width: 90%; padding: 3px 0; line-height: 1.35; word-wrap: break-word; white-space: pre-wrap; }
.bubble.me::before { content: "You: "; font-weight: 600; color: var(--blue); }
.bubble.them::before { content: "Partner: "; font-weight: 600; color: var(--navy); }
.bubble.sys { align-self: stretch; color: var(--muted); font-size: 11px; font-style: italic; }
.chat-form { display: flex; gap: 4px; }
.drop { border: 1px dashed var(--rule-strong); border-radius: 3px; padding: 18px; text-align: center; background: var(--well); }
.drop.over, .drop:hover { border-color: var(--blue); background: var(--blue-wash); }
.transfers { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.transfers li { border: 1px solid var(--rule); border-radius: 3px; padding: 6px 8px; font-size: 12px; }
.transfers .bar { height: 6px; border-radius: 3px; margin-top: 4px; background: var(--rule); overflow: hidden; }
.transfers .bar i { display: block; height: 100%; background: var(--blue); width: 0; }
.transfers a { color: var(--blue); text-decoration: underline; cursor: pointer; }
.info { width: 100%; border-collapse: collapse; font-size: 12px; user-select: text; }
.info td { padding: 4px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.info td:first-child { color: var(--muted); width: 38%; }

/* ---------------------------------------------------------------- menus */
.dropdown { position: relative; }
.dropdown .menu { display: none; position: absolute; top: 100%; left: 0; z-index: 30; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 3px; padding: 3px; min-width: 220px; box-shadow: 0 6px 18px -8px rgba(11, 26, 46, .35); }
.dropdown.open .menu { display: block; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: none; padding: 5px 16px; font-size: 12px; border-radius: 2px; }
.menu button:hover { background: var(--blue-wash); color: var(--navy); }
.menu hr { border: none; border-top: 1px solid var(--rule); margin: 3px 0; }

/* ---------------------------------------------------------------- dialogs */
.modal { position: fixed; inset: 0; background: rgba(11, 26, 46, .45); display: grid; place-items: center; z-index: 100; }
.modal-card { background: var(--paper); border: 1px solid var(--navy); border-radius: 3px; padding: 16px 18px; width: 440px; max-height: 90vh; overflow: auto; box-shadow: 0 12px 32px -12px rgba(11, 26, 46, .5); }
.modal-card.wide { width: 600px; }
.modal-card h2 { margin: -16px -18px 12px; padding: 7px 12px; background: var(--navy); color: #fff; font-size: 13px; }
.form-grid { display: grid; grid-template-columns: 150px 1fr; align-items: center; column-gap: 10px; }
.form-grid .lbl { margin: 6px 0; }
.form-grid .input, .form-grid .select, .form-grid .row { margin: 3px 0; }
.trusted { list-style: none; margin: 4px 0; padding: 0; border: 1px solid var(--rule); border-radius: 3px; background: var(--paper); }
.trusted li { display: flex; justify-content: space-between; align-items: center; padding: 3px 6px; border-bottom: 1px solid var(--rule); font-size: 12px; }
.trusted li:last-child { border-bottom: none; }
.audit-list { max-height: 55vh; overflow: auto; font-size: 11px; font-family: Consolas, monospace; user-select: text; background: var(--well); border: 1px solid var(--rule-strong); border-radius: 3px; padding: 6px; }
.audit-list div { padding: 2px 0; border-bottom: 1px solid var(--rule); }
.audit-list .ev { font-weight: 600; color: var(--blue-dark); }
.audit-list .bad { font-weight: 700; color: var(--navy); text-decoration: underline; }
.diag-ok { color: var(--green); font-weight: 600; }
.diag-warn { color: var(--ink-2); font-weight: 600; }
.diag-bad { color: var(--navy); font-weight: 700; text-decoration: underline; }

#toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: var(--navy); color: var(--on-navy); border: 1px solid var(--navy-3); border-radius: 3px; padding: 7px 14px; font-size: 12px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 200; box-shadow: 0 8px 24px -12px rgba(11, 26, 46, .5); }
#toast.show { opacity: 1; }

/* brand "muted" (#64748b) is below 4.5:1 on the tinted soft/well backgrounds, so small text there uses ink-2 */
#view-home > .muted, .footer, .stats, .group-label, .tab, #host-hero .muted, .drop .muted { color: var(--ink-2); }
.tab.active { color: var(--navy); }

@media (max-width: 860px) { .home-grid { grid-template-columns: 1fr; } }
