/*
  Reinos de Ferro v0.1.149
  Menus principais em painel compacto, para evitar páginas gigantes com espaço vazio.
  Fica isolado neste ficheiro para não mexer nos sistemas funcionais.
*/

body.gge-layout-active {
  --rdf-menu-panel-width: min(1100px, calc(100vw - 96px));
  --rdf-menu-panel-max-height: calc(100vh - var(--gge-topbar-height, 46px) - 118px);
  --rdf-menu-panel-bg: linear-gradient(180deg, #dfc28e 0%, #c39961 48%, #a87943 100%);
  --rdf-menu-panel-border: #5c3c1d;
  --rdf-menu-inner-bg: linear-gradient(180deg, #f1dbad 0%, #d3ad75 100%);
  --rdf-menu-text: #2d1909;
  --rdf-menu-muted: #68472a;
}

/* Painel padrão para todos os menus principais. Castelo e mapa continuam em ecrã completo. */
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) {
  position: absolute !important;
  left: 50% !important;
  top: calc(50% - 6px) !important;
  transform: translate(-50%, -50%) !important;
  width: var(--rdf-menu-panel-width) !important;
  max-width: var(--rdf-menu-panel-width) !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: var(--rdf-menu-panel-max-height) !important;
  margin: 0 !important;
  padding: 0 12px 12px !important;
  overflow: auto !important;
  overscroll-behavior: contain;
  color: var(--rdf-menu-text) !important;
  border: 2px solid var(--rdf-menu-panel-border) !important;
  border-radius: 12px !important;
  background: var(--rdf-menu-panel-bg) !important;
  box-shadow: 0 14px 40px rgba(0,0,0,.55), inset 0 1px rgba(255,255,255,.55) !important;
  scrollbar-width: thin;
}

/* Cabeçalho comum dos painéis */
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) > .view-title {
  position: sticky !important;
  inset: 0 auto auto auto !important;
  z-index: 20 !important;
  width: auto !important;
  max-width: none !important;
  min-height: 56px !important;
  margin: 0 -12px 12px !important;
  padding: 9px 42px 9px 15px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 10px !important;
  pointer-events: auto !important;
  border: 0 !important;
  border-bottom: 2px solid #806036 !important;
  border-radius: 10px 10px 0 0 !important;
  background: linear-gradient(180deg, #f1dcae 0%, #cda167 100%) !important;
  box-shadow: inset 0 1px rgba(255,255,255,.65), 0 3px 10px rgba(0,0,0,.18) !important;
}

body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) > .view-title > div:first-child,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) > .view-title h2,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) > .view-title p {
  display: block !important;
}

body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) > .view-title h2 {
  margin: 0 !important;
  color: #2b1607 !important;
  font: 900 25px Georgia, serif !important;
  line-height: 1.05 !important;
  text-shadow: 0 1px rgba(255,255,255,.35) !important;
}

body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) > .view-title p {
  margin: 3px 0 0 !important;
  color: var(--rdf-menu-muted) !important;
  font-size: 12px !important;
  line-height: 1.22 !important;
  font-weight: 700 !important;
}

body.gge-layout-active .view-title-extra {
  margin-left: auto !important;
  color: #2d1909 !important;
  font-size: 12px !important;
  font-weight: 800 !important;
}

body.gge-layout-active .view-close-btn {
  position: absolute !important;
  right: 9px !important;
  top: 50% !important;
  transform: translateY(-50%) !important;
  width: 30px !important;
  height: 30px !important;
  display: grid !important;
  place-items: center !important;
  padding: 0 !important;
  border: 1px solid #8f2d24 !important;
  border-radius: 6px !important;
  color: #fff7df !important;
  background: linear-gradient(#d44b3d, #93231d) !important;
  box-shadow: inset 0 1px rgba(255,255,255,.45), 0 3px 8px rgba(0,0,0,.35) !important;
  font: 900 24px/1 Georgia, serif !important;
  cursor: pointer !important;
}
body.gge-layout-active .view-close-btn:hover { filter: brightness(1.08); }

/* Componentes comuns dentro dos menus */
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .game-card,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .panel,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .equipment-character-list,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .equipment-paperdoll,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .equipment-summary,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .equipment-smith-list,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .equipment-smith-card,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .equipment-smith-upgrade,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .equipment-smith-empty-panel {
  color: var(--rdf-menu-text) !important;
  border: 1px solid #7b542b !important;
  background: var(--rdf-menu-inner-bg) !important;
  box-shadow: inset 0 1px rgba(255,255,255,.45), 0 5px 14px rgba(0,0,0,.22) !important;
}

body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .game-card-head,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .panel h3 {
  color: #2b1607 !important;
  background: linear-gradient(#f2dfb6, #bb8c50) !important;
  border-bottom-color: #7b542b !important;
}

body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .card-grid {
  width: 100% !important;
  max-width: 100% !important;
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)) !important;
  gap: 10px !important;
}

body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .game-card h3,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .game-card small,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .stats-line,
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .empty-state {
  color: #3a2412 !important;
}

body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .table {
  width: 100% !important;
  color: #2d1909 !important;
  background: #f0d8a4 !important;
  border: 1px solid #7b542b !important;
  border-radius: 9px !important;
  overflow: hidden !important;
}
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .table th {
  color: #2b1607 !important;
  background: linear-gradient(#f3dfb5, #bb8c50) !important;
}
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .table td {
  color: #2d1909 !important;
  border-color: #c09a62 !important;
}

/* Ferreiro: deixa de ocupar o ecrã inteiro quando não há equipamentos. */
body.gge-layout-active .content > .equipment-smith-view {
  width: min(880px, calc(100vw - 72px)) !important;
}
body.gge-layout-active .equipment-smith-view .equipment-smith-empty-panel {
  max-width: 640px !important;
  min-height: 0 !important;
  margin: 16px auto 6px !important;
  padding: 28px 26px !important;
  border-radius: 12px !important;
}
body.gge-layout-active .equipment-smith-view .equipment-smith-empty-panel h3 {
  margin: 0 0 12px !important;
  color: #2b1607 !important;
  font-size: 22px !important;
}
body.gge-layout-active .equipment-smith-view .equipment-smith-empty-panel p {
  margin: 0 !important;
  color: #4d3218 !important;
  font-size: 16px !important;
  line-height: 1.4 !important;
}
body.gge-layout-active .equipment-smith-shell {
  min-height: 0 !important;
  max-height: calc(var(--rdf-menu-panel-max-height) - 82px) !important;
  grid-template-columns: minmax(220px, 280px) minmax(360px, 1fr) minmax(210px, 260px) !important;
  gap: 12px !important;
}
body.gge-layout-active .equipment-smith-list {
  max-height: calc(var(--rdf-menu-panel-max-height) - 92px) !important;
}

/* Comandantes e Governadores: continuam compactos, mas agora dentro de uma janela. */
body.gge-layout-active .content > .equipment-view.equipment-commanders,
body.gge-layout-active .content > .equipment-view.equipment-governors {
  position: absolute !important;
  left: 50% !important;
  top: calc(50% - 6px) !important;
  transform: translate(-50%, -50%) !important;
  width: min(1164px, calc(100vw - 72px)) !important;
  max-width: min(1164px, calc(100vw - 72px)) !important;
  height: auto !important;
  max-height: var(--rdf-menu-panel-max-height) !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 10px 10px !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  color: var(--rdf-menu-text) !important;
  border: 2px solid var(--rdf-menu-panel-border) !important;
  border-radius: 12px !important;
  background: var(--rdf-menu-panel-bg) !important;
  box-shadow: 0 14px 40px rgba(0,0,0,.55), inset 0 1px rgba(255,255,255,.55) !important;
}
body.gge-layout-active .content > .equipment-view.equipment-commanders > .view-title,
body.gge-layout-active .content > .equipment-view.equipment-governors > .view-title {
  margin: 0 -10px 0 !important;
  flex: 0 0 auto !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-shell,
body.gge-layout-active .equipment-view.equipment-governors .equipment-shell {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  max-height: calc(var(--rdf-menu-panel-max-height) - 78px) !important;
  height: min(620px, calc(var(--rdf-menu-panel-max-height) - 78px)) !important;
  overflow: hidden !important;
  grid-template-columns: 218px minmax(410px, 1fr) 338px !important;
  gap: 9px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-summary,
body.gge-layout-active .equipment-view.equipment-governors .equipment-summary,
body.gge-layout-active .equipment-view.equipment-commanders .equipment-character-list,
body.gge-layout-active .equipment-view.equipment-governors .equipment-character-list,
body.gge-layout-active .equipment-view.equipment-commanders .equipment-paperdoll,
body.gge-layout-active .equipment-view.equipment-governors .equipment-paperdoll {
  overflow: hidden !important;
  border-radius: 9px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-inventory,
body.gge-layout-active .equipment-view.equipment-governors .equipment-inventory {
  overflow: auto !important;
  min-height: 84px !important;
}

/* Aliança e outros painéis em grelha não devem ficar perdidos no meio do ecrã. */
body.gge-layout-active .alliance-layout {
  width: 100% !important;
  max-width: 100% !important;
  gap: 12px !important;
}
body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) .game-card[style] {
  margin: 14px auto !important;
}

@media (max-width: 980px), (max-height: 760px) {
  body.gge-layout-active {
    --rdf-menu-panel-width: min(1020px, calc(100vw - 32px));
    --rdf-menu-panel-max-height: calc(100vh - var(--gge-topbar-height, 46px) - 96px);
  }
  body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) {
    width: var(--rdf-menu-panel-width) !important;
    max-width: var(--rdf-menu-panel-width) !important;
  }
  body.gge-layout-active .equipment-view.equipment-commanders .equipment-shell,
  body.gge-layout-active .equipment-view.equipment-governors .equipment-shell {
    grid-template-columns: 190px minmax(360px, 1fr) 300px !important;
  }
  body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) > .view-title h2 {
    font-size: 22px !important;
  }
}

/* =========================================================
   v0.1.149 — Posição unificada das janelas
   Todas as janelas/painéis compactos abrem com o topo alinhado
   pela posição do menu Recrutar/Oficina, evitando umas mais altas
   e outras mais baixas conforme a altura do conteúdo.
   ========================================================= */
body.gge-layout-active {
  --rdf-menu-window-top: max(
    calc(var(--gge-topbar-height, 46px) + 18px),
    calc((100vh - min(76vh, 660px)) / 2)
  );
  --rdf-menu-window-bottom-gap: 30px;
  --rdf-menu-panel-max-height: calc(100vh - var(--rdf-menu-window-top) - var(--rdf-menu-window-bottom-gap));
}

body.gge-layout-active .modal-backdrop {
  box-sizing: border-box !important;
  display: grid !important;
  place-items: start center !important;
  padding-top: var(--rdf-menu-window-top) !important;
  padding-left: 14px !important;
  padding-right: 14px !important;
  padding-bottom: var(--rdf-menu-window-bottom-gap) !important;
}

body.gge-layout-active .modal-backdrop > .modal {
  margin: 0 !important;
}

body.gge-layout-active .content > .view:not(.castle-view):not(.map-view):not(.outpost-castle-view) {
  top: var(--rdf-menu-window-top) !important;
  transform: translateX(-50%) !important;
}

body.gge-layout-active .content > .equipment-view.equipment-commanders,
body.gge-layout-active .content > .equipment-view.equipment-governors {
  top: var(--rdf-menu-window-top) !important;
  transform: translateX(-50%) !important;
}

@media (max-height: 760px) and (min-width: 850px) {
  body.gge-layout-active {
    --rdf-menu-window-bottom-gap: 18px;
  }
}


/* =========================================================
   v0.1.149 — Comandantes/Governadores com dimensão corrigida
   Ficam com a mesma escala dos painéis compactos e deixam espaço
   livre para a barra inferior, evitando sobreposição/corte.
   ========================================================= */
body.gge-layout-active .content > .equipment-view.equipment-commanders,
body.gge-layout-active .content > .equipment-view.equipment-governors {
  box-sizing: border-box !important;
  width: min(1100px, calc(100vw - 96px)) !important;
  max-width: min(1100px, calc(100vw - 96px)) !important;
  height: min(76vh, 660px) !important;
  max-height: calc(100vh - var(--gge-topbar-height, 46px) - 112px) !important;
  min-height: 0 !important;
  overflow: hidden !important;
  padding: 0 10px 10px !important;
  gap: 8px !important;
}

body.gge-layout-active .content > .equipment-view.equipment-commanders > .view-title,
body.gge-layout-active .content > .equipment-view.equipment-governors > .view-title {
  min-height: 44px !important;
  max-height: 52px !important;
  padding: 7px 42px 7px 14px !important;
  margin: 0 -10px 0 !important;
}
body.gge-layout-active .content > .equipment-view.equipment-commanders > .view-title h2,
body.gge-layout-active .content > .equipment-view.equipment-governors > .view-title h2 {
  font-size: 23px !important;
}
body.gge-layout-active .content > .equipment-view.equipment-commanders > .view-title p,
body.gge-layout-active .content > .equipment-view.equipment-governors > .view-title p {
  max-width: 900px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

body.gge-layout-active .equipment-view.equipment-commanders .equipment-shell,
body.gge-layout-active .equipment-view.equipment-governors .equipment-shell {
  box-sizing: border-box !important;
  flex: 1 1 auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
  display: grid !important;
  grid-template-columns: 214px minmax(420px, 1fr) 318px !important;
  gap: 8px !important;
  overflow: hidden !important;
}

body.gge-layout-active .equipment-view.equipment-commanders .equipment-character-list,
body.gge-layout-active .equipment-view.equipment-governors .equipment-character-list,
body.gge-layout-active .equipment-view.equipment-commanders .equipment-paperdoll,
body.gge-layout-active .equipment-view.equipment-governors .equipment-paperdoll,
body.gge-layout-active .equipment-view.equipment-commanders .equipment-summary,
body.gge-layout-active .equipment-view.equipment-governors .equipment-summary {
  box-sizing: border-box !important;
  min-height: 0 !important;
  padding: 8px !important;
  border-radius: 8px !important;
}

body.gge-layout-active .equipment-view.equipment-commanders .equipment-character-list,
body.gge-layout-active .equipment-view.equipment-governors .equipment-character-list,
body.gge-layout-active .equipment-view.equipment-commanders .equipment-summary,
body.gge-layout-active .equipment-view.equipment-governors .equipment-summary {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  overscroll-behavior: contain !important;
}

body.gge-layout-active .equipment-view.equipment-commanders .equipment-paperdoll,
body.gge-layout-active .equipment-view.equipment-governors .equipment-paperdoll {
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
}

body.gge-layout-active .equipment-view.equipment-commanders .equipment-character-list h3,
body.gge-layout-active .equipment-view.equipment-governors .equipment-character-list h3,
body.gge-layout-active .equipment-view.equipment-commanders .equipment-summary h3,
body.gge-layout-active .equipment-view.equipment-governors .equipment-summary h3 {
  margin: 0 0 7px !important;
  font-size: 17px !important;
  line-height: 1.05 !important;
}

body.gge-layout-active .equipment-view.equipment-commanders .equipment-character-btn,
body.gge-layout-active .equipment-view.equipment-governors .equipment-character-btn {
  min-height: 58px !important;
  margin-bottom: 7px !important;
  padding: 7px !important;
  grid-template-columns: 34px 1fr !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-character-btn span,
body.gge-layout-active .equipment-view.equipment-governors .equipment-character-btn span {
  width: 31px !important;
  height: 31px !important;
  font-size: 18px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-character-btn b,
body.gge-layout-active .equipment-view.equipment-governors .equipment-character-btn b {
  font-size: 12px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-character-btn small,
body.gge-layout-active .equipment-view.equipment-governors .equipment-character-btn small {
  font-size: 10px !important;
}

body.gge-layout-active .equipment-view.equipment-commanders .equipment-hero-card,
body.gge-layout-active .equipment-view.equipment-governors .equipment-hero-card {
  flex: 0 0 auto !important;
  grid-template-columns: 78px 1fr !important;
  min-height: 78px !important;
  margin-bottom: 8px !important;
  padding: 8px !important;
  gap: 9px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-hero-portrait,
body.gge-layout-active .equipment-view.equipment-governors .equipment-hero-portrait {
  width: 70px !important;
  height: 78px !important;
  font-size: 38px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-hero-card h2,
body.gge-layout-active .equipment-view.equipment-governors .equipment-hero-card h2 {
  font-size: 22px !important;
  line-height: 1.05 !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-hero-card p,
body.gge-layout-active .equipment-view.equipment-governors .equipment-hero-card p {
  font-size: 11px !important;
}

body.gge-layout-active .equipment-view.equipment-commanders .equipment-slots,
body.gge-layout-active .equipment-view.equipment-governors .equipment-slots {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  grid-template-rows: repeat(3, minmax(0, 1fr)) !important;
  gap: 7px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-slot,
body.gge-layout-active .equipment-view.equipment-governors .equipment-slot {
  min-height: 0 !important;
  padding: 7px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-slot-name,
body.gge-layout-active .equipment-view.equipment-governors .equipment-slot-name {
  margin-bottom: 5px !important;
  font-size: 11px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-empty-slot,
body.gge-layout-active .equipment-view.equipment-governors .equipment-empty-slot {
  height: 40px !important;
  font-size: 14px !important;
}

body.gge-layout-active .equipment-view.equipment-commanders .equipment-summary-list,
body.gge-layout-active .equipment-view.equipment-governors .equipment-summary-list {
  gap: 4px !important;
  margin-bottom: 7px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-summary-row,
body.gge-layout-active .equipment-view.equipment-governors .equipment-summary-row {
  min-height: 25px !important;
  padding: 4px 7px !important;
  font-size: 11px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-set-summary,
body.gge-layout-active .equipment-view.equipment-governors .equipment-set-summary {
  margin: 6px 0 7px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-set-card,
body.gge-layout-active .equipment-view.equipment-governors .equipment-set-card {
  margin-bottom: 4px !important;
  padding: 5px 7px !important;
  border-radius: 7px !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-set-card strong,
body.gge-layout-active .equipment-view.equipment-governors .equipment-set-card strong {
  font-size: 10.5px !important;
  line-height: 1.1 !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-set-card small,
body.gge-layout-active .equipment-view.equipment-governors .equipment-set-card small {
  font-size: 8.5px !important;
  line-height: 1.12 !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-inventory,
body.gge-layout-active .equipment-view.equipment-governors .equipment-inventory {
  min-height: 70px !important;
  max-height: none !important;
  overflow: visible !important;
  padding-right: 0 !important;
}
body.gge-layout-active .equipment-view.equipment-commanders .equipment-empty-inventory,
body.gge-layout-active .equipment-view.equipment-governors .equipment-empty-inventory {
  min-height: 70px !important;
  padding: 9px !important;
  font-size: 11px !important;
}

@media (max-height: 760px) and (min-width: 850px) {
  body.gge-layout-active .content > .equipment-view.equipment-commanders,
  body.gge-layout-active .content > .equipment-view.equipment-governors {
    height: calc(100vh - var(--gge-topbar-height, 46px) - 112px) !important;
  }
  body.gge-layout-active .equipment-view.equipment-commanders .equipment-shell,
  body.gge-layout-active .equipment-view.equipment-governors .equipment-shell {
    grid-template-columns: 196px minmax(370px, 1fr) 300px !important;
    gap: 7px !important;
  }
  body.gge-layout-active .equipment-view.equipment-commanders .equipment-hero-card,
  body.gge-layout-active .equipment-view.equipment-governors .equipment-hero-card {
    grid-template-columns: 64px 1fr !important;
    min-height: 66px !important;
  }
  body.gge-layout-active .equipment-view.equipment-commanders .equipment-hero-portrait,
  body.gge-layout-active .equipment-view.equipment-governors .equipment-hero-portrait {
    width: 58px !important;
    height: 66px !important;
    font-size: 32px !important;
  }
  body.gge-layout-active .equipment-view.equipment-commanders .equipment-empty-slot,
  body.gge-layout-active .equipment-view.equipment-governors .equipment-empty-slot {
    height: 34px !important;
  }
}

/* =========================================================
   Painel de Administração — alinhamento superior
   Abre junto ao topo da área de jogo, em vez de ficar centrado
   verticalmente, mantendo espaço livre para a barra inferior.
   ========================================================= */
body.gge-layout-active .content > .view.admin-view:not(.castle-view):not(.map-view):not(.outpost-castle-view) {
  top: 16px !important;
  transform: translateX(-50%) !important;
  max-height: calc(100vh - var(--gge-topbar-height, 46px) - 134px) !important;
}

/* =========================================================
   v0.1.155 — Relatórios de batalha abaixo da barra superior
   O relatório abre totalmente visível, com uma margem abaixo
   da barra de recursos, sem voltar a esconder os botões finais.
   ========================================================= */
body.gge-layout-active .modal-backdrop:has(> .battle-report-modal),
body.gge-layout-active .modal-backdrop:has(> .battle-details-modal) {
  box-sizing: border-box !important;
  place-items: start center !important;
  padding-top: calc(var(--gge-topbar-height, 46px) + 12px) !important;
  padding-bottom: 10px !important;
}

body.gge-layout-active .modal-backdrop > .battle-report-modal,
body.gge-layout-active .modal-backdrop > .battle-details-modal {
  box-sizing: border-box !important;
  display: flex !important;
  flex-direction: column !important;
  max-height: calc(100vh - var(--gge-topbar-height, 46px) - 22px) !important;
  margin: 0 !important;
  overflow: hidden !important;
}

body.gge-layout-active .battle-report-modal > .modal-body,
body.gge-layout-active .battle-details-modal > .modal-body {
  flex: 1 1 auto !important;
  min-height: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

body.gge-layout-active .battle-report-modal > .modal-actions,
body.gge-layout-active .battle-details-modal > .modal-actions {
  position: relative !important;
  z-index: 8 !important;
  flex: 0 0 auto !important;
  min-height: 54px !important;
  padding: 8px 14px !important;
  box-shadow: 0 -4px 10px rgba(63, 39, 20, .28) !important;
}

/* Compactação apenas em ecrãs mais baixos, sem alterar o aspeto geral. */
@media (max-height: 950px) and (min-width: 821px) {
  body.gge-layout-active .battle-report-sheet {
    min-height: 0 !important;
    padding: 12px 14px 14px !important;
  }

  body.gge-layout-active .battle-report-ribbon {
    margin: -2px auto 4px !important;
    padding: 7px 26px 6px !important;
  }

  body.gge-layout-active .battle-report-ribbon h2 {
    font-size: 25px !important;
    line-height: 1.05 !important;
  }

  body.gge-layout-active .battle-report-ribbon span {
    margin-top: 2px !important;
  }

  body.gge-layout-active .battle-report-meta {
    margin: 0 8px -39px !important;
  }

  body.gge-layout-active .battle-report-meta > div:first-child {
    padding: 6px 11px !important;
  }

  body.gge-layout-active .battle-report-result-seal {
    width: 58px !important;
    height: 58px !important;
    font-size: 30px !important;
  }

  body.gge-layout-active .battle-report-scene {
    height: 195px !important;
    margin-bottom: 7px !important;
  }

  body.gge-layout-active .battle-scene-army {
    bottom: 16px !important;
    font-size: 52px !important;
  }

  body.gge-layout-active .battle-scene-fortress {
    bottom: 5px !important;
    font-size: 130px !important;
  }

  body.gge-layout-active .battle-summary-grid {
    gap: 7px !important;
    grid-template-columns: 1fr 210px 1fr !important;
  }

  body.gge-layout-active .battle-lord-card {
    padding: 8px 10px !important;
  }

  body.gge-layout-active .battle-big-stat {
    margin: 5px auto 4px !important;
  }

  body.gge-layout-active .battle-big-stat b {
    font-size: 26px !important;
  }

  body.gge-layout-active .battle-mini-stats span,
  body.gge-layout-active .battle-result-card > div {
    padding: 5px 4px !important;
  }

  body.gge-layout-active .battle-result-card {
    gap: 4px !important;
    padding: 6px !important;
  }

  body.gge-layout-active .battle-loot-section {
    margin-top: 7px !important;
    padding: 7px 10px !important;
  }

  body.gge-layout-active .battle-loot-section h4 {
    margin-bottom: 5px !important;
  }

  body.gge-layout-active .battle-loot-card {
    min-height: 36px !important;
  }

  body.gge-layout-active .battle-loot-section > small {
    margin-top: 4px !important;
  }

  body.gge-layout-active .battle-equipment-section {
    margin-top: 7px !important;
    padding: 7px 10px !important;
  }

  body.gge-layout-active .battle-report-message {
    margin-top: 7px !important;
    padding: 7px 12px !important;
  }
}
