:root {
    --bg-color: #070b12;
    --bg-accent: radial-gradient(circle at top, rgba(56, 189, 248, 0.14), transparent 35%), radial-gradient(circle at right, rgba(34, 197, 94, 0.08), transparent 25%);
    --card-bg: rgba(8, 15, 26, 0.72);
    --card-bg-strong: rgba(11, 20, 34, 0.92);
    --border-color: rgba(148, 163, 184, 0.14);
    --text-main: #e5eef8;
    --text-muted: #8fa3bc;
    --green: #22c55e;
    --red: #ef4444;
    --blue: #38bdf8;
    --shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

html {
    color-scheme: dark;
}
body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 1.5rem;
    background: var(--bg-accent), var(--bg-color);
    color: var(--text-main);
    font-family: Inter, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

button,
input,
select,
textarea {
    font: inherit;
}

.auth-shell {
    width: min(100%, 760px);
    display: grid;
    gap: 1rem;
}

.auth-card {
    padding: 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    background: rgba(8, 15, 26, 0.82);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
    display: grid;
    gap: 1rem;
}

.brand-block {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand-mark {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.28), rgba(34, 197, 94, 0.16));
    border: 1px solid rgba(56, 189, 248, 0.22);
    font-weight: 800;
    color: #f8fbff;
}

.eyebrow,
.subtitle,
.footer-note,
.audit-meta,
.bot-meta {
    margin: 0;
    color: var(--text-muted);
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.brand-block h1,
.dashboard-topbar h2,
.panel-head h3 {
    margin: 0;
}

.status-card,
.user-panel,
.dashboard-topbar,
.panel-head,
.bot-card-head,
.bot-stats,
.bot-actions,
.dashboard-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.status-card,
.user-panel {
    padding: 0.95rem 1rem;
    border-radius: 18px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--green);
    box-shadow: 0 0 0 6px rgba(34, 197, 94, 0.12);
    flex: 0 0 auto;
}

.auth-block {
    display: grid;
    justify-items: start;
    gap: 0.75rem;
}

.user-panel {
    align-items: center;
}

.logout-btn,
.dashboard-actions button,
.full-width,
.bot-actions button,
.dashboard-topbar button {
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-main);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    cursor: pointer;
    transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.logout-btn:hover,
.dashboard-actions button:hover,
.bot-actions button:hover,
.dashboard-topbar button:hover {
    transform: translateY(-1px);
    border-color: rgba(56, 189, 248, 0.35);
    background: rgba(255, 255, 255, 0.07);
}

.footer-note {
    text-align: center;
    font-size: 0.92rem;
}

.dashboard-shell {
    width: min(100%, 1280px);
    display: grid;
    gap: 1rem;
}

.dashboard-topbar {
    padding: 1rem 1.1rem;
    border: 1px solid var(--border-color);
    border-radius: 22px;
    background: rgba(8, 15, 26, 0.82);
    backdrop-filter: blur(14px);
    box-shadow: var(--shadow);
}

.dashboard-actions {
    flex-wrap: wrap;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.75rem;
}

.stat-card,
.panel-card,
.empty-state,
.details-box,
.console-output,
.audit-row,
.bot-card {
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background: rgba(8, 15, 26, 0.82);
    box-shadow: var(--shadow);
}

.stat-card {
    padding: 1rem;
    display: grid;
    gap: 0.25rem;
}

.stat-card strong {
    font-size: 1.6rem;
}

.stat-card span,
.panel-head .pill,
.status,
.bot-meta,
.audit-meta {
    color: var(--text-muted);
    font-size: 0.88rem;
}

.dashboard-grid,
.two-col {
    display: grid;
    gap: 1rem;
}

.dashboard-grid {
    grid-template-columns: 1.2fr 0.8fr;
}

.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel-card {
    padding: 1rem;
}

.panel-head {
    margin-bottom: 0.9rem;
}

.pill {
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
}

.bento-grid,
.audit-list {
    display: grid;
    gap: 0.75rem;
}

.bot-card {
    padding: 0.9rem;
    display: grid;
    gap: 0.8rem;
}

.bot-card-head {
    align-items: start;
}

.bot-name {
    font-size: 1.05rem;
    font-weight: 700;
}

.status.online { color: var(--green); }
.status.stopped,
.status.errored { color: var(--red); }

.bot-stats {
    flex-wrap: wrap;
    justify-content: flex-start;
    color: var(--text-muted);
}

.bot-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
}

.field-label {
    display: block;
    margin-top: 0.35rem;
    margin-bottom: 0.35rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

input,
select,
textarea {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 0.9rem;
    border-radius: 12px;
}

select {
    appearance: none;
    background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
    background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 10px) calc(50% - 2px);
    background-size: 6px 6px, 6px 6px;
    background-repeat: no-repeat;
    padding-right: 2.4rem;
}

input:focus,
select:focus,
textarea:focus,
button:focus {
    outline: none;
    border-color: rgba(56, 189, 248, 0.75);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.14);
}

.console-output {
    min-height: 320px;
    margin: 0;
    padding: 1rem;
    color: #cdd9e8;
    overflow: auto;
    white-space: pre-wrap;
    line-height: 1.5;
}

.details-box {
    padding: 1rem;
    display: grid;
    gap: 0.75rem;
}

.detail-title {
    font-weight: 700;
    font-size: 1.05rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.5rem;
    color: var(--text-muted);
}

.audit-row {
    padding: 0.9rem 1rem;
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.audit-action {
    font-weight: 700;
    text-transform: capitalize;
}

.empty-state {
    padding: 1rem;
    color: var(--text-muted);
    text-align: center;
}

.error-msg {
    min-height: 1.4em;
    color: var(--red);
    text-align: center;
}

@media (max-width: 980px) {
    .stats-grid,
    .dashboard-grid,
    .two-col {
        grid-template-columns: 1fr;
    }

    .dashboard-topbar,
    .status-card,
    .user-panel,
    .panel-head,
    .bot-card-head,
    .audit-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-actions,
    .bot-actions {
        width: 100%;
    }

    .dashboard-actions button,
    .bot-actions button,
    .logout-btn {
        width: 100%;
    }
}

@media (max-width: 640px) {
    body {
        padding: 1rem;
    }

    .auth-card,
    .dashboard-topbar,
    .panel-card {
        padding: 1rem;
    }

    .brand-block {
        align-items: flex-start;
        flex-direction: column;
    }
}