:root {
    --bg: #0d1117;
    --bg-card: #161b22;
    --bg-input: #0d1117;
    --bg-hover: #1c2333;
    --border: #30363d;
    --text: #e6edf3;
    --text-muted: #8b949e;
    --accent: #58a6ff;
    --accent-hover: #79b8ff;
    --green: #3fb950;
    --green-bg: rgba(63, 185, 80, 0.1);
    --red: #f85149;
    --red-bg: rgba(248, 81, 73, 0.1);
    --yellow: #d29922;
    --yellow-bg: rgba(210, 153, 34, 0.1);
    --purple: #bc8cff;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    --transition: 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

code {
    background: var(--bg-hover);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    color: var(--accent);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.navbar {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(10px);
}

.nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    gap: 32px;
}

.nav-brand {
    font-size: 1.2em;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}

.brand-icon { font-size: 1.4em; }

.nav-links {
    display: flex;
    gap: 8px;
    flex: 1;
}

.nav-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    transition: all var(--transition);
}

.nav-link:hover, .nav-link.active {
    color: var(--text);
    background: var(--bg-hover);
}

.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-id {
    color: var(--text-muted);
    font-size: 0.9em;
}

.page-header {
    margin-bottom: 32px;
}

.page-header h1 {
    font-size: 1.8em;
    font-weight: 700;
}

.page-desc {
    color: var(--text-muted);
    margin-top: 4px;
}

.back-link {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9em;
}

.back-link:hover { color: var(--accent); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    font-family: inherit;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); }

.btn-danger {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.btn-danger:hover { background: rgba(248, 81, 73, 0.2); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    padding: 6px 12px;
}

.btn-ghost:hover { color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 0.85em; }
.btn-block { width: 100%; justify-content: center; }

.btn-group {
    display: flex;
    gap: 8px;
    margin: 16px 0;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
}

.chat-card {
    display: block;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: all var(--transition);
    color: var(--text);
}

.chat-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(88, 166, 255, 0.1);
}

.chat-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.chat-icon { font-size: 1.6em; }
.chat-card-header h3 { font-size: 1.1em; }

.chat-card-body {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.chat-stat {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9em;
    color: var(--text-muted);
}

.stat-label { min-width: 70px; }
.stat-value { color: var(--text); font-weight: 600; }
.status-on { color: var(--green); }
.status-off { color: var(--red); }

.chat-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 0.85em;
    color: var(--text-muted);
}

.arrow { font-size: 1.2em; color: var(--accent); }

.section-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
}

.section-card h2 {
    font-size: 1.3em;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.section-card h3 {
    font-size: 1.05em;
    margin: 24px 0 16px;
    color: var(--text-muted);
}

.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 24px;
    overflow-x: auto;
    padding-bottom: 4px;
}

.tab {
    padding: 10px 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: inherit;
    font-size: 0.95em;
}

.tab:hover { color: var(--text); border-color: var(--accent); }
.tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.tab-content { display: none; }
.tab-content.active { display: block; }

.form { display: flex; flex-direction: column; gap: 16px; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.9em;
    color: var(--text-muted);
    font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text);
    font-size: 0.95em;
    transition: border-color var(--transition);
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.form-group select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b949e'%3E%3Cpath d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    margin-bottom: 16px;
}

.status-connected {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.status-dot { font-size: 0.8em; }

.connection-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.info-row {
    display: flex;
    gap: 12px;
    font-size: 0.9em;
}

.info-row span { color: var(--text-muted); min-width: 120px; }

.table-wrapper {
    overflow-x: auto;
    margin: 16px 0;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.9em;
}

.data-table th {
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table tr:hover td { background: var(--bg-hover); }

.nowrap { white-space: nowrap; }

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.8em;
    font-weight: 500;
}

.badge-ok { background: var(--green-bg); color: var(--green); }
.badge-fail { background: var(--red-bg); color: var(--red); }
.badge-vk { background: rgba(88, 166, 255, 0.1); color: var(--accent); }
.badge-web { background: rgba(188, 140, 255, 0.1); color: var(--purple); }

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    text-align: center;
}

.stat-name { color: var(--accent); font-weight: 600; font-size: 0.9em; }
.stat-num { font-size: 2em; font-weight: 700; margin: 4px 0; }
.stat-sub { font-size: 0.8em; color: var(--text-muted); }

.execute-result {
    margin-top: 16px;
    padding: 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
}

.execute-result.success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.execute-result.error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.alert {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.95em;
}

.alert-error {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid rgba(248, 81, 73, 0.3);
}

.alert-warning {
    background: var(--yellow-bg);
    color: var(--yellow);
    border: 1px solid rgba(210, 153, 34, 0.3);
}

.alert-success {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid rgba(63, 185, 80, 0.3);
}

.text-muted { color: var(--text-muted); }

.empty-state {
    text-align: center;
    padding: 80px 20px;
}

.empty-icon { font-size: 4em; margin-bottom: 16px; }
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { color: var(--text-muted); max-width: 400px; margin: 0 auto; }

.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--bg);
    background-image:
        radial-gradient(ellipse at 20% 50%, rgba(88, 166, 255, 0.08) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 50%, rgba(188, 140, 255, 0.06) 0%, transparent 50%);
}

.login-container { width: 100%; max-width: 440px; padding: 20px; }

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 40px;
    box-shadow: var(--shadow);
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-icon {
    font-size: 3em;
    display: block;
    margin-bottom: 12px;
}

.login-header h1 {
    font-size: 1.6em;
    margin-bottom: 4px;
}

.login-subtitle {
    color: var(--text-muted);
    font-size: 0.95em;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.login-form .form-group label {
    font-size: 0.9em;
    color: var(--text-muted);
    margin-bottom: 6px;
    display: block;
}

.login-form input {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    color: var(--text);
    font-size: 1.1em;
    letter-spacing: 2px;
    text-align: center;
    font-family: 'Consolas', 'Monaco', monospace;
}

.login-form input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

.login-help {
    border-top: 1px solid var(--border);
    padding-top: 24px;
}

.login-help h3 {
    font-size: 0.95em;
    margin-bottom: 12px;
    color: var(--text-muted);
}

.login-help ol {
    padding-left: 20px;
    color: var(--text-muted);
    font-size: 0.9em;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.login-help li { line-height: 1.5; }

.help-note {
    margin-top: 12px;
    font-size: 0.85em;
    color: var(--text-muted);
    font-style: italic;
}

.docs-layout {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 32px;
}

.docs-nav {
    position: sticky;
    top: 80px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-self: start;
}

.docs-link {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.9em;
    transition: all var(--transition);
}

.docs-link:hover, .docs-link.active {
    color: var(--text);
    background: var(--bg-hover);
}

.docs-content {
    display: flex;
    flex-direction: column;
    gap: 40px;
}

.doc-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
}

.doc-section h2 {
    font-size: 1.4em;
    margin-bottom: 16px;
}

.doc-section h3 {
    margin: 20px 0 12px;
    color: var(--accent);
}

.doc-section p { margin-bottom: 12px; color: var(--text-muted); }
.doc-section ul, .doc-section ol { padding-left: 24px; color: var(--text-muted); margin-bottom: 12px; }
.doc-section li { margin-bottom: 6px; }

.doc-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 20px 0;
}

.doc-step {
    display: flex;
    gap: 16px;
    align-items: flex-start;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.step-num {
    width: 36px;
    height: 36px;
    min-width: 36px;
    background: var(--accent);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.95em;
}

.doc-step strong { color: var(--text); display: block; margin-bottom: 4px; }
.doc-step p { margin: 0; font-size: 0.9em; }

.doc-example {
    background: var(--bg);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    padding: 16px 20px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    margin: 12px 0;
}

.doc-example p { margin-bottom: 6px; }

.doc-warning {
    background: var(--yellow-bg);
    border: 1px solid rgba(210, 153, 34, 0.3);
    color: var(--yellow);
    padding: 16px;
    border-radius: var(--radius-sm);
    margin: 12px 0;
    font-size: 0.9em;
}

.site-footer {
    border-top: 1px solid var(--border);
    margin-top: 60px;
    padding: 24px 0;
    text-align: center;
}

.footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    color: var(--text-muted);
    font-size: 0.9em;
}

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.9em;
    font-weight: 500;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease;
    max-width: 400px;
}

.toast-success { background: #1a3a2a; color: var(--green); border: 1px solid rgba(63, 185, 80, 0.3); }
.toast-error { background: #3a1a1a; color: var(--red); border: 1px solid rgba(248, 81, 73, 0.3); }
.toast-info { background: #1a2a3a; color: var(--accent); border: 1px solid rgba(88, 166, 255, 0.3); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.loading {
    opacity: 0.6;
    pointer-events: none;
}

@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
    .cards-grid { grid-template-columns: 1fr; }
    .docs-layout { grid-template-columns: 1fr; }
    .docs-nav { position: static; flex-direction: row; flex-wrap: wrap; }
    .nav-inner { padding: 0 16px; gap: 16px; }
    .nav-links { display: none; }
    .login-card { padding: 24px; }
    .tabs { gap: 2px; }
    .tab { padding: 8px 14px; font-size: 0.85em; }
}

@media (max-width: 480px) {
    .container { padding: 16px; }
    .section-card { padding: 16px; }
    .nav-user .user-id { display: none; }
}

.forum-profile {
    margin-top: 24px;
    padding: 24px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.forum-profile h4 {
    margin: 20px 0 12px;
    color: var(--text-muted);
    font-size: 0.95em;
}

.forum-profile-header {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}

.forum-avatar {
    width: 72px;
    height: 72px;
    min-width: 72px;
    border-radius: 50%;
    background: var(--bg-hover);
    background-size: cover;
    background-position: center;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8em;
    font-weight: 700;
    color: var(--accent);
}

.forum-profile-info h3 {
    font-size: 1.3em;
    margin-bottom: 4px;
}

.forum-meta {
    display: flex;
    gap: 16px;
    margin: 8px 0;
    font-size: 0.9em;
    color: var(--text-muted);
}

.forum-groups-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.forum-group-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 20px;
    font-size: 0.85em;
    color: var(--text);
}

.forum-group-tag small {
    color: var(--text-muted);
}

.forum-group-tag.primary {
    background: rgba(88, 166, 255, 0.1);
    border-color: rgba(88, 166, 255, 0.3);
    color: var(--accent);
}

.forum-group-tag.primary small {
    color: var(--accent);
}

@media (max-width: 600px) {
    .forum-profile-header { flex-direction: column; align-items: center; text-align: center; }
    .forum-meta { flex-wrap: wrap; justify-content: center; }
}
