:root {
    color-scheme: dark;
    --bg: #090b10;
    --panel: #151922;
    --panel-2: #1b202b;
    --text: #f5f7fb;
    --muted: #aab1be;
    --line: rgba(255,255,255,.09);
    --red: #ef2b36;
    --green: #45d483;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    min-height: 100vh;
    background: radial-gradient(circle at top, #222733 0, var(--bg) 52%);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: #fff; }
.topbar {
    min-height: 72px;
    padding: 14px clamp(18px,4vw,54px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
    background: rgba(9,11,16,.85);
    backdrop-filter: blur(16px);
}
.brand { display:flex; align-items:baseline; gap:10px; text-decoration:none; white-space:nowrap; }
.brand strong { font-size: 28px; letter-spacing: -2px; line-height:1; }
.brand strong span { color: var(--red); }
.brand small { color: var(--muted); text-transform:uppercase; letter-spacing:.16em; }
nav { display:flex; align-items:center; gap:18px; font-size:14px; flex-wrap:wrap; justify-content:flex-end; }
nav a, .link-button { color:#dfe4ed; text-decoration:none; }
.inline { display:inline; margin:0; }
.link-button {
    border:0; background:none; padding:0; font:inherit; cursor:pointer;
}
.user-chip {
    padding:7px 11px; border:1px solid var(--line); border-radius:999px; color:var(--muted);
}
.shell { width:min(1120px, calc(100% - 32px)); margin:0 auto; padding:48px 0 72px; }
.auth-card, .form-card {
    width:min(480px,100%); margin:5vh auto 0; padding:36px;
    border:1px solid var(--line); border-radius:22px; background:rgba(21,25,34,.94);
    box-shadow:0 25px 80px rgba(0,0,0,.35);
}
.form-card { margin-top:0; }
h1 { margin:.25rem 0 .7rem; font-size:clamp(30px,5vw,48px); letter-spacing:-.04em; }
h2 { margin-top:0; }
.eyebrow { color:#ff6972; text-transform:uppercase; letter-spacing:.17em; font-weight:800; font-size:12px; }
.muted, .card p, .hero p { color:var(--muted); line-height:1.65; }
.stack { display:grid; gap:18px; margin-top:28px; }
label { display:grid; gap:8px; color:#dfe4ed; font-size:14px; font-weight:700; }
input, select {
    width:100%; border:1px solid var(--line); border-radius:12px; padding:13px 14px;
    background:#0d1016; color:#fff; font:inherit; outline:none;
}
input:focus, select:focus { border-color:#fb5a64; box-shadow:0 0 0 3px rgba(239,43,54,.13); }
.primary, .button {
    display:inline-flex; align-items:center; justify-content:center; border:0; border-radius:12px;
    padding:13px 18px; background:var(--red); color:#fff; text-decoration:none;
    font-weight:800; cursor:pointer;
}
.button.secondary { background:#262c38; }
.button:disabled { opacity:.5; cursor:not-allowed; }
.hero { display:flex; justify-content:space-between; gap:30px; align-items:center; margin-bottom:34px; }
.status-card {
    min-width:280px; padding:20px; display:flex; gap:13px; align-items:center;
    background:rgba(69,212,131,.08); border:1px solid rgba(69,212,131,.2); border-radius:16px;
}
.status-card small { display:block; color:#8ccda9; margin-top:4px; }
.dot { width:12px; height:12px; border-radius:50%; background:var(--green); box-shadow:0 0 16px var(--green); }
.grid { display:grid; grid-template-columns:repeat(3,1fr); gap:18px; }
.card {
    padding:24px; border:1px solid var(--line); background:rgba(21,25,34,.91); border-radius:18px;
}
.card-head { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.card-head h2 { margin-bottom:0; }
dl { display:grid; grid-template-columns:auto 1fr; gap:10px 18px; margin:0; }
dt { color:var(--muted); } dd { margin:0; text-align:right; overflow-wrap:anywhere; }
.page-head { display:flex; align-items:end; justify-content:space-between; gap:20px; margin-bottom:24px; }
.table-wrap { overflow:auto; border:1px solid var(--line); border-radius:16px; }
table { width:100%; border-collapse:collapse; background:rgba(21,25,34,.94); min-width:830px; }
th, td { padding:15px 16px; border-bottom:1px solid var(--line); text-align:left; vertical-align:middle; }
th { color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.1em; }
tr:last-child td { border-bottom:0; }
.badge { display:inline-block; padding:5px 9px; border-radius:999px; font-size:12px; font-weight:800; }
.badge.ok { color:#7ce5aa; background:rgba(69,212,131,.1); }
.badge.wait { color:#ffd681; background:rgba(255,193,77,.10); }
.badge.off { color:#c1c5ce; background:rgba(255,255,255,.06); }
.badge.error { color:#ff969d; background:rgba(239,43,54,.13); }
.actions { display:flex; gap:13px; white-space:nowrap; }
.flash { padding:13px 16px; border-radius:12px; margin-bottom:18px; }
.flash.error { background:rgba(239,43,54,.13); border:1px solid rgba(239,43,54,.25); }
.flash.success { background:rgba(69,212,131,.1); border:1px solid rgba(69,212,131,.23); }
.signal-actions { display:flex; gap:10px; flex-wrap:wrap; margin:18px 0 10px; }
.signal-message { margin:0; font-size:14px; }
.peer-wrap { margin-top:16px; padding-top:14px; border-top:1px solid var(--line); }
.peer-wrap ul { margin:9px 0 0; padding-left:20px; color:var(--muted); }
code { color:#ff9da3; }
@media (max-width: 900px) {
    .grid { grid-template-columns:1fr 1fr; }
}
@media (max-width: 720px) {
    .topbar, .hero, .page-head { align-items:flex-start; flex-direction:column; }
    .grid { grid-template-columns:1fr; }
    .status-card { min-width:0; width:100%; }
    nav { justify-content:flex-start; }
}
/* R100 AUDIO WEBRTC */
.audio-head { align-items:center; }
.audio-state-panel {
    min-width:280px; display:flex; align-items:center; gap:12px;
    padding:16px 18px; border:1px solid var(--line); border-radius:15px;
    background:rgba(21,25,34,.92);
}
.audio-state-panel small { color:var(--muted); line-height:1.4; }
.audio-toolbar {
    display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:18px;
}
.audio-check {
    display:flex; grid-template-columns:auto 1fr; align-items:center; gap:9px;
    padding:10px 13px; border:1px solid var(--line); border-radius:12px;
    background:rgba(21,25,34,.8); color:var(--muted);
}
.audio-check input { width:auto; }
.meter-card {
    padding:18px 20px; border:1px solid var(--line); border-radius:16px;
    background:rgba(21,25,34,.86); margin-bottom:34px;
}
.meter-label { display:flex; justify-content:space-between; gap:15px; color:var(--muted); font-size:13px; }
.meter {
    height:12px; overflow:hidden; margin-top:11px; border-radius:999px;
    background:#07090d; border:1px solid var(--line);
}
.meter span {
    display:block; width:1%; height:100%; border-radius:inherit;
    background:linear-gradient(90deg,#45d483 0 72%,#f2c84b 86%,#ef2b36 100%);
    transition:width 70ms linear;
}
.micro-note { margin:10px 0 0; color:var(--muted); font-size:12px; line-height:1.5; }
.section-title { display:flex; align-items:end; justify-content:space-between; gap:18px; margin-bottom:16px; }
.section-title h2 { margin:.2rem 0 0; font-size:30px; }
.remote-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; }
.empty-card,.remote-card,.return-card {
    padding:22px; border:1px solid var(--line); border-radius:17px;
    background:rgba(21,25,34,.92);
}
.empty-card { color:var(--muted); grid-column:1/-1; line-height:1.6; }
.remote-top { display:flex; align-items:flex-start; justify-content:space-between; gap:15px; }
.remote-top strong,.remote-top small { display:block; }
.remote-top small { margin-top:5px; color:var(--muted); }
.remote-message { color:var(--muted); font-size:13px; }
.remote-controls { display:grid; grid-template-columns:1fr auto; gap:14px; align-items:end; margin-top:18px; }
.remote-controls label { color:var(--muted); }
.remote-card audio { width:100%; height:0; opacity:0; position:absolute; pointer-events:none; }
.return-card { display:grid; grid-template-columns:1fr minmax(180px,280px); gap:22px; align-items:center; }
.return-card p { color:var(--muted); margin:.45rem 0 0; }
.volume-control { color:var(--muted); }
.audio-warning {
    margin-top:20px; padding:14px 16px; border-radius:13px;
    background:rgba(239,43,54,.12); border:1px solid rgba(239,43,54,.25);
    color:#ffc1c5; line-height:1.5;
}
.button.compact { padding:9px 12px; font-size:13px; }
@media (max-width:900px) { .remote-grid { grid-template-columns:1fr; } }
@media (max-width:720px) {
    .audio-state-panel { min-width:0; width:100%; }
    .return-card { grid-template-columns:1fr; }
    .meter-label { flex-direction:column; gap:5px; }
}
/* R100 BRANDING AND AUDIO DEVICES — 2026-07-22 */
.brand-official {
    display: flex;
    align-items: center;
    gap: 14px;
}

.brand-official img {
    display: block;
    width: auto;
    height: 54px;
    max-width: 150px;
    object-fit: contain;
}

.brand-section {
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .16em;
    font-size: 12px;
    font-weight: 800;
    padding-left: 13px;
    border-left: 1px solid var(--line);
}

.device-panel {
    padding: 22px;
    margin-bottom: 18px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(21, 25, 34, .91);
}

.compact-title {
    margin-bottom: 18px;
}

.compact-title h2 {
    margin-bottom: 0;
}

.device-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.device-grid label small {
    color: var(--muted);
    line-height: 1.45;
    font-weight: 400;
}

.device-grid select:disabled {
    opacity: .7;
    cursor: not-allowed;
}

.device-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 18px;
}

.audio-toolbar {
    padding: 4px 0 0;
}

.remote-controls input[type="range"],
.volume-control input[type="range"] {
    accent-color: var(--red);
}

@media (max-width: 720px) {
    .brand-official {
        width: 100%;
        justify-content: space-between;
    }

    .brand-official img {
        height: 48px;
        max-width: 132px;
    }

    .device-grid {
        grid-template-columns: 1fr;
    }

    .device-actions {
        align-items: stretch;
        flex-direction: column;
    }

    .device-actions > * {
        width: 100%;
    }
}
/* R100 WEBRTC MONITORING AND RECOVERY — 2026-07-22 */
.telemetry-panel {
    padding: 22px;
    margin-bottom: 34px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: rgba(21, 25, 34, .91);
}

.telemetry-title {
    align-items: center;
    margin-bottom: 18px;
}

.telemetry-title h2 {
    margin-bottom: 0;
}

.telemetry-intro,
.telemetry-note {
    color: var(--muted);
    line-height: 1.55;
}

.telemetry-intro {
    margin: 0;
}

.telemetry-note {
    margin: 18px 0 0;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    font-size: 12px;
}

.telemetry-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.telemetry-grid article {
    min-width: 0;
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(8, 10, 15, .46);
}

.telemetry-grid article > span,
.remote-stats div > span:first-child {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.telemetry-grid strong {
    display: block;
    margin-top: 7px;
    font-size: 20px;
    overflow-wrap: anywhere;
}

.telemetry-grid small {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    line-height: 1.35;
}

.remote-meter {
    height: 9px;
    margin: 14px 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #07090d;
}

.remote-meter span {
    display: block;
    width: 1%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(
        90deg,
        #45d483 0 72%,
        #f2c84b 86%,
        #ef2b36 100%
    );
    transition: width 70ms linear;
}

.remote-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 9px;
    margin: 15px 0;
}

.remote-stats > div {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: rgba(8, 10, 15, .4);
}

.remote-stats strong {
    display: block;
    margin-top: 5px;
    font-size: 13px;
    overflow-wrap: anywhere;
}

.remote-quality {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 7px;
}

.remote-quality .badge {
    width: fit-content;
}

.remote-card {
    position: relative;
}

@media (max-width: 940px) {
    .telemetry-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .remote-stats {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

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

    .telemetry-grid strong {
        font-size: 17px;
    }

    .remote-stats {
        grid-template-columns: 1fr 1fr;
    }
}
/* PER-JOURNALIST RETURN ROUTING — 2026-07-22 */
.return-routing {
    margin-top: 15px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(8, 10, 15, .42);
}
.return-routing label {
    display: grid;
    gap: 8px;
}
.return-routing small {
    color: var(--muted);
    font-weight: 400;
    line-height: 1.4;
}
/* R100 HYBRID ANDROID MODE — 2026-07-22 */
.native-audio-mode .device-panel {
    border-color: rgba(239, 43, 54, .28);
}

.native-audio-mode .device-panel::before {
    content: "Áudio nativo Android";
    display: inline-block;
    margin-bottom: 14px;
    padding: 5px 9px;
    border-radius: 999px;
    color: #7ce5aa;
    background: rgba(69, 212, 131, .1);
    font-size: 12px;
    font-weight: 800;
}

.native-audio-mode #input-device:disabled {
    opacity: .9;
}

.native-audio-mode .micro-note {
    margin-top: 12px;
}

.native-audio-mode .micro-note::after {
    content: " A ligação continua ativa com o ecrã bloqueado através do serviço em primeiro plano da aplicação.";
}
