:root {
    --bg: #0b0d12;
    --bg-glow-1: #3b5bfd;
    --bg-glow-2: #a855f7;
    --bg-glow-3: #22d3ee;
    --surface: rgba(24, 27, 33, 0.6);
    --surface-solid: #181b21;
    --surface-hover: rgba(32, 36, 44, 0.85);
    --border: rgba(255, 255, 255, 0.08);
    --border-hover: rgba(255, 255, 255, 0.16);
    --text: #f2f4f7;
    --text-muted: #9aa1ad;
    --accent: #6ea8fe;
    --accent-2: #a855f7;
    --accent-gradient: linear-gradient(135deg, #6ea8fe, #a855f7);
    --error: #ff6b6b;
    --shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.5);
    --radius-lg: 20px;
    --radius-md: 14px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
    -webkit-font-smoothing: antialiased;
    position: relative;
    overflow-x: hidden;
}

/* Ambient background glow */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(600px circle at 12% 8%, color-mix(in srgb, var(--bg-glow-1) 22%, transparent), transparent 60%),
        radial-gradient(500px circle at 88% 18%, color-mix(in srgb, var(--bg-glow-2) 18%, transparent), transparent 60%),
        radial-gradient(700px circle at 50% 100%, color-mix(in srgb, var(--bg-glow-3) 14%, transparent), transparent 60%);
    pointer-events: none;
    animation: drift 22s ease-in-out infinite alternate;
}

@keyframes drift {
    0% { transform: translate3d(0, 0, 0) scale(1); }
    100% { transform: translate3d(0, -2%, 0) scale(1.05); }
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Login */
.login-body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    background: var(--surface);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 44px 36px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow);
    animation: fadeUp 0.5s ease both;
}

.login-card h1 {
    font-size: 24px;
    margin: 0 0 6px;
    letter-spacing: -0.02em;
}

.login-card .subtitle {
    color: var(--text-muted);
    margin: 0 0 28px;
    font-size: 14px;
}

.login-card form {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.login-card input {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 15px;
    color: var(--text);
    font-size: 22px;
    text-align: center;
    letter-spacing: 8px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-card input::placeholder {
    letter-spacing: normal;
    font-size: 14px;
    color: var(--text-muted);
}

.login-card input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent);
}

.login-card button {
    background: var(--accent-gradient);
    background-size: 160% 160%;
    border: none;
    border-radius: var(--radius-md);
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    color: #0b0d12;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-position 0.4s ease;
}

.login-card button:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--accent) 55%, transparent);
    background-position: 100% 0;
}

.login-card button:active:not(:disabled) {
    transform: translateY(0);
}

.login-card button:disabled,
.login-card input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.login-card .error {
    color: var(--error);
    font-size: 14px;
    margin: 18px 0 0;
    animation: fadeUp 0.3s ease both;
}

/* Dashboard */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 32px;
    border-bottom: 1px solid var(--border);
    background: rgba(11, 13, 18, 0.6);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    position: sticky;
    top: 0;
    z-index: 10;
}

.page-header h1 {
    font-size: 19px;
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.logout {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.logout:hover {
    color: var(--text);
    border-color: var(--border);
    background: var(--surface-hover);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 18px;
    padding: 36px;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: var(--surface);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 26px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
    overflow: hidden;
    transition: background 0.2s ease, transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    animation: fadeUp 0.45s ease both;
}

.grid .card:nth-child(1) { animation-delay: 0.02s; }
.grid .card:nth-child(2) { animation-delay: 0.06s; }
.grid .card:nth-child(3) { animation-delay: 0.10s; }
.grid .card:nth-child(4) { animation-delay: 0.14s; }
.grid .card:nth-child(5) { animation-delay: 0.18s; }
.grid .card:nth-child(6) { animation-delay: 0.22s; }

.card::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.25s ease;
    z-index: -1;
}

.card::after {
    content: "";
    position: absolute;
    inset: 1px;
    background: var(--surface-solid);
    border-radius: calc(var(--radius-lg) - 1px);
    z-index: -1;
}

.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: var(--shadow);
}

.card:hover::before {
    opacity: 1;
}

.card-icon {
    font-size: 30px;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in srgb, var(--accent) 14%, transparent);
    border-radius: 14px;
    transition: transform 0.2s ease, background 0.2s ease;
}

.card:hover .card-icon {
    transform: scale(1.08) rotate(-4deg);
    background: color-mix(in srgb, var(--accent) 22%, transparent);
}

.card-name {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.card-description {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
}

.empty-state {
    color: var(--text-muted);
    padding: 64px 32px;
    text-align: center;
    max-width: 420px;
    margin: 0 auto;
    animation: fadeUp 0.5s ease both;
}

.empty-state code {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    padding: 2px 7px;
    border-radius: 6px;
    font-size: 0.9em;
}

@media (max-width: 480px) {
    .page-header {
        padding: 18px 20px;
    }

    .grid {
        padding: 20px;
        gap: 14px;
    }

    .login-card {
        padding: 32px 24px;
    }
}
