/* Prestus Meet — tema claro/escuro */
:root {
  --brand: #1f5fd6;
  --brand-600: #174bb0;
  --brand-50: #eaf1ff;
  --bg: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --border: #e3e7ef;
  --text: #1b2333;
  --muted: #667085;
  --online: #16a34a;
  --away: #9aa3b2;
  --danger: #dc2626;
  --danger-600: #b91c1c;
  --bubble-me: #1f5fd6;
  --bubble-me-text: #ffffff;
  --bubble-other: #ffffff;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .18);
  --radius: 12px;
  --meet-bg: #111318;
  --meet-tile: #23262e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand: #4c86f0;
    --brand-600: #3a72dc;
    --brand-50: #1b2740;
    --bg: #0f1218;
    --surface: #171b23;
    --surface-2: #1d222c;
    --border: #2a303c;
    --text: #e7eaf0;
    --muted: #98a2b3;
    --bubble-me: #2f68d8;
    --bubble-other: #222834;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text); background: var(--bg);
}
button { font: inherit; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
a { color: var(--brand); }
.hidden { display: none !important; }
:where(svg[aria-hidden="true"]) { width: 20px; height: 20px; flex: none; }
.twofa-box .title svg { width: 18px; height: 18px; color: var(--brand); }

/* ---------------------------------------------------------------- botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: 8px; padding: 9px 16px;
  background: var(--brand); color: #fff; font-weight: 600; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--brand-600); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn.danger { background: var(--danger); }
.btn.danger:hover { background: var(--danger-600); }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 8px;
  border: 0; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: var(--brand-50); color: var(--brand); }
.icon-btn svg, .btn svg { width: 18px; height: 18px; }

/* ---------------------------------------------------------------- avatares */
.avatar {
  position: relative; flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 13px; user-select: none;
}
.avatar.lg { width: 44px; height: 44px; font-size: 15px; }
.avatar .dot {
  position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--surface); background: var(--away);
}
.avatar .dot.on { background: var(--online); }

/* ---------------------------------------------------------------- login */
.login-page { min-height: 100%; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 600px at 10% -10%, var(--brand-50), transparent), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow-lg); padding: 32px 28px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 20px; }
.brand-mark { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); color: #fff;
  display: grid; place-items: center; }
.brand-mark svg { width: 22px; height: 22px; }
.login-card h1 { font-size: 22px; margin: 24px 0 4px; }
.login-card p.sub { color: var(--muted); margin: 0 0 24px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 13px; }
.field input {
  width: 100%; padding: 11px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 6px; }
.code-input { letter-spacing: .5em; text-align: center; font-size: 20px !important; font-weight: 600; }
.pass-wrap { position: relative; }
.pass-wrap .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); }
.form-error { background: #fdecec; color: #9b1c1c; border: 1px solid #f7caca; border-radius: 8px;
  padding: 10px 12px; margin-bottom: 16px; font-size: 13px; }
@media (prefers-color-scheme: dark) { .form-error { background: #3a1717; color: #fca5a5; border-color: #5b2121; } }
.twofa-box { background: var(--brand-50); border-radius: 10px; padding: 14px; margin-bottom: 16px; }
.twofa-box .title { display: flex; gap: 8px; align-items: center; font-weight: 600; margin-bottom: 8px; }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin-top: 20px; }

/* ---------------------------------------------------------------- app shell */
.app { display: grid; grid-template-columns: 68px 320px 1fr; height: 100vh; height: 100dvh; }
.rail { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column;
  align-items: center; padding: 12px 0; gap: 6px; }
.rail .brand-mark { margin-bottom: 14px; }
.rail-btn { width: 56px; padding: 8px 0 6px; border: 0; border-radius: 10px; background: transparent; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; position: relative; }
.rail-btn svg { width: 22px; height: 22px; }
.rail-btn:hover { background: var(--surface-2); color: var(--text); }
.rail-btn.active { color: var(--brand); background: var(--brand-50); }
.rail-btn .badge { position: absolute; top: 4px; right: 8px; }
.rail-spacer { flex: 1; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff;
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }

.sidebar { background: var(--surface-2); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; }
.sidebar-head { padding: 18px 16px 10px; display: flex; align-items: center; justify-content: space-between; }
.sidebar-head h2 { font-size: 20px; margin: 0; }
.search { margin: 0 16px 10px; position: relative; }
.search input { width: 100%; padding: 8px 10px 8px 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); outline: none; }
.search input:focus { border-color: var(--brand); }
.search svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.chips { display: flex; gap: 6px; padding: 0 16px 8px; }
.chip { border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.chip.active { background: var(--brand-50); border-color: var(--brand); color: var(--brand); font-weight: 600; }
.list { overflow-y: auto; flex: 1; padding: 0 8px 16px; }
.section-title { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; padding: 12px 8px 6px; }
.row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; cursor: pointer; position: relative; }
.row:hover { background: var(--surface); }
.row.active { background: var(--surface); box-shadow: var(--shadow); }
.row .meta { flex: 1; min-width: 0; }
.row .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .preview { color: var(--muted); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row.unread .preview { color: var(--text); font-weight: 600; }
.row .side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row .time { font-size: 11px; color: var(--muted); }
.meet-btn { flex: none; display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border); background: var(--surface);
  color: var(--brand); border-radius: 8px; padding: 5px 8px; font-size: 12px; font-weight: 600; }
.meet-btn:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.meet-btn svg { width: 15px; height: 15px; }
.empty { color: var(--muted); text-align: center; padding: 24px 12px; font-size: 13px; }

.main { display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.main-head { height: 64px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--border); }
.main-head .title { font-weight: 700; font-size: 16px; }
.main-head .status { font-size: 12px; color: var(--muted); }
.main-head .grow { flex: 1; min-width: 0; }
.back-btn { display: none; }

/* ---------------------------------------------------------------- chat */
.messages { flex: 1; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 2px; }
.day-sep { align-self: center; font-size: 12px; color: var(--muted); margin: 14px 0 8px; }
.msg { display: flex; gap: 8px; max-width: 72%; margin-top: 8px; }
.msg.cont { margin-top: 0; }
.msg.cont .avatar { visibility: hidden; height: 0; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.msg .bubble { background: var(--bubble-other); border-radius: 12px; padding: 8px 12px; box-shadow: var(--shadow);
  white-space: pre-wrap; word-wrap: break-word; overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--bubble-me); color: var(--bubble-me-text); }
.msg.me .bubble a { color: #fff; }
.msg .info { font-size: 11px; color: var(--muted); margin: 0 4px 2px; }
.msg.me .info { text-align: right; }
.msg .meet-link { display: inline-flex; margin-top: 6px; }
.typing { height: 20px; padding: 0 24px; font-size: 12px; color: var(--muted); font-style: italic; }
.composer { display: flex; gap: 8px; padding: 12px 20px 18px; align-items: flex-end; }
.composer textarea { flex: 1; resize: none; max-height: 160px; min-height: 44px; padding: 11px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); outline: none; }
.composer textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }
.composer .btn { height: 44px; }

.welcome { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--muted); }
.welcome h3 { color: var(--text); font-size: 20px; margin: 16px 0 6px; }
.welcome .art { width: 96px; height: 96px; border-radius: 28px; background: var(--brand-50); color: var(--brand);
  display: grid; place-items: center; margin: 0 auto; }
.welcome .art svg { width: 48px; height: 48px; }

/* ---------------------------------------------------------------- reuniões */
.meetings-wrap { flex: 1; overflow-y: auto; padding: 24px; }
.new-meeting { display: flex; gap: 10px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-bottom: 24px; }
.new-meeting input { flex: 1 1 220px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); outline: none; }
.new-meeting input:focus { border-color: var(--brand); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.card .title { font-weight: 700; font-size: 15px; }
.card .sub { color: var(--muted); font-size: 12.5px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; color: var(--online); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--online); animation: pulse 1.6s infinite; }
.live.idle { color: var(--muted); }
.live.idle::before { background: var(--away); animation: none; }
@keyframes pulse { 0%, 100% { opacity: 1 } 50% { opacity: .35 } }
.stack { display: flex; }
.stack .avatar { width: 28px; height: 28px; font-size: 11px; border: 2px solid var(--surface); margin-left: -6px; }
.stack .avatar:first-child { margin-left: 0; }
.card .actions { display: flex; gap: 8px; margin-top: auto; }

/* ---------------------------------------------------------------- modal / toast */
.overlay { position: fixed; inset: 0; background: rgba(10, 14, 22, .55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: 16px; padding: 28px; width: 100%; max-width: 360px; text-align: center; box-shadow: var(--shadow-lg); }
.modal h3 { margin: 14px 0 4px; }
.modal p { color: var(--muted); margin: 0 0 20px; }
.modal .actions { display: flex; gap: 10px; justify-content: center; }
.ringing .avatar { margin: 0 auto; animation: ring 1.2s infinite; }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(31, 95, 214, .5) } 100% { box-shadow: 0 0 0 22px rgba(31, 95, 214, 0) } }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow-lg);
  max-width: 320px; font-size: 13px; cursor: default; animation: slidein .2s ease-out; }
.toast.clickable { cursor: pointer; }
.toast strong { display: block; }
@keyframes slidein { from { transform: translateY(10px); opacity: 0 } }

/* ---------------------------------------------------------------- responsivo (app) */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; grid-template-rows: 1fr 60px; }
  .rail { grid-row: 2; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--border); padding: 0 8px; }
  .rail .brand-mark, .rail-spacer { display: none; }
  .sidebar, .main { grid-row: 1; grid-column: 1; }
  .app.show-main .sidebar { display: none; }
  .app:not(.show-main) .main { display: none; }
  .back-btn { display: inline-grid; }
  .messages { padding: 16px 12px; }
  .msg { max-width: 88%; }
  .composer { padding: 10px 12px 12px; }
  .meetings-wrap { padding: 16px; }
}

/* ---------------------------------------------------------------- sala de reunião */
.meet-page { background: var(--meet-bg); color: #e8eaed; height: 100vh; height: 100dvh; overflow: hidden; }
.prejoin { height: 100%; display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 40px; align-items: center;
  max-width: 1100px; margin: 0 auto; padding: 24px 32px; }
.pj-preview { position: relative; aspect-ratio: 16 / 9; background: var(--meet-tile); border-radius: 16px; overflow: hidden; }
.pj-preview video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.pj-off { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #9aa0a6; }
.pj-off .avatar { margin: 0 auto 10px; }
.pj-preview .controls { position: absolute; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 12px; }
.prejoin h1 { font-size: 26px; font-weight: 500; margin: 0 0 6px; }
.prejoin .sub { color: #9aa0a6; margin-bottom: 24px; }
.round { width: 52px; height: 52px; border-radius: 50%; border: 0; display: grid; place-items: center; background: #3c4043; color: #fff;
  transition: background .15s; position: relative; }
.round:hover { background: #4a4f54; }
.round.off { background: #ea4335; }
.round.off:hover { background: #d33426; }
.round.on { background: #8ab4f8; color: #202124; }
.round svg { width: 22px; height: 22px; }
.round.leave { width: 64px; border-radius: 26px; background: #ea4335; }
.round .badge { position: absolute; top: -2px; right: -2px; }
.meet-shell { height: 100%; display: grid; grid-template-rows: 1fr 80px; grid-template-columns: 1fr auto; }
.stage { grid-column: 1; padding: 16px; min-height: 0; display: flex; }
.grid { flex: 1; display: grid; gap: 10px; align-content: center; justify-content: center; min-height: 0; }
.stage.presenting { gap: 10px; }
.stage.presenting .grid { flex: 0 0 220px; grid-template-columns: 1fr !important; align-content: start; overflow-y: auto; }
.spotlight { flex: 1; min-width: 0; display: none; }
.stage.presenting .spotlight { display: flex; }
.tile { position: relative; background: var(--meet-tile); border-radius: 12px; overflow: hidden; aspect-ratio: 16 / 9; min-width: 0;
  outline: 3px solid transparent; transition: outline-color .15s; }
.tile.speaking { outline-color: #8ab4f8; }
.tile video { width: 100%; height: 100%; object-fit: cover; background: #000; }
.tile.self video:not(.screen) { transform: scaleX(-1); }
.tile video.screen, .spotlight .tile video { object-fit: contain; }
.spotlight .tile { width: 100%; height: 100%; aspect-ratio: auto; }
.tile .placeholder { position: absolute; inset: 0; display: grid; place-items: center; }
.tile .placeholder .avatar { width: 84px; height: 84px; font-size: 30px; }
.tile .label { position: absolute; left: 10px; bottom: 8px; display: flex; gap: 6px; align-items: center; font-size: 13px;
  background: rgba(0, 0, 0, .5); padding: 3px 8px; border-radius: 6px; max-width: calc(100% - 20px); }
.tile .label span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .label svg { width: 14px; height: 14px; flex: none; color: #f28b82; }
.tile .hand { position: absolute; top: 8px; left: 10px; font-size: 22px; }
.tile .conn { position: absolute; top: 8px; right: 10px; font-size: 11px; background: rgba(0, 0, 0, .55); padding: 2px 6px; border-radius: 6px; color: #fdd663; }
.reaction-fly { position: absolute; bottom: 90px; font-size: 40px; pointer-events: none; animation: fly 2.6s ease-out forwards; z-index: 5; }
@keyframes fly { to { transform: translateY(-60vh); opacity: 0 } }
.meet-bar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 0 20px; gap: 12px; }
.meet-bar .left { min-width: 0; color: #e8eaed; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meet-bar .center, .meet-bar .right { display: flex; gap: 10px; align-items: center; }
.panel { grid-row: 1; grid-column: 2; width: 340px; margin: 16px 16px 0 0; background: #fff; color: #202124; border-radius: 12px;
  display: flex; flex-direction: column; min-height: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; font-size: 17px; }
.panel-body { flex: 1; overflow-y: auto; padding: 0 16px 12px; }
.panel .icon-btn { color: #5f6368; }
.panel .row:hover { background: #f1f3f4; }
.panel .avatar .dot { border-color: #fff; }
.mchat { margin-bottom: 12px; }
.mchat .who { font-weight: 600; font-size: 13px; }
.mchat .who small { color: #5f6368; font-weight: 400; margin-left: 6px; }
.mchat .txt { white-space: pre-wrap; overflow-wrap: anywhere; }
.panel-foot { padding: 10px 12px 14px; display: flex; gap: 8px; }
.panel-foot input { flex: 1; border-radius: 999px; border: 0; background: #f1f3f4; padding: 10px 14px; outline: none; color: #202124; }
.reactions-pop { position: absolute; bottom: 64px; left: 50%; transform: translateX(-50%); background: #3c4043; border-radius: 999px;
  padding: 6px 10px; display: flex; gap: 4px; }
.reactions-pop button { background: transparent; border: 0; font-size: 22px; padding: 4px 6px; border-radius: 8px; }
.reactions-pop button:hover { background: #4a4f54; }
.meet-msg { height: 100%; display: grid; place-items: center; text-align: center; padding: 24px; }
.meet-msg h2 { font-weight: 500; }
.clock { color: #9aa0a6; margin-right: 10px; }
@media (max-width: 860px) {
  .prejoin { grid-template-columns: 1fr; gap: 20px; padding: 16px; align-content: center; }
  .panel { position: fixed; inset: 0 0 80px 0; width: auto; margin: 0; border-radius: 0; z-index: 10; }
  .meet-bar { padding: 0 10px; }
  .meet-bar .left, .meet-bar .right .opt { display: none; }
  .round { width: 44px; height: 44px; }
  .round.leave { width: 54px; }
  .stage { padding: 8px; }
  .stage.presenting { flex-direction: column; }
  .stage.presenting .grid { flex: 0 0 110px; grid-template-columns: none !important; grid-auto-flow: column; grid-auto-columns: 180px; overflow-x: auto; }
}
