.app {
  grid-template-rows: auto auto minmax(0, 1fr);
}

.documentbar {
  position: relative;
  z-index: 24;
  display: grid;
  grid-template-columns: auto minmax(60px, 1fr) auto auto;
  align-items: center;
  min-height: 60px;
  gap: 12px;
  padding: 8px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.studio-brand,
.studio-header-preferences,
.studio-header-actions,
.studio-brand-title,
.studio-language {
  display: flex;
  align-items: center;
  min-width: 0;
}

.studio-brand { gap: 8px; }
.studio-brand-copy { min-width: 0; }
.studio-brand-title { gap: 6px; line-height: 1.25; }
.studio-brand-title strong { font-size: 16px; white-space: nowrap; }
.studio-version { flex: none; color: var(--muted); font: 10px var(--font-num); }
.studio-credit {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  white-space: nowrap;
  text-decoration: none;
}
.studio-credit:hover { text-decoration: underline; text-underline-offset: 2px; }
.studio-mark {
  flex: 0 0 37px;
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--accent-soft);
  color: var(--accent);
}
.studio-mark > svg { width: 29px; height: 29px; }

.studio-project {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-content: center;
  min-width: 0;
  min-height: 40px;
  gap: 2px;
  padding: 4px 8px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}
.studio-project:hover:not(:disabled) {
  background: var(--surface-2);
  border-color: var(--line);
}
.studio-project:disabled { opacity: .65; cursor: default; }
.documentbar #document-title {
  display: block;
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 0;
  overflow: hidden;
  border: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.studio-project .saved-indicator {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.studio-project .saved-indicator::before {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-inline-end: 4px;
  border-radius: 50%;
  background: var(--add);
  content: '';
}
.studio-project .saved-indicator[data-save-state="error"]::before { background: var(--del); }

.studio-header-preferences { gap: 6px; }
.studio-header-actions { gap: 6px; }
.studio-header-actions svg,
.studio-header-preferences svg {
  flex: none;
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.studio-language { gap: 5px; color: var(--muted); font-size: 12px; }
.studio-language select {
  max-width: 100%;
  min-height: 34px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}
.documentbar .studio-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  min-height: 34px;
  padding: 0;
}
.documentbar .studio-feedback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 34px;
  white-space: nowrap;
}
@media (max-width: 1279px) {
  .documentbar .studio-feedback { width: 34px; padding: 0; }
  .studio-feedback > span { display: none; }
}
.documentbar .project-file-actions {
  gap: 0;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.documentbar .project-file-actions .btn { border-color: transparent; background: transparent; }
.documentbar .project-file-actions .btn:hover:not(:disabled) {
  border-color: var(--line);
  background: var(--surface);
}
.documentbar #b-ai-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
}
.studio-units { color: var(--muted); font: 11px var(--font-num); }

@media (min-width: 1001px) and (max-width: 1279px) {
  .documentbar { gap: 8px; padding-inline: 12px; }
  .studio-header-actions { gap: 5px; }
  .documentbar .studio-header-actions > .btn:not(.studio-icon-btn),
  .documentbar .project-file-actions > .btn,
  .documentbar #b-files {
    padding-inline: 7px;
    font-size: 12px;
  }
}
@media (max-width: 1279px) {
  .studio-language-label { display: none; }
}
@media (max-width: 1000px) {
  .documentbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 5px 8px;
    padding: 6px 10px;
  }
  .studio-header-actions { grid-column: 1 / -1; justify-content: flex-end; }
  .documentbar .project-file-popover { position: absolute; inset: calc(100% + 8px) 0 auto auto; }
}
@media (max-width: 680px) {
  .documentbar #project-file-menu { position: static; }
  .documentbar .project-file-popover { inset-inline-end: 8px; }
}
@media (max-width: 540px) {
  .documentbar { gap: 4px 6px; padding-inline: 7px; }
  .studio-brand { gap: 5px; }
  .studio-brand-title strong { font-size: 13px; }
  .studio-mark { flex-basis: 29px; width: 29px; height: 29px; border-radius: 7px; }
  .studio-mark > svg { width: 24px; height: 24px; }
  .studio-credit { font-size: 9px; }
  .studio-version, .studio-language > svg { display: none; }
  .studio-project { padding-inline: 3px; }
  .documentbar #document-title { font-size: 12px; }
  .studio-header-preferences { gap: 3px; }
  .studio-header-actions { gap: 4px; }
  .studio-header-actions #b-files .file-label { display: none; }
}
@media (max-width: 380px) {
  .studio-credit { display: none; }
}
