/* Activi Remote - technician web app. Activi's dark theme with the orange accent. */
:root {
  --bg: #0f1115; --bg2: #141821; --card: #1a1d23; --card2: #20242e;
  --line: #2a2e37; --line2: #363b47;
  --fg: #e8eaed; --muted: #9aa0a6; --faint: #6b7280;
  --orange: #ff7a1a; --orange-dim: #c85f12;
  --green: #4ade80; --red: #ef4444; --amber: #f59e0b; --blue: #60a5fa;
  --radius: 12px; --radius-sm: 8px;
  --sidebar-w: 320px;
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
/* the hidden attribute must win over the layout rules below (.boot/.auth/.app use display:grid) */
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); overflow: hidden; -webkit-tap-highlight-color: transparent; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; color: var(--muted); background: var(--bg); }

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; letter-spacing: .01em; }
.brand b { color: var(--orange); font-weight: 800; }
.brand.big { font-size: 24px; margin-bottom: 22px; justify-content: center; }
.brand-mark { width: 20px; height: 20px; border-radius: 6px; background: linear-gradient(135deg, var(--orange), #ffab5e); box-shadow: 0 0 18px rgba(255,122,26,.45); flex: none; }
.brand.big .brand-mark { width: 26px; height: 26px; }

/* ---------- language switch ---------- */
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lang-switch { display: inline-flex; gap: 2px; background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 2px; flex: none; }
.lang-switch button { appearance: none; background: transparent; border: 0; color: var(--muted); font: inherit; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 16px; cursor: pointer; line-height: 1; transition: background .15s, color .15s; }
.lang-switch button:hover { color: var(--fg); }
.lang-switch button.active { background: var(--orange); color: #1a1205; }
#langAuth { position: absolute; top: 16px; right: 16px; }

/* ---------- auth ---------- */
.auth { position: fixed; inset: 0; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1200px 600px at 20% -10%, rgba(255,122,26,.10), transparent 60%),
  radial-gradient(900px 500px at 100% 110%, rgba(96,165,250,.08), transparent 55%), var(--bg); }
.auth-card { position: relative; width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px; box-shadow: 0 30px 80px rgba(0,0,0,.5); }
.auth-foot { position: fixed; bottom: 18px; width: 100%; text-align: center; color: var(--faint); font-size: 12px; left: 0; }
.auth h1 { font-size: 20px; margin: 0 0 4px; }
.auth .lead { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

/* ---------- forms ---------- */
.fld { display: block; margin-bottom: 14px; }
.fld > span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
input, .sel { width: 100%; padding: 11px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--bg2); color: var(--fg); font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, .sel:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,122,26,.18); }
.check { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--muted); margin-bottom: 14px; cursor: pointer; }
.check input { width: auto; }
.sel { width: auto; padding: 7px 10px; font-size: 13px; }

.btn { appearance: none; border: 1px solid var(--line2); background: var(--card2); color: var(--fg); border-radius: var(--radius-sm); padding: 11px 14px; font-weight: 600; font-size: 14px; cursor: pointer; transition: transform .05s, background .15s, border-color .15s; }
.btn:hover { border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: linear-gradient(180deg, var(--orange), var(--orange-dim)); border-color: transparent; color: #1a1205; width: 100%; padding: 12px; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: #3a1414; border-color: #5b1d1d; color: #ffb4b4; }
.btn.danger:hover { background: #4a1818; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); text-align: left; }
.btn.ghost:hover { background: var(--card2); color: var(--fg); }
.btn.tiny { padding: 7px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.msg { font-size: 13px; margin-top: 10px; min-height: 18px; }
.msg.err { color: var(--red); } .msg.ok { color: var(--green); }
.link { color: var(--orange); background: none; border: 0; cursor: pointer; font-size: 13px; padding: 0; }
.qr { display: block; margin: 12px auto; border-radius: 8px; background: #fff; padding: 8px; width: 200px; height: 200px; }
.secret { font-family: ui-monospace, monospace; background: var(--bg2); padding: 8px 10px; border-radius: 6px; word-break: break-all; font-size: 12px; color: var(--amber); text-align: center; }

/* ---------- app layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; height: 100vh; }
.sidebar { background: var(--bg2); border-right: 1px solid var(--line); padding: 18px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
.who { font-size: 12px; color: var(--muted); margin-top: -8px; }
.who b { color: var(--fg); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.panel-head h2 { margin: 0; }
.side-nav { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }

.machines { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; }
.machine { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid transparent; cursor: pointer; }
.machine:hover { background: var(--card2); border-color: var(--line); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.machine .m-main { flex: 1; min-width: 0; }
.machine .m-id { font-weight: 600; font-size: 14px; }
.machine .m-label { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.machine .m-badge { font-size: 10px; color: var(--amber); border: 1px solid var(--amber); border-radius: 20px; padding: 1px 6px; }
.empty { color: var(--faint); font-size: 13px; padding: 6px 2px; }

/* ---------- stage ---------- */
.stage { display: flex; flex-direction: column; min-width: 0; background: #000; }
.stage-head { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: var(--bg2); border-bottom: 1px solid var(--line); min-height: 54px; }
.session-title { font-size: 14px; color: var(--muted); flex: 1; }
.session-title.live { color: var(--green); }
.stage-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { font-size: 11px; color: var(--muted); border: 1px solid var(--line2); border-radius: 20px; padding: 3px 9px; }
.pill.rtc { color: var(--green); border-color: var(--green); }
.screen-wrap { flex: 1; position: relative; display: grid; place-items: center; overflow: hidden; background:
  radial-gradient(800px 400px at 50% 0%, rgba(255,122,26,.05), transparent 60%), #000; }
.screen { max-width: 100%; max-height: 100%; object-fit: contain; cursor: crosshair; touch-action: none; }
.placeholder { text-align: center; color: var(--muted); padding: 20px; }
.ph-logo, .ph-sub { }
.ph-logo { width: 54px; height: 54px; margin: 0 auto 16px; border-radius: 14px; background: linear-gradient(135deg, var(--orange), #ffab5e); opacity: .85; box-shadow: 0 0 40px rgba(255,122,26,.3); }
.ph-sub { font-size: 12px; color: var(--faint); }
.status { position: absolute; bottom: 12px; left: 12px; font-size: 12px; color: var(--muted); background: rgba(0,0,0,.55); padding: 5px 10px; border-radius: 20px; backdrop-filter: blur(4px); max-width: 80%; }
.drop-hint { position: absolute; inset: 14px; border: 2px dashed var(--orange); border-radius: 14px; display: grid; place-items: center; font-size: 20px; color: var(--orange); background: rgba(255,122,26,.08); pointer-events: none; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--card2); border: 1px solid var(--line2); padding: 10px 16px; border-radius: 20px; font-size: 13px; box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 50; }

/* ---------- overlay / sheets ---------- */
.overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 20px; z-index: 60; backdrop-filter: blur(3px); }
.sheet { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: 100%; max-width: 720px; max-height: 85vh; overflow-y: auto; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.sheet h2 { margin: 0 0 14px; font-size: 18px; }
.sheet .close { float: right; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
td.wrap { white-space: normal; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line2); color: var(--muted); }
.tag.granted, .tag.started, .tag.login { color: var(--green); border-color: #255e3a; }
.tag.denied, .tag.ended, .tag.login_failed { color: var(--red); border-color: #5b2020; }
.tag.unattended_attempt, .tag.unattended_granted, .tag.file_transfer { color: var(--amber); border-color: #6b4e14; }
.row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.row .fld { flex: 1; margin-bottom: 0; min-width: 140px; }
.only-mobile { display: none; }

/* ---------- mobile ---------- */
@media (max-width: 820px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 340px); z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 60px rgba(0,0,0,.6); }
  .app.menu-open .sidebar { transform: translateX(0); }
  .only-mobile { display: inline-flex; }
  .stage-tools { gap: 6px; }
  .stage-tools .sel, .pill { display: none; }
}
