.formcommand-loading-overlay {
    position: fixed;
    z-index: 30000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    visibility: hidden;
    opacity: 0;
    background: rgba(10, 29, 23, .64);
    backdrop-filter: blur(7px);
    -webkit-backdrop-filter: blur(7px);
    transition: opacity .16s ease, visibility .16s ease;
    box-sizing: border-box;
}

.formcommand-loading-overlay.active {
    visibility: visible;
    opacity: 1;
}

.formcommand-loading-panel {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 220px;
    max-width: min(430px, calc(100vw - 48px));
    padding: 19px 23px;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 12px;
    color: #fff;
    background: #12372a;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
    box-sizing: border-box;
}

.formcommand-loading-spinner {
    width: 22px;
    height: 22px;
    flex: 0 0 22px;
    border: 2px solid rgba(255, 255, 255, .28);
    border-top-color: #71c69b;
    border-right-color: #ed7c3b;
    border-radius: 50%;
    animation: formcommand-loading-spin .8s linear infinite;
}

.formcommand-loading-message {
    color: #fff;
    font: 700 15px/1.4 Inter, "Segoe UI", Arial, sans-serif;
    overflow-wrap: anywhere;
}

html.formcommand-is-loading,
body.formcommand-is-loading,
body.formcommand-modal-open {
    overflow: hidden;
}

@keyframes formcommand-loading-spin {
    to { transform: rotate(360deg); }
}

.toast-region {
    position: fixed;
    right: 1.25rem;
    bottom: 1.25rem;
    z-index: 29000;
    display: flex;
    flex-direction: column;
    gap: .65rem;
    width: min(390px, calc(100vw - 2rem));
    pointer-events: none;
}

.app-toast {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: .8rem;
    align-items: start;
    padding: 1rem;
    border: 1px solid #d8dcd7;
    border-left: 4px solid #1f6b4b;
    background: #fff;
    color: #17201d;
    box-shadow: 0 16px 42px rgba(20, 38, 30, .2);
    transform: translateY(12px);
    opacity: 0;
    transition: transform .18s ease, opacity .18s ease;
    pointer-events: auto;
    box-sizing: border-box;
}

.app-toast.visible { transform: none; opacity: 1; }
.app-toast.information { border-left-color: #39778a; }
.app-toast.warning { border-left-color: #c5632f; }
.app-toast.error { border-left-color: #b74733; }
.app-toast-marker {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #e9f2ed;
    color: #1f6b4b;
    font-size: .72rem;
    font-weight: 900;
}
.app-toast.information .app-toast-marker { background: #e8f1f4; color: #39778a; }
.app-toast.warning .app-toast-marker { background: #fff0e7; color: #a95429; }
.app-toast.error .app-toast-marker { background: #f9e9e6; color: #b74733; }
.app-toast strong { display: block; margin: .05rem 0 .18rem; font-size: .82rem; }
.app-toast p { margin: 0; color: #63706a; font-size: .76rem; line-height: 1.45; }
.app-toast-close { border: 0; background: transparent; color: #78817c; font-size: 1rem; padding: 0; cursor: pointer; }

.formcommand-modal {
    position: fixed;
    z-index: 31000;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(12, 28, 22, .62);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-sizing: border-box;
}

.formcommand-modal[hidden] { display: none; }

.formcommand-modal-dialog {
    width: min(540px, calc(100vw - 40px));
    border: 1px solid rgba(31, 107, 75, .24);
    border-radius: 12px;
    background: #fff;
    color: #17201d;
    box-shadow: 0 28px 80px rgba(10, 24, 18, .34);
    overflow: hidden;
    box-sizing: border-box;
}

.formcommand-modal-accent { height: 4px; background: #39778a; }
.formcommand-modal[data-type="success"] .formcommand-modal-accent { background: #1f6b4b; }
.formcommand-modal[data-type="warning"],
.formcommand-modal[data-type="confirmation"] { --modal-tone: #a95429; --modal-soft: #fff0e7; }
.formcommand-modal[data-type="warning"] .formcommand-modal-accent,
.formcommand-modal[data-type="confirmation"] .formcommand-modal-accent { background: #ed7c3b; }
.formcommand-modal[data-type="error"] { --modal-tone: #b74733; --modal-soft: #f9e9e6; }
.formcommand-modal[data-type="error"] .formcommand-modal-accent { background: #b74733; }
.formcommand-modal[data-type="success"] { --modal-tone: #1f6b4b; --modal-soft: #e9f2ed; }
.formcommand-modal[data-type="information"] { --modal-tone: #39778a; --modal-soft: #e8f1f4; }

.formcommand-modal-content {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 1rem;
    padding: 1.65rem;
}

.formcommand-modal-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--modal-soft, #e8f1f4);
    color: var(--modal-tone, #39778a);
    font-weight: 900;
}

.formcommand-modal-type {
    display: block;
    color: #748079;
    font-size: .62rem;
    font-weight: 850;
    letter-spacing: .1em;
}

.formcommand-modal h2 {
    margin: .25rem 0 .55rem;
    color: #17201d;
    font: 700 1.5rem/1.2 Georgia, "Times New Roman", serif;
}

.formcommand-modal p {
    margin: 0;
    color: #63706a;
    font: 400 .86rem/1.65 Inter, "Segoe UI", Arial, sans-serif;
    white-space: pre-line;
}

.formcommand-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: .65rem;
    padding: .95rem 1.65rem 1.05rem;
    border-top: 1px solid #dcded8;
    background: #f7f8f5;
}

.formcommand-modal-actions .btn {
    min-width: 94px;
    padding: .68rem 1.05rem;
    border: 1px solid #1f6b4b;
    border-radius: 6px;
    background: #1f6b4b;
    color: #fff;
    font: 700 .84rem/1 Inter, "Segoe UI", Arial, sans-serif;
    cursor: pointer;
}

.formcommand-modal-actions .btn:hover,
.formcommand-modal-actions .btn:focus { background: #15523a; border-color: #15523a; }
.formcommand-modal-actions .btn-outline-dark { background: #fff; border-color: #aeb7b1; color: #26352e; }
.formcommand-modal-actions .btn-outline-dark:hover,
.formcommand-modal-actions .btn-outline-dark:focus { background: #eef1ed; border-color: #77847c; color: #17201d; }
.formcommand-modal-actions .btn-danger { background: #a83f31; border-color: #a83f31; color: #fff; }
.formcommand-modal-actions .btn-danger:hover,
.formcommand-modal-actions .btn-danger:focus { background: #883226; border-color: #883226; }
.formcommand-modal-actions .btn:focus { outline: 0; box-shadow: 0 0 0 3px rgba(31, 107, 75, .2); }

[data-loading-submitted="true"] [type="submit"] { cursor: wait; }

@media (max-width: 480px) {
    .formcommand-loading-overlay,
    .formcommand-modal { padding: 18px; }
    .formcommand-loading-panel { min-width: min(220px, calc(100vw - 36px)); max-width: calc(100vw - 36px); padding: 17px 19px; }
    .formcommand-modal-dialog { width: calc(100vw - 36px); }
    .formcommand-modal-content { padding: 1.35rem; }
    .formcommand-modal-actions { padding: .85rem 1.35rem 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    .formcommand-loading-overlay,
    .app-toast { transition: none; }
    .formcommand-loading-spinner { animation: none; }
}
