:root {
    --bg: #F4F4F5;
    --surface: #FFFFFF;
    --text-main: #09090B;
    --text-muted: #71717A;
    --border: #E4E4E7;
    --primary: #18181B;
    --radius: 24px;
    --radius-sm: 12px;
    --shadow: 0 10px 40px rgba(0,0,0,0.04);
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden; /* Might need to adjust if content overflows on small screens */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Allow scrolling on mobile if content is tall */
@media (max-height: 800px) {
    body {
        overflow-y: auto;
        align-items: flex-start;
    }
}

/* --- LOGIN SCREEN --- */
.login-wrapper {
    position: absolute;
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    z-index: 10;
    background: #ffffff;
}

.login-card {
    background: var(--surface);
    padding: 40px;
    border-radius: 32px;
    width: 100%; max-width: 420px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    text-align: center;
    position: relative;
}

.logo-badge {
    width: 48px; height: 48px;
    background: var(--primary); color: white;
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; margin: 0 auto 16px;
}

.input-stack { margin: 24px 0; display: flex; flex-direction: column; gap: 12px; }

.custom-input {
    width: 100%; padding: 14px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); outline: none; background: var(--bg);
    font-family: inherit;
}

.btn-primary {
    width: 100%; padding: 16px; background: var(--primary); color: white;
    border: none; border-radius: var(--radius-sm); font-weight: 600; cursor: pointer;
    transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.9; }

/* Стили для разделителя и быстрой кнопки */
.divider {
    margin: 24px 0; font-size: 12px; color: var(--text-muted); position: relative;
}
.divider::before, .divider::after {
    content: ''; position: absolute; top: 50%; width: 40%; height: 1px; background: var(--border);
}
.divider::before { left: 0; } .divider::after { right: 0; }

.btn-fast-login {
    width: 100%; padding: 14px;
    background: transparent; border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px; font-weight: 500; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    gap: 10px; transition: all 0.2s;
    color: var(--text-main);
    font-family: inherit;
}
.btn-fast-login:hover { background: #FAFAFA; border-color: #d4d4d8; }

/* --- DASHBOARD VIEW --- */
.dashboard-wrapper {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    background: #fff;
    z-index: 1;
    padding: 40px;
    display: flex;
    flex-direction: column;
    /* visibility: hidden; opacity: 0; - Removed for direct template rendering */
    overflow-y: auto;
}

.dash-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 32px; max-width: 1200px; width: 100%;
    margin-left: auto; margin-right: auto;
}

.user-profile {
    display: flex; align-items: center; gap: 12px;
    background: var(--bg); padding: 8px 16px 8px 8px;
    border-radius: 30px; cursor: pointer;
    border: 1px solid transparent; transition: border-color 0.2s;
    text-decoration: none;
    color: inherit;
}
.user-profile:hover { border-color: var(--border); }

.avatar {
    width: 32px; height: 32px; background: #000; color: #fff;
    border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px;
}

.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 20px;
    max-width: 1200px; width: 100%; margin: 0 auto;
    padding-bottom: 40px;
}

.app-card {
    background: var(--bg);
    border-radius: var(--radius);
    padding: 24px;
    height: 220px;
    display: flex; flex-direction: column; justify-content: space-between;
    text-decoration: none;
    color: var(--text-main);
    border: 1px solid transparent;
    position: relative; overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s, border-color 0.3s;
}

.app-card:hover {
    background: #fff; border-color: var(--border);
    box-shadow: var(--shadow); transform: translateY(-4px);
}

.app-icon {
    width: 52px; height: 52px; background: #fff; border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    font-size: 26px; color: var(--text-main);
    box-shadow: 0 4px 12px rgba(0,0,0,0.04);
}

.app-info h3 { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.app-info p { font-size: 13px; opacity: 0.6; line-height: 1.4; }
.app-info a { transition: border-color 0.2s; }
.app-info a:hover { border-bottom-color: var(--text-main); }
.app-card.wide .app-info a:hover { border-bottom-color: rgba(255,255,255,0.8); }

.app-card.wide {
    grid-column: span 2;
    background: linear-gradient(135deg, #18181B 0%, #27272A 100%);
    color: white;
}
.app-card.wide .app-icon { background: rgba(255,255,255,0.1); color: white; box-shadow: none; }
.app-card.wide .app-info p { opacity: 0.7; }
.app-card.wide:hover { transform: translateY(-4px); box-shadow: 0 10px 30px rgba(0,0,0,0.2); }

@media(max-width: 600px) {
    .app-card.wide { grid-column: span 1; }
    .login-card { box-shadow: none; border: none; background: transparent; padding: 20px; }
    .dashboard-wrapper { padding: 20px; }
}

/* Alert styles */
.alert {
    margin-top: 16px;
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    display: none;
}
.alert-error {
    background-color: #FEF2F2;
    color: #991B1B;
    border: 1px solid #FEE2E2;
}
.alert-success {
    background-color: #F0FDF4;
    color: #166534;
    border: 1px solid #DCFCE7;
}
.alert-info {
    background-color: #EFF6FF;
    color: #1E40AF;
    border: 1px solid #DBEAFE;
}

/* Hint */
.hint-text {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.4;
}

