/* Voicy Brainstorm Dashboard — Apple-inspired design */

:root {
    --bg-primary: #1a1a1e;
    --bg-secondary: #2a2a2e;
    --bg-tertiary: #3a3a3e;
    --bg-hover: #4a4a4e;
    --text-primary: #f5f5f7;
    --text-secondary: #a1a1a6;
    --text-muted: #6e6e73;
    --accent: #0a84ff;
    --accent-hover: #409cff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --purple: #bf5af2;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.2s ease;
}

@media (prefers-color-scheme: light) {
    :root {
        --bg-primary: #f5f5f7;
        --bg-secondary: #ffffff;
        --bg-tertiary: #e8e8ed;
        --bg-hover: #d1d1d6;
        --text-primary: #1d1d1f;
        --text-secondary: #6e6e73;
        --text-muted: #a1a1a6;
        --border: rgba(0, 0, 0, 0.08);
        --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    }
}

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

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Helvetica Neue', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

/* Lucide icons */
[data-lucide] {
    width: 16px;
    height: 16px;
    stroke-width: 1.75;
    display: inline-block;
    vertical-align: middle;
}

.header-icon {
    width: 18px;
    height: 18px;
    margin-right: 2px;
}

.section-icon {
    width: 12px;
    height: 12px;
    opacity: 0.6;
    margin-right: 4px;
}

.tab-icon {
    width: 13px;
    height: 13px;
    margin-right: 3px;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    stroke-width: 1;
}

/* Layout */
.app {
    display: grid;
    grid-template-columns: 260px 1fr 340px;
    grid-template-rows: 56px 1fr 48px;
    height: 100vh;
    gap: 1px;
    background: var(--border);
}

/* Header */
.header {
    grid-column: 1 / -1;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    padding: 0 20px;
    gap: 16px;
    -webkit-app-region: drag;
}

.header h1 {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
}

.header .session-info {
    font-size: 12px;
    color: var(--text-secondary);
    margin-left: auto;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    -webkit-app-region: no-drag;
}

.icon-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.icon-btn [data-lucide] {
    width: 16px;
    height: 16px;
}

.header .connection-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--red);
    transition: background var(--transition);
}

.header .connection-dot.connected {
    background: var(--green);
}

/* Sidebar */
.sidebar {
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-section {
    padding: 16px;
}

.sidebar-section h2 {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    align-items: center;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.sidebar-action {
    color: var(--text-muted);
    cursor: pointer;
    transition: color var(--transition);
    display: inline-flex;
    align-items: center;
}

.sidebar-action svg {
    width: 14px;
    height: 14px;
}

.sidebar-action:hover {
    color: var(--text-primary);
}

.sidebar-action.syncing {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.add-project-form {
    padding: 8px 0;
}

.add-project-form input,
.add-project-form textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 12px;
    margin-bottom: 4px;
    box-sizing: border-box;
}

.add-project-form textarea {
    resize: vertical;
    font-family: inherit;
}

.add-project-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.btn-sm {
    padding: 4px 10px;
    border: none;
    border-radius: 4px;
    font-size: 11px;
    cursor: pointer;
    background: var(--accent);
    color: #fff;
}

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

.btn-ghost {
    background: none;
    color: var(--text-muted);
    border: 1px solid var(--border);
}

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

/* Projects list */
.projects-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
}

.projects-list li {
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    cursor: pointer;
    transition: background var(--transition);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.projects-list li:hover {
    background: var(--bg-hover);
}

.projects-list .project-group-header {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    padding: 12px 12px 4px;
    cursor: default;
}

.projects-list .project-group-header:hover {
    background: none;
}

.projects-list li.active {
    background: var(--accent);
    color: white;
}

/* Agent status bar — in header, ingesprongen tot chat kolom */
.agents-bar {
    display: flex;
    gap: 5px;
    margin-left: calc(260px - 80px);  /* sidebar breedte minus logo breedte */
    align-items: center;
}

.agent-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    font-size: 11px;
    color: var(--text-muted);
    cursor: default;
    transition: all var(--transition);
    position: relative;
}

.agent-chip:hover {
    border-color: var(--text-secondary);
    color: var(--text-secondary);
}

.agent-chip .agent-name {
    font-size: 10px;
}

.agent-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background var(--transition);
    flex-shrink: 0;
}

.agent-dot.idle { background: var(--green); }
.agent-dot.thinking { background: var(--orange); animation: pulse 1.5s infinite; }
.agent-dot.deep_thinking { background: var(--purple); animation: pulse 1s infinite; }
.agent-dot.speaking { background: var(--accent); animation: pulse 0.8s infinite; }
.agent-dot.listening { background: var(--green); animation: pulse 1.2s infinite; }
.agent-dot.transcribing { background: var(--orange); animation: pulse 1s infinite; }
.agent-dot.stopped { background: var(--text-muted); }
.agent-dot.searching { background: var(--orange); animation: pulse 1.2s infinite; }
.agent-dot.stopped { background: var(--red); }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* Chat area */
.chat-area {
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

.message {
    max-width: 75%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.45;
    animation: fadeIn 0.25s ease;
    word-wrap: break-word;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.message.user {
    align-self: flex-end;
    background: var(--accent);
    color: white;
    border-bottom-right-radius: 6px;
}

.message.assistant {
    align-self: flex-start;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
}

.message .timestamp {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    display: block;
}

.message.assistant .timestamp {
    color: var(--text-muted);
}

/* Live partial transcript boven het invoerveld */
.partial-transcript {
    padding: 8px 20px;
    margin: 0 20px 6px;
    background: rgba(80, 110, 200, 0.12);
    border: 1px dashed rgba(120, 150, 220, 0.35);
    border-radius: 8px;
    color: rgba(220, 230, 255, 0.85);
    font-style: italic;
    font-size: 14px;
    line-height: 1.4;
    max-height: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Chat input */
.chat-input-area {
    padding: 12px 20px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: center;
}

.chat-input-area input {
    flex: 1;
    padding: 10px 16px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    outline: none;
    transition: border-color var(--transition);
}

.chat-input-area input:focus {
    border-color: var(--accent);
}

.chat-input-area input::placeholder {
    color: var(--text-muted);
}

.chat-input-area button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: var(--accent);
    color: white;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition);
    flex-shrink: 0;
}

.chat-input-area button:hover {
    background: var(--accent-hover);
}

.chat-input-area button [data-lucide] {
    width: 16px;
    height: 16px;
}

.mic-btn.mic-on {
    background: var(--accent);
    color: #fff;
    animation: mic-pulse 1.5s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
    50% { box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
}

.audio-clients-bar {
    padding: 6px 20px;
    background: var(--bg-tertiary);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: center;
    font-size: 12px;
    color: var(--text-muted);
}

.audio-clients-bar .client-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
}

.audio-clients-bar .client-chip:hover {
    border-color: var(--accent);
}

.audio-clients-bar .client-chip.active {
    border-color: var(--accent);
    background: rgba(99, 102, 241, 0.1);
}

.audio-clients-bar .client-chip .disconnect-btn {
    margin-left: 4px;
    opacity: 0.5;
    cursor: pointer;
}

.audio-clients-bar .client-chip .disconnect-btn:hover {
    opacity: 1;
    color: #ef4444;
}

/* Right panel */
.right-panel {
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.tabs {
    display: flex;
    border-bottom: 1px solid var(--border);
    padding: 0 8px;
}

.tab {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition);
    display: flex;
    align-items: center;
}

.tab:hover {
    color: var(--text-secondary);
}

.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.tab-badge {
    display: inline-block;
    min-width: 16px;
    height: 16px;
    padding: 0 5px;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    line-height: 16px;
    text-align: center;
    margin-left: 4px;
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: none;
}

.tab-content.active {
    display: block;
}

.tab-content::-webkit-scrollbar {
    width: 6px;
}

.tab-content::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

/* Notes */
.note-item {
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    animation: fadeIn 0.25s ease;
}

.note-item .note-category {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 6px;
    border-radius: 4px;
    margin-bottom: 6px;
}

.note-category.decision { background: rgba(48, 209, 88, 0.2); color: var(--green); }
.note-category.action_item { background: rgba(255, 159, 10, 0.2); color: var(--orange); }
.note-category.insight { background: rgba(10, 132, 255, 0.2); color: var(--accent); }
.note-category.architecture_change { background: rgba(191, 90, 242, 0.2); color: var(--purple); }

.note-item .note-text {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary);
}

/* Tasks */
.task-item {
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    display: flex;
    gap: 10px;
    align-items: flex-start;
    animation: fadeIn 0.25s ease;
}

.task-checkbox {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid var(--text-muted);
    flex-shrink: 0;
    cursor: pointer;
    transition: all var(--transition);
    margin-top: 1px;
}

.task-checkbox.done {
    background: var(--green);
    border-color: var(--green);
}

.task-checkbox.in_progress {
    border-color: var(--orange);
}

.task-info {
    flex: 1;
    min-width: 0;
}

.task-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.task-title.done {
    text-decoration: line-through;
    color: var(--text-muted);
}

.task-description {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.task-priority {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}

.task-priority.high { background: rgba(255, 69, 58, 0.2); color: var(--red); }
.task-priority.medium { background: rgba(255, 159, 10, 0.2); color: var(--orange); }
.task-priority.low { background: rgba(48, 209, 88, 0.2); color: var(--green); }

/* Wiki panel */
.wiki-item {
    padding: 10px 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    animation: fadeIn 0.25s ease;
}

.wiki-item .wiki-query {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    margin-bottom: 6px;
}

.wiki-item .wiki-result {
    font-size: 13px;
    line-height: 1.4;
    color: var(--text-primary);
    white-space: pre-wrap;
}

/* Status bar */
.status-bar {
    grid-column: 1 / -1;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    padding: 0 20px;
    font-size: 11px;
    color: var(--text-muted);
    gap: 20px;
}

.speaking-indicator {
    display: none;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-weight: 500;
}

.speaking-indicator.active {
    display: flex;
}

.speaking-bars {
    display: flex;
    gap: 2px;
    align-items: center;
    height: 14px;
}

.speaking-bars span {
    width: 3px;
    background: var(--accent);
    border-radius: 1px;
    animation: speakBar 0.8s ease-in-out infinite;
}

.speaking-bars span:nth-child(1) { height: 6px; animation-delay: 0s; }
.speaking-bars span:nth-child(2) { height: 10px; animation-delay: 0.1s; }
.speaking-bars span:nth-child(3) { height: 14px; animation-delay: 0.2s; }
.speaking-bars span:nth-child(4) { height: 10px; animation-delay: 0.3s; }
.speaking-bars span:nth-child(5) { height: 6px; animation-delay: 0.4s; }

@keyframes speakBar {
    0%, 100% { transform: scaleY(0.5); }
    50% { transform: scaleY(1); }
}

/* Empty state */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
    padding: 40px;
}

.empty-state .icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* =========================================================================
   Settings Page
   ========================================================================= */

.settings-page {
    background: var(--bg-primary);
    overflow-y: auto;
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.settings-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 100%;
}

.settings-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-header h2 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.settings-header h2 [data-lucide] {
    width: 20px;
    height: 20px;
}

.settings-status {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: 12px;
}

.settings-status.configured {
    background: rgba(48, 209, 88, 0.15);
    color: var(--green);
}

.settings-status.not-configured {
    background: rgba(255, 159, 10, 0.15);
    color: var(--orange);
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

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

.settings-group {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 20px;
    border: 1px solid var(--border);
}

.settings-group-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.settings-field {
    margin-bottom: 16px;
}

.settings-field:last-child {
    margin-bottom: 0;
}

.settings-field label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.settings-field .field-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.settings-field .field-status.has-value {
    background: var(--green);
}

.settings-field .field-status.empty {
    background: var(--text-muted);
}

.settings-field input {
    width: 100%;
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 13px;
    font-family: 'SF Mono', 'Menlo', monospace;
    outline: none;
    transition: border-color var(--transition);
}

.settings-field input:focus {
    border-color: var(--accent);
}

.settings-field input::placeholder {
    color: var(--text-muted);
    font-family: -apple-system, BlinkMacSystemFont, sans-serif;
}

.settings-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding-top: 8px;
}

.btn-primary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

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

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

.btn-primary [data-lucide] {
    width: 15px;
    height: 15px;
}

.settings-save-status {
    font-size: 12px;
    color: var(--text-muted);
    transition: color var(--transition);
}

.settings-save-status.success {
    color: var(--green);
}

.settings-save-status.error {
    color: var(--red);
}

/* =========================================================================
   Downloads Page
   ========================================================================= */

.downloads-page {
    background: var(--bg-primary);
    overflow-y: auto;
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.downloads-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    min-height: 100%;
}

.downloads-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.downloads-header h2 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.downloads-header h2 [data-lucide] {
    width: 20px;
    height: 20px;
}

.downloads-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Download Card */
.download-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    gap: 20px;
    align-items: flex-start;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.download-card:not(.download-card-disabled):hover {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), var(--shadow);
}

.download-card.download-card-highlight {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 4px 20px rgba(10, 132, 255, 0.15);
}

.download-card-disabled {
    opacity: 0.55;
}

.download-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.download-card-icon [data-lucide] {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
}

.download-card-info {
    flex: 1;
    min-width: 0;
}

.download-card-info h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 4px;
}

.download-card-desc {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-bottom: 10px;
}

.download-card-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.download-card-format {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.download-card-size {
    font-size: 12px;
    color: var(--text-muted);
}

.download-card-badge-soon {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    background: rgba(255, 159, 10, 0.15);
    color: var(--orange);
}

.download-card-requirements {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 4px;
}

.download-card-action {
    flex-shrink: 0;
    align-self: center;
}

.btn-download {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition), opacity var(--transition);
    white-space: nowrap;
}

.btn-download:hover:not(:disabled) {
    background: var(--accent-hover);
}

.btn-download:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn-download [data-lucide] {
    width: 16px;
    height: 16px;
}

/* Setup instructions */
.download-setup-info {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}

.download-setup-info h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.download-setup-info ol {
    list-style: none;
    counter-reset: setup-step;
    padding: 0;
}

.download-setup-info li {
    counter-increment: setup-step;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    padding: 6px 0 6px 32px;
    position: relative;
}

.download-setup-info li::before {
    content: counter(setup-step);
    position: absolute;
    left: 0;
    top: 6px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* OS detection hint */
.download-os-hint {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center;
    padding: 8px;
}

/* =========================================================================
   Pairing Page
   ========================================================================= */

.pairing-page {
    background: var(--bg-primary);
    overflow-y: auto;
    grid-column: 2 / 3;
    grid-row: 2 / 3;
}

.pairing-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 32px 24px;
    display: flex;
    flex-direction: column;
    gap: 32px;
    min-height: 100%;
}

.pairing-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pairing-header h2 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.pairing-header h2 [data-lucide] {
    width: 20px;
    height: 20px;
}

.pairing-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
    padding: 32px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.pairing-instructions {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* Pairing code input — 6 large boxes */
.pairing-code-input {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pairing-digit {
    width: 56px;
    height: 68px;
    text-align: center;
    font-size: 32px;
    font-weight: 700;
    font-family: 'SF Mono', 'Menlo', 'Courier New', monospace;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
    caret-color: var(--accent);
}

.pairing-digit:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(10, 132, 255, 0.2);
}

.pairing-digit.filled {
    border-color: var(--accent);
}

.pairing-digit.error {
    border-color: var(--red);
    animation: shake 0.4s ease;
}

.pairing-separator {
    width: 16px;
    height: 2px;
    background: var(--text-muted);
    border-radius: 1px;
    flex-shrink: 0;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.pairing-confirm-btn {
    min-width: 200px;
    justify-content: center;
}

.pairing-status {
    font-size: 14px;
    font-weight: 500;
    min-height: 20px;
    text-align: center;
    transition: color var(--transition);
}

.pairing-status.success {
    color: var(--green);
}

.pairing-status.error {
    color: var(--red);
}

.pairing-status.pending {
    color: var(--text-muted);
}

/* Devices section */
.devices-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
}

.devices-section h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.devices-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.devices-loading {
    text-align: center;
    color: var(--text-muted);
    padding: 16px;
    font-size: 13px;
}

.device-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    transition: background var(--transition);
}

.device-item:hover {
    background: var(--bg-tertiary);
}

.device-item-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.device-item-icon [data-lucide] {
    width: 18px;
    height: 18px;
    color: var(--text-secondary);
}

.device-item-info {
    flex: 1;
    min-width: 0;
}

.device-item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.device-item-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.device-item-revoke {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all var(--transition);
    flex-shrink: 0;
}

.device-item-revoke:hover {
    border-color: var(--red);
    color: var(--red);
    background: rgba(255, 69, 58, 0.1);
}

.devices-empty {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    padding: 20px;
}

/* Responsive */
@media (max-width: 1024px) {
    .app {
        grid-template-columns: 200px 1fr 280px;
    }
}

@media (max-width: 768px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: 56px 1fr 48px;
    }
    .sidebar, .right-panel {
        display: none;
    }
}
