/* BroX Web — identidade do app trazida para o desktop.
 *
 * Tokens amostrados do próprio app (android-app/.../values/colors.xml):
 * core_status_on #2D93F0 é o azul real do núcleo, cortex_bg_top #0A0F1C é
 * o fundo das telas de córtex. Nada de azul de hyperlink padrão do
 * navegador, nada de painel administrativo genérico: superfícies neutras,
 * espaçamento generoso, o azul usado com parcimônia como acento.
 */
:root {
  --bg:            #070B14;
  --surface:       #0F1524;
  --surface-2:     #151C2E;
  --surface-hover: #1B2438;
  --border:        #232C42;
  --border-soft:   #1A2135;
  --text:          #ECF1F8;   /* off-white, não branco puro */
  --text-dim:      #97A3B8;
  --text-faint:    #6B788F;
  --accent:        #2D93F0;   /* azul BroX */
  --accent-soft:   #7FBEF7;
  --accent-bg:     rgba(45, 147, 240, 0.12);
  --danger:        #E5654F;
  --ok:            #48B87A;
  --warn:          #D9A445;
  --radius:        14px;
  --radius-sm:     10px;
  --shadow:        0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.18);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

/* Nenhum azul de hyperlink: links herdam a cor do texto e ganham o acento
   só no hover/foco. */
a { color: inherit; text-decoration: none; }
a:hover { color: var(--accent-soft); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ------------------------------------------------------------- topo */
.topbar {
  display: flex; align-items: center; gap: 20px;
  padding: 0 28px; height: 62px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: .2px; }
.topbar .brand img { height: 26px; width: auto; display: block; }
.topbar .brand .tag {
  font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); border: 1px solid var(--accent-bg);
  background: var(--accent-bg); padding: 2px 7px; border-radius: 999px;
}
.topbar nav { display: flex; gap: 4px; margin-left: 12px; }
.topbar nav a {
  padding: 7px 14px; border-radius: 999px; font-size: 14px; color: var(--text-dim);
  transition: background .15s, color .15s;
}
.topbar nav a:hover { background: var(--surface-hover); color: var(--text); }
.topbar nav a.active { background: var(--accent-bg); color: var(--accent-soft); }
.topbar .spacer { flex: 1; }
.topbar .who { color: var(--text-dim); font-size: 13px; }

/* ------------------------------------------------------------- layout */
.container { max-width: 1180px; margin: 0 auto; padding: 34px 28px 80px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { margin: 0 0 6px; font-size: 26px; font-weight: 640; letter-spacing: -.4px; }
.page-head p { margin: 0; color: var(--text-dim); font-size: 14px; }

.grid { display: grid; gap: 16px; }
.grid.cortices { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.grid.two { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }

/* ------------------------------------------------------------- cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card + .card { margin-top: 16px; }
.card h2 { margin: 0 0 14px; font-size: 15px; font-weight: 620; letter-spacing: .2px; }
.card h2 .muted { font-weight: 400; color: var(--text-dim); }

a.cortex-card { display: block; }
.cortex-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 20px;
  transition: border-color .15s, background .15s, transform .15s;
}
.cortex-card:hover { border-color: var(--accent); background: var(--surface-2); transform: translateY(-1px); }
.cortex-card .emoji { font-size: 26px; line-height: 1; }
.cortex-card .name { margin-top: 12px; font-size: 16px; font-weight: 600; }
.cortex-card .count { margin-top: 4px; color: var(--text-dim); font-size: 13px; }

/* ------------------------------------------------------------- nota */
.note-card {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 12px;
  transition: border-color .15s, background .15s;
}
.note-card:hover { border-color: var(--border); background: var(--surface-2); }
.note-card header { display: flex; align-items: flex-start; gap: 12px; }
.note-card .meta { color: var(--text-dim); font-size: 12.5px; }
.note-card .title {
  display: block; margin-top: 3px; font-size: 16px; font-weight: 560; color: var(--text);
}
.note-card .title:hover { color: var(--accent-soft); }
.note-card .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; padding: 3px 9px; border-radius: 999px;
  background: var(--surface-hover); color: var(--text-dim);
  border: 1px solid var(--border-soft);
}
.chip.accent { background: var(--accent-bg); color: var(--accent-soft); border-color: transparent; }
.chip.ok { color: var(--ok); }
.chip.warn { color: var(--warn); }

/* ------------------------------------------------------------- menu ⋮ */
.menu { position: relative; margin-left: auto; }
.menu > button {
  background: transparent; border: 1px solid transparent; color: var(--text-dim);
  font-size: 18px; line-height: 1; cursor: pointer; border-radius: 8px;
  width: 34px; height: 34px; display: grid; place-items: center;
}
.menu > button:hover { background: var(--surface-hover); color: var(--text); }
.menu-list {
  display: none; position: absolute; right: 0; top: 38px; z-index: 30;
  min-width: 226px; padding: 6px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.menu.open .menu-list { display: block; }
.menu-list button {
  display: block; width: 100%; text-align: left; padding: 9px 12px;
  background: transparent; border: 0; color: var(--text); font: inherit;
  font-size: 14px; border-radius: 7px; cursor: pointer;
}
.menu-list button:hover { background: var(--surface-hover); }
.menu-list button.danger { color: var(--danger); }
.menu-list hr { border: 0; border-top: 1px solid var(--border-soft); margin: 5px 2px; }

/* ------------------------------------------------------------- player */
.player {
  display: flex; align-items: center; gap: 12px; margin-top: 12px;
  padding: 9px 12px; background: var(--surface-2);
  border: 1px solid var(--border-soft); border-radius: 999px;
}
.player button.pp {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent-bg); color: var(--accent-soft);
  border: 1px solid transparent; cursor: pointer; font-size: 13px;
  display: grid; place-items: center;
}
.player button.pp:hover { background: var(--accent); color: #fff; }
.player input[type=range] {
  flex: 1; min-width: 60px; -webkit-appearance: none; appearance: none;
  height: 4px; border-radius: 2px; background: var(--border); cursor: pointer;
}
.player input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 13px; height: 13px; border-radius: 50%;
  background: var(--accent); border: 0; cursor: pointer;
}
.player input[type=range]::-moz-range-thumb {
  width: 13px; height: 13px; border-radius: 50%; background: var(--accent);
  border: 0; cursor: pointer;
}
.player .time {
  flex: none; font-variant-numeric: tabular-nums; font-size: 12px;
  color: var(--text-dim); min-width: 84px; text-align: right;
}
.player button.rate {
  flex: none; min-width: 46px; padding: 4px 8px; font-size: 12px;
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 999px; cursor: pointer;
}
.player button.rate:hover { color: var(--accent-soft); border-color: var(--accent); }

/* ------------------------------------------------------------- formulários */
label.field { display: block; margin-bottom: 14px; }
label.field span { display: block; font-size: 13px; color: var(--text-dim); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=date], input[type=time],
input[type=search], select, textarea {
  width: 100%; padding: 10px 13px; font: inherit; font-size: 14.5px;
  color: var(--text); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
}
input::placeholder, textarea::placeholder { color: var(--text-faint); }
textarea { min-height: 84px; resize: vertical; }

.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 10px 18px; font: inherit; font-size: 14.5px; font-weight: 550;
  border-radius: var(--radius-sm); cursor: pointer;
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border);
  transition: background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1F84E1; }
.btn.danger { color: var(--danger); border-color: rgba(229,101,79,.35); }
.btn.danger:hover { background: rgba(229,101,79,.12); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ------------------------------------------------------------- login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-box { width: 100%; max-width: 380px; }
.login-box .card { padding: 30px; }
.login-box .logo { text-align: center; margin-bottom: 22px; }
.login-box .logo img { height: 38px; }
.login-box .logo p { margin: 10px 0 0; color: var(--text-dim); font-size: 13px; }

/* ------------------------------------------------------------- diversos */
.empty { color: var(--text-dim); font-size: 14px; padding: 22px 0; text-align: center; }
.error {
  background: rgba(229,101,79,.12); border: 1px solid rgba(229,101,79,.35);
  color: #F3A392; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 14px;
}
.muted { color: var(--text-dim); }
.transcript {
  white-space: pre-wrap; word-break: break-word; font-size: 14.5px;
  line-height: 1.7; color: var(--text);
}
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; font-size: 14px; }
.kv dt { color: var(--text-dim); }
.kv dd { margin: 0; }

.task { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border-soft); }
.task:last-child { border-bottom: 0; }
.task .body { flex: 1; min-width: 0; }
.task .body .txt { font-size: 14.5px; }
.task.done .body .txt { color: var(--text-dim); text-decoration: line-through; }

.occ { border: 1px solid var(--border-soft); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 10px; background: var(--surface-2); }
.occ.next { border-color: var(--accent); background: var(--accent-bg); }
.occ .when { font-size: 16px; font-weight: 580; }
.occ .sub { color: var(--text-dim); font-size: 13px; margin-top: 2px; }

/* wide content nunca faz a página rolar na horizontal */
.scroll-x { overflow-x: auto; }

/* ------------------------------------------------------------- responsivo */
@media (max-width: 900px) {
  .grid.two { grid-template-columns: 1fr; }
  .container { padding: 24px 16px 60px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .topbar .who { display: none; }
}

/* Celular: o topo vira duas linhas em vez de uma faixa que rola de lado.
   Numa linha só, o botão "Sair" ficava fora da viewport (medido em 390px:
   a borda direita caía em 474px) — visível apenas para quem descobrisse
   que a barra rolava. Agora marca e ações ficam na primeira linha e a
   navegação na segunda, tudo dentro da tela. */
@media (max-width: 560px) {
  .topbar {
    height: auto;
    flex-wrap: wrap;
    align-items: center;
    padding: 10px 14px;
    row-gap: 8px;
  }
  .topbar .brand { order: 1; }
  .topbar .spacer { order: 2; flex: 1; }
  .topbar form { order: 3; }
  .topbar form .btn { padding: 7px 14px; font-size: 13.5px; }
  .topbar nav {
    order: 4;
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }
  .topbar nav a { flex: 1; text-align: center; padding: 8px 6px; }
}
@media (max-width: 560px) {
  .player .time { min-width: 74px; font-size: 11.5px; }
  .page-head h1 { font-size: 22px; }
}


/* ---------------------------------------- assistente de reunião (/app/reunioes) */
.field { display: block; margin: 0 0 14px; }
.field > span { display: block; font-size: 13px; color: var(--muted, #93A0B8); margin-bottom: 6px; }
.field > span em { font-style: normal; opacity: .7; }
.field input {
  width: 100%; box-sizing: border-box; padding: 11px 13px; font-size: 15px;
  color: #ECF1F8; background: #0F1524; border: 1px solid #232C42; border-radius: 9px;
}
.field input:focus { outline: none; border-color: #2D93F0; }
.field input:disabled { opacity: .55; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.hint { font-size: 13px; color: #93A0B8; margin: 4px 0 10px; min-height: 1em; }
.status-line { display: flex; align-items: center; gap: 10px; font-size: 16px; }
.dot { width: 11px; height: 11px; border-radius: 50%; background: #4A5568; flex: none; }
.dot.live { background: #2D93F0; animation: brox-pulse 1.3s ease-in-out infinite; }
.dot.ok { background: #3FBF7F; }
.dot.err { background: #E5654F; }
@keyframes brox-pulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

@media (max-width: 640px) {
  .row { flex-direction: column; }
  .row .btn { width: 100%; }
}


/* ===========================================================================
   Rodada 3 — home em grid de aplicativos
   ===========================================================================
   O ícone é o elemento principal; o nome só identifica. Tudo usa os tokens
   de :root — nenhuma cor literal nova. */

.secao { margin-bottom: 40px; }
.secao:last-child { margin-bottom: 8px; }
.secao-head { margin-bottom: 18px; }
.secao-head h1 {
  margin: 0; font-size: 26px; font-weight: 640; letter-spacing: -.4px;
}
.secao-head h2 {
  margin: 0; font-size: 15px; font-weight: 620; letter-spacing: .3px;
  color: var(--text-dim); text-transform: uppercase;
}

/* `auto-fit`/`minmax` decide a quantidade por linha sozinho: em desktop
   comum dá ~3 na largura do container, e reduz para 2 e 1 conforme a tela
   encolhe — sem número fixo em lugar nenhum. */
/* `auto-fill`, NÃO `auto-fit`: com `auto-fit` as trilhas vazias colapsam e
   uma seção com um único tile (Meus Assistentes) esticava o tile pela
   largura inteira da página. Com `auto-fill` as trilhas permanecem, então
   um tile sozinho ocupa a mesma largura de um tile de córtex e as três
   seções ficam alinhadas entre si.

   `minmax(240px, …)` no container de 1124px resolve para 4 colunas em tela
   larga e 3 em desktop/notebook normal (~1024), caindo para 2 em tablet e
   mobile. Com 280px dava 3 fixos em toda largura de desktop, mas os tiles
   saíam com 365px e muito vazio em volta do ícone — a especificação pede
   "aproximadamente 3 por linha na área principal" e permite ajuste natural
   em tela grande. Nenhum número de colunas é fixado em lugar nenhum. */
.app-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}

.tile {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px;
  min-height: 142px;
  padding: 22px 16px;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.tile:hover { border-color: var(--accent); background: var(--surface-2); transform: translateY(-2px); }
.tile:active { transform: translateY(0); background: var(--surface-hover); }
.tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--accent);
}

/* Hierarquia invertida em relação ao layout antigo: ícone grande, nome pequeno. */
.tile-icone { font-size: 46px; line-height: 1; }
.tile-nome {
  font-size: 13px; font-weight: 520; line-height: 1.3;
  color: var(--text-dim);
  /* Nomes longos ("Terapia de Casal", "Assistente de reunião") quebram em
     duas linhas em vez de estourar o tile. */
  overflow-wrap: anywhere;
}
.tile:hover .tile-nome, .tile:focus-visible .tile-nome { color: var(--text); }

/* Ferramentas: mesma família visual, com um toque que as distingue de um
   córtex sem virar outro componente. */
.tile-ferramenta { background: var(--surface-2); border-color: var(--border); }
.tile-ferramenta .tile-icone { font-size: 40px; }

/* Cabeçalho com voltar (páginas de córtex) */
.page-head.com-voltar { display: flex; align-items: flex-start; gap: 14px; }
.page-head.com-voltar h1 { font-size: 22px; }
.voltar {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; margin-top: 2px;
  font-size: 20px; line-height: 1; text-decoration: none;
  color: var(--text-dim);
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: var(--radius-sm);
  transition: border-color .15s, color .15s, background .15s;
}
.voltar:hover { color: var(--text); border-color: var(--accent); background: var(--surface-2); }
.voltar:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 480px) {
  .app-grid {
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 10px;
  }
  .tile { min-height: 118px; padding: 16px 8px; gap: 9px; }
  .tile-icone { font-size: 34px; }
  .tile-ferramenta .tile-icone { font-size: 30px; }
  .tile-nome { font-size: 12px; }
  .secao { margin-bottom: 30px; }
}
