:root {
    --tb-bg: #0b0f17;
    --tb-surface: rgba(11, 18, 32, 0.86);
    --tb-border: rgba(255, 255, 255, 0.12);
    --tb-text: #eaf2ff;
    --tb-muted: #9aa9c2;
    --tb-primary: #6ea8ff;
    --tb-primary-2: #4d86ff;
    --tb-danger: #ff6b6b;
    --tb-ring: rgba(109, 169, 255, 0.35);
    --tb-shadow: 0 18px 38px rgba(0, 0, 0, 0.45);
    --tb-radius: 20px;
    --tb-glass: saturate(180%) blur(10px);
}

.tb-page {
    background: radial-gradient(1400px 900px at 70% -10%, #1a2240 0%, var(--tb-bg) 55%) fixed;
    color: var(--tb-text);
    min-height: 100dvh;
    margin: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

.tb-header {
    background: linear-gradient(180deg, rgba(18, 28, 52, 0.92), rgba(18, 28, 52, 0.6));
    border-bottom: 1px solid var(--tb-border);
    position: sticky;
    top: 0;
    z-index: 40;
    backdrop-filter: var(--tb-glass);
    -webkit-backdrop-filter: var(--tb-glass);
}

.tb-header__inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 16px clamp(20px, 4vw, 40px);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.tb-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.tb-brand__logo {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.tb-brand__text {
    font-weight: 600;
    letter-spacing: .3px;
}

.tb-nav {
    display: inline-flex;
    gap: 12px;
    flex-wrap: wrap;
}

.tb-nav a {
    color: var(--tb-muted);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 12px;
    transition: background .18s ease, color .18s ease;
}

.tb-nav a:hover,
.tb-nav a:focus {
    color: var(--tb-text);
    background: rgba(255, 255, 255, 0.14);
}

.tb-container {
    max-width: 1200px;
    margin: clamp(24px, 6vw, 44px) auto;
    padding: 0 clamp(18px, 4vw, 40px) clamp(40px, 8vw, 60px);
}

.tb-card {
    background: var(--tb-surface);
    border-radius: var(--tb-radius);
    border: 1px solid var(--tb-border);
    box-shadow: var(--tb-shadow);
    backdrop-filter: var(--tb-glass);
    -webkit-backdrop-filter: var(--tb-glass);
    padding: clamp(20px, 5vw, 32px);
}

.tb-card--layout {
    display: grid;
    grid-template-columns: minmax(220px, 280px) 1fr;
    gap: clamp(20px, 4vw, 32px);
}

.tb-sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.tb-sidebar__header h2 {
    margin: 0 0 6px;
    font-size: 1.1rem;
}

.tb-sidebar__subtitle {
    margin: 0;
    color: var(--tb-muted);
    font-size: .9rem;
}

.tb-bot-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.tb-bot-item {
    display: block;
}

.tb-bot-item button {
    width: 100%;
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
    cursor: pointer;
    text-align: left;
    transition: border-color .18s ease, background .18s ease, transform .12s ease;
}

.tb-bot-item button:hover,
.tb-bot-item button:focus {
    border-color: var(--tb-primary);
    background: rgba(110, 168, 255, 0.16);
    outline: none;
}

.tb-bot-item--active button,
.tb-bot-item button.tb-bot-item--active {
    border-color: rgba(110, 168, 255, 0.65);
    background: rgba(110, 168, 255, 0.22);
    transform: translateY(-1px);
}

.tb-bot-item button strong {
    font-size: 1rem;
}

.tb-bot-item button span {
    font-size: .85rem;
    color: var(--tb-muted);
}

.tb-bot-item--loading,
.tb-bot-item--empty,
.tb-bot-item--error {
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px dashed rgba(255, 255, 255, 0.18);
    color: var(--tb-muted);
    background: rgba(255, 255, 255, 0.04);
}

.tb-workspace {
    display: flex;
    flex-direction: column;
    gap: clamp(18px, 3vw, 26px);
}

.tb-workspace__header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 18px;
    align-items: flex-start;
}

.tb-workspace__desc,
.tb-workspace__meta-info {
    margin: 6px 0 0;
    color: var(--tb-muted);
    font-size: .95rem;
}

.tb-workspace__status {
    display: grid;
    gap: 10px;
    justify-items: end;
}

.tb-status {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(255, 255, 255, 0.08);
    color: var(--tb-text);
    font-weight: 600;
}

.tb-status--running {
    box-shadow: 0 0 0 4px rgba(0, 212, 166, 0.2);
}

.tb-status--paused {
    box-shadow: 0 0 0 4px rgba(255, 218, 120, 0.2);
}

.tb-status--stopping {
    box-shadow: 0 0 0 4px rgba(255, 107, 107, 0.2);
}

.tb-subscription {
    font-size: .9rem;
    color: var(--tb-muted);
}

.tb-chat {
    background: rgba(5, 9, 18, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 18px;
    padding: 18px;
    min-height: 240px;
    max-height: 420px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.tb-bubble {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-size: .95rem;
    line-height: 1.45;
    max-width: 100%;
    word-break: break-word;
}

.tb-bubble__time {
    font-size: .75rem;
    color: rgba(255, 255, 255, 0.55);
}

.tb-bubble--user {
    background: linear-gradient(180deg, rgba(110, 168, 255, 0.25) 0%, rgba(110, 168, 255, 0.12) 100%);
    border-color: rgba(110, 168, 255, 0.45);
}

.tb-bubble--warning {
    background: linear-gradient(180deg, rgba(255, 159, 99, 0.25) 0%, rgba(255, 159, 99, 0.12) 100%);
    border-color: rgba(255, 159, 99, 0.45);
}

.tb-bubble--bot {
    background: linear-gradient(180deg, rgba(93, 230, 196, 0.25) 0%, rgba(93, 230, 196, 0.12) 100%);
    border-color: rgba(93, 230, 196, 0.45);
}

.tb-controls {
    display: grid;
    gap: clamp(18px, 3vw, 26px);
}

.tb-config,
.tb-actions {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: clamp(16px, 3vw, 22px);
    display: grid;
    gap: 16px;
}

.tb-section-title {
    margin: 0;
    font-size: 1.05rem;
}

.tb-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.tb-field {
    display: grid;
    gap: 8px;
}

.tb-field--wide {
    grid-column: span 2;
}

.tb-label {
    font-size: .9rem;
    color: var(--tb-muted);
}

.tb-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    outline: none;
    transition: box-shadow .18s ease, border-color .18s ease, background .18s ease;
}

.tb-input:focus {
    border-color: var(--tb-primary);
    box-shadow: 0 0 0 4px var(--tb-ring);
}

.tb-actions__group {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.tb-btn {
    --bg: rgba(255, 255, 255, 0.08);
    --bd: rgba(255, 255, 255, 0.2);
    --fg: var(--tb-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 12px;
    border: 1px solid var(--bd);
    background: var(--bg);
    color: var(--fg);
    cursor: pointer;
    user-select: none;
    text-decoration: none;
    transition: transform .08s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
}

.tb-btn:hover {
    transform: translateY(-1px);
}

.tb-btn:active {
    transform: translateY(0);
}

.tb-btn.primary {
    --bg: linear-gradient(180deg, var(--tb-primary) 0%, var(--tb-primary-2) 100%);
    --bd: transparent;
    --fg: #031129;
    font-weight: 600;
}

.tb-btn.outline {
    --bg: rgba(255, 255, 255, 0.04);
    --bd: rgba(255, 255, 255, 0.24);
}

.tb-console-status {
    background: rgba(5, 9, 18, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 10px 14px;
    font-size: .92rem;
    color: var(--tb-muted);
}

.tb-footer {
    margin-top: clamp(24px, 5vw, 36px);
    text-align: center;
    color: var(--tb-muted);
    font-size: .9rem;
}

@media (max-width: 1024px) {
    .tb-card--layout {
        grid-template-columns: 1fr;
    }

    .tb-workspace__status {
        justify-items: flex-start;
    }

    .tb-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .tb-grid {
        grid-template-columns: 1fr;
    }

    .tb-actions__group {
        flex-direction: column;
        align-items: stretch;
    }
}
