/* Goklah — estrutura do app shell (barra estreita + barra contextual +
   conteúdo), cabeçalho, tela de autenticação e composição da Início.

   As medidas seguem as extraídas do Stoat (ver plano da fase): rail com
   item de 56x56, barra contextual de 248px, cabeçalho de 48px, conteúdo
   da Início centralizado com padding 48px e gap 32px, colunas de ação
   de 260px. */

/* ---- Região de arrasto da janela ----
   A barra nativa do Electron está oculta (titleBarStyle: "hidden"), então
   a janela só pode ser movida por áreas marcadas com app-region: drag.
   Tudo que é interativo dentro dessas áreas precisa voltar pra no-drag,
   senão o clique vira arrasto e o botão não funciona. */

.titlebar-drag {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--titlebar-h);
  -webkit-app-region: drag;
  z-index: 1;
}

.app-header {
  -webkit-app-region: drag;
}

.app-header button,
.app-header a,
.app-header input,
.app-header select,
.titlebar-drag button,
.titlebar-drag a {
  -webkit-app-region: no-drag;
}

/* ---- Entrada pública / autenticação — sem shell, tela cheia ---- */

.auth-shell {
  height: 100vh;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 44%, var(--accent-muted) 0, transparent 32%),
    var(--bg-app);
}

.auth-shell[hidden] {
  display: none;
}

.public-titlebar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--titlebar-h);
  display: flex;
  align-items: center;
  padding: 0 152px 0 var(--space-l);
  z-index: 3;
  -webkit-app-region: drag;
}

.public-titlebar-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-s);
  color: var(--text-primary);
  font-size: var(--text-base);
  user-select: none;
}

.public-titlebar-brand img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.public-theme-toggle {
  position: fixed;
  top: calc(var(--titlebar-h) + var(--space-4));
  right: var(--space-5);
  z-index: 4;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--accent-muted);
  color: var(--text-secondary);
  -webkit-app-region: no-drag;
}

.public-theme-toggle:hover {
  background: var(--accent-muted-strong);
  color: var(--accent);
}

.auth-main {
  height: 100%;
  overflow-y: auto;
  display: flex;
  align-items: safe center;
  justify-content: center;
  padding: calc(var(--titlebar-h) + var(--space-6)) var(--space-6) 68px;
}

.welcome-view {
  width: 100%;
  display: flex;
  justify-content: center;
}

.welcome-card {
  width: min(360px, calc(100vw - 48px));
  padding: var(--space-x);
  border-radius: var(--radius-xl);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-raised);
  text-align: center;
}

.welcome-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-l);
  margin-bottom: var(--space-5);
  color: var(--text-primary);
  font-size: 30px;
  line-height: 1;
  font-weight: var(--weight-bold);
  letter-spacing: -0.04em;
}

.welcome-brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
}

.welcome-card h1 {
  max-width: 290px;
  margin-inline: auto;
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.welcome-card > p {
  margin: var(--space-3) auto 0;
  max-width: 300px;
  color: var(--text-muted);
  line-height: 1.55;
}

.welcome-card .welcome-notice {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  background: var(--warning-muted);
  color: var(--text-secondary);
  font-size: var(--text-base);
}

.welcome-actions {
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.welcome-actions button {
  width: 100%;
}

.session-restore-view {
  width: min(380px, calc(100vw - 48px));
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: var(--space-3);
  color: var(--text-primary);
}

.session-restore-mascot {
  width: 82px;
  height: 82px;
  object-fit: contain;
}

.session-restore-spinner {
  width: 22px;
  height: 22px;
  color: var(--accent);
  animation: session-spin 900ms linear infinite;
}

.session-restore-view > p {
  color: var(--text-muted);
}

.session-restore-actions {
  width: 100%;
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-2);
}

.session-restore-actions button {
  width: 100%;
}

@keyframes session-spin {
  to { transform: rotate(360deg); }
}

.public-footer {
  position: fixed;
  left: var(--space-7);
  bottom: var(--space-5);
  display: flex;
  gap: var(--space-2);
  color: var(--text-muted);
  font-size: var(--text-sm);
  user-select: none;
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-l);
  margin-bottom: var(--space-x);
}

/* Mascote Klah no lugar da caixa com a letra "G". */
.auth-mascot {
  width: 72px;
  height: 72px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.auth-brand h1 {
  font-size: var(--title-lg-size);
  line-height: var(--title-lg-line);
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
}

.auth-card {
  position: relative;
  width: min(420px, calc(100vw - 48px));
}

#resetPasswordView {
  width: min(620px, calc(100vw - 48px));
}

#resetPasswordForm {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

#resetPasswordForm > .hint,
#resetPasswordForm > button,
#resetPasswordForm > .error {
  grid-column: 1 / -1;
}

#registerView {
  width: min(760px, calc(100vw - 48px));
}

#registerForm {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.9fr);
  gap: var(--space-4);
  align-items: start;
}

.register-fields,
.register-visuals {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

#registerForm > button,
#registerForm > .error {
  grid-column: 1 / -1;
}

@media (max-width: 700px) {
  #registerForm { grid-template-columns: 1fr; }
  #registerForm > button, #registerForm > .error { grid-column: 1; }

  #resetPasswordForm { grid-template-columns: 1fr; }
  #resetPasswordForm > .hint,
  #resetPasswordForm > button,
  #resetPasswordForm > .error { grid-column: 1; }
}

.auth-brand-compact {
  flex-direction: row;
  justify-content: center;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.auth-brand-compact .auth-mascot {
  width: 48px;
  height: 48px;
}

.auth-brand-compact h1 {
  font-size: var(--text-xl);
}

.auth-back {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
}

@media (max-height: 640px) {
  .public-footer {
    display: none;
  }

  .auth-main {
    padding-bottom: var(--space-4);
    align-items: flex-start;
  }

  .welcome-view,
  .session-restore-view {
    margin-block: auto;
  }
}

/* ---- App shell (autenticado): três colunas ---- */

.app-shell {
  position: fixed;
  inset: var(--titlebar-h) 0 0;
  display: grid;
  grid-template-columns: var(--rail-w) var(--context-sidebar-w) 1fr;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.app-shell[hidden] {
  display: none;
}

/* Barra de título própria, mas com os botões de janela continuando nativos.
   A cor é a mesma informada ao titleBarOverlay no processo principal, então
   minimizar/maximizar/fechar deixam de parecer uma caixa separada. */
.app-window-titlebar {
  position: fixed;
  inset: 0 0 auto;
  height: var(--titlebar-h);
  box-sizing: border-box;
  display: flex;
  align-items: center;
  padding: 0 152px 0 var(--space-l);
  background: var(--bg-app);
  -webkit-app-region: drag;
  z-index: 55;
}

/* A divisória fica logo abaixo do titleBarOverlay nativo. Se ela ocupar o
   último pixel da barra, o Windows a recobre na região dos botões de janela. */
.app-window-titlebar::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 1px;
  background: color-mix(in srgb, var(--border) 62%, transparent);
  pointer-events: none;
}

.app-window-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-s);
  color: var(--text-primary);
  font-size: var(--text-base);
  line-height: 1;
  user-select: none;
}

.app-window-brand img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

/* ---- Barra estreita (rail) ---- */

.rail {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-block: var(--space-md) var(--space-md);
  min-width: 0;
  /* O topo do rail encosta na quina da janela; a faixa de arrasto fica
     por conta do cabeçalho e da barra contextual, não daqui — o rail é
     todo clicável. */
}

/* Salas + "+" + comunidades rolam juntos; as configurações ficam fixas
   no rodapé. O scroller esconde a própria barra de rolagem (o rail tem
   56px, uma barra visível comeria o espaço do avatar). */
.rail-scroll {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-height: 0;
  width: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: none;
}

.rail-scroll::-webkit-scrollbar {
  display: none;
}

.rail-rooms {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  flex-shrink: 0;
}

/* Separador: 1px, largura calc(100% - 24px), margem 6px auto — medida
   do LineDivider do Stoat. */
.rail-divider {
  height: 1px;
  flex-shrink: 0;
  margin: var(--space-s) auto;
  width: calc(100% - 24px);
  background: var(--border-strong);
}

/* ---- Barra contextual ---- */

.context-sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.context-nav,
.context-room {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

/* Título da barra: title/medium (16px/1.5rem/600), com o respiro
   generoso do SidebarTitle do Stoat (paddingBlock 8px + 15px). Também
   é área de arrasto — é uma faixa sem nada interativo. */
.context-title {
  padding-block: calc(var(--space-md) + 15px) var(--space-md);
  padding-inline: var(--space-lg);
  font-size: var(--title-md-size);
  line-height: var(--title-md-line);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-title);
  color: var(--text-primary);
  -webkit-app-region: drag;
}

.context-menu {
  display: flex;
  flex-direction: column;
  /* 5px entre itens — o mesmo espaçador do HomeSidebar do Stoat. */
  gap: 5px;
}

/* Cabeçalho de seção ("Mensagens diretas", "Participantes"): 13px/500,
   com o `+` alinhado à direita. Medidas do `Category` do Stoat. */
.context-category {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--space-lg);
  padding-top: calc(var(--space-xl) - 5px);
  padding-bottom: var(--space-md);
  font-size: 13px;
  line-height: var(--label-md-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  color: var(--text-muted);
}

.context-conversations {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-inline: var(--space-l);
}

.context-footer {
  padding: var(--space-l) var(--space-lg);
}

/* Painel de sala — cabeçalho, corpo rolável e ações no rodapé. Só reúne
   o que já existia na tela da sala; nenhum canal inventado. */

.context-room-header {
  display: flex;
  align-items: center;
  gap: var(--space-l);
  padding: var(--space-l) var(--space-lg);
  min-height: var(--header-h);
  -webkit-app-region: drag;
}

.context-room-header .name {
  font-size: var(--title-md-size);
  line-height: var(--title-md-line);
  font-weight: var(--weight-semibold);
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.context-room-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-inline: var(--space-l);
  display: flex;
  flex-direction: column;
  gap: var(--space-l);
}

.context-room-actions {
  padding: var(--space-l);
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* ---- Área de conteúdo ---- */

.content-area {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-app);
  overflow: hidden;
}

/* Cabeçalho interno fica abaixo da barra nativa: usa toda a largura do painel
   e separa contextos com uma linha, não com um cartão arredondado. */
.app-header {
  height: var(--header-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 var(--space-4);
  font-weight: var(--weight-semibold);
  font-size: var(--body-lg-size);
  color: var(--text-primary);
  border-bottom: 1px solid var(--border);
}

.app-header-icon {
  font-size: 22px;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.app-header-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}

.view {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-6) var(--space-6) var(--space-xl);
}

/* ---- Amigos ----
   Cabeçalho, lista e atividade formam painéis de aplicação contínuos. Bordas
   separam regiões; caixas arredondadas ficam só nos controles interativos. */
.friends-tabs {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  margin-left: var(--space-2);
  padding-left: var(--space-4);
  border-left: 1px solid var(--border);
  -webkit-app-region: no-drag;
}

.friends-tab {
  min-height: 32px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-weight: var(--weight-semibold);
  box-shadow: none;
  white-space: nowrap;
}

.friends-tab:hover,
.friends-tab.active {
  background: var(--bg-active);
  color: var(--text-primary);
}

.friends-tab-add,
.friends-tab-add.active {
  background: var(--accent);
  color: var(--text-on-accent);
}

.friends-tab-add:hover {
  background: var(--accent-hover);
  color: var(--text-on-accent);
}

.friends-tab-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--danger);
  color: white;
  font-size: 10px;
  line-height: 1;
}

.friends-view {
  width: 100%;
  max-width: none;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
}

.friends-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(248px, 28%, 360px);
  width: 100%;
  height: 100%;
  min-height: 0;
}

.friends-panels {
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-6);
}

.friends-panel {
  min-width: 0;
}

.friends-panel[hidden] {
  display: none;
}

label.friends-search {
  height: 38px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-sunken);
  color: var(--text-muted);
}

.friends-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 24%, transparent);
}

.friends-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.friends-section-heading {
  margin-top: var(--space-6);
  padding: 0 var(--space-2) var(--space-3);
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  color: var(--text-muted);
}

.friends-section-heading h2 {
  margin: 0;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.friends-section-heading span {
  font-size: var(--text-sm);
}

.friends-panel-intro {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

.friends-panel-intro h2,
.friends-panel-intro p {
  margin: 0;
}

.friends-panel-intro h2 {
  font-size: var(--text-lg);
}

.friends-panel-intro p {
  margin-top: 3px;
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.friends-panel-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-active);
  color: var(--text-secondary);
}

.friends-panel-icon.accent {
  background: var(--accent-muted);
  color: var(--accent);
}

.friends-add-panel {
  padding: 0;
  border: 0;
  background: transparent;
}

.friends-add-form {
  margin-top: var(--space-5);
  gap: var(--space-2);
}

.friends-add-form > label {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.friends-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
}

.friends-add-row input {
  min-width: 0;
}

.friends-activity {
  min-width: 0;
  overflow-y: auto;
  padding: var(--space-5);
  border-left: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-app) 96%, var(--bg-surface) 4%);
}

.friends-activity h2 {
  margin: 0 0 var(--space-4);
  font-size: var(--text-lg);
}

.friends-active-list {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
}

.friends-active-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
  padding: var(--space-3);
  border: 0;
  border-radius: 0;
  background: var(--bg-surface);
  color: var(--text-primary);
  text-align: left;
}

.friends-active-item:hover {
  background: var(--bg-hover);
}

.friends-active-copy {
  min-width: 0;
  display: grid;
}

.friends-active-copy strong,
.friends-active-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.friends-active-copy span {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

.friends-active-empty {
  padding: var(--space-5) var(--space-4);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: center;
}

.friends-active-empty strong {
  display: block;
  margin-bottom: var(--space-2);
}

.friends-active-empty p {
  color: var(--text-muted);
  font-size: var(--text-sm);
}

@media (max-width: 1180px) {
  .friends-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .friends-activity {
    display: none;
  }
}

@media (max-width: 900px) {
  .friends-tabs {
    gap: 2px;
    margin-left: 2px;
    padding-left: var(--space-2);
  }

  .friends-tab {
    padding-inline: var(--space-2);
  }

  .friends-tab .icon {
    display: none;
  }

  .friends-panels {
    padding: var(--space-4);
  }

  .friends-add-row {
    grid-template-columns: 1fr;
  }
}

/* ---- Início ----
   Conteúdo centralizado, padding 48px 0 e gap 32px — composição do
   Home.tsx do Stoat. A Home não tem formulário nenhum: cada ação abre
   um modal. */

.view-home {
  max-width: none;
  padding: 48px var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
  min-height: 100%;
}

.home-brand {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: var(--space-3);
  text-align: center;
}

.home-mascot {
  width: 54px;
  height: 54px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.home-wordmark {
  font-size: var(--text-2xl);
  line-height: 1.2;
  font-weight: var(--weight-bold);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}

/* Contêiner das ações: fundo próprio, padding 8px, gap 8px, raio 16px —
   o `Buttons` do Stoat. Duas colunas de 260px que envolvem (flex-wrap)
   quando não cabem. */
.home-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
}

/* 260px é a medida do Stoat e vale sempre que couber. Abaixo disso a
   coluna encolhe um pouco em vez de empilhar: a Início em 840x560 tem
   ~536px úteis, e empilhar as seis ações numa coluna só era justamente
   o que fazia a tela virar uma lista longa de rolagem. */
.home-actions-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  flex: 1 1 224px;
  width: 260px;
  max-width: 260px;
  min-width: 0;
  margin-inline: 0.25em;
}

.home-actions-col > * {
  flex-grow: 1;
}

/* Em janelas baixas (840x560 é o mínimo suportado), aperta o respiro
   vertical pra marca + ações continuarem visíveis sem virar uma coluna
   longa de rolagem. */
@media (max-height: 640px) {
  .view-home {
    padding-block: var(--space-6);
    gap: var(--space-5);
  }

  .home-mascot {
    width: 46px;
    height: 46px;
  }

  .home-wordmark {
    font-size: var(--text-xl);
  }
}

/* Janela estreita: devolve espaço horizontal pras duas colunas
   continuarem lado a lado. */
@media (max-width: 1100px) {
  .view-home {
    padding-inline: var(--space-l);
  }

  .home-actions-col {
    margin-inline: 0;
  }
}

/* ---- Central de configurações (Fase B) ----
   Camada em tela cheia por cima de qualquer view do shell (Opção A —
   ver views/settings.ts para a justificativa da escolha arquitetural).
   Fundo opaco (não é um scrim translúcido sobre a app): troca a tela
   inteira, mas SEM tocar em nenhum estado da view por baixo — fechar
   só esconde a camada de novo. */

.settings-overlay {
  position: fixed;
  inset: var(--titlebar-h) 0 0;
  /* Entre o popover (40) e o tooltip (60) na escala de camadas do app —
     nada dentro da central precisa ficar acima do tooltip. */
  z-index: 50;
  background: var(--bg-app);
  display: flex;
  flex-direction: column;
}

.settings-overlay[hidden] {
  display: none;
}

/* Fica abaixo da faixa de arrasto (nunca disputa espaço com os botões
   nativos sobrepostos do Windows, que só ocupam os --titlebar-h do
   topo) — por isso não precisa do padding-right de 148px que o
   .app-header usa; basta começar depois dessa faixa. */
.settings-close-control {
  position: fixed;
  top: calc(var(--titlebar-h) + var(--space-3));
  right: max(var(--space-6), calc(100vw - var(--settings-sidebar-w) - 816px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  -webkit-app-region: no-drag;
  z-index: 2;
}

.settings-close {
  border-radius: var(--radius-full);
  background: var(--bg-surface);
}

.settings-close-shortcut {
  color: var(--text-muted);
  font-size: 10px;
  line-height: 1;
  font-weight: var(--weight-semibold);
  letter-spacing: 0.04em;
}

.settings-layout {
  flex: 1;
  min-height: 0;
  display: flex;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: var(--bg-surface);
  box-shadow: none;
}

.notes-header-tools,
.dm-header-tools {
  margin-left: auto;
  -webkit-app-region: no-drag;
}

.dm-header-tools {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.notes-header-tools[hidden],
.dm-header-tools[hidden] {
  display: none;
}

.notes-header-tools input,
.dm-header-tools input {
  width: min(240px, 28vw);
  height: 36px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
}

.settings-sidebar {
  width: var(--settings-sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: color-mix(in srgb, var(--bg-sidebar) 92%, var(--accent) 8%);
  border-right: 1px solid var(--border);
  align-items: flex-end;
}

.settings-sidebar-scroll {
  flex: 1;
  width: min(240px, calc(100% - var(--space-5)));
  box-sizing: border-box;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  margin-right: var(--space-3);
  padding: var(--space-l) 0 var(--space-l);
}

.settings-sidebar-scroll .menu-button {
  width: 100%;
  box-sizing: border-box;
  margin-inline: 0;
  border-radius: var(--radius-sm);
}

.settings-sidebar-scroll .menu-button.selected {
  border-radius: var(--radius-sm);
}

.settings-group-title {
  padding-inline: var(--space-md);
  padding-top: var(--space-l);
  padding-bottom: var(--space-md);
  font-size: 13px;
  line-height: var(--label-md-line);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  color: var(--text-muted);
}

.settings-group-title:first-child {
  padding-top: 0;
}

.settings-sidebar-footer {
  width: min(240px, calc(100% - var(--space-5)));
  box-sizing: border-box;
  margin-right: var(--space-3);
  flex-shrink: 0;
  padding: var(--space-l);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.settings-sidebar-footer .menu-button {
  margin: 0;
  width: 100%;
  border-radius: var(--radius-sm);
}

.settings-footer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-inline: var(--space-md);
}

.settings-version {
  font-size: var(--label-sm-size);
  color: var(--text-disabled);
}

.settings-more-hint {
  color: var(--text-disabled);
  display: inline-flex;
  cursor: default;
}

.settings-more-hint .icon {
  font-size: 14px;
}

/* Rodapé "Versão / Termos / Privacidade / Guias" (Fase C — mesma linha
   do rodapé do Stoat analisado nos prints). Termos/Privacidade/Guias
   ainda não têm nenhum conteúdo por trás (nenhuma página de termos foi
   escrita) — texto estático com tooltip "Ainda não existe" em vez de um
   link que levaria a lugar nenhum, mesma honestidade das páginas-
   placeholder. */
.settings-footer-links {
  display: flex;
  gap: var(--space-3);
  padding-inline: var(--space-md);
  font-size: var(--label-sm-size);
  color: var(--text-disabled);
  cursor: default;
}

/* O conteúdo ocupa a largura restante, mas a página fica alinhada ao
   começo desse plano. Em telas largas, a área vazia adicional é absorvida
   pelo lado direito e a navegação ganha um recuo proporcional à esquerda:
   a central inteira forma um bloco visual, sem colar as ferramentas na
   borda da janela. */
.settings-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--space-x) var(--space-6) 64px;
  background: var(--bg-app);
  border-radius: 0;
}

.settings-page {
  max-width: 720px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.settings-page-title {
  font-size: var(--title-lg-size);
  line-height: var(--title-lg-line);
  font-weight: var(--weight-bold);
  margin: 0;
}

.settings-description {
  font-size: var(--body-md-size);
  line-height: var(--body-md-line);
  color: var(--text-secondary);
  margin: 0;
}

/* Bloco "Excluir conta" dentro de Minha conta. A ação exige senha, código
   por e-mail e uma confirmação final antes da remoção permanente. */
.settings-danger-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.settings-danger-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--danger);
  font-weight: var(--weight-semibold);
}

/* Em janelas estreitas (840px é o mínimo suportado — sidebar de 260px +
   conteúdo já usa quase toda a largura) a página encolhe pra caber sem
   forçar rolagem horizontal, em vez de manter os 640px fixos. */
@media (max-width: 1000px) {
  .settings-content {
    padding-left: var(--space-l);
    padding-right: 72px;
  }

  .settings-close-control {
    right: var(--space-4);
  }
}

.account-deletion-code {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.account-deletion-code[hidden] {
  display: none;
}

.account-deletion-code input {
  flex: 1;
  min-width: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

@media (max-width: 720px) {
  .account-deletion-code {
    align-items: stretch;
    flex-direction: column;
  }
}
