.ribbon-tabs #tab-insert[aria-selected="true"] {
  border-radius: 4px 4px 0 0;
  box-shadow: inset 0 -2px #5487e6;
}

.insert-ribbon {
  --insert-icon-color: #365584;
  min-height: 107px;
  padding: 5px 7px 4px;
  align-items: stretch;
  overflow: auto hidden;
  scrollbar-width: thin;
}

.insert-group {
  display: grid;
  grid-template-rows: 73px 17px;
  flex: 0 0 auto;
  align-content: end;
  padding: 0 5px;
  border-right: 1px solid var(--line);
}
.insert-group:first-child { padding-inline-start: 0; }
.insert-group:last-child { padding-inline-end: 0; border-right: 0; }
.insert-controls, .insert-text-stack { display: flex; align-items: start; gap: 1px; }
.insert-command {
  display: grid;
  justify-items: center;
  grid-template-rows: 29px minmax(25px, auto) 6px;
  min-width: 43px;
  min-height: 67px;
  max-width: 76px;
  align-content: start;
  align-items: center;
  gap: 1px;
  padding: 3px 5px 1px;
  text-align: center;
  font-size: .75rem;
  line-height: 1.08;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
}
.insert-label { max-width: 70px; text-wrap: balance; }
.insert-icon { display: block; color: var(--insert-icon-color, #365584); width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 1.45; stroke-linecap: round; stroke-linejoin: round; }
.insert-command:hover, .insert-command[aria-expanded="true"] { background: #eaf1ff; border-color: #ceddf6; }
.insert-command:disabled { opacity: .47; cursor: not-allowed; background: transparent; border-color: transparent; }
.insert-caret { width: 5px; height: 5px; border-right: 1px solid currentColor; border-bottom: 1px solid currentColor; rotate: 45deg; align-self: start; }
.insert-caption { text-align: center; color: var(--muted); align-self: end; font-size: .6875rem; line-height: 14px; white-space: nowrap; }
.insert-text-stack { align-items: stretch; flex-direction: column; gap: 1px; padding: 2px 1px 0 3px; }
.insert-command.insert-compact {
  display: flex;
  align-items: center;
  min-height: 21px;
  max-width: none;
  gap: 4px;
  padding: 1px 4px;
  white-space: nowrap;
}
.insert-compact .insert-icon { width: 15px; height: 15px; }
.insert-compact .insert-label { max-width: none; }

.insert-popover {
  display: none;
  position: fixed;
  inset: auto;
  margin: 0;
  min-width: min(202px, calc(100vw - 16px));
  max-width: calc(100vw - 16px);
  max-height: calc(100dvh - 16px);
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 24px #18223b26;
}
.insert-popover:popover-open { display: block; }
.insert-popover[data-fallback-open] { display: block; z-index: 30; }
.insert-popover > button {
  display: grid;
  gap: 1px;
  width: 100%;
  min-height: 30px;
  padding: 5px 8px;
  text-align: left;
  border: 0;
  border-radius: 5px;
  background: transparent;
  font-size: .875rem;
}
.insert-popover > button:not(:disabled):hover, .insert-popover > button:not(:disabled):focus-visible { background: #eaf1ff; }
.insert-popover > button:disabled { color: var(--muted); cursor: not-allowed; }
.insert-popover small, .insert-menu-status { color: var(--muted); font-size: .75rem; }
.insert-menu-status { padding: 4px 6px 6px; min-height: 25px; }
.insert-popover hr { margin: 5px 0; border: 0; border-top: 1px solid var(--line); }
.brasa-cover-dialog { width: min(740px, calc(100% - 30px)); }
.brasa-cover-gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(112px, 1fr)); gap: 8px; }
.brasa-cover-option { display: grid; justify-items: center; grid-template-rows: auto minmax(36px, auto); gap: 5px; padding: 5px; border: 1px solid var(--line); border-radius: 6px; background: transparent; font-size: .8125rem; }
.brasa-cover-option:hover { border-color: #7498dd; background: #7898dc14; }
.brasa-cover-preview { display: grid; align-content: center; width: 100%; aspect-ratio: 3 / 4; gap: 2px; padding: 8px; border: 1px solid #d2d9e4; background: white; }
.brasa-cover-preview small { font-size: .625rem; }
.brasa-cover-preview strong { font: 700 1.25rem Georgia, serif; }
.brasa-cover-preview[data-cover-model="academic"] { justify-items: center; }
.brasa-cover-preview[data-cover-model="institutional"] { border-top: 4px solid #10365c; }
.brasa-cover-preview[data-cover-model="proposal"] { border-bottom: 4px solid #087685; }

:root[data-office-theme="dark"] .insert-ribbon { --insert-icon-color: #b1cfff; background: #272d37; }
:root[data-office-theme="dark"] :is(.insert-popover, .insert-command:not(:disabled):hover, .insert-command[aria-expanded="true"]) { background: #323c4d; border-color: #526783; }
:root[data-office-theme="dark"] .insert-popover > button:not(:disabled):is(:hover,:focus-visible) { background: #44536c; }
@media (max-width: 620px) {
  .insert-ribbon { padding-inline: 5px; }
  .insert-group { padding-inline: 4px; }
}
