/* Compact action buttons inside popups and modal forms only. Close controls
   retain their dedicated size and alignment; page buttons are unaffected. */
body :is(.modal, .app-system-dialog, .app-notice-card, .toast) .btn:not(.btn-close) {
    --bs-btn-padding-y: .25rem;
    --bs-btn-padding-x: .5rem;
    --bs-btn-font-size: .8125rem;
    padding: .25rem .5rem !important;
    font-size: .8125rem !important;
    line-height: 1.4 !important;
    min-height: 28px !important;
    height: auto !important;
    gap: .3rem !important;
}

body :is(.modal, .app-system-dialog, .app-notice-card, .toast) .btn:not(.btn-close) > :is(i, .bi, .app-auto-button-icon) {
    font-size: inherit !important;
    line-height: inherit !important;
}

/* Shared short notices. Existing placement and dismissal timers are preserved. */
body .app-notice-card.app-notice-card {
    --notice-tint: #dcf5fc;
    --notice-accent: #08769b;
    position: relative;
    display: block;
    background: #fff !important;
    color: #60676f !important;
    border: 1px solid #eef0f2 !important;
    border-radius: 3px !important;
    box-shadow: 0 4px 13px rgb(0 0 0 / 10%) !important;
    padding: 16px 44px 16px 68px !important;
    min-height: 82px;
    text-align: left !important;
    overflow-wrap: anywhere;
}
body .app-notice-card[data-notice-type="error"] { --notice-tint: #ffdddd; --notice-accent: #c51b28; }
body .app-notice-card[data-notice-type="warning"] { --notice-tint: #fffed7; --notice-accent: #85800a; }
body .app-notice-card[data-notice-type="success"] { --notice-tint: #e1ffd9; --notice-accent: #338823; }
.app-notice-card > [data-notice-decoration="rail"] {
    position: absolute; inset: 0 auto 0 0; width: 48px;
    display: flex; align-items: flex-start; justify-content: center;
    padding-top: 16px; box-sizing: border-box;
    background: var(--notice-tint); color: var(--notice-accent);
    border-radius: 2px 0 0 2px; font-size: 28px; line-height: 1;
}
body .app-notice-card [data-notice-decoration="icon"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    font-size: 28px !important;
    line-height: 28px !important;
}
.app-notice-card > [data-notice-decoration="heading"] { font-weight: 700; color: #202428; margin-bottom: 3px; font-size: 1rem; line-height: 24px; }
.app-notice-card > [data-notice-decoration="close"] {
    position: absolute; right: 12px; top: 16px; border: 0; background: transparent;
    display: inline-flex; align-items: center; justify-content: center;
    width: 24px; height: 24px;
    color: #878b90; font-size: 26px; line-height: 1; padding: 0; cursor: pointer;
}
.app-notice-card > [data-notice-decoration="close"]:focus-visible { outline: 2px solid var(--notice-accent); outline-offset: 2px; }
body .app-notice-card .modal-body { display: block !important; padding: 0 !important; color: inherit !important; }
.app-notice-card > .modal-header, .app-notice-card > .modal-footer,
.app-notice-card > .toast-header, .app-notice-card > .btn-close,
.app-notice-card .modal-body > i, .app-notice-card .modal-body .app-message-icon,
.app-notice-card #externalPrFeedbackIcon { display: none !important; }
.app-notice-card > .toast-body { padding: 0; }
.app-notice-card a:not(.btn) { color: inherit; text-decoration: underline; }
body .app-notice-card.app-notice-dismissed { display: none !important; }
@media (max-width: 480px) {
    body .app-notice-card.app-notice-card { padding-left: 56px !important; }
    .app-notice-card > [data-notice-decoration="rail"] { width: 40px; }
}
@media print { [data-notice-decoration="close"] { display: none !important; } }

/* Buttoned message dialogs; forms and confirmation callbacks are not rewritten. */
body .modal-content.app-action-dialog,
body .app-system-dialog > .app-action-dialog {
    --dialog-tint: #e4efff;
    --dialog-accent: #175bb0;
    background: #fff !important;
    color: #30343b !important;
    border: 0 !important;
    border-radius: 3px !important;
    box-shadow: 0 10px 30px rgb(0 0 0 / 14%) !important;
    padding: 0 !important;
    overflow: hidden;
}
body .app-action-dialog[data-dialog-type="success"] { --dialog-tint: #e1f7e4; --dialog-accent: #167326; }
body .app-action-dialog[data-dialog-type="error"] { --dialog-tint: #ffe4e4; --dialog-accent: #c21e24; }
body .app-action-dialog[data-dialog-type="warning"] { --dialog-tint: #fff5d8; --dialog-accent: #866400; }
body .app-action-dialog > .modal-header {
    display: flex !important; align-items: center !important; justify-content: space-between; gap: 16px;
    padding: 10px 16px !important; border: 0 !important;
    background: var(--dialog-tint) !important; color: var(--dialog-accent) !important;
}
body .app-action-dialog .modal-header .modal-title { font-size: .95rem; font-weight: 500; color: inherit !important; margin: 0; line-height: 24px; }
/* Override the global modal rule that pins close buttons 1rem below the top. */
body .modal .modal-content.app-action-dialog > .modal-header .btn-close,
body .app-system-dialog .app-action-dialog > .modal-header .app-system-dialog-close {
    position: static !important;
    top: auto !important;
    right: auto !important;
    margin: 0 0 0 auto !important;
    padding: 0 !important;
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    transform: none;
}
body .app-action-dialog > .modal-body {
    padding: 24px !important; background: #fff !important; color: #30343b !important;
    text-align: left !important; overflow-wrap: anywhere;
}
body .app-action-dialog .modal-body h5,
body .app-action-dialog .modal-body h6 { color: var(--dialog-accent); }
body .app-action-dialog > .modal-footer {
    display: flex !important; justify-content: flex-end !important; gap: 8px;
    padding: 12px 16px !important; border-top: 1px solid #edf0f2 !important;
    background: #fff !important;
}
body .app-action-dialog .modal-body > .d-flex > i:first-child {
    width: 44px; height: 44px; flex: 0 0 44px; display: inline-flex;
    align-items: center; justify-content: center; border: 1px solid #d5d9de;
    border-radius: 50%; color: var(--dialog-accent);
}
.app-system-dialog { width: min(500px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0; border: 0; border-radius: 3px; background: transparent; }
.app-system-dialog::backdrop { background: rgb(15 23 42 / 38%); }
.app-system-dialog .modal-body { white-space: pre-wrap; }
.app-system-dialog-close { background: transparent; border: 0; color: inherit; font-size: 24px; line-height: 1; cursor: pointer; }
.app-system-dialog-close:focus-visible { outline: 2px solid currentColor; }
