/* 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;
}

.wordmark {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--bone);
  white-space: nowrap;
}

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

.actions {
  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); }

/* 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);
}

/* O botão da sessão perde o rótulo antes dos outros: é o mais novo e o menos usado. */
@media (max-width: 1440px) {
  .actions #btnSession .lbl { display: none; }
  .actions #btnSession { width: 34px; padding: 0; }
}

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

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

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

@media (max-width: 420px) {
  .wordmark { display: none; }
}
