:root {
    --bg: #0f1115;
    --surface: #171a21;
    --surface-2: #1f232c;
    --border: #2a2f3a;
    --text: #eef0f4;
    --text-dim: #9aa1af;
    --accent: #6c5ce7;
    --accent-2: #00d9c0;
    --success: #2ecc71;
    --warning: #f5a623;
    --danger: #e74c3c;
    --radius: 14px;
    --shadow: 0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: radial-gradient(circle at top left, #1a1d27, var(--bg) 60%);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}

a { color: inherit; text-decoration: none; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 220px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar .brand {
    font-weight: 700;
    font-size: 1.2rem;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    margin-bottom: 24px;
    padding: 0 10px;
}

.nav-link {
    padding: 10px 14px;
    border-radius: 10px;
    color: var(--text-dim);
    font-size: 0.95rem;
    transition: background 0.15s, color 0.15s;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active { background: var(--accent); color: white; }

.main {
    flex: 1;
    padding: 32px 40px;
    max-width: 1100px;
}

.page-title {
    font-size: 1.6rem;
    font-weight: 700;
    margin-bottom: 4px;
}
.page-subtitle { color: var(--text-dim); margin-bottom: 28px; }

.grid {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    margin-bottom: 28px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
}

.card h3 { margin: 0 0 10px 0; font-size: 1rem; color: var(--text-dim); font-weight: 600; }
.card .big-number { font-size: 2rem; font-weight: 700; }

.progress-bar {
    height: 8px;
    background: var(--surface-2);
    border-radius: 6px;
    overflow: hidden;
    margin-top: 10px;
}
.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.schema-card { display: flex; flex-direction: column; gap: 8px; }
.schema-card .name { font-weight: 600; font-size: 1.05rem; }
.schema-card .meta { color: var(--text-dim); font-size: 0.85rem; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 10px;
    border: none;
    background: var(--accent);
    color: white;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); }
.btn.danger { background: var(--danger); }
.btn.small { padding: 6px 12px; font-size: 0.8rem; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; margin-bottom: 6px; color: var(--text-dim); font-size: 0.9rem; }
input, select, textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); }

.auth-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
}
.auth-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    width: 100%;
    max-width: 380px;
    box-shadow: var(--shadow);
}
.auth-card h1 { font-size: 1.4rem; margin-bottom: 4px; }
.auth-card p.sub { color: var(--text-dim); margin-bottom: 24px; font-size: 0.9rem; }

.alert { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 0.9rem; }
.alert.error { background: rgba(231,76,60,0.15); color: #ff8577; border: 1px solid rgba(231,76,60,0.4); }
.alert.success { background: rgba(46,204,113,0.15); color: #7be3a1; border: 1px solid rgba(46,204,113,0.4); }

.exercise-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr auto;
    gap: 10px;
    align-items: end;
    margin-bottom: 12px;
    padding: 12px;
    background: var(--surface-2);
    border-radius: 10px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 4px;
}
.calendar-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    background: var(--surface-2);
}
.calendar-cell.level-1 { background: rgba(108,92,231,0.35); }
.calendar-cell.level-2 { background: rgba(108,92,231,0.6); }
.calendar-cell.level-3 { background: rgba(108,92,231,0.85); }
.calendar-cell.level-4 { background: var(--accent); }

.set-row {
    display: grid;
    grid-template-columns: 40px 1fr 1fr auto;
    gap: 10px;
    align-items: center;
    margin-bottom: 8px;
}
.set-row .set-label { color: var(--text-dim); font-size: 0.85rem; }

.timer-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 8px 14px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--accent-2);
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 10px;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: var(--shadow);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
}

@media (max-width: 720px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
    .main { padding: 20px; }
    .exercise-row { grid-template-columns: 1fr; }
}
