:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #080914;
  color: #f5f6ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 20% 0%, #22205a 0, #080914 35%, #05060c 100%); }
button, input { font: inherit; }
.shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 36px 0 60px; }
.header-right { display: flex; align-items: center; gap: 12px; }
.icon-btn { padding: 8px 12px; background: #17192b; border: 1px solid #2c3048; border-radius: 999px; cursor: pointer; font-size: 14px; }
.icon-btn:hover { background: #26283c; }
.settings-drawer { background: #111427; border: 1px solid #343750; border-radius: 14px; padding: 16px; margin-bottom: 24px; }
.settings-drawer label { font-size: 12px; font-weight: 700; color: #9e91ff; text-transform: uppercase; letter-spacing: 0.05em; }
.gateway-row { display: flex; gap: 10px; align-items: center; margin-top: 6px; }
.gateway-row input { margin: 0; flex: 1; }
.gateway-row button { padding: 11px 18px; white-space: nowrap; }
.eyebrow { color: #9e91ff; font-size: 12px; font-weight: 800; letter-spacing: .18em; }
h1 { margin: 6px 0; font-size: clamp(32px, 5vw, 54px); }
h2 { margin-top: 0; }
p { color: #b9bdd1; line-height: 1.55; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.panel { background: rgba(17, 18, 35, .9); border: 1px solid rgba(158, 145, 255, .2); border-radius: 20px; padding: 24px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
button { border: 0; border-radius: 12px; padding: 12px 16px; background: linear-gradient(135deg, #765cff, #9d66ff); color: white; font-weight: 750; cursor: pointer; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary { background: #26283c; }
input { width: 100%; padding: 13px 14px; margin: 8px 0 14px; background: #090a15; color: white; border: 1px solid #343750; border-radius: 12px; outline: none; }
.code { margin: 18px 0; font-size: 44px; font-weight: 850; letter-spacing: .18em; color: #b8adff; }
.request { margin-top: 18px; padding: 16px; background: #111427; border-radius: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.status { padding: 8px 14px; border-radius: 999px; background: #17192b; color: #babee0; font-size: 13px; font-weight: 600; border: 1px solid #2c3048; transition: all 0.2s ease; }
.status.online { background: #132f22; color: #52e396; border-color: #1f6844; }
.status.waiting { background: #2f2a13; color: #e3bc52; border-color: #685d1f; }
.status.active { background: #131e3d; color: #72a3ff; border-color: #284080; }
.status.alert { background: #3d131b; color: #ff7287; border-color: #802838; }
.timer { font-size: 13px; color: #9e91ff; font-weight: 600; margin: 4px 0 12px; }
.hint { min-height: 24px; }
.session-banner { position: sticky; top: 0; left: 0; width: 100%; background: linear-gradient(90deg, #3d0c15 0%, #1f080c 100%); border-bottom: 2px solid #ff3355; padding: 10px 24px; display: flex; justify-content: space-between; align-items: center; z-index: 1000; box-shadow: 0 4px 20px rgba(255, 51, 85, 0.2); }
.session-banner[hidden] { display: none !important; }
.banner-content { display: flex; align-items: center; gap: 12px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff3355; animation: pulse 1.5s infinite; }
@keyframes pulse { 0% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(1.2); } 100% { opacity: 1; transform: scale(1); } }
.live-text { color: #ff5577; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; }
.banner-sub { color: #d0d4e8; font-size: 13px; }
.banner-ctrl { color: #ffd166; font-size: 13px; font-weight: 800; letter-spacing: 0.05em; }
.banner-actions { display: flex; align-items: center; gap: 10px; }
.danger-sub { background: #3d101a; border: 1px solid #731e2f; color: #ff8599; }
.danger-sub:hover { background: #5a1726; }
.danger-btn { background: #b81434; color: white; padding: 8px 16px; border-radius: 8px; font-size: 12px; font-weight: 700; border: none; cursor: pointer; }
.danger-btn:hover { background: #d6183e; }
.control-modal { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.75); display: flex; justify-content: center; align-items: center; z-index: 2000; backdrop-filter: blur(4px); }
.control-modal[hidden] { display: none !important; }
.file-info-box { background: #1a1d36; border: 1px solid #343750; border-radius: 10px; padding: 12px 16px; margin: 14px 0; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.file-name { font-weight: 700; color: #b8adff; word-break: break-all; font-size: 14px; text-align: left; }
.file-size { font-size: 12px; color: #52e396; background: #0d0f1e; padding: 4px 8px; border-radius: 6px; white-space: nowrap; font-family: monospace; }
.clipboard-input { width: 100%; background: #090a15; border: 1px solid #343750; border-radius: 10px; color: white; padding: 12px; resize: vertical; font-family: monospace; font-size: 13px; margin: 12px 0 16px; outline: none; }
.clipboard-input:focus { border-color: #765cff; }
.transfer-card { position: fixed; bottom: 24px; right: 24px; width: 340px; background: #131528; border: 1px solid #765cff; border-radius: 14px; padding: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.6); z-index: 1500; }
.transfer-card[hidden] { display: none !important; }
.transfer-info { display: flex; align-items: center; gap: 10px; }
.transfer-icon { font-size: 20px; }
.transfer-details { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.transfer-details strong { font-size: 13px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.transfer-details span { font-size: 11px; color: #9e91ff; margin-top: 2px; }
.icon-btn-sm { background: transparent; border: none; color: #8e95b3; cursor: pointer; font-size: 14px; padding: 4px; }
.icon-btn-sm:hover { color: #ff7287; }
.progress-bar-bg { width: 100%; height: 6px; background: #26283c; border-radius: 999px; margin-top: 10px; overflow: hidden; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #765cff, #52e396); transition: width 0.1s ease; }
.notification-toast { position: fixed; top: 20px; right: 20px; background: #17192b; border: 1px solid #52e396; color: #f5f6ff; padding: 12px 20px; border-radius: 12px; display: flex; align-items: center; gap: 10px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 3000; font-size: 13px; animation: fadeIn 0.2s ease; }
.notification-toast[hidden] { display: none !important; }
.session-timer { font-size: 12px; font-weight: 700; color: #52e396; background: #0c1a14; border: 1px solid #1f6844; padding: 4px 10px; border-radius: 6px; font-family: monospace; white-space: nowrap; }
.quality-badge { font-size: 11px; font-weight: 700; color: #52e396; background: #132f22; border: 1px solid #1f6844; }
.screen-modal-card { max-width: 680px; width: 95%; }
.screen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; margin: 18px 0; max-height: 50vh; overflow-y: auto; }
.screen-card { background: #17192b; border: 2px solid #2c3048; border-radius: 12px; padding: 12px; cursor: pointer; text-align: center; transition: all 0.2s ease; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.screen-card:hover { border-color: #765cff; background: #1f223a; transform: translateY(-2px); }
.screen-card img { width: 100%; height: auto; border-radius: 6px; object-fit: contain; background: #080914; max-height: 120px; }
.screen-card span { font-size: 13px; font-weight: 700; color: #f5f6ff; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
.control-modal-card { background: #131528; border: 2px solid #ffaa00; border-radius: 18px; padding: 30px; max-width: 460px; width: 90%; text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,0.8); }
.modal-icon { font-size: 40px; margin-bottom: 12px; }
.control-modal-card h3 { margin: 0 0 10px; font-size: 20px; color: #ffc04d; }
.control-modal-card p { color: #d1d5eb; line-height: 1.5; font-size: 14px; margin: 8px 0; }
.modal-note { font-size: 12px; color: #8e95b3; }
.modal-actions { display: flex; justify-content: center; gap: 14px; margin-top: 20px; }
.modal-actions button { min-width: 140px; }
video.controlling { cursor: crosshair; }
.viewer-title-row { display: flex; align-items: center; gap: 12px; }
.info-badge { font-size: 11px; font-weight: 700; color: #72a3ff; background: #131e3d; border: 1px solid #284080; padding: 3px 8px; border-radius: 6px; }
.viewer-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.viewer-panel { margin-top: 20px; }
.viewer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
video { width: 100%; min-height: 320px; max-height: 60vh; margin-top: 16px; border-radius: 14px; background: #010205; object-fit: contain; }
.diag-panel { margin-top: 20px; background: #0d0f1e; border: 1px solid #232742; }
.diag-panel h3 { margin: 0 0 14px; font-size: 14px; color: #9e91ff; text-transform: uppercase; letter-spacing: 0.08em; }
.diag-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.diag-item { background: #131527; padding: 10px 14px; border-radius: 10px; border: 1px solid #1f2238; }
.diag-label { display: block; font-size: 11px; color: #8a8ea8; text-transform: uppercase; margin-bottom: 4px; }
.diag-value { font-size: 14px; font-weight: 700; color: #72a3ff; font-family: monospace; }

/* Acceso Desatendido UI */
.panel-divider { border: 0; height: 1px; background: rgba(158, 145, 255, 0.2); margin: 20px 0; }
.unattended-host-box { background: #0c0e1e; border: 1px solid #282c4d; border-radius: 14px; padding: 16px; margin-top: 10px; }
.unattended-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.unattended-title { font-size: 14px; font-weight: 800; color: #b8adff; display: block; }
.unattended-sub { font-size: 11px; color: #8e95b3; margin: 4px 0 0; line-height: 1.4; }
.status-pill { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.status-pill-off { background: #1f2238; color: #8a8ea8; border: 1px solid #2f3456; }
.status-pill-on { background: #132f22; color: #52e396; border: 1px solid #1f6844; }
.device-id-row { display: flex; justify-content: space-between; align-items: center; background: #13162b; border: 1px solid #2c3154; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }
.device-id-label { display: block; font-size: 10px; text-transform: uppercase; color: #8e95b3; font-weight: 700; letter-spacing: 0.05em; }
.device-id-value { font-size: 20px; font-weight: 850; color: #72a3ff; letter-spacing: 0.12em; font-family: monospace; }
.icon-btn-secondary { background: #1f223c; border: 1px solid #343960; color: #b8adff; border-radius: 8px; padding: 6px 12px; font-size: 12px; cursor: pointer; transition: all 0.2s ease; }
.icon-btn-secondary:hover { background: #2f345c; color: white; }
.unattended-toggle-row { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; cursor: pointer; }
.toggle-label { font-size: 13px; font-weight: 600; color: #e1e4f5; cursor: pointer; }
.unattended-config-area { margin-top: 10px; padding-top: 10px; border-top: 1px dashed #282c4d; }
.unattended-input-label { font-size: 11px; font-weight: 700; color: #9e91ff; text-transform: uppercase; }
.password-row { display: flex; gap: 10px; align-items: center; margin-top: 4px; }
.password-row input { margin: 0; flex: 1; }
.password-row button { padding: 12px 18px; white-space: nowrap; }
.unattended-pass-status { display: block; font-size: 11px; margin-top: 6px; color: #52e396; }

/* Viewer Mode Switcher Tabs */
.viewer-tabs { display: flex; gap: 8px; margin-bottom: 18px; border-bottom: 1px solid #282c4d; padding-bottom: 10px; }
.tab-btn { background: #131527; color: #8e95b3; border: 1px solid #282c4d; border-radius: 10px; padding: 8px 14px; font-size: 12px; font-weight: 700; cursor: pointer; transition: all 0.2s ease; }
.tab-btn:hover { background: #1c1f38; color: white; }
.tab-btn.active { background: linear-gradient(135deg, #765cff, #9d66ff); color: white; border-color: transparent; }

/* Fail-visible Unattended active session banner */
.session-banner.unattended-mode { background: linear-gradient(90deg, #5c0d1b 0%, #29080e 100%); border-bottom: 2px solid #ff1a40; box-shadow: 0 4px 25px rgba(255, 26, 64, 0.4); }

@media (max-width: 760px) { .grid { grid-template-columns: 1fr; } .brand { flex-direction: column; } }
