/* Toasts, confirmations and form notices (src/utilities/notifications.js), on every page.
   Toasts are dark and quiet so they read as the system answering; colour is only on the icon. */

.bms-toasts,
.bms-confirm {
    --nt-ink: #1c1a17;
    --nt-ink-2: #6b655e;
    --nt-line: #e3e0dc;
    --nt-surface: #fff;
    --nt-success: #3fb37a;
    --nt-danger: #e5574a;
    --nt-danger-ink: #b3261e;
    --nt-danger-tint: rgb(194 55 43 / .08);
    --nt-warning: #f2a33a;
    --nt-info: #9fb4c9;
    --nt-font: "Geist", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
    font-family: var(--nt-font);
    -webkit-font-smoothing: antialiased;
}

/* ---------- toasts ---------- */

/* bottom right, clear of the toolbar and its New ... button; the newest sits nearest the edge */
.bms-toasts {
    position: fixed;
    right: 16px;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    z-index: 3000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    width: min(380px, calc(100vw - 32px));
    pointer-events: none;
}

.bms-toast {
    display: grid;
    grid-template-columns: 20px 1fr 24px;
    align-items: start;
    gap: 10px;
    width: 100%;
    padding: 12px 10px 12px 14px;
    border-radius: 12px;
    background: var(--nt-ink);
    color: #f7f5f2;
    box-shadow: 0 1px 2px rgb(0 0 0 / .18), 0 10px 28px -6px rgb(0 0 0 / .32);
    pointer-events: auto;
    animation: bms-toast-in .18s cubic-bezier(.2, .7, .3, 1) both;
}

.bms-toast.is-leaving {
    animation: bms-toast-out .16s ease-in both;
}

.bms-toast__icon svg {
    display: block;
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.bms-toast--success .bms-toast__icon { color: var(--nt-success); }
.bms-toast--danger .bms-toast__icon { color: var(--nt-danger); }
.bms-toast--warning .bms-toast__icon { color: var(--nt-warning); }
.bms-toast--info .bms-toast__icon { color: var(--nt-info); }

.bms-toasts .bms-toast__text {
    margin: 0;
    padding-top: 1px;
    font-size: 13.5px;
    line-height: 1.45;
    letter-spacing: -.005em;
    overflow-wrap: anywhere;
}

.bms-toast__close {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin: -2px 0 0;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: rgb(247 245 242 / .55);
    cursor: pointer;
}

.bms-toast__close:hover,
.bms-toast__close:focus-visible {
    background: rgb(255 255 255 / .1);
    color: #fff;
    outline: none;
}

.bms-toast__close svg {
    width: 14px;
    height: 14px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

@keyframes bms-toast-in {
    from { opacity: 0; transform: translateY(8px) scale(.98); }
    to { opacity: 1; transform: none; }
}

@keyframes bms-toast-out {
    to { opacity: 0; transform: translateX(12px); }
}

@media (max-width: 600px) {
    .bms-toasts {
        left: 16px;
        width: auto;
        align-items: stretch;
    }

    @keyframes bms-toast-out {
        to { opacity: 0; transform: translateY(8px); }
    }
}

/* ---------- confirmations ---------- */

.bms-confirm {
    position: fixed;
    inset: 0;
    z-index: 2990;
    display: grid;
    place-items: center;
    padding: 16px;
}

.bms-confirm__backdrop {
    position: absolute;
    inset: 0;
    background: rgb(28 26 23 / .38);
    animation: bms-fade-in .16s ease-out both;
}

.bms-confirm__panel {
    position: relative;
    width: min(420px, 100%);
    padding: 22px 22px 18px;
    border-radius: 16px;
    background: var(--nt-surface);
    color: var(--nt-ink);
    box-shadow: 0 24px 60px -12px rgb(28 26 23 / .35), 0 0 0 1px rgb(28 26 23 / .06);
    animation: bms-confirm-in .18s cubic-bezier(.2, .7, .3, 1) both;
}

.bms-confirm.is-leaving .bms-confirm__backdrop { animation: bms-fade-out .15s ease-in both; }
.bms-confirm.is-leaving .bms-confirm__panel { animation: bms-fade-out .15s ease-in both; }

.bms-confirm .bms-confirm__title {
    margin: 0 0 6px;
    font-family: inherit;
    font-size: 17px;
    font-weight: 600;
    line-height: 1.3;
    letter-spacing: -.01em;
    color: var(--nt-ink);
}

.bms-confirm .bms-confirm__text {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--nt-ink-2);
}

.bms-confirm__field {
    display: block;
    margin: 16px 0 0;
    font-weight: normal;
}

.bms-confirm .bms-confirm__label {
    display: block;
    margin: 0 0 6px;
    font-size: 13px;
    font-weight: 500;
    color: var(--nt-ink);
}

.bms-confirm__field input {
    display: block;
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--nt-line);
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    color: var(--nt-ink);
}

.bms-confirm__field input:focus {
    border-color: #b9b2aa;
    outline: none;
    box-shadow: 0 0 0 3px rgb(28 26 23 / .07);
}

.bms-confirm__field textarea {
    display: block;
    width: 100%;
    min-height: 76px;
    padding: 9px 11px;
    border: 1px solid var(--nt-line);
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    line-height: 1.45;
    color: var(--nt-ink);
    resize: vertical;
}

.bms-confirm__field textarea:focus {
    border-color: #b9b2aa;
    outline: none;
    box-shadow: 0 0 0 3px rgb(28 26 23 / .07);
}

.bms-confirm .bms-confirm__hint {
    display: block;
    margin: 6px 0 0;
    font-size: 12px;
    color: var(--nt-ink-2);
}

.bms-confirm .bms-confirm__error {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--nt-danger-tint);
    color: var(--nt-danger-ink);
    font-size: 13.5px;
    line-height: 1.45;
}

.bms-confirm .bms-confirm__error[hidden] {
    display: none;
}

.bms-confirm__error-icon svg {
    display: block;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
}

.bms-confirm__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin: 20px 0 0;
}

.bms-confirm__actions button {
    min-height: 36px;
    padding: 0 16px;
    border-radius: 10px;
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color .12s, border-color .12s, opacity .12s;
}

.bms-confirm__cancel {
    border: 1px solid var(--nt-line);
    background: var(--nt-surface);
    color: var(--nt-ink);
}

.bms-confirm__cancel:hover { background: #f5f3f0; }

.bms-confirm__ok {
    border: 1px solid var(--nt-ink);
    background: var(--nt-ink);
    color: #fff;
}

.bms-confirm__ok.is-danger {
    border-color: var(--nt-danger-ink);
    background: var(--nt-danger-ink);
}

.bms-confirm__ok:hover:not(:disabled) { opacity: .9; }

.bms-confirm__actions button:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgb(28 26 23 / .14);
}

.bms-confirm__actions button:disabled {
    cursor: default;
    opacity: .45;
}

.bms-confirm__ok.is-busy:disabled {
    opacity: .8;
}

.bms-confirm__ok.is-busy::before {
    content: "";
    display: inline-block;
    width: 13px;
    height: 13px;
    margin: 0 8px -2px 0;
    border: 2px solid rgb(255 255 255 / .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: bms-spin .7s linear infinite;
}

@keyframes bms-confirm-in {
    from { opacity: 0; transform: translateY(6px) scale(.98); }
    to { opacity: 1; transform: none; }
}

@keyframes bms-fade-in { from { opacity: 0; } }
@keyframes bms-fade-out { to { opacity: 0; } }
@keyframes bms-spin { to { transform: rotate(360deg); } }

/* ---------- notices inside forms and panels ---------- */

.portal .bms-notice {
    position: relative;
    margin: 0 0 14px;
    padding: 11px 40px 11px 14px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 13.5px;
    line-height: 1.45;
    box-shadow: none;
    animation: bms-fade-in .16s ease-out both;
}

.portal .bms-notice.alert-danger { border-color: rgb(194 55 43 / .18); background: rgb(194 55 43 / .07); color: #9c2a20; }
.portal .bms-notice.alert-success { border-color: rgb(46 155 98 / .2); background: rgb(46 155 98 / .08); color: #1f6b43; }
.portal .bms-notice.alert-warning { border-color: rgb(242 163 58 / .3); background: rgb(242 163 58 / .1); color: #8a5310; }
.portal .bms-notice.alert-info { border-color: var(--shell-line, #e3e0dc); background: #f7f6f4; color: #1c1a17; }

.portal .bms-notice .pull-right {
    position: absolute;
    top: 8px;
    right: 8px;
    float: none !important;
}

.portal .bms-notice .close {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    opacity: .6;
    text-shadow: none;
    font-size: 13px;
    line-height: 24px;
}

.portal .bms-notice .close:hover { opacity: 1; background: rgb(28 26 23 / .06); }

@media (prefers-reduced-motion: reduce) {
    .bms-toast,
    .bms-toast.is-leaving,
    .bms-confirm__backdrop,
    .bms-confirm__panel,
    .bms-confirm.is-leaving .bms-confirm__panel,
    .portal .bms-notice {
        animation-duration: .01ms;
    }
}
