:root {
    --sp-bg: #edf5f0;
    --sp-panel: rgba(255, 255, 255, 0.74);
    --sp-panel-strong: #fffdfb;
    --sp-text: #172126;
    --sp-muted: #667072;
    --sp-soft: #f5f8f6;
    --sp-line: rgba(23, 33, 38, 0.10);
    --sp-accent: #fa7059;
    --sp-accent-deep: #e35c48;
    --sp-teal: #5aa69c;
    --sp-shadow: 0 20px 48px rgba(42, 58, 50, 0.12);
}

html[data-theme="super-admin"] {
    --sp-bg: #101820;
    --sp-panel: rgba(19, 31, 39, 0.78);
    --sp-panel-strong: #172530;
    --sp-text: #f3efe8;
    --sp-muted: rgba(243, 239, 232, 0.68);
    --sp-soft: rgba(255, 255, 255, 0.06);
    --sp-line: rgba(243, 239, 232, 0.10);
    --sp-accent: #ff8069;
    --sp-accent-deep: #ff6d55;
    --sp-teal: #83d0bd;
    --sp-shadow: 0 24px 70px rgba(0, 0, 0, 0.32);
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    min-height: 100%;
}

body {
    font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.page-splash {
    min-height: 100dvh;
    overflow: hidden;
    color: var(--sp-text);
    background:
        radial-gradient(circle at 50% -8%, rgba(250, 112, 89, 0.12), transparent 30%),
        linear-gradient(180deg, #f9faf7 0%, var(--sp-bg) 74%, #e5f0ea 100%);
}

html[data-theme="super-admin"] .page-splash {
    background:
        radial-gradient(circle at 50% -8%, rgba(255, 128, 105, 0.14), transparent 30%),
        linear-gradient(180deg, #111d25 0%, var(--sp-bg) 100%);
}

.splash {
    width: 100%;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(0.75rem, env(safe-area-inset-top)) 0.75rem max(2.25rem, env(safe-area-inset-bottom));
    position: relative;
    isolation: isolate;
}

.splash::before,
.splash::after {
    content: "";
    position: absolute;
    left: 50%;
    width: min(76vw, 300px);
    height: 28px;
    transform: translateX(-50%);
    border-radius: 0 0 18px 18px;
    background: rgba(250, 112, 89, 0.10);
    z-index: -1;
}

.splash::before {
    top: 0;
}

.splash::after {
    bottom: 0;
    height: 42px;
    border-radius: 22px 22px 0 0;
    background: rgba(90, 166, 156, 0.09);
}

.splash-grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.32;
    background-image:
        linear-gradient(rgba(36, 73, 61, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(36, 73, 61, 0.045) 1px, transparent 1px);
    background-size: 34px 34px;
    mask-image: linear-gradient(180deg, transparent 0%, black 14%, black 86%, transparent 100%);
}

.brand-wrap {
    width: 100%;
    max-width: 390px;
    min-height: min(92dvh, 720px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.9rem;
    padding: clamp(1.05rem, 4.8vw, 1.45rem) clamp(1rem, 4.4vw, 1.35rem);
    border: 1px solid rgba(255, 255, 255, 0.82);
    border-radius: 34px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(247, 252, 248, 0.52));
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.88),
        0 18px 60px rgba(34, 55, 43, 0.10);
    position: relative;
    z-index: 1;
    animation: sp-enter 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

html[data-theme="super-admin"] .brand-wrap {
    background: linear-gradient(180deg, rgba(24, 39, 49, 0.84), rgba(16, 24, 32, 0.72));
    border-color: rgba(255, 255, 255, 0.10);
}

.brand-shell {
    display: block;
}

.brand-copy-block {
    display: grid;
    justify-items: center;
    gap: 0.95rem;
    text-align: center;
    padding-top: 0.2rem;
}

.brand-mark {
    width: 70%;
    max-width: 218px;
    display: flex;
    justify-content: center;
    margin-bottom: 0.25rem;
}

.brand-logo {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 18px rgba(23, 33, 38, 0.08));
}

.brand-copy {
    width: min(100%, 260px);
    display: grid;
    gap: 0.36rem;
}

.brand-subcopy {
    font-size: clamp(0.94rem, 3.9vw, 1.04rem);
    line-height: 1.5;
    color: var(--sp-muted);
    font-weight: 600;
}

.splash-feature-row {
    width: min(100%, 250px);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.55rem;
}

.splash-feature {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0 0.78rem;
    border-radius: 999px;
    border: 1px solid rgba(23, 33, 38, 0.07);
    background: rgba(255, 255, 255, 0.84);
    color: #283236;
    box-shadow: 0 4px 12px rgba(31, 51, 42, 0.05);
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
}

html[data-theme="super-admin"] .splash-feature {
    background: rgba(255, 255, 255, 0.07);
    color: var(--sp-text);
}

.splash-status-wrap {
    width: min(100%, 245px);
    display: grid;
    gap: 0.62rem;
    margin-top: 0.45rem;
}

.splash-status {
    font-size: 0.85rem;
    line-height: 1.25;
    font-weight: 800;
    color: rgba(23, 33, 38, 0.64);
}

html[data-theme="super-admin"] .splash-status {
    color: rgba(243, 239, 232, 0.68);
}

.splash-loader {
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: rgba(23, 33, 38, 0.10);
    overflow: hidden;
    position: relative;
}

html[data-theme="super-admin"] .splash-loader {
    background: rgba(243, 239, 232, 0.12);
}

.splash-loader-fill {
    position: absolute;
    inset: 0 auto 0 0;
    width: 35%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--sp-accent), var(--sp-teal));
    animation: sp-progress 1.45s ease-in-out infinite;
}

.splash-install-card {
    width: 100%;
    display: grid;
    gap: 0.9rem;
    padding: 1.05rem 1rem 0.95rem;
    border: 1px solid rgba(250, 112, 89, 0.22);
    border-radius: 20px;
    background: var(--sp-panel-strong);
    box-shadow: var(--sp-shadow);
    text-align: center;
}

.splash-install-card[hidden] {
    display: none !important;
}

.splash-install-copy {
    display: grid;
    justify-items: center;
    gap: 0.24rem;
}

.splash-install-kicker {
    font-size: 0.66rem;
    font-weight: 900;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--sp-accent-deep);
}

.splash-install-title {
    font-size: clamp(1.08rem, 4.2vw, 1.22rem);
    font-weight: 900;
    line-height: 1.14;
    letter-spacing: 0;
}

.splash-install-text,
.splash-install-note {
    max-width: 275px;
    font-size: 0.78rem;
    line-height: 1.38;
    color: var(--sp-muted);
    font-weight: 500;
}

.splash-install-note {
    margin-top: 0.16rem;
    color: rgba(23, 33, 38, 0.72);
    font-weight: 800;
}

html[data-theme="super-admin"] .splash-install-note {
    color: rgba(243, 239, 232, 0.76);
}

.splash-install-actions {
    display: grid;
    gap: 0.65rem;
}

.splash-install-primary,
.splash-install-secondary {
    width: 100%;
    min-height: 48px;
    border-radius: 999px;
    padding: 0 1rem;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 900;
    cursor: pointer;
    transition: transform 140ms ease, opacity 140ms ease, background 140ms ease, border-color 140ms ease;
}

.splash-install-primary {
    border: 0;
    background: var(--sp-accent);
    color: #172126;
    box-shadow: 0 12px 24px rgba(250, 112, 89, 0.24);
}

.splash-install-secondary {
    border: 1px solid rgba(23, 33, 38, 0.12);
    background: #ffffff;
    color: var(--sp-text);
}

html[data-theme="super-admin"] .splash-install-secondary {
    background: rgba(255, 255, 255, 0.06);
}

@media (hover: hover) and (pointer: fine) {
    .splash-install-primary:hover,
    .splash-install-secondary:hover {
        transform: translateY(-1px);
    }
}

.splash-install-primary:active,
.splash-install-secondary:active {
    transform: translateY(0);
}

.splash-install-primary:disabled,
.splash-install-secondary:disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

.splash-credit {
    position: fixed;
    left: 50%;
    bottom: max(0.8rem, env(safe-area-inset-bottom));
    transform: translateX(-50%);
    font-size: 0.58rem;
    color: rgba(23, 33, 38, 0.28);
    white-space: nowrap;
    z-index: 1;
}

html[data-theme="super-admin"] .splash-credit {
    color: rgba(243, 239, 232, 0.28);
}

.page-splash.is-exiting .brand-wrap,
.page-splash.is-exiting .splash-credit {
    animation: sp-exit 260ms ease forwards;
}

.page-splash.is-exiting .splash-grid {
    opacity: 0;
    transition: opacity 240ms ease;
}

@keyframes sp-enter {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.985);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes sp-exit {
    from {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
    to {
        opacity: 0;
        transform: translateY(-10px) scale(0.985);
    }
}

@keyframes sp-progress {
    0% {
        transform: translateX(-115%);
    }
    46% {
        transform: translateX(94%);
    }
    100% {
        transform: translateX(340%);
    }
}

@media (min-width: 720px) {
    .splash {
        padding: 1.25rem 1rem 2.75rem;
    }

    .brand-wrap {
        max-width: 420px;
    }
}

@media (max-width: 360px) {
    .splash {
        padding-left: 0.45rem;
        padding-right: 0.45rem;
    }

    .brand-wrap {
        min-height: calc(100dvh - 3.1rem);
        gap: 0.72rem;
        padding: 0.82rem;
        border-radius: 28px;
    }

    .brand-copy-block {
        gap: 0.75rem;
    }

    .brand-mark {
        width: 68%;
        max-width: 188px;
    }

    .brand-copy {
        width: min(100%, 230px);
    }

    .splash-install-card {
        padding: 0.9rem 0.78rem 0.78rem;
    }
}

/* ── Touch optimizations ── */
.splash-install-primary,
.splash-install-secondary { touch-action: manipulation; }

@media (max-height: 670px) {
    .brand-wrap {
        min-height: calc(100dvh - 2.8rem);
        gap: 0.72rem;
        padding-top: 0.9rem;
    }

    .brand-copy-block {
        gap: 0.72rem;
    }

    .brand-subcopy {
        font-size: 0.86rem;
        line-height: 1.35;
    }

    .splash-install-card {
        gap: 0.68rem;
        padding-top: 0.9rem;
    }

    .splash-install-primary,
    .splash-install-secondary {
        min-height: 43px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .splash-loader-fill,
    .brand-wrap,
    .page-splash.is-exiting .brand-wrap,
    .page-splash.is-exiting .splash-credit {
        animation: none !important;
        transition: none !important;
    }
}
