/* =========================================================
   eiFAM App — premium UI (sidebar shell, components, launcher)
   Depends on css/theme.css for design tokens.
   ========================================================= */

/* =========================================================
   App shell
   ========================================================= */
body {
    /* The launcher's animated decorations (orbits, pulses, float) must never
       cause a horizontal page scrollbar, even when they momentarily overflow. */
    overflow-x: hidden;
}

.app-shell {
    min-height: 100vh;
}

.app-main {
    margin-left: 264px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ---- Sidebar ---- */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 264px;
    z-index: 1040;
    display: flex;
    flex-direction: column;
    background: var(--sidebar-bg);
    border-right: 1px solid var(--sidebar-border);
    transition: transform 0.28s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 72px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--sidebar-border);
    text-decoration: none;
}

.sidebar-brand-logo {
    height: 38px;
    max-width: 168px;
    object-fit: contain;
}

.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-group-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--sidebar-text);
    opacity: 0.55;
    padding: 18px 12px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 500;
    transition: color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

    .sidebar-link:hover {
        color: var(--sidebar-text-hover);
        background: rgba(255, 255, 255, 0.06);
    }

    .sidebar-link.is-active {
        color: var(--sidebar-active-text);
        background: var(--sidebar-active-bg);
        font-weight: 600;
    }

        .sidebar-link.is-active .sidebar-icon {
            color: var(--color-primary-strong);
        }

    .sidebar-link:active {
        transform: scale(0.98);
    }

.sidebar-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.sidebar-footer {
    flex-shrink: 0;
    padding: 14px 12px;
    border-top: 1px solid var(--sidebar-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sidebar-user {
    position: relative;
    margin-bottom: 6px;
}

.sidebar-user-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: none;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
    border-radius: 10px;
    cursor: pointer;
}

    .sidebar-user-trigger:hover,
    .sidebar-user-trigger.is-open {
        background: rgba(255, 255, 255, 0.06);
    }

.sidebar-user-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, var(--color-primary-strong), var(--color-primary));
}

.sidebar-user-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.sidebar-user-name {
    color: var(--sidebar-text-hover);
    font-size: 0.88rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    color: var(--sidebar-text);
    font-size: 0.72rem;
    opacity: 0.8;
}

.sidebar-user-caret {
    margin-left: auto;
    flex-shrink: 0;
    color: var(--sidebar-text);
    opacity: 0.7;
    transition: transform 0.15s ease;
}

    .sidebar-user-trigger.is-open .sidebar-user-caret {
        transform: rotate(180deg);
    }

/* Sidebar company switch */
.sidebar-company {
    position: relative;
    margin-bottom: 2px;
}

.sidebar-company-trigger {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px 10px;
    border: none;
    background: none;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
    border-radius: 10px;
    cursor: pointer;
}

    .sidebar-company-trigger:hover,
    .sidebar-company-trigger.is-open {
        background: rgba(255, 255, 255, 0.06);
    }

.sidebar-company-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--color-primary);
}

.sidebar-company-name {
    flex: 1;
    min-width: 0;
    color: var(--sidebar-text-hover);
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-company-caret {
    flex-shrink: 0;
    color: var(--sidebar-text);
    opacity: 0.7;
    transition: transform 0.15s ease;
}

    .sidebar-company-trigger.is-open .sidebar-company-caret {
        transform: rotate(180deg);
    }

.company-switcher {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(100% + 8px);
    z-index: 40;
    background: var(--color-surface, var(--sidebar-bg));
    border: 1px solid var(--sidebar-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    padding: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.company-switcher-head {
    display: flex;
    align-items: center;
    margin: 0 4px 6px;
}

.company-switcher-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.company-switcher-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.company-switcher-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: none;
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

    .company-switcher-item:hover {
        background: rgba(255, 255, 255, 0.06);
        color: var(--sidebar-text-hover);
    }

    .company-switcher-item.is-current {
        color: var(--color-primary);
        border-color: rgba(255, 255, 255, 0.08);
        background: rgba(255, 255, 255, 0.03);
    }

.company-switcher-item-check {
    color: var(--color-primary);
    font-size: 0.9rem;
}

/* Account switcher dropdown */
.account-switcher {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: calc(100% + 8px);
    z-index: 40;
    background: var(--color-surface, var(--sidebar-bg));
    border: 1px solid var(--sidebar-border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
    padding: 8px;
}

.account-switcher-scroll {
    max-height: 240px;
    overflow-y: auto;
}

.account-switcher-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 2px;
}

    .account-switcher-item:hover {
        background: var(--color-hover, rgba(128, 128, 128, 0.12));
    }

.account-switcher-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    font-weight: 700;
    color: #fff;
    background: linear-gradient(135deg, var(--color-primary-strong), var(--color-primary));
}

.account-switcher-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
    text-align: left;
}

.account-switcher-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-switcher-username {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.account-switcher-active {
    color: var(--color-primary);
    margin-left: 4px;
}

.account-switcher-item-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}

.account-switcher-item-main {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    padding: 0;
    border: none;
    background: none;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    text-align: left;
    cursor: pointer;
}

    .account-switcher-item-main:hover .account-switcher-name {
        color: var(--color-primary);
    }

.account-switcher-remove-form {
    flex-shrink: 0;
}

.account-switcher-remove {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: 50%;
    background: none;
    color: var(--color-text-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: all 0.15s ease;
}

    .account-switcher-remove:hover {
        color: var(--color-danger);
        border-color: var(--color-danger);
    }

.account-switcher-switch {
    border: 1px solid var(--color-primary);
    background: transparent;
    color: var(--color-primary);
    border-radius: 6px;
    font-size: 0.72rem;
    padding: 3px 8px;
    cursor: pointer;
    flex-shrink: 0;
}

    .account-switcher-switch:hover {
        background: var(--color-primary);
        color: #fff;
    }

.account-switcher-footer {
    border-top: 1px solid var(--sidebar-border);
    padding-top: 6px;
    margin-top: 4px;
}

.account-switcher-signout {
    width: 100%;
    background: none;
    border: none;
    color: rgba(248, 113, 113, 0.9);
    font-size: 0.8rem;
    text-align: left;
    padding: 6px 8px;
    border-radius: 8px;
    cursor: pointer;
}

    .account-switcher-signout:hover {
        background: var(--color-hover, rgba(128, 128, 128, 0.12));
    }

.account-switcher-add {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 8px;
    margin-top: 2px;
    color: var(--color-primary);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

    .account-switcher-add:hover {
        background: var(--color-hover, rgba(128, 128, 128, 0.12));
    }

/* Account menu (environment picker + actions) */
.account-switcher-env {
    border-bottom: 1px solid var(--sidebar-border);
    padding: 2px 4px 10px;
    margin-bottom: 6px;
}

.account-switcher-env-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin: 0 4px 6px;
}

.account-switcher-env-label {
    display: block;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
}

.account-switcher-env-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.account-switcher-env-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: none;
    color: var(--color-text);
    font-family: inherit;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

    .account-switcher-env-item:hover {
        background: rgba(255, 255, 255, 0.06);
        color: var(--sidebar-text-hover);
    }

    .account-switcher-env-item.is-current {
        color: var(--color-primary);
        border-color: rgba(255, 255, 255, 0.08);
        background: rgba(255, 255, 255, 0.03);
    }

.account-switcher-env-item-check {
    color: var(--color-primary);
    font-size: 0.9rem;
}

.account-switcher-menu {
    display: flex;
    flex-direction: column;
}

.account-switcher-menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 8px;
    border: none;
    background: none;
    color: var(--color-text);
    font-size: 0.85rem;
    font-weight: 500;
    font-family: inherit;
    text-align: left;
    border-radius: 8px;
    cursor: pointer;
    text-decoration: none;
}

    .account-switcher-menu-btn:hover {
        background: var(--color-hover, rgba(128, 128, 128, 0.12));
    }

    .account-switcher-menu-btn.is-open {
        color: var(--color-heading);
    }

    .account-switcher-menu-btn--danger {
        color: rgba(248, 113, 113, 0.9);
    }

        .account-switcher-menu-btn--danger:hover {
            color: #fca5a5;
            background: rgba(248, 113, 113, 0.10);
        }

.account-switcher-menu-icon {
    flex-shrink: 0;
    color: var(--color-text-muted);
}

.account-switcher-menu-btn.is-open .account-switcher-menu-icon,
.account-switcher-menu-btn:hover .account-switcher-menu-icon {
    color: var(--color-text);
}

.account-switcher-menu-btn--danger .account-switcher-menu-icon,
.account-switcher-menu-btn--danger:hover .account-switcher-menu-icon {
    color: inherit;
}

.account-switcher-menu-chevron {
    margin-left: auto;
    color: var(--color-text-muted);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.account-switcher-menu-btn.is-open .account-switcher-menu-chevron {
    transform: rotate(180deg);
}

.account-switcher-divider {
    height: 1px;
    background: var(--sidebar-border);
    margin: 6px 4px;
}

.account-switcher-sub {
    margin-top: 6px;
    padding: 6px;
    border: 1px solid var(--sidebar-border);
    border-radius: 8px;
    background: rgba(128, 128, 128, 0.05);
}

.account-switcher-empty {
    padding: 10px 8px;
    font-size: 0.8rem;
    color: var(--color-text-muted);
    text-align: center;
}

/* Switch-account modal */
.account-switcher-modal {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.account-switcher-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 12, 24, 0.6);
    backdrop-filter: blur(3px);
}

.account-switcher-modal-dialog {
    position: relative;
    width: 100%;
    max-width: 420px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 18px;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.5);
}

.account-switcher-modal-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 0;
}

.account-switcher-modal-body {
    padding: 14px 24px;
    color: var(--color-text);
    font-size: 0.92rem;
}

.account-switcher-modal-foot {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 4px 24px 20px;
}

.account-switcher-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.sidebar-link--logout {
    color: rgba(248, 113, 113, 0.9);
}

/* Page transition veil (env/account switches, sign out) */
.page-veil {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(4, 12, 24, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.page-veil-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 30px 44px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.5);
}

.page-veil-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.18);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: pageVeilSpin 0.7s linear infinite;
}

.page-veil-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--color-text);
}

@keyframes pageVeilSpin {
    to {
        transform: rotate(360deg);
    }
}

    .sidebar-link--logout:hover {
        color: #fca5a5;
        background: rgba(248, 113, 113, 0.10);
    }

.sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1035;
    background: rgba(4, 12, 24, 0.6);
    backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

/* ---- Topbar ---- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 1025;
    height: 64px;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 28px;
    background: color-mix(in srgb, var(--color-bg) 82%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
}

.topbar-burger {
    display: none;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    color: var(--color-text);
    cursor: pointer;
    transition: all 0.2s ease;
}

    .topbar-burger:hover {
        border-color: var(--color-primary);
        color: var(--color-primary);
    }

    .topbar-burger svg {
        width: 20px;
        height: 20px;
    }

.topbar-title {
    flex: 1;
    min-width: 0;
}

.topbar-title-text {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--color-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user--mobile {
    display: none;
    font-size: 0.88rem;
    color: var(--color-text-muted);
    white-space: nowrap;
}

/* Theme toggle (also used on login) */
.theme-toggle {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: all 0.25s ease;
}

    .theme-toggle:hover {
        border-color: var(--color-primary);
        color: var(--color-primary);
        transform: translateY(-1px);
    }

    .theme-toggle svg {
        width: 19px;
        height: 19px;
    }

    .theme-toggle .icon-sun {
        display: none;
    }

    .theme-toggle .icon-moon {
        display: block;
    }

    .theme-toggle.is-light .icon-sun {
        display: block;
    }

    .theme-toggle.is-light .icon-moon {
        display: none;
    }

/* ---- Content & footer ---- */
.app-content {
    flex: 1;
    padding: 32px 28px 48px;
    position: relative;
}

    .app-content::before {
        content: '';
        position: fixed;
        inset: 0;
        z-index: -1;
        pointer-events: none;
        background: radial-gradient(circle at 78% -6%, rgba(47, 155, 216, 0.10) 0%, transparent 40%), radial-gradient(circle at 8% 96%, rgba(47, 155, 216, 0.07) 0%, transparent 38%);
        transition: background 0.4s ease;
    }

:root[data-theme="light"] .app-content::before {
    background: radial-gradient(circle at 78% -6%, rgba(11, 111, 168, 0.08) 0%, transparent 40%), radial-gradient(circle at 8% 96%, rgba(11, 111, 168, 0.06) 0%, transparent 38%);
}

.app-footer {
    padding: 14px 28px;
    border-top: 1px solid var(--color-border);
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

/* =========================================================
   Page headers
   ========================================================= */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.page-eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--color-primary);
    margin-bottom: 6px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.4px;
    margin: 0;
}

.page-subtitle {
    color: var(--color-text-muted);
    font-size: 0.92rem;
    margin: 8px 0 0;
    max-width: 640px;
}

.page-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* =========================================================
   Cards
   ========================================================= */
.card {
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-card);
}

.card-header {
    background: transparent;
    border-bottom: 1px solid var(--color-border);
    padding: 18px 22px;
    font-weight: 700;
    color: var(--color-heading);
}

.card-body {
    padding: 22px;
}

.card-table .card-body {
    padding: 0;
}

/* =========================================================
   Tables
   ========================================================= */
.table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--color-text);
    --bs-table-border-color: var(--color-border);
    color: var(--color-text);
}

    .table thead th {
        font-size: 0.7rem;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 0.09em;
        color: var(--color-text-muted);
        border-bottom: 1px solid var(--color-border-strong);
        padding: 14px 18px;
        white-space: nowrap;
    }

    .table tbody td {
        padding: 14px 18px;
        vertical-align: middle;
        border-bottom: 1px solid var(--color-border);
    }

    .table tbody tr:last-child td {
        border-bottom: none;
    }

.table-hover > tbody > tr:hover > * {
    --bs-table-accent-bg: var(--color-primary-soft);
    background-color: var(--color-primary-soft);
}

.table-striped > tbody > tr:nth-of-type(odd) > * {
    --bs-table-accent-bg: var(--color-surface-2);
    background-color: var(--color-surface-2);
}

.table > :not(caption) > * > * {
    color: inherit;
}

/* Searchable / height-limited management tables */
.table-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--color-border);
}

.table-search {
    position: relative;
    flex: 1 1 240px;
    max-width: 360px;
}

.table-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--color-text-muted);
    pointer-events: none;
}

.table-search .form-control {
    padding-left: 36px;
}

.table-scroll {
    max-height: 520px;
    overflow-y: auto;
}

    .table-scroll thead th {
        position: sticky;
        top: 0;
        z-index: 2;
        background: var(--color-surface);
    }

/* =========================================================
   Badges
   ========================================================= */
.badge {
    font-weight: 600;
    padding: 0.42em 0.7em;
    border-radius: 999px;
}

.badge-soft {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

    .badge-soft::before {
        content: '';
        width: 6px;
        height: 6px;
        border-radius: 50%;
        background: currentColor;
    }

    .badge-soft.badge-success {
        background: var(--color-success-soft);
        color: var(--color-success);
    }

    .badge-soft.badge-danger {
        background: var(--color-danger-soft);
        color: var(--color-danger);
    }

    .badge-soft.badge-warning {
        background: var(--color-warning-soft);
        color: var(--color-warning);
    }

    .badge-soft.badge-secondary {
        background: var(--color-surface-2);
        color: var(--color-text-muted);
        border: 1px solid var(--color-border);
    }

    .badge-soft.badge-primary {
        background: var(--color-primary-soft);
        color: var(--color-primary);
    }

/* App identity mark (used in tables) */
.app-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: 800;
    color: #ffffff;
    background: linear-gradient(145deg, var(--app-color, var(--color-primary)), color-mix(in srgb, var(--app-color, var(--color-primary)) 70%, #07263c));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25), 0 6px 16px -6px rgba(7, 38, 60, 0.6);
}

/* Stat cards (import page) */
.stat-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface-2);
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--stat-color, var(--color-primary));
    background: color-mix(in srgb, var(--stat-color, var(--color-primary)) 14%, transparent);
}

.stat-card-label {
    font-size: 0.76rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
}

.stat-card-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--color-heading);
    line-height: 1.1;
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.18s ease;
}

    .btn:focus-visible {
        box-shadow: 0 0 0 0.25rem var(--color-focus-ring);
    }

.btn-primary {
    --bs-btn-bg: var(--color-primary);
    --bs-btn-border-color: var(--color-primary);
    --bs-btn-hover-bg: var(--color-primary-strong);
    --bs-btn-hover-border-color: var(--color-primary-strong);
    --bs-btn-active-bg: var(--color-primary-strong);
    --bs-btn-active-border-color: var(--color-primary-strong);
    --bs-btn-disabled-bg: var(--color-primary);
    --bs-btn-disabled-border-color: var(--color-primary);
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.10), transparent);
    box-shadow: 0 6px 16px -6px rgba(11, 111, 168, 0.5);
    color: var(--color-on-primary);
}

    .btn-primary:hover {
        transform: translateY(-1px);
        box-shadow: 0 10px 22px -8px rgba(11, 111, 168, 0.6);
    }

.btn-outline-primary {
    --bs-btn-color: var(--color-primary);
    --bs-btn-border-color: var(--color-primary);
    --bs-btn-hover-bg: var(--color-primary);
    --bs-btn-hover-border-color: var(--color-primary);
    --bs-btn-active-bg: var(--color-primary);
    --bs-btn-active-border-color: var(--color-primary);
}

.btn-outline-secondary,
.btn-ghost {
    --bs-btn-color: var(--color-text-muted);
    --bs-btn-border-color: var(--color-border-strong);
    --bs-btn-hover-bg: var(--color-primary-soft);
    --bs-btn-hover-color: var(--color-primary);
    --bs-btn-hover-border-color: var(--color-primary);
    --bs-btn-active-bg: var(--color-primary-soft);
    --bs-btn-active-color: var(--color-primary);
    --bs-btn-active-border-color: var(--color-primary);
    background: var(--color-surface);
}

.btn-sm {
    border-radius: 8px;
    font-size: 0.82rem;
}

.btn-link {
    --bs-btn-color: var(--color-primary);
    --bs-btn-hover-color: var(--color-primary-strong);
    text-decoration: none;
}

/* =========================================================
   Forms
   ========================================================= */
.form-label {
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--color-heading);
    margin-bottom: 6px;
}

.form-control,
.form-select {
    background-color: var(--input-bg);
    border: 1px solid var(--input-border);
    color: var(--color-text);
    border-radius: 10px;
    padding: 0.55rem 0.9rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

    .form-control:focus,
    .form-select:focus {
        background-color: var(--input-bg);
        border-color: var(--color-primary);
        box-shadow: 0 0 0 3px var(--color-focus-ring);
        color: var(--color-text);
    }

    .form-control::placeholder {
        color: var(--color-text-muted);
    }

    .form-control:disabled,
    .form-control[readonly] {
        background-color: var(--color-surface-2);
        color: var(--color-text-muted);
    }

    .form-select:disabled,
    .form-select[readonly] {
        background-color: var(--color-surface-2);
        border-color: var(--color-border);
        color: var(--color-text-muted);
        opacity: 1;
        --bs-form-select-bg-img: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%238fa3ba' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
    }

.form-text {
    color: var(--color-text-muted);
}

/* Custom checkbox rows */
.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    background: var(--color-surface);
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease;
}

    .form-check:hover {
        border-color: var(--color-primary);
    }

    .form-check:has(.form-check-input:checked) {
        border-color: var(--color-primary);
        background: var(--color-primary-soft);
    }

.form-check-input {
    margin: 0;
    flex-shrink: 0;
    border: 1px solid var(--color-border-strong);
    background-color: var(--input-bg);
}

    .form-check-input:checked {
        background-color: var(--color-primary);
        border-color: var(--color-primary);
    }

    .form-check-input:focus {
        box-shadow: 0 0 0 3px var(--color-focus-ring);
        border-color: var(--color-primary);
    }

.form-check-label {
    color: var(--color-text);
    font-size: 0.9rem;
}

.form-floating > label {
    color: var(--color-text-muted);
}

/* =========================================================
   Alerts
   ========================================================= */
.alert {
    border-radius: 12px;
    border: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text);
}

.alert-danger {
    background: var(--color-danger-soft);
    border-color: rgba(248, 113, 113, 0.35);
    color: var(--color-danger);
}

.alert-success {
    background: var(--color-success-soft);
    border-color: rgba(52, 211, 153, 0.35);
    color: var(--color-success);
}

.alert-warning {
    background: var(--color-warning-soft);
    border-color: rgba(251, 191, 36, 0.35);
    color: var(--color-warning);
}

.text-muted {
    color: var(--color-text-muted) !important;
}

.text-primary {
    color: var(--color-primary) !important;
}

/* =========================================================
   Launcher
   ========================================================= */
.launcher-page {
    position: relative;
    min-height: calc(100vh - 200px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* Contain the animated backdrop and floating launcher decorations so they
       can't overflow the page and add a horizontal/vertical scrollbar. */
    overflow: hidden;
}

/* Ambient backdrop: slowly drifting, twinkling starfield behind the launcher */
.launcher-page::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background-image:
        radial-gradient(circle, rgba(255, 255, 255, 0.6) 0 1px, transparent 1.6px),
        radial-gradient(circle, rgba(255, 255, 255, 0.35) 0 1px, transparent 1.6px),
        radial-gradient(circle, rgba(255, 255, 255, 0.5) 0 1px, transparent 1.6px),
        radial-gradient(circle, rgba(255, 255, 255, 0.25) 0 1px, transparent 1.6px);
    background-size: 340px 340px, 280px 280px, 210px 210px, 460px 460px;
    background-position: 0 0, 30px 18px, 70px 40px, 120px 90px;
    background-repeat: repeat;
    animation: launcherStarsDrift 90s linear infinite, launcherStars 6s ease-in-out infinite alternate;
}

/* Ambient backdrop: drifting aurora glows */
.launcher-page::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    background:
        radial-gradient(620px 360px at 50% 42%, color-mix(in srgb, var(--color-primary) 18%, transparent), transparent 70%),
        radial-gradient(460px 300px at 18% 82%, rgba(229, 72, 77, 0.10), transparent 70%),
        radial-gradient(460px 300px at 82% 76%, rgba(134, 198, 43, 0.09), transparent 70%);
    animation: launcherAurora 16s ease-in-out infinite alternate;
}

.launcher-hero {
    position: relative;
    z-index: 1;
    margin-bottom: 26px;
    animation: launcherHeroIn 0.9s cubic-bezier(0.22, 0.9, 0.36, 1) backwards;
}

.launcher-title {
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: -0.8px;
    margin: 0 0 8px;
    color: var(--color-heading);
    display: flex;
    align-items: center;
    gap: 10px;
}

.launcher-brand {
    height: 0.92em;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.18));
}

.text-gradient {
    background: linear-gradient(120deg, var(--color-primary-strong) 0%, var(--color-primary) 38%, #bde4fb 50%, var(--color-primary) 62%, #7abde2 100%);
    background-size: 220% auto;
    background-position: 0% 50%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: launcherGradientShift 6s ease-in-out infinite;
}

.launcher-subtitle {
    color: var(--color-text-muted);
    font-size: 1rem;
    margin: 0;
    animation: launcherHeroIn 0.7s cubic-bezier(0.22, 0.9, 0.36, 1) 0.15s backwards;
}

.env-switcher {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 18px;
    animation: launcherHeroIn 0.7s cubic-bezier(0.22, 0.9, 0.36, 1) 0.25s backwards;
}

.env-switcher-label {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--color-text-muted);
}

.env-switcher-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.env-switcher-control .form-select {
    width: auto;
    min-width: 160px;
}

.env-switcher-hint {
    font-size: 0.75rem;
    font-style: italic;
    color: var(--color-text-muted);
}

.launcher {
    position: relative;
    z-index: 1;
    width: 100%;
    /* The launcher is a 1:1 square, so cap its width to the vertical space
       available (viewport minus hero, topbar and footer) so it can never push
       the page taller and force a vertical scrollbar. */
    max-width: min(820px, calc(100vh - 340px), 100%);
    aspect-ratio: 1 / 1;
    margin: 0 auto;
}

/* Soft breathing glow behind the hub */
.launcher::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 62%;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: radial-gradient(circle, color-mix(in srgb, var(--color-primary) 26%, transparent) 0%, transparent 62%);
    pointer-events: none;
    z-index: 0;
    animation: launcherGlowBreath 6s ease-in-out infinite;
}

/* Faint rotating orbital energy field */
.launcher::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 96%;
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg, rgba(255, 255, 255, 0.05) 30deg, transparent 60deg, rgba(255, 255, 255, 0.03) 150deg, transparent 210deg);
    -webkit-mask: radial-gradient(closest-side, transparent 62%, #000 78%);
    mask: radial-gradient(closest-side, transparent 62%, #000 78%);
    pointer-events: none;
    z-index: 0;
    animation: launcherFieldSpin 40s linear infinite;
}

.launcher-lines,
.launcher-pulses {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.launcher-line {
    stroke: var(--app-color, var(--color-primary));
    stroke-width: 0.4;
    stroke-dasharray: 100;
    stroke-dashoffset: 0;
    opacity: var(--line-opacity, 0.5);
    vector-effect: non-scaling-stroke;
    filter: drop-shadow(0 0 2px color-mix(in srgb, var(--app-color, #1f82b8) 55%, transparent));
    transition: stroke 0.25s ease, opacity 0.25s ease, filter 0.25s ease;
    animation: launcherLineIn 0.7s cubic-bezier(0.22, 0.9, 0.36, 1) backwards;
    animation-delay: calc(0.45s + var(--i) * 130ms);
}

.launcher-line--disabled {
    stroke: var(--color-text-muted);
    filter: none;
}

.launcher-line--lit {
    stroke: color-mix(in srgb, var(--app-color, #1f82b8) 35%, #ffffff);
    opacity: 1 !important;
    filter: drop-shadow(0 0 3px var(--app-color, #1f82b8)) drop-shadow(0 0 8px color-mix(in srgb, var(--app-color, #1f82b8) 60%, transparent));
}

@keyframes launcherLineIn {
    0% {
        stroke-dashoffset: 100;
        opacity: 0;
    }

    55% {
        opacity: 0.95;
    }

    100% {
        stroke-dashoffset: 0;
        opacity: var(--line-opacity, 0.5);
    }
}

.launcher-pulse {
    fill: #ffffff;
    stroke: var(--app-color, #1f82b8);
    stroke-width: 0.5;
    opacity: 0;
    filter: drop-shadow(0 0 3px var(--app-color, #1f82b8));
}

.launcher-hub,
.launcher-spoke {
    position: absolute;
    transform: translate(-50%, -50%);
}

/* Hub (eicor) bubble */
.launcher-hub {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 184px;
    height: 184px;
    border-radius: 50%;
    text-decoration: none;
    color: #ffffff;
    z-index: 3;
    animation: launcherHubIn 0.85s cubic-bezier(0.22, 0.9, 0.36, 1) backwards;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
}

.launcher-hub-inner {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    animation: launcherFloatInner 6.5s ease-in-out 1s infinite;
}

/* One-shot "impact" flash when the hub lands */
.launcher-hub::after {
    content: '';
    position: absolute;
    inset: -12px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.85);
    box-shadow: 0 0 34px 8px color-mix(in srgb, var(--app-color, #1f82b8) 80%, #ffffff);
    opacity: 0;
    animation: launcherHubFlash 1s ease-out 1s forwards;
    pointer-events: none;
}

.launcher-hub::before {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    opacity: 0;
    animation: launcherPulse 2.6s ease-out 1.1s infinite;
    pointer-events: none;
}

@keyframes launcherHubIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.3);
    }

    55% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.16);
    }

    75% {
        transform: translate(-50%, -50%) scale(0.94);
    }

    90% {
        transform: translate(-50%, -50%) scale(1.05);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes launcherHubFlash {
    0% {
        opacity: 0.95;
        transform: scale(0.45);
    }

    100% {
        opacity: 0;
        transform: scale(2.4);
    }
}

@keyframes launcherPulse {
    0% {
        transform: scale(0.96);
        opacity: 0.7;
    }

    70% {
        transform: scale(1.08);
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

/* Rotating halo of energy around the hub */
.launcher-hub-halo {
    position: absolute;
    inset: -16px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, transparent 0deg, color-mix(in srgb, var(--app-color, #1f82b8) 60%, #ffffff) 40deg, transparent 90deg, transparent 190deg, color-mix(in srgb, var(--app-color, #1f82b8) 40%, #ffffff) 230deg, transparent 280deg);
    -webkit-mask: radial-gradient(closest-side, transparent 74%, #000 82%);
    mask: radial-gradient(closest-side, transparent 74%, #000 82%);
    opacity: 0.85;
    pointer-events: none;
    z-index: 1;
    animation: launcherHaloSpin 9s linear infinite;
}

@keyframes launcherHaloSpin {
    to {
        transform: rotate(360deg);
    }
}

/* Orbiting satellites */
.launcher-orbit {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 130%;
    aspect-ratio: 1 / 1;
    margin: -50% 0 0 -50%;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    pointer-events: none;
    z-index: 1;
    animation: launcherOrbitSpin 16s linear infinite;
}

.launcher-orbit--b {
    width: 158%;
    border-style: dotted;
    border-color: rgba(255, 255, 255, 0.12);
    animation-duration: 26s;
    animation-direction: reverse;
}

.launcher-orbit i {
    position: absolute;
    left: 50%;
    top: -4px;
    width: 7px;
    height: 7px;
    margin-left: -3.5px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 8px 3px color-mix(in srgb, var(--app-color, #1f82b8) 75%, #ffffff);
}

@keyframes launcherOrbitSpin {
    to {
        transform: rotate(360deg);
    }
}

/* One-shot nova burst when the hub pops in */
.launcher-burst {
    position: absolute;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

.launcher-burst i {
    position: absolute;
    left: 50%;
    top: 50%;
    width: 7px;
    height: 7px;
    margin: -3.5px 0 0 -3.5px;
    border-radius: 50%;
    background: #ffffff;
    box-shadow: 0 0 10px 3px rgba(255, 255, 255, 0.75);
    opacity: 0;
    animation: launcherBurst 1.2s cubic-bezier(0.16, 0.84, 0.44, 1) 1.05s forwards;
}

.launcher-burst i:nth-child(3n) {
    width: 5px;
    height: 5px;
    margin: -2.5px 0 0 -2.5px;
    box-shadow: 0 0 8px 2px color-mix(in srgb, var(--app-color, #1f82b8) 80%, #ffffff);
}

@keyframes launcherBurst {
    0% {
        opacity: 1;
        transform: rotate(var(--ba, 0deg)) translateY(0) scale(1);
    }

    70% {
        opacity: 0.9;
        transform: rotate(var(--ba, 0deg)) translateY(74px) scale(1);
    }

    100% {
        opacity: 0;
        transform: rotate(var(--ba, 0deg)) translateY(112px) scale(0.2);
    }
}

.launcher-hub:hover,
.launcher-hub:focus {
    transform: translate(-50%, -50%) scale(1.14);
    color: #ffffff;
    z-index: 5;
}

.launcher-hub img {
    height: 60px;
    max-width: 136px;
    object-fit: contain;
    filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.35));
}

.launcher-hub-name {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: rgba(255, 255, 255, 0.95);
    text-transform: uppercase;
}

/* Program-colored bubble shared by the hub and active tiles */
.launcher-hub,
.launcher-tile--idle {
    background: radial-gradient(circle at 30% 24%, color-mix(in srgb, var(--app-color, #1f82b8) 74%, #ffffff) 0%, transparent 58%), linear-gradient(145deg, var(--app-color, #1f82b8) 0%, color-mix(in srgb, var(--app-color, #1f82b8) 78%, #07263c) 100%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.35), inset 0 -10px 18px rgba(7, 38, 60, 0.35), 0 14px 34px -10px color-mix(in srgb, var(--app-color, #1f82b8) 60%, transparent);
}

.launcher-hub-monogram,
.launcher-tile-monogram {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 800;
    color: #ffffff;
    background: rgba(255, 255, 255, 0.22);
    border: 1px solid rgba(255, 255, 255, 0.4);
    flex-shrink: 0;
}

/* Spoke bubbles */
.launcher-spoke {
    width: 112px;
    height: 112px;
    z-index: 2;
    animation-name: launcherSpokeIn, launcherFloat;
    animation-duration: 0.9s, 7s;
    animation-timing-function: cubic-bezier(0.22, 0.61, 0.36, 1), ease-in-out;
    animation-delay: calc(0.55s + var(--i, 0) * 130ms), calc(1.6s + var(--i, 0) * 200ms);
    animation-iteration-count: 1, infinite;
    animation-fill-mode: backwards, none;
    transition: opacity 0.35s ease, filter 0.35s ease;
}

@keyframes launcherSpokeIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.55);
    }

    65% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.05);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes launcherHeroIn {
    0% {
        opacity: 0;
        transform: translateY(26px) scale(0.96);
        filter: blur(4px);
    }

    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
        filter: blur(0);
    }
}

@keyframes launcherGradientShift {
    0% {
        background-position: 0% 50%;
    }

    100% {
        background-position: 100% 50%;
    }
}

@keyframes launcherGlowBreath {
    0%, 100% {
        opacity: 0.55;
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.08);
    }
}

@keyframes launcherFieldSpin {
    to {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

@keyframes launcherStars {
    0% {
        opacity: 0.45;
    }

    100% {
        opacity: 1;
    }
}

@keyframes launcherStarsDrift {
    from {
        background-position: 0 0, 30px 18px, 70px 40px, 120px 90px;
    }

    to {
        background-position: 340px 340px, 310px 298px, 280px 250px, 580px 550px;
    }
}

@keyframes launcherAurora {
    0% {
        opacity: 0.55;
        transform: scale(1);
    }

    100% {
        opacity: 1;
        transform: scale(1.05);
    }
}

/* Gentle idle float so the bubbles feel alive */
@keyframes launcherFloat {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0);
    }

    50% {
        transform: translate(-50%, -50%) translateY(-8px);
    }
}

@keyframes launcherFloatInner {
    0%, 100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.launcher-tile {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease, filter 0.3s ease;
    position: relative;
}

    .launcher-tile img {
        height: 40px;
        max-width: 72px;
        object-fit: contain;
        filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.35));
    }

.launcher-tile--idle {
    color: #ffffff;
}

    .launcher-tile--idle::after {
        content: '';
        position: absolute;
        inset: 0;
        border-radius: 50%;
        border: 2px solid rgba(255, 255, 255, 0.85);
        opacity: 0;
        transform: scale(0.55);
        pointer-events: none;
    }

    .launcher-tile--idle:hover,
    .launcher-tile--idle:focus {
        transform: scale(1.18);
        color: #ffffff;
        z-index: 4;
        box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.4), inset 0 -10px 18px rgba(7, 38, 60, 0.35), 0 22px 48px -10px color-mix(in srgb, var(--app-color, #1f82b8) 80%, transparent), 0 0 26px color-mix(in srgb, var(--app-color, #1f82b8) 45%, transparent);
    }

        .launcher-tile--idle:hover::after {
            animation: launcherTileRipple 0.85s cubic-bezier(0.16, 0.84, 0.44, 1) infinite;
        }

@keyframes launcherTileRipple {
    0% {
        transform: scale(0.55);
        opacity: 0.9;
    }

    100% {
        transform: scale(1.9);
        opacity: 0;
    }
}

.launcher-tile--disabled {
    border: 2px dashed var(--color-border-strong);
    color: var(--color-text-muted);
    cursor: not-allowed;
    filter: grayscale(1);
    opacity: 0.55;
    box-shadow: none;
    background: var(--color-surface-2);
}

/* Cinematic focus: hovering a spoke quiets the rest of the constellation */
.launcher--focused .launcher-line {
    opacity: calc(var(--line-opacity, 0.5) * 0.35);
    filter: none;
}

.launcher--focused .launcher-line--lit {
    opacity: 1 !important;
    filter: drop-shadow(0 0 3px var(--app-color, #1f82b8)) drop-shadow(0 0 8px color-mix(in srgb, var(--app-color, #1f82b8) 60%, transparent));
}

.launcher--focused .launcher-spoke {
    opacity: 0.35;
    filter: saturate(0.55) brightness(0.9);
}

    .launcher--focused .launcher-spoke:hover {
        opacity: 1;
        filter: none;
    }

.launcher--focused .launcher-hub {
    box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.35), inset 0 -10px 18px rgba(7, 38, 60, 0.35), 0 14px 34px -10px color-mix(in srgb, var(--app-color, #1f82b8) 60%, transparent), 0 0 30px color-mix(in srgb, var(--app-color, #1f82b8) 50%, transparent);
}

/* Tooltip */
.launcher-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    width: max-content;
    max-width: 15rem;
    background: var(--color-surface);
    color: var(--color-text);
    border: 1px solid var(--color-border-strong);
    border-radius: 12px;
    padding: 10px 14px;
    text-align: left;
    box-shadow: var(--shadow-pop);
    z-index: 20;
    transform-origin: bottom center;
    animation: launcherTooltipIn 0.3s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes launcherTooltipIn {
    0% {
        opacity: 0;
        transform: translateX(-50%) translateY(6px) scale(0.85);
    }

    65% {
        opacity: 1;
        transform: translateX(-50%) translateY(-2px) scale(1.05);
    }

    100% {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

    .launcher-tooltip::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 50%;
        transform: translateX(-50%);
        border: 6px solid transparent;
        border-top-color: var(--color-surface);
    }

.launcher-tooltip-desc {
    display: block;
    font-size: 0.76rem;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.launcher-tooltip-ver {
    display: inline-block;
    font-size: 0.68rem;
    color: var(--color-primary);
    background: var(--color-primary-soft);
    border-radius: 999px;
    padding: 2px 8px;
    margin-top: 6px;
}

@media (prefers-reduced-motion: reduce) {
    .launcher-page::before,
    .launcher-page::after,
    .launcher::before,
    .launcher::after,
    .launcher-hero,
    .launcher-subtitle,
    .launcher-line,
    .launcher-hub,
    .launcher-hub-inner,
    .launcher-hub::before,
    .launcher-hub::after,
    .launcher-hub-halo,
    .launcher-orbit,
    .launcher-burst i,
    .launcher-spoke,
    .text-gradient {
        animation: none !important;
    }

    .launcher-hero,
    .launcher-line,
    .launcher-hub,
    .launcher-spoke {
        opacity: 1 !important;
    }

    .launcher-line {
        stroke-dashoffset: 0 !important;
    }

    .launcher-hub-halo,
    .launcher-orbit,
    .launcher-burst,
    .launcher-pulses {
        display: none;
    }

    .welcome-modal-enter,
    .welcome-modal-leave {
        transition: none !important;
    }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (min-width: 992px) {
    .app-main {
        margin-left: 264px;
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.4);
    }

    .app-main {
        margin-left: 0;
    }

    .topbar-burger {
        display: flex;
    }

    .topbar {
        padding: 0 18px;
    }

    .app-content {
        padding: 24px 18px 40px;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }
}

@media (max-width: 575.98px) {
    .launcher {
        max-width: 100%;
    }

    .launcher-hub {
        width: 132px;
        height: 132px;
    }

        .launcher-hub img {
            height: 44px;
            max-width: 96px;
        }

    .launcher-hub-name {
        font-size: 0.62rem;
    }

    .launcher-spoke {
        width: 76px;
        height: 76px;
    }

    .launcher-tile img {
        height: 28px;
        max-width: 50px;
    }

    .launcher-title {
        font-size: 1.7rem;
    }

    .topbar-user--mobile {
        display: inline;
    }

    .sidebar-user {
        display: none;
    }
}

.form-check .form-check-input {
    float: left;
    margin-left: 0;
}

/* =========================================================
   Welcome popup (shown after sign-in on the launcher)
   ========================================================= */
.welcome-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(4, 12, 24, 0.6);
    backdrop-filter: blur(3px);
}

.welcome-modal {
    width: 100%;
    max-width: 480px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 18px;
    box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.5);
}

/* Enter: springy pop with a slight rise */
.welcome-modal-enter {
    transition: opacity 0.3s ease, transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.welcome-modal-enter-start {
    opacity: 0;
    transform: translateY(26px) scale(0.88);
}

.welcome-modal-enter-end {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Leave: gentle fade down */
.welcome-modal-leave {
    transition: opacity 0.22s ease, transform 0.28s ease;
}

.welcome-modal-leave-start {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.welcome-modal-leave-end {
    opacity: 0;
    transform: translateY(14px) scale(0.94);
}

.welcome-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 0;
}

.welcome-title {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.3px;
    margin: 4px 0 0;
    color: var(--color-heading);
}

.welcome-close {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.welcome-close:hover {
    color: var(--color-danger);
    border-color: var(--color-danger);
}

.welcome-body {
    padding: 18px 24px;
    color: var(--color-text);
    font-size: 0.92rem;
}

.welcome-greeting {
    margin: 0;
}

.welcome-steps {
    margin: 12px 0 0;
    padding-left: 20px;
    color: var(--color-text-muted);
}

.welcome-steps li {
    margin-bottom: 8px;
}

.welcome-section-title {
    font-weight: 700;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin: 18px 0 10px;
}

.welcome-apps {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
}

.welcome-app {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border: 1px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface-2);
    color: var(--color-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.86rem;
    transition: all 0.18s ease;
}

.welcome-app:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    transform: translateY(-1px);
}

.welcome-app .app-mark {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
    border-radius: 9px;
}

.welcome-app-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.welcome-footer {
    display: flex;
    justify-content: flex-end;
    padding: 14px 24px 20px;
}