:root {
  --bg: #0b1220;
  --panel: #131c2e;
  --panel-2: #1b2640;
  --line: #24314f;
  --text: #e6ebf5;
  --muted: #8b97b0;
  --accent: #22c55e;
  --accent-2: #16a34a;
  --danger: #ef4444;
  --warn: #f59e0b;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button { font: inherit; cursor: pointer; border: 0; color: inherit; background: none; }
input { font: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9em; }
.center { text-align: center; }
.error { color: var(--danger); min-height: 1.2em; margin: 8px 0 0; }
.info { color: var(--accent); margin: 4px 0 0; }
.info:empty { display: none; }
.item .approve { background: var(--accent); color: #04120a; font-weight: 600; padding: 6px 10px; border-radius: 8px; font-size: 0.8rem; }
.menu-list { display: flex; flex-direction: column; gap: 8px; }
.menu-list .secondary { text-align: left; }
.temp-pass { font-family: ui-monospace, monospace; font-size: 1.2rem; letter-spacing: 1px; background: var(--bg); padding: 10px; border-radius: 8px; text-align: center; user-select: all; }

.screen { min-height: 100%; }
#auth { display: grid; place-items: center; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 28px 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 1.5rem; }
.brand img { width: 34px; height: 34px; }
.brand.small { font-size: 1.05rem; }
.brand.small img { width: 26px; height: 26px; }
.tabs { display: flex; gap: 4px; background: var(--bg); padding: 4px; border-radius: 10px; margin: 18px 0 14px; }
.tabs button { flex: 1; padding: 8px 4px; border-radius: 8px; font-size: 0.85rem; color: var(--muted); }
.tabs button.active { background: var(--panel-2); color: var(--text); }
.tab-panel { display: flex; flex-direction: column; gap: 10px; }
.tab-panel input, .modal input[type=text], .modal input[type=password] { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text); }
.tab-panel input:focus { outline: 2px solid var(--accent); border-color: transparent; }

.primary { background: var(--accent); color: #04120a; font-weight: 600; padding: 12px 16px; border-radius: 10px; }
.primary:hover { background: var(--accent-2); }
.primary.sm { padding: 6px 12px; }
.secondary { background: var(--panel-2); padding: 10px 14px; border-radius: 10px; }
.link { color: var(--accent); font-size: 0.85rem; padding: 0 4px; }
.download-win { display: block; text-align: center; margin-top: 14px; padding: 10px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted); font-size: 0.9rem; text-decoration: none; }
.download-win:hover { color: var(--text); border-color: var(--accent); }
.icon-btn { width: 36px; height: 36px; border-radius: 10px; background: var(--panel-2); font-size: 1.1rem; }

#main { max-width: 640px; margin: 0 auto; padding-bottom: 240px; }
header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.header-right { display: flex; align-items: center; gap: 10px; }
.conn { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.conn.on { background: var(--accent); }

.banner { margin: 12px 16px 0; padding: 10px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); font-size: 0.9rem; }
.banner.warn { border-color: var(--warn); }

main { padding: 0 16px; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 20px 4px 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; transition: background .15s, border-color .15s; }
.item:hover { background: var(--panel-2); border-color: #33456e; }
.item.offline { opacity: 0.5; cursor: default; }
.item.me { cursor: default; }
.avatar { position: relative; width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--panel-2); display: grid; place-items: center; font-weight: 600; }
.avatar .dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--panel); background: #475569; }
.avatar .dot.on { background: var(--accent); }
.avatar .dot.busy { background: var(--warn); }
.item .info { flex: 1; min-width: 0; }
.item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item .sub { font-size: 0.8rem; color: var(--muted); }
.item .action { font-size: 1.2rem; opacity: 0.8; }
.item .del { color: var(--muted); font-size: 0.9rem; padding: 4px 8px; }
.badge { font-size: 0.7rem; background: var(--panel-2); padding: 2px 6px; border-radius: 6px; margin-left: 6px; color: var(--muted); font-weight: 500; }

/* Chamada */
.call { position: fixed; left: 50%; transform: translateX(-50%); bottom: 16px; width: calc(100% - 32px); max-width: 608px; background: var(--panel); border: 1px solid var(--accent); border-radius: 20px; padding: 16px; box-shadow: 0 20px 50px rgba(0,0,0,.5); z-index: 10; }
.call-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.call-title { font-weight: 700; font-size: 1.1rem; }
.peers { list-style: none; padding: 0; margin: 12px 0; display: flex; flex-wrap: wrap; gap: 8px; }
.peer { display: flex; align-items: center; gap: 8px; padding: 6px 10px 6px 6px; background: var(--panel-2); border-radius: 999px; font-size: 0.9rem; border: 2px solid transparent; transition: border-color .1s; }
.peer.talking { border-color: var(--accent); }
.peer.pending { opacity: .55; }
.peer .avatar { width: 28px; height: 28px; font-size: 0.75rem; }
.call-actions { display: flex; align-items: center; justify-content: center; gap: 18px; }
.mic { width: 72px; height: 72px; border-radius: 50%; background: var(--panel-2); font-size: 1.8rem; border: 3px solid var(--line); user-select: none; -webkit-user-select: none; touch-action: none; }
.mic.on { background: var(--accent); border-color: #86efac; box-shadow: 0 0 0 6px rgba(34,197,94,.2); }
.hangup { width: 52px; height: 52px; border-radius: 50%; background: var(--danger); font-size: 1.2rem; font-weight: 700; }
#mic-hint { margin-top: 8px; min-height: 1.2em; }

/* Modal / toast */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 20; padding: 16px; }
.modal-card { width: 100%; max-width: 420px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 20px; max-height: 85vh; overflow: auto; }
.modal-card h3 { margin: 0 0 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.check { display: flex; align-items: center; gap: 10px; padding: 8px 4px; }
.setting { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.setting select { padding: 10px; border-radius: 10px; background: var(--bg); color: var(--text); border: 1px solid var(--line); font: inherit; }
.toast { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 30; max-width: calc(100% - 32px); }
.setting summary { cursor: pointer; color: var(--muted); }
.setting details input, details.setting input { margin-top: 8px; }
.welcome { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 25; padding: 16px; overflow: auto; }
.welcome-card { width: 100%; max-width: 440px; background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 24px; }
.welcome-card h2 { margin: 6px 0 10px; font-size: 1.3rem; }
.welcome-card p { line-height: 1.5; }
.welcome-icon { font-size: 2rem; }
.welcome-list { padding-left: 18px; line-height: 1.5; color: var(--muted); }
.welcome-steps { display: flex; gap: 6px; margin-bottom: 8px; }
.welcome-steps span { height: 4px; flex: 1; border-radius: 4px; background: var(--line); }
.welcome-steps span.on { background: var(--accent); }
.welcome .check { margin: 8px 0; align-items: flex-start; }
.welcome .download-win { margin-top: 8px; }
.mic.arming { outline: 3px solid var(--accent); outline-offset: 3px; transition: outline-color 2s; }
