:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg-body: #f1f5f9;
    --bg-card: #ffffff;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --sidebar-width: 240px;
    --header-height: 54px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { 
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
    background: var(--bg-body); 
    color: var(--text-main); 
    line-height: 1.45; 
    font-size: 14px;
}
a { color: var(--primary); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--primary-hover); }

/* --- Кнопки --- */
.btn { 
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; 
    padding: 7px 14px; border-radius: 6px; font-weight: 500; cursor: pointer; 
    border: none; transition: 0.2s; font-size: 13px; text-decoration: none; 
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--text-main); }
.btn-sm { padding: 4px 10px; font-size: 12px; }

/* --- Формы --- */
input, select, textarea { 
    width: 100%; padding: 7px 11px; border: 1px solid var(--border); 
    border-radius: 6px; font-size: 13px; background: #fff; 
    transition: 0.2s; font-family: inherit; 
}
input:focus, select:focus, textarea:focus { 
    outline: none; border-color: var(--primary); 
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.1); 
}
label { display: block; font-size: 12px; font-weight: 600; color: var(--text-main); margin-bottom: 4px; }

/* --- Утилиты --- */
.alert { padding: 9px 13px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.alert-ok { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-err { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warn { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }

.card { 
    background: var(--bg-card); border-radius: 10px; padding: 16px; 
    box-shadow: 0 1px 2px rgba(0,0,0,0.04); margin-bottom: 14px; 
    border: 1px solid var(--border); 
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: 11px; font-weight: 600; }
.badge-ok { background: #d1fae5; color: #065f46; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-err { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

.status-pending { background: #fef3c7; color: #92400e; }
.status-active { background: #d1fae5; color: #065f46; }
.status-paused { background: #e2e8f0; color: #475569; }
.status-rejected { background: #fee2e2; color: #991b1b; }

/* --- Шапка --- */
.top-header { 
    position: fixed; top: 0; left: 0; right: 0; 
    height: var(--header-height); background: var(--bg-card); 
    border-bottom: 1px solid var(--border); 
    display: flex; align-items: center; justify-content: space-between; 
    padding: 0 16px; z-index: 1000; 
}
.logo { font-size: 17px; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 6px; text-decoration: none; }
.logo:hover { color: var(--primary-hover); }
.burger-btn { display: none; background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-main); padding: 6px; }
.user-mini { display: flex; align-items: center; gap: 10px; }
.user-balance { font-weight: 700; color: var(--success); font-size: 13px; }

/* --- Боковое меню --- */
.sidebar { 
    position: fixed; top: var(--header-height); left: 0; bottom: 0; 
    width: var(--sidebar-width); background: var(--bg-card); 
    border-right: 1px solid var(--border); padding: 12px 0; 
    overflow-y: auto; z-index: 900; transition: transform 0.3s ease; 
}
.sidebar-menu { list-style: none; padding: 0 8px; }
.sidebar-menu li { margin-bottom: 2px; }
.sidebar-menu a { 
    display: flex; align-items: center; gap: 10px; 
    padding: 8px 12px; border-radius: 6px; 
    color: var(--text-muted); font-weight: 500; font-size: 13px; 
    text-decoration: none; transition: 0.2s; 
}
.sidebar-menu a:hover, .sidebar-menu a.active { background: #eef2ff; color: var(--primary); }
.sidebar-menu .divider { height: 1px; background: var(--border); margin: 10px 0; }
.sidebar-menu .logout { color: var(--danger); }
.sidebar-menu .logout:hover { background: #fef2f2; }

/* --- Основной контент --- */
.main-content { 
    margin-left: var(--sidebar-width); 
    margin-top: var(--header-height); 
    padding: 20px; 
    min-height: calc(100vh - var(--header-height)); 
}

/* --- Заголовки --- */
h1 { font-size: 22px; margin-bottom: 16px; font-weight: 700; }
h2 { font-size: 16px; margin-bottom: 12px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }

/* --- Таблицы --- */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 12px; background: #f8fafc; color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border); font-size: 12px; }
td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text-main); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafc; }

/* --- Код --- */
.code-box { background: #f8fafc; border: 1px solid var(--border); padding: 10px; border-radius: 6px; font-family: 'Courier New', monospace; font-size: 12px; word-break: break-all; }
.code-dark { background: #1e293b; color: #f1f5f9; padding: 12px; border-radius: 6px; font-family: 'Courier New', monospace; font-size: 12px; white-space: pre-wrap; word-break: break-all; }

/* --- Статистика (компактная) --- */
.stat { 
    padding: 14px; border-radius: 8px; text-align: center; 
    background: var(--bg-card); border: 1px solid var(--border); 
}
.stat b { display: block; font-size: 20px; margin-bottom: 3px; color: var(--primary); font-weight: 700; }
.stat span { color: var(--text-muted); font-size: 11px; }

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

/* --- Пароль --- */
.password-wrapper { position: relative; }
.password-wrapper input { padding-right: 40px; }
.toggle-password { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 16px; padding: 4px; }
.toggle-password:hover { color: var(--primary); }

/* --- Адаптивность --- */
@media (max-width: 1024px) {
    .burger-btn { display: block; }
    .sidebar { transform: translateX(-100%); width: 260px; box-shadow: 4px 0 20px rgba(0,0,0,0.1); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; padding: 16px; }
    .overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4); z-index: 800; }
    .overlay.active { display: block; }
}

@media (max-width: 600px) {
    .grid { grid-template-columns: 1fr; }
    .top-header { padding: 0 12px; }
    .card { padding: 14px; }
    .stat { padding: 12px; }
    .stat b { font-size: 18px; }
    h1 { font-size: 20px; }
}