/* Barra do topo: marca, ações de arquivo e histórico, estado do salvamento e idioma. */

.topbar {
  grid-area: top;
  display: flex;
  align-items: center;
  gap: 16px;
  padding-inline: 16px 14px;
  background: var(--hull);
  border-bottom: 1px solid var(--seam);
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  margin-right: auto;
}

.brand-mark {
  width: 30px;
  height: 30px;
  color: var(--brass);
  flex: none;
}

.brand-text {
  display: grid;
  line-height: 1.05;
  min-width: 0;
}

.brand-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

/* Selo discreto de versão beta ao lado do nome. */
.beta-badge {
  flex: none;
  padding: 2px 5px 1px;
  border: 1px solid rgba(201, 162, 79, 0.38);
  border-radius: 3px;
  color: var(--brass);
  font: 500 9.5px/1 var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.85;
  cursor: help;
}

.wordmark {
  margin: 0;
  min-width: 0;
  font-weight: 400;
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--bone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 12.5px;
  color: var(--lichen);
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
}

.sep {
  width: 1px;
  height: 22px;
  background: var(--seam-2);
  margin-inline: 6px;
  flex: none;
}

.save-state {
  font: 12px var(--font-mono);
  color: var(--lichen);
  margin-right: 6px;
  white-space: nowrap;
}

.save-state::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 1px;
  background: var(--lichen);
}

.save-state[data-kind="ok"]::before { background: var(--moss); }
.save-state[data-kind="pending"]::before { background: var(--brass); }
.save-state[data-kind="warn"]::before { background: var(--ember); }

/* Apoio ao projeto: painel nativo aberto na inicialização e acessível pelo botão. */

.support-toggle {
  flex: none;
}

.support-panel {
  position: fixed;
  inset: calc(var(--top-h) + 8px) 14px auto auto;
  box-sizing: border-box;
  width: min(352px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--top-h) - 24px);
  overflow-y: auto;
  margin: 0;
  padding: 20px;
  border: 1px solid var(--seam-2);
  border-radius: 8px;
  background: var(--hull);
  color: var(--bone);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.24);
}

.support-title {
  margin: 0 0 10px;
  font: 400 22px/1.2 var(--font-display);
}

.support-description {
  margin: 0 0 12px;
  color: var(--bone-2);
}

.support-link {
  text-decoration: none;
}

/* Seletor de idioma */

.lang {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  background: var(--hull-2);
  border: 1px solid var(--seam);
  border-radius: 6px;
  flex: none;
}

.lang svg {
  width: 16px;
  height: 16px;
  margin-inline: 5px 3px;
  color: var(--lichen);
  flex: none;
}

.lang button {
  height: 28px;
  min-width: 32px;
  padding: 0 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--bone-2);
  font: 500 12px var(--font-mono);
  letter-spacing: 0.04em;
  cursor: pointer;
}

.lang button:hover {
  color: var(--bone);
}

.lang button[aria-pressed="true"] {
  background: var(--hull-3);
  color: var(--brass-2);
  box-shadow: inset 0 0 0 1px var(--seam-2);
}

@media (max-width: 1640px) {
  .actions #btnSession .lbl { display: none; }
  .actions #btnSession { width: 34px; padding: 0; }
  .support-toggle-label { display: none; }
  .support-toggle { width: 34px; padding: 0; }
}

@media (max-width: 1480px) {
  .brand-sub { display: none; }
  .actions .btn.ghost .lbl { display: none; }
  .actions .btn.ghost { width: 34px; padding: 0; }
}

@media (max-width: 1100px) {
  .save-state { display: none; }
}

@media (max-width: 820px) {
  .topbar {
    gap: 8px;
    padding-inline: 12px 10px;
  }

  .wordmark { font-size: 18px; }
  .brand-mark { width: 24px; height: 24px; }
  .sep { margin-inline: 2px; }
  .lang svg { display: none; }
  .lang button { min-width: 28px; padding: 0 4px; }
  .actions { flex-shrink: 1; overflow-x: auto; scrollbar-width: none; }
  .actions .btn { flex: none; }
  .actions .btn.primary .lbl { display: none; }
  .actions .btn.primary { width: 36px; padding: 0; }
}

@media (max-width: 600px) {
  .brand { flex: none; }
  .brand-text { display: none; }
}
