* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #f4f6fb;
    color: #1a1f36;
    line-height: 1.6;
}

/* Login Container */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-title {
    font-size: 26px;
    font-weight: 800;
    margin-bottom: 30px;
    text-align: center;
    color: #1a1f36;
}

/* Registration Success */
.registration-success {
    background: #fff;
    border-radius: 16px;
    padding: 40px;
    max-width: 500px;
    margin: 0 auto;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,.15);
}

.success-title {
    font-size: 24px;
    font-weight: 800;
    color: #10b981;
    margin-bottom: 20px;
}

.credentials-box {
    background: #f9fafb;
    border: 2px solid #10b981;
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.credential-item {
    margin: 12px 0;
    padding: 12px;
    background: #fff;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.credential-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.credential-value {
    font-size: 20px;
    font-weight: 800;
    color: #1a1f36;
    margin-top: 4px;
    font-family: 'Courier New', monospace;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all .2s;
    font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, .1);
}

.form-textarea {
    resize: vertical;
    min-height: 120px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    border: none;
    cursor: pointer;
    transition: all .2s;
    text-decoration: none;
    display: inline-block;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, .4);
}

.btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(16, 185, 129, .4);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
}

.btn-danger:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(239, 68, 68, .4);
}

.btn-secondary {
    background: #6b7280;
    color: #fff;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-full {
    width: 100%;
}

/* Alerts */
.alert {
    padding: 14px 18px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.alert-warning {
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

/* Sidebar */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: #1a1f36;
    padding: 24px 0;
    overflow-y: auto;
    z-index: 100;
}

.sidebar-header {
    padding: 0 24px 24px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    margin-bottom: 24px;
}

.sidebar-title {
    color: #fff;
    font-size: 20px;
    font-weight: 800;
}

.sidebar-subtitle {
    color: rgba(255,255,255,.6);
    font-size: 12px;
    margin-top: 4px;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-item {
    margin: 4px 12px;
}

.sidebar-link {
    display: block;
    padding: 12px 16px;
    color: rgba(255,255,255,.8);
    text-decoration: none;
    border-radius: 8px;
    transition: all .2s;
    font-weight: 500;
}

.sidebar-link:hover, .sidebar-link.active {
    background: rgba(102, 126, 234, .15);
    color: #fff;
}

.sidebar-footer {
    padding: 24px;
    border-top: 1px solid rgba(255,255,255,.1);
    margin-top: 24px;
}

.user-info {
    color: rgba(255,255,255,.8);
    font-size: 13px;
}

.user-name {
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}

/* Main Container */
.container {
    margin-left: 260px;
    padding: 30px;
    min-height: 100vh;
}

@media (max-width: 768px) {
    .sidebar {
        width: 200px;
    }
    .container {
        margin-left: 200px;
        padding: 20px;
    }
}

/* Page Header */
.page-header {
    margin-bottom: 30px;
}

.page-title {
    font-size: 28px;
    font-weight: 800;
    color: #1a1f36;
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 14px;
    color: #6b7280;
}

/* Cards */
.card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid #e5e7eb;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #1a1f36;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 4px 14px rgba(0,0,0,.1);
    transition: all .2s;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
}

.stat-value {
    font-size: 32px;
    font-weight: 800;
    line-height: 1;
}

.stat-label {
    font-size: 13px;
    opacity: .9;
    margin-top: 8px;
}

/* Table */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th {
    background: #f9fafb;
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #374151;
    border-bottom: 2px solid #e5e7eb;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 14px;
}

.table tr:hover {
    background: #f9fafb;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
}

.badge-active {
    background: #d1fae5;
    color: #065f46;
}

.badge-ended {
    background: #fee2e2;
    color: #991b1b;
}

.badge-upcoming {
    background: #dbeafe;
    color: #1e40af;
}

.badge-graded {
    background: #d1fae5;
    color: #065f46;
}

.badge-pending {
    background: #fef3c7;
    color: #92400e;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
}

.empty-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
}

.empty-text {
    font-size: 14px;
}

/* File Upload */
.file-upload {
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    transition: all .2s;
    cursor: pointer;
}

.file-upload:hover {
    border-color: #667eea;
    background: #f9fafb;
}

.file-upload-label {
    color: #374151;
    font-weight: 600;
    margin-bottom: 8px;
}

.file-upload-hint {
    font-size: 12px;
    color: #6b7280;
}

/* Score Display */
.score-display {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0;
}

.score-item {
    background: #f9fafb;
    padding: 16px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #e5e7eb;
}

.score-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.score-value {
    font-size: 28px;
    font-weight: 800;
    color: #1a1f36;
}

/* Telegram Link */
.telegram-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: #0088cc;
    color: #fff;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 600;
    transition: all .2s;
}

.telegram-link:hover {
    background: #006699;
    transform: translateY(-2px);
}

/* Problem Display */
.problem-box {
    background: #f9fafb;
    border-left: 4px solid #667eea;
    padding: 20px;
    border-radius: 8px;
    margin: 20px 0;
}

.problem-title {
    font-weight: 700;
    margin-bottom: 12px;
    color: #1a1f36;
}

.problem-text {
    line-height: 1.7;
    color: #374151;
}

/* Timer Display */
.timer-display {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    padding: 16px 24px;
    border-radius: 8px;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 20px;
}

/* Utilities */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-10 { gap: 10px; }
