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

body {
    margin: 0;
    font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app {
    display: flex;
    height: 100vh;
    height: 100dvh;
}

#main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#topbar {
    height: var(--topbar-height);
    display: flex;
    flex-direction: row;
    align-items: center;
    padding: 0 12px;
    border-bottom: 1px solid var(--border);
    gap: 8px;
    flex-shrink: 0;
    background: var(--bg-primary);
}

#sessionTitle {
    flex: 1;
    font-weight: 600;
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.token-badge {
    font-size: 12px;
    color: var(--text-tertiary);
    white-space: nowrap;
}

/* Buttons */
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.icon-btn:hover {
    background: var(--bg-secondary);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: #ffffff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.send-btn:hover {
    background: var(--accent-hover);
}

.send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.stop-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--danger);
    color: #ffffff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s;
}

.stop-btn:hover {
    background: #dc2626;
}

.ghost-btn {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    transition: background 0.15s;
}

.ghost-btn:hover {
    background: var(--bg-secondary);
}

/* Overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
}

/* Hidden utility */
.hidden {
    display: none !important;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 100;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar.open {
        transform: none;
    }

    .hidden-mobile {
        display: none;
    }

    .show-mobile {
        display: flex;
    }
}

@media (min-width: 769px) {
    .show-mobile {
        display: none;
    }
}
