:root {
    --bg: #08090d;
    --panel: rgba(18, 21, 26, 0.88);
    --panel-strong: rgba(11, 13, 18, 0.92);
    --text: #f4f7fb;
    --muted: #aeb7c6;
    --cyan: #00f5ff;
    --cyan-soft: rgba(0, 245, 255, 0.28);
    --green: #35d08b;
    --red: #ff4b45;
    --red-soft: rgba(255, 75, 69, 0.18);
    --line: rgba(0, 245, 255, 0.28);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    background:
        linear-gradient(rgba(8, 9, 13, 0.66), rgba(8, 9, 13, 0.84)),
        var(--page-bg),
        var(--bg);
    background-size: cover;
    background-position: center;
    font-family: "Segoe UI", "Inter", Arial, sans-serif;
    letter-spacing: 0;
}

a {
    color: inherit;
}

.login-shell,
.portal-shell {
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-panel {
    width: min(420px, 100%);
    display: grid;
    gap: 22px;
    justify-items: center;
    padding: 42px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 0 34px var(--cyan-soft);
    text-align: center;
}

.brand-logo {
    width: 128px;
    height: 128px;
    object-fit: contain;
    border-radius: 8px;
    filter: drop-shadow(0 0 18px var(--cyan-soft));
}

.brand-copy h1,
.portal-header h1,
.app-card h2 {
    margin: 0;
    color: var(--cyan);
    font-weight: 800;
    letter-spacing: 0.02em;
}

.brand-copy p,
.portal-header p,
.app-card p {
    margin: 8px 0 0;
    color: var(--muted);
    line-height: 1.45;
}

.primary-btn,
.danger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 20px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
}

.primary-btn {
    width: 100%;
    background: #5865f2;
    box-shadow: 0 0 22px rgba(88, 101, 242, 0.36);
}

.primary-btn:hover {
    background: #4752c4;
}

.danger-btn {
    background: linear-gradient(135deg, var(--red), #ff744d);
    box-shadow: 0 0 22px var(--red-soft);
}

.danger-btn:hover {
    filter: brightness(1.08);
}

.setup-warning {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid rgba(255, 75, 69, 0.72);
    border-radius: 8px;
    background: var(--red-soft);
    color: #ffd6d3;
}

.portal-shell {
    min-height: 100vh;
    padding: 48px 0 64px;
}

.portal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 36px;
}

.identity,
.user-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.brand-mark,
.user-avatar {
    width: 72px;
    height: 72px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--cyan);
    box-shadow: 0 0 18px var(--cyan-soft);
}

.user-avatar {
    width: 46px;
    height: 46px;
    border-radius: 50%;
}

.apps-grid {
    width: min(760px, 100%);
    margin: 10px auto 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, 180px);
    justify-content: center;
    gap: 22px;
}

.app-card {
    position: relative;
    width: 180px;
    min-height: 180px;
    aspect-ratio: 1 / 1;
    padding: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    background: var(--panel);
    border: 1px solid rgba(0, 245, 255, 0.18);
    border-radius: 8px;
    text-decoration: none;
    text-align: center;
    box-shadow: inset 0 0 24px rgba(0, 245, 255, 0.08);
    transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.app-card:hover {
    transform: translateY(-3px);
    border-color: var(--cyan);
    box-shadow: 0 0 26px var(--cyan-soft);
}

.app-card-top {
    display: grid;
    place-items: center;
}

.app-icon-wrap,
.app-icon-img,
.app-icon-fallback {
    width: 72px;
    height: 72px;
}

.app-icon-wrap {
    position: relative;
}

.app-icon-img {
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: 0 0 18px rgba(0, 245, 255, 0.16);
}

.app-icon-fallback {
    display: none;
    place-items: center;
    border-radius: 8px;
    background: var(--panel-strong);
    border: 1px solid var(--line);
    color: var(--cyan);
    font-weight: 800;
}

.status-pill {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(53, 208, 139, 0.16);
    color: #9ff5c9;
    font-size: 12px;
    font-weight: 700;
}

.app-card h2 {
    font-size: 20px;
    line-height: 1.1;
}

.app-card p {
    min-height: 38px;
    display: -webkit-box;
    overflow: hidden;
    font-size: 13px;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

@media (max-width: 720px) {
    .login-shell,
    .portal-shell {
        width: min(100% - 28px, 1120px);
    }

    .login-panel {
        padding: 30px 22px;
    }

    .portal-header,
    .user-actions {
        align-items: flex-start;
        flex-direction: column;
    }

    .apps-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 16px;
    }

    .app-card {
        width: 100%;
        min-height: 160px;
    }
}
