/* Menší tlačítka v oknech (Petr 4. 11. 2026, princip z Koní): samostatné tlačítko dole (Zavřít, Hotovo) a „+ Nová poznámka“ nejsou přes celou šířku okna,
   ale malé a uprostřed. Mění se jen velikost a zarovnání, barvy a chování zůstávají. */
html.compact-preview .modal-footer { justify-content: center !important; }
html.compact-preview .modal-footer > :is(.btn,.btn-close,.btn-primary):only-child,
html.compact-preview :is(#notes-overlay,#mating-overview-overlay) .modal-footer > .btn:only-child,
html.compact-preview #mating-overview-overlay > div > .modal-footer > .btn:only-child {
  width: auto !important; min-width: 150px !important; max-width: 70% !important; min-height: 40px !important; padding: 0 22px !important;
  margin: 0 auto !important; flex: 0 0 auto !important; box-sizing: border-box;
}
html.compact-preview #notes-overlay :is(#notes-tab-content,#wl-tab-content,#contacts-tab-content) > .btn-primary {
  width: auto !important; min-width: 220px; max-width: 100%; display: block; margin-left: auto !important; margin-right: auto !important; padding: 0 22px !important; min-height: 44px;
}
html.compact-preview #reserved-list-modal button.btn-primary[style*="width:100%"] {
  width: auto !important; min-width: 150px; max-width: 70%; display: block; margin: 0 auto !important; padding: 0 22px !important; min-height: 40px;
}

/* Samotná tlačítka přes celou šířku okna: stejná pevná šířka uprostřed; Zavřít/Zrušit malé */
html.compact-preview :is([id$="-modal"],[id$="-overlay"]) .btn[style*="width:100%"]:not(.btn + .btn):not(.btn:has(+ .btn)) { width: min(100%, 360px) !important; display: block; margin-left: auto !important; margin-right: auto !important; }
html.compact-preview :is([id$="-modal"],[id$="-overlay"]) .btn[style*="width:100%"]:is([onclick*="close"],[onclick*="remove()"],[onclick*="Close"]):not(.btn + .btn):not(.btn:has(+ .btn)) { width: auto !important; min-width: 150px; max-width: 70%; font-weight: 700; }

/* Spodní tlačítka oken: nejvýš tři vedle sebe, stejně velká a stejné písmo (13 px, tučně). Barvy zůstávají podle aplikace. */
html.compact-preview .modal-footer { flex-wrap: wrap !important; gap: 8px !important; align-items: stretch !important; }
html.compact-preview .modal-footer > :is(.btn,.btn-close,.btn-primary,.btn-danger) {
  flex: 0 1 calc(33.333% - 6px) !important; min-width: 0 !important; max-width: 240px !important; margin: 0 !important; padding: 4px 8px !important; min-height: 48px !important;
  display: flex; align-items: center; justify-content: center; text-align: center; white-space: normal; line-height: 1.15; overflow-wrap: anywhere; border-radius: 6px !important; box-sizing: border-box;
  font-weight: 700 !important; font-size: calc(13px * var(--fs-scale, 1)) !important;
}
html.compact-preview .modal-footer:has(> :nth-child(2):last-child) > :is(.btn,.btn-close,.btn-primary,.btn-danger) { flex-basis: calc(50% - 4px) !important; }
/* samostatné tlačítko dole znovu (musí přebít obecné pravidlo výše) */
html.compact-preview .modal-footer > :is(.btn,.btn-close,.btn-primary,.btn-danger):only-child,
html.compact-preview :is(#notes-overlay,#mating-overview-overlay) .modal-footer > .btn:only-child,
html.compact-preview #mating-overview-overlay > div > .modal-footer > .btn:only-child { flex: 0 0 auto !important; width: auto !important; min-width: 150px !important; max-width: 70% !important; padding: 0 22px !important; min-height: 40px !important; }

/* Tlačítka vedle sebe v oknech mají stejnou velikost a sílu písma */
html.compact-preview .overlay :is(div,footer):has(> .btn + .btn) > .btn,
html.compact-preview .overlay .modal-footer button,
html.compact-preview #notes-overlay :is(#notes-tab-btn,#wl-tab-btn,#contacts-tab-btn,#notes-tab-content>.btn-primary,#wl-tab-content>.btn-primary) {
  font-size: calc(13px * var(--fs-scale, 1)) !important; font-weight: 700 !important; font-family: inherit;
}
/* Čtyři a víc tlačítek v liště: dvě a dvě (rovnoměrně, text se vejde) */
html.compact-preview .modal-footer:has(> :nth-child(4)) > :is(.btn,.btn-close,.btn-primary,.btn-danger) { flex-basis: calc(50% - 4px) !important; }

/* Okna vytvářená za běhu: dvojice a trojice tlačítek jsou stejně široké, vycentrované, stejné písmo */
html.compact-preview :is([id$="-modal"],[id$="-overlay"],.overlay) div:not(.modal-footer):has(> .btn + .btn) { justify-content: center !important; align-items: stretch !important; flex-wrap: wrap; gap: 8px !important; }
html.compact-preview :is([id$="-modal"],[id$="-overlay"],.overlay) div:not(.modal-footer):has(> .btn + .btn) > .btn {
  flex: 0 1 calc(33.333% - 6px) !important; min-width: 0 !important; width: auto !important; max-width: 240px !important; margin: 0 !important; padding: 4px 8px !important; min-height: 48px !important;
  display: flex; align-items: center; justify-content: center; text-align: center; white-space: normal; line-height: 1.15; overflow-wrap: anywhere; border-radius: 6px !important; box-sizing: border-box;
  font-size: calc(13px * var(--fs-scale, 1)) !important; font-weight: 700 !important;
}
html.compact-preview :is([id$="-modal"],[id$="-overlay"],.overlay) div:not(.modal-footer):has(> .btn + .btn):has(> .btn:nth-child(2):last-child) > .btn { flex-basis: calc(50% - 4px) !important; max-width: 220px !important; }

/* Okna s lištou .of-ft (Hmotnost, Krytí, Kalendář…): všechna tlačítka stejně tučná, samotné Zavřít malé a uprostřed */
html.compact-preview .of-modal .of-ft .of-bt { font-weight: 700 !important; }
html.compact-preview .of-ft:has(> .of-bt:only-child) { justify-content: center !important; }
html.compact-preview .of-ft > .of-bt:only-child { flex: 0 0 auto !important; width: auto !important; min-width: 150px !important; max-width: 70% !important; min-height: 42px !important; padding: 0 22px !important; margin: 0 auto !important; }
/* Kalendář březosti (Kočky): Zavřít pod obsahem není přes celé okno */
html.compact-preview .pc-close { width: auto !important; min-width: 150px; max-width: 70%; display: block; margin: 14px auto 0 !important; padding: 0 22px !important; min-height: 40px; font-weight: 700; }
/* Okna s vlastní lištou tlačítek (Hmotnost, Krytí, Zdravotní plán): stejná tloušťka písma, samotné Zavřít malé */
html.compact-preview .overlay button[class*="-bt"] { font-weight: 700 !important; }
html.compact-preview #health-plan-overlay .hp-ft > .hp-close:only-child { flex: 0 0 auto !important; width: auto !important; min-width: 150px !important; max-width: 70% !important; padding: 0 22px !important; margin: 0 auto !important; }

/* Lišta s tlačítkem Smazat a skupinou tlačítek uvnitř (Vrh, Štěně…): všechna stejně široká, dvě a dvě */
html.compact-preview .overlay .modal-footer:has(> div > .btn) { display: grid !important; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px !important; justify-content: stretch !important; align-items: stretch !important; }
html.compact-preview .overlay .modal-footer:has(> div > .btn) > div:not(#_) { display: contents !important; }
html.compact-preview .overlay .modal-footer:has(> div > .btn) :is(.btn,.btn-close,.btn-primary):not(#_) { flex: none !important; width: 100% !important; max-width: none !important; min-width: 0 !important; margin: 0 !important; min-height: 44px !important; }
