/* ============================================================
   PASCOTO CHAT — visual limpo estilo app de mensagem
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #d8dee3;
  --panel: #ffffff;
  --bar: #eef1f4;
  --line: #cfd7dc;
  --ink: #111b21;
  --ink-2: #4b5960;
  --ink-3: #77868f;
  --brand: #12463c;       /* verde-escuro corporativo (header, login) */
  --brand-dark: #0c332b;
  --brand-sub: #a9c6bd;
  --green: #00a884;
  --green-dark: #008f72;
  --green-soft: #d9fdd3;
  --chat-bg: #e2e8e5;
  --red: #ea3d2f;
  --amber: #f5a623;
  --shadow: 0 1px 2px rgba(17, 27, 33, .16);
  --f: -apple-system, "Segoe UI", system-ui, Roboto, "Helvetica Neue", sans-serif;
}

html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f);
  overflow: hidden;
}

.screen { height: 100dvh; display: flex; flex-direction: column; }
.center { align-items: center; justify-content: center; }
[hidden] { display: none !important; }

::selection { background: #c5f2e9; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; border-radius: 6px; }

/* ============================================================
   Entrada — split corporativo (marca à esquerda, ação à direita)
   ============================================================ */
.login {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(380px, 46%) 1fr;
  min-height: 100dvh;
}

.login-brand {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  padding: 48px 44px;
  color: #fff;
  background:
    radial-gradient(700px 420px at 90% -5%, rgba(0, 168, 132, .35), transparent 55%),
    radial-gradient(600px 500px at -10% 110%, rgba(0, 168, 132, .18), transparent 55%),
    linear-gradient(160deg, var(--brand) 0%, var(--brand-dark) 100%);
  overflow: hidden;
}
.login-brand::before { /* pontilhado sutil de textura */
  content: '';
  position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.10) 1px, transparent 1.4px);
  background-size: 26px 26px;
  opacity: .35;
  pointer-events: none;
}
.brand-inner {
  position: relative;
  max-width: 380px;
  display: flex; flex-direction: column; gap: 18px;
  animation: fadeup .55s cubic-bezier(.2,.8,.25,1) both;
}
.brand-badge {
  width: 76px; height: 76px;
  border-radius: 22px;
  background: linear-gradient(160deg, var(--green), var(--green-dark));
  display: grid; place-items: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-badge svg { width: 40px; height: 40px; }
.login-brand h1 { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.brand-tag { font-size: 15px; color: #cfe3dc; line-height: 1.5; }
.brand-feats {
  list-style: none;
  display: flex; flex-direction: column; gap: 14px;
  margin-top: 8px;
  padding-top: 22px;
  border-top: 1px solid rgba(255, 255, 255, .14);
}
.brand-feats li { display: flex; align-items: center; gap: 12px; font-size: 14px; color: #dcebe5; }
.brand-feats b { color: #fff; }
.brand-feats svg {
  width: 34px; height: 34px; flex: none;
  padding: 7px;
  color: #8ee6cf;
  background: rgba(255, 255, 255, .09);
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
}
.brand-foot { margin-top: 14px; font-size: 12px; color: rgba(255, 255, 255, .45); }

.login-panel {
  display: flex; align-items: center; justify-content: center;
  background: #f4f6f8;
  padding: 40px 24px;
}
.login-box {
  width: min(400px, 100%);
  display: flex; flex-direction: column; gap: 14px;
}
.login-box > * { animation: fadeup .5s cubic-bezier(.2,.8,.25,1) both; }
.login-box > *:nth-child(2) { animation-delay: .05s; }
.login-box > *:nth-child(3) { animation-delay: .1s; }
.login-box > *:nth-child(4) { animation-delay: .15s; }
.login-box > *:nth-child(5) { animation-delay: .2s; }
.login-box > *:nth-child(6) { animation-delay: .25s; }
.login-box h2 { font-size: 24px; font-weight: 800; letter-spacing: -.02em; }
.login-sub { font-size: 14px; color: var(--ink-2); margin-top: -8px; }

.conn-pill {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 600;
  color: #8a6d1a;
  background: #fdf3d7;
  border: 1px solid #f1dfa8;
  border-radius: 999px;
  padding: 6px 12px;
  transition: all .2s;
}
.conn-pill::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--amber);
  animation: pulse 1.2s ease-in-out infinite;
}
.conn-pill.ok { color: #0c6b52; background: #e2f6ef; border-color: #bfe8da; }
.conn-pill.ok::before { background: var(--green); animation: none; }

.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: block; margin-bottom: 7px; }
.senha-field {
  display: flex; align-items: center; gap: 10px;
  background: var(--panel);
  border: 1.5px solid #c6ced4;
  border-radius: 12px;
  padding: 0 6px 0 14px;
  transition: border-color .15s, box-shadow .15s;
}
.senha-field:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0, 168, 132, .14); }
.senha-field > svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; }
.senha-field input {
  flex: 1;
  font: 500 15px/1 var(--f);
  color: var(--ink);
  background: none; border: none; outline: none;
  padding: 14px 0;
  letter-spacing: .06em;
}
.senha-field button {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  color: var(--ink-3);
  background: none; border: none; border-radius: 50%;
  cursor: pointer;
}
.senha-field button:hover { color: var(--ink-2); background: rgba(17,27,33,.05); }
.senha-field button svg { width: 19px; height: 19px; }

.join-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.station {
  display: flex; align-items: center; gap: 11px;
  text-align: left;
  background: var(--panel);
  border: 1.5px solid #d8dee3;
  border-radius: 14px;
  padding: 13px 13px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(17, 27, 33, .06);
  transition: border-color .15s, box-shadow .15s, transform .06s;
}
.station:hover { border-color: var(--green); box-shadow: 0 4px 14px rgba(0, 168, 132, .16); transform: translateY(-1px); }
.station:active { transform: translateY(0) scale(.98); }
.st-avatar {
  width: 42px; height: 42px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800; color: #fff;
  letter-spacing: .01em;
}
.st-avatar.central-1 { background: linear-gradient(160deg, #2f6fed, #1d4fc4); }
.st-avatar.central-2 { background: linear-gradient(160deg, #8b5cf6, #6d35e8); }
.st-avatar.loja-1    { background: linear-gradient(160deg, #f59e0b, #dd7d02); }
.st-avatar.loja-2    { background: linear-gradient(160deg, #10a5a0, #0b807c); }
.st-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.st-info b { font-size: 14.5px; font-weight: 700; color: var(--ink); }
.st-info small { font-size: 11.5px; color: var(--ink-3); }
.station.busy .st-info small { color: var(--red); font-weight: 600; }
.station .cdot { margin-left: auto; }

.join-hint {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--ink-3); line-height: 1.5;
}
.join-hint svg { width: 16px; height: 16px; flex: none; }
.join-hint b { color: var(--ink-2); }

@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } }

/* bolinha de presença */
.cdot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #cfd6db;
  flex: none;
}
.cdot.on { background: #25d366; }
.cdot.off { background: var(--red); }

/* ============================================================
   App de chat
   ============================================================ */
.chat-app {
  width: min(980px, 100vw);
  height: 100dvh;
  margin: 0 auto;
  display: flex; flex-direction: column;
  background: var(--panel);
  box-shadow: 0 6px 32px rgba(17, 27, 33, .25);
}
@media (min-width: 1000px) {
  .chat-app { height: calc(100dvh - 32px); margin: 16px auto; border-radius: 14px; overflow: hidden; }
}

/* topo — barra escura corporativa */
.topbar {
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(180deg, var(--brand), var(--brand-dark));
  padding: 11px 16px;
  box-shadow: 0 2px 8px rgba(12, 51, 43, .35);
  position: relative; z-index: 3;
}
.avatar {
  width: 44px; height: 44px; flex: none;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid rgba(255, 255, 255, .3);
  display: grid; place-items: center;
}
.avatar svg { width: 24px; height: 24px; }
.topbar-info { flex: 1; min-width: 0; }
.topbar-title { font-size: 16.5px; font-weight: 700; color: #fff; }
.topbar-sub {
  display: flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--brand-sub);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar-sub b { color: #dcebe5; font-weight: 600; }
.topbar-sub .sep { color: rgba(255, 255, 255, .25); }
.icon-btn {
  width: 40px; height: 40px; flex: none;
  display: grid; place-items: center;
  color: #cfe3dc;
  background: none; border: none; border-radius: 50%;
  cursor: pointer;
  transition: background .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .12); }
.icon-btn svg { width: 21px; height: 21px; }

.btn-install {
  font: 600 13px/1 var(--f);
  color: var(--green-dark);
  background: none;
  border: 1.5px solid var(--green);
  border-radius: 999px;
  padding: 9px 16px;
  cursor: pointer;
  transition: background .15s;
}
.btn-install:hover { background: #eafaf6; }
.topbar-install { flex: none; color: #fff; border-color: rgba(255, 255, 255, .55); }
.topbar-install:hover { background: rgba(255, 255, 255, .12); }

/* barra de destino */
.dest-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(17, 27, 33, .07);
  position: relative; z-index: 2;
  overflow-x: auto;
}
.dest-label { font-size: 12px; font-weight: 700; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; flex: none; }
.dest-chips { display: flex; gap: 7px; }
.chip {
  display: flex; align-items: center; gap: 6px;
  font: 600 13px/1 var(--f);
  color: var(--ink-2);
  background: var(--panel);
  border: 1px solid #c3ccd2;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 1px 1px rgba(17, 27, 33, .06);
  transition: background .12s, color .12s, border-color .12s, transform .05s;
}
.chip:active { transform: scale(.96); }
.chip:hover { border-color: var(--green); }
.chip.sel { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 2px 6px rgba(0, 168, 132, .35); }
.chip.sel .cdot.on { background: #b7ffd9; box-shadow: none; }
.chip.dim:not(.sel) { opacity: .55; }

/* aviso "fulano está falando" */
.live-banner {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600;
  color: var(--green-dark);
  background: #eafaf6;
  border-bottom: 1px solid #ccefe6;
  padding: 8px 16px;
}
.live-banner::before {
  content: '';
  width: 8px; height: 8px; border-radius: 50%; flex: none;
  background: var(--green);
  animation: pulse 1.1s ease-in-out infinite;
}
.live-banner .muted-note { font-weight: 500; font-size: 11.5px; color: var(--ink-3); }
@keyframes pulse { 50% { opacity: .35; } }

/* mensagens */
.chat-log {
  flex: 1;
  overflow-y: auto;
  background: var(--chat-bg);
  padding: 18px 7% 12px;
  display: flex; flex-direction: column; gap: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(17,27,33,.2) transparent;
}
.chat-log::-webkit-scrollbar { width: 7px; }
.chat-log::-webkit-scrollbar-thumb { background: rgba(17,27,33,.18); border-radius: 4px; }

.day-sep {
  align-self: center;
  font-size: 11.5px; font-weight: 600;
  color: var(--ink-2);
  background: #ffffffd9;
  border-radius: 8px;
  padding: 6px 12px;
  margin: 10px 0 8px;
  box-shadow: var(--shadow);
  text-transform: uppercase;
  letter-spacing: .03em;
}

/* vazio elegante */
.chat-log:empty::before {
  content: 'Sem recados por aqui ainda — manda o primeiro 👋';
  align-self: center;
  margin: auto;
  font-size: 13.5px; font-weight: 500;
  color: var(--ink-2);
  background: #ffffffcc;
  border-radius: 999px;
  padding: 10px 20px;
  box-shadow: var(--shadow);
}

.msg { display: flex; margin-top: 10px; }
.msg.follow { margin-top: 2px; }
.msg .bubble {
  position: relative;
  max-width: min(75%, 560px);
  background: var(--panel);
  border: 1px solid rgba(17, 27, 33, .07);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgba(17, 27, 33, .14);
  padding: 7px 10px 8px;
}
.msg:not(.follow) .bubble { border-top-left-radius: 2px; }
.msg:not(.follow) .bubble::before { /* cauda */
  content: '';
  position: absolute; top: -1px; left: -8px;
  border-top: 10px solid var(--panel);
  border-left: 9px solid transparent;
  filter: drop-shadow(-1px 1px 1px rgba(17, 27, 33, .08));
}
.msg.mine { justify-content: flex-end; }
.msg.mine .bubble { background: var(--green-soft); }
.msg.mine:not(.follow) .bubble { border-top-left-radius: 10px; border-top-right-radius: 2px; }
.msg.mine:not(.follow) .bubble::before {
  left: auto; right: -8px;
  border-top-color: var(--green-soft);
  border-left: none;
  border-right: 9px solid transparent;
  filter: drop-shadow(1px 1px 1px rgba(17, 27, 33, .08));
}
.mhead {
  font-size: 12.5px; font-weight: 700;
  color: var(--green-dark);
  margin-bottom: 2px;
}
.mhead .mdest { font-weight: 600; color: var(--ink-3); }
.msg.mine .mhead { color: var(--ink-2); }
.mtext {
  font-size: 14.5px; line-height: 1.45;
  word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap;
  padding-right: 44px;
}
.mtime {
  position: absolute; right: 9px; bottom: 5px;
  font-size: 10.5px; color: var(--ink-3);
}

/* faixa de voz (eu falando) */
.onair { display: none; align-items: center; gap: 8px; padding: 9px 16px; font-size: 13.5px; font-weight: 600; }
.onair[data-mode="tx"] {
  display: flex;
  color: #fff; background: var(--red);
}
.onair[data-mode="tx"]::before {
  content: ''; width: 9px; height: 9px; border-radius: 50%; background: #fff;
  animation: pulse 1s ease-in-out infinite;
}
.onair[data-mode="rx"] { display: none; } /* recebimento já tem o banner verde */

/* composer */
.composer {
  display: flex; align-items: center; gap: 9px;
  background: var(--bar);
  border-top: 1px solid var(--line);
  box-shadow: 0 -1px 4px rgba(17, 27, 33, .07);
  position: relative; z-index: 2;
  padding: 10px 12px;
}
.composer form { flex: 1; display: flex; }
.composer input {
  flex: 1;
  font: 400 15px/1.3 var(--f);
  color: var(--ink);
  background: var(--panel);
  border: 1px solid #c3ccd2;
  border-radius: 999px;
  padding: 12px 18px;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(17, 27, 33, .05);
  transition: border-color .15s;
}
.composer input:focus { border-color: var(--green); }
.composer input::placeholder { color: var(--ink-3); }

.mic-btn, .send-btn {
  width: 46px; height: 46px; flex: none;
  display: grid; place-items: center;
  border: none; border-radius: 50%;
  cursor: pointer;
  transition: background .15s, transform .06s;
  touch-action: none;
  user-select: none; -webkit-user-select: none;
}
.mic-btn { background: none; color: var(--ink-2); }
.mic-btn:hover { background: rgba(17,27,33,.06); }
.mic-btn svg { width: 23px; height: 23px; }
.mic-btn.tx { background: var(--red); color: #fff; transform: scale(1.08); box-shadow: 0 0 0 6px rgba(234, 61, 47, .18); }
.mic-btn.blocked { opacity: .4; cursor: not-allowed; }
body.no-mic .mic-btn { display: none; }

.send-btn { background: #b9c2c8; color: #fff; transition: background .2s, transform .06s; }
.send-btn.ready { background: var(--green); }
.send-btn.ready:hover { background: var(--green-dark); }
.send-btn:active { transform: scale(.94); }
.send-btn svg { width: 21px; height: 21px; margin-left: 2px; }

/* ============================================================
   Configurações
   ============================================================ */
.modal {
  position: fixed; inset: 0;
  background: rgba(17, 27, 33, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal-card {
  width: min(420px, 92vw);
  max-height: 88dvh; overflow-y: auto;
  background: var(--panel);
  border-radius: 16px;
  box-shadow: 0 16px 60px rgba(17,27,33,.25);
  padding: 26px 24px 20px;
  display: flex; flex-direction: column; gap: 20px;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-card h2 { font-size: 18px; }
.modal-x {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  color: var(--ink-3);
  background: var(--bar);
  border: none; border-radius: 50%;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.modal-x:hover { background: #e2e7ea; color: var(--ink); }
.modal-x svg { width: 16px; height: 16px; }
.modal-card .set-row, .modal-card .switch-row { border-top: 1px solid #e6eaee; padding-top: 18px; }
.set-row { display: flex; flex-direction: column; gap: 10px; }
.set-label { font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.set-inline { display: flex; align-items: center; gap: 12px; }
.set-note { font-size: 12px; color: var(--ink-3); }
.mini-btn {
  font: 600 13px/1 var(--f);
  color: var(--ink-2);
  background: var(--bar);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}
.mini-btn:hover { background: #e6e9ec; }

input[type=range] { flex: 1; accent-color: var(--green); height: 22px; }

.switch-row {
  display: flex; align-items: center; gap: 12px;
  font-size: 14.5px;
  cursor: pointer;
}
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch {
  width: 42px; height: 24px; flex: none;
  border-radius: 999px;
  background: #cfd6db;
  position: relative;
  transition: background .15s;
}
.switch::after {
  content: '';
  position: absolute; top: 2.5px; left: 3px;
  width: 19px; height: 19px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(17,27,33,.3);
  transition: left .15s;
}
.switch-row input:checked + .switch { background: var(--green); }
.switch-row input:checked + .switch::after { left: 20px; }
.switch-row input:focus-visible + .switch { outline: 2px solid var(--green); outline-offset: 2px; }

.set-mutes { display: flex; flex-direction: column; gap: 12px; }

.primary-btn {
  font: 600 15px/1 var(--f);
  color: #fff;
  background: var(--green);
  border: none; border-radius: 999px;
  padding: 13px;
  cursor: pointer;
  transition: background .15s;
}
.primary-btn:hover { background: var(--green-dark); }

/* ============================================================
   Toasts
   ============================================================ */
#toasts {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  z-index: 80;
  width: max-content; max-width: 92vw;
}
.toast {
  font-size: 13.5px; font-weight: 500;
  color: #fff;
  background: #1f2c33;
  border-radius: 10px;
  padding: 11px 18px;
  box-shadow: 0 8px 28px rgba(17,27,33,.35);
  animation: toastin .18s ease-out;
}
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* ============================================================
   Ativar som
   ============================================================ */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(12, 51, 43, .8); backdrop-filter: blur(3px); }
.unlock-card {
  width: min(380px, 90vw);
  background: var(--panel);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5);
  padding: 32px 30px 26px;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center;
  animation: fadeup .35s cubic-bezier(.2,.8,.25,1) both;
}
.unlock-icon {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--green), var(--green-dark));
  display: grid; place-items: center;
  box-shadow: 0 8px 22px rgba(0, 168, 132, .4);
}
.unlock-icon svg { width: 32px; height: 32px; }
.unlock-card h3 { font-size: 18px; font-weight: 700; }
.unlock-card p { font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }
.primary-btn.big { width: 100%; padding: 15px; font-size: 16px; margin-top: 6px; }

/* ============================================================
   Sem microfone / responsivo
   ============================================================ */
@media (max-width: 880px) {
  .login { grid-template-columns: 1fr; }
  .login-brand { padding: 30px 24px; }
  .brand-inner { max-width: 100%; gap: 10px; }
  .brand-badge { width: 54px; height: 54px; border-radius: 16px; }
  .brand-badge svg { width: 28px; height: 28px; }
  .login-brand h1 { font-size: 24px; }
  .brand-feats, .brand-foot { display: none; }
  .login-panel { align-items: flex-start; padding-top: 26px; }
}

@media (max-width: 640px) {
  .chat-log { padding: 14px 4% 10px; }
  .msg .bubble { max-width: 86%; }
  .topbar-sub #presence { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
