/* --- 1. DESIGN SYSTEM & VARIABLES --- */
:root {
    /* Palette - Neutral (Slate) */
    --bg-app: #ffffff;
    --bg-sidebar: #f9fafb;
    --bg-card: #ffffff;
    --bg-hover: #f3f4f6;
    --bg-active: #e5e7eb;

    /* Borders */
    --border: #e5e7eb;
    --border-focus: #2563eb;

    /* Text */
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;

    /* Accents */
    --accent-primary: #111827; /* Black for high contrast actions */
    --accent-text: #ffffff;
    --accent-blue: #2563eb;
    --accent-red: #ef4444;
    --accent-red-bg: #fee2e2;
    --accent-green: #10b981;
    --accent-green-bg: #d1fae5;

    /* Dimensions */
    --sidebar-width: 300px;
    --header-height: 60px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --font-sans: 'Inter', -apple-system, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-app: #0a0a0a;
        --bg-sidebar: #111111;
        --bg-card: #171717;
        --bg-hover: #262626;
        --bg-active: #333333;
        --border: #333333;
        --text-primary: #ededed;
        --text-secondary: #a1a1a1;
        --text-tertiary: #666666;
        --accent-primary: #ffffff;
        --accent-text: #000000;
        --accent-red-bg: #451a1a;
        --accent-green-bg: #064e3b;
    }
}

/* --- 2. RESET & BASE STYLES --- */
* { box-sizing: border-box; margin: 0; padding: 0; outline: none; }

body {
    font-family: var(--font-sans);
    background-color: var(--bg-app);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    display: flex;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* --- 3. LAYOUT CONTAINER --- */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* --- 4. LEFT SIDEBAR --- */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.sidebar-header {
    height: var(--header-height);
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.app-title {
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-title span {
    width: 10px;
    height: 10px;
    background: var(--accent-primary);
    border-radius: 2px;
}

.icon-btn {
    padding: 8px;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    transition: all 0.2s;
}
.icon-btn:hover { background-color: var(--bg-hover); color: var(--text-primary); }

.sidebar-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.conversation-item {
    padding: 12px;
    border-radius: var(--radius-md);
    margin-bottom: 5px;
    cursor: pointer;
    border: 1px solid rgba(128, 128, 128, 0.15);
    transition: all 0.2s ease;
    position: relative;
}

.conversation-item:hover {
    background-color: var(--bg-hover);
}

.conversation-item.active {
    background-color: var(--bg-card);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.conv-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

.conv-id { font-weight: 500; color: var(--text-primary); }
.conv-date { font-size: 12px; color: var(--text-tertiary); }

.conv-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.status-badge {
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.status-badge.completed { background-color: var(--bg-active); color: var(--text-secondary); }
.status-badge.active { background-color: var(--accent-green-bg); color: var(--accent-green); }
.status-badge.recording { background-color: var(--accent-red-bg); color: var(--accent-red); animation: pulse 2s infinite; }

/* Recording conversation card indicator */
.conversation-item.recording {
    box-shadow: 0 0 8px 2px rgba(239, 68, 68, 0.4);
    animation: recording-glow 2s ease-in-out infinite;
}
@keyframes recording-glow {
    0%, 100% { box-shadow: 0 0 8px 2px rgba(239, 68, 68, 0.3); }
    50% { box-shadow: 0 0 12px 4px rgba(239, 68, 68, 0.5); }
}
.conversation-item.recording .conv-id::after {
    content: '';
    display: inline-block;
    width: 8px;
    height: 8px;
    background: var(--accent-red);
    border-radius: 50%;
    margin-left: 8px;
    animation: pulse 2s infinite;
}

.delete-trigger {
    opacity: 0;
    color: var(--text-tertiary);
    font-size: 18px;
    padding: 2px;
    line-height: 1;
}
.conversation-item:hover .delete-trigger { opacity: 1; }
.delete-trigger:hover { color: var(--accent-red); }

.loading {
    text-align: center;
    padding: 20px;
    color: var(--text-tertiary);
}

/* --- 4. MAIN CONTENT --- */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--bg-app);
    position: relative;
}

/* Top Bar */
.top-bar {
    height: var(--header-height);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    background: var(--bg-app);
    z-index: 10;
    position: relative;
}

/* Center controls absolutely for true centering */
.top-bar .controls-group {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-tertiary);
}
.status-dot.connected { background-color: var(--accent-green); box-shadow: 0 0 0 4px var(--accent-green-bg); }
.status-dot.recording { background-color: var(--accent-red); animation: pulse 2s infinite; }

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0); }
    100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

/* Controls */
.controls-group {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 13px;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--accent-primary);
    color: var(--accent-text);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-danger {
    background-color: var(--accent-red-bg);
    color: var(--accent-red);
}
.btn-danger:hover { background-color: #fee2e2; filter: brightness(0.95); }

.btn-outline {
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--text-secondary); background-color: var(--bg-hover); }

/* Transcript View */
.transcript-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 40px;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    position: relative;
    /* M97: Scroll moved to .tab-content-body */
}

.empty-state {
    flex: 1;  /* M97: Fill available space in flex parent */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary);
    text-align: center;
}
.empty-state h3 { font-size: 18px; color: var(--text-primary); margin-bottom: 8px; }
.empty-state p { margin-bottom: 20px; }

/* Transcript Header */
.transcript-header {
    margin-bottom: 16px;
    flex-shrink: 0;  /* M97: Prevent header from shrinking when scrolling */
}

.transcript-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px 0;
    line-height: 1.3;
    padding: 4px 8px;
    margin: -4px -8px 4px -8px;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s;
}

.transcript-title:hover {
    background-color: var(--bg-hover);
}

.transcript-title:focus {
    background-color: var(--bg-active);
    outline: none;
}

.transcript-date {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* Transcript Header Layout */
.transcript-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.transcript-header-left {
    flex: 1;
    min-width: 0;
}

.transcript-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

/* Transcript Tab Bar (Milestone 18) */
.transcript-tabs {
    display: flex;
    gap: 4px;
    margin-top: 16px;
    margin-bottom: 8px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;  /* M97: Prevent tabs from shrinking when scrolling */
}

.transcript-tab {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    transition: all 0.15s;
    position: relative;
}

.transcript-tab:hover:not(.active) {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.transcript-tab.active {
    color: var(--text-primary);
    background-color: var(--bg-hover);
}

.transcript-tab.active::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--accent-primary);
}

/* Tab content wrapper */
.transcript-tab-content {
    flex: 1;
    overflow-y: auto;
    position: relative;  /* For absolute-positioned overlays */
}

.transcript-tab-content.hidden {
    display: none;
}

/* Small button variant */
.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    gap: 6px;
}

.btn-sm svg {
    width: 14px;
    height: 14px;
}

/* Transcript Version Toggle */
.version-toggle {
    display: flex;
    background-color: var(--bg-hover);
    border-radius: var(--radius-sm);
    padding: 2px;
    flex-shrink: 0;
}

.version-btn {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border-radius: calc(var(--radius-sm) - 2px);
    transition: all 0.15s;
}

.version-btn:hover:not(.active) {
    color: var(--text-primary);
}

.version-btn.active {
    background-color: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-sm);
}

/* Transcript Messages */
.message-block {
    display: flex;
    gap: 16px;
    margin: 0 10px 24px 0;
}

.speaker-avatar {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background-color: var(--bg-active);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    flex-shrink: 0;
    margin-top: 4px;
}

/* Dynamic speaker colors */
.speaker-0 { background-color: #e0e7ff; color: #3730a3; }
.speaker-1 { background-color: #dcfce7; color: #166534; }
.speaker-2 { background-color: #ffedd5; color: #9a3412; }
.speaker-3 { background-color: #fce7f3; color: #9d174d; }
.speaker-4 { background-color: #e0f2fe; color: #0369a1; }
.speaker-5 { background-color: #fef3c7; color: #92400e; }
.speaker-6 { background-color: #f3e8ff; color: #7c3aed; }
.speaker-7 { background-color: #ccfbf1; color: #0f766e; }

.message-content {
    flex: 1;
}

.message-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.speaker-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.message-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-tertiary);
}

.message-text {
    line-height: 1.6;
    color: var(--text-secondary);
    font-size: 15px;
}

/* Highlighting new text */
.message-text span.new {
    animation: highlightFade 2s forwards;
}

@keyframes highlightFade {
    0% { background-color: var(--accent-green-bg); color: var(--text-primary); }
    100% { background-color: transparent; }
}

/* --- 5. MODAL --- */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
}
.modal-overlay.visible { opacity: 1; pointer-events: auto; }

.modal {
    background: var(--bg-card);
    padding: 24px;
    border-radius: var(--radius-lg);
    width: 400px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transform: scale(0.95);
    transition: transform 0.2s;
}
.modal-overlay.visible .modal { transform: scale(1); }

.modal h3 { margin-bottom: 8px; }
.modal p { color: var(--text-secondary); margin-bottom: 24px; line-height: 1.5; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; }

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .sidebar { position: absolute; height: 100%; z-index: 20; transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-md); }
    .hamburger { display: block !important; }
}
.hamburger { display: none; margin-right: 16px; }

/* --- INLINE EDITABLE SPEAKER NAME --- */
.speaker-name[contenteditable="true"] {
    cursor: text;
    padding: 1px 4px;
    margin: -1px -4px;
    border-radius: 3px;
    transition: background-color 0.15s;
}

.speaker-name[contenteditable="true"]:hover {
    background-color: var(--bg-hover);
}

.speaker-name[contenteditable="true"]:focus {
    background-color: var(--bg-active);
    outline: none;
}


/* --- ACTION MODAL FORM --- */
.action-modal {
    width: 450px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--bg-app);
    color: var(--text-primary);
    transition: border-color 0.2s;
}

.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' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.form-group select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    border-color: var(--border-focus);
    outline: none;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
}

#testConnectionGroup {
    display: flex;
    align-items: center;
    gap: 12px;
}

#testConnectionResult {
    font-size: 13px;
}

#testConnectionResult.success {
    color: var(--accent-green);
}

#testConnectionResult.error {
    color: var(--accent-red);
}


/* --- RECORDING MODE DROPDOWN --- */
.recording-dropdown {
    position: relative;
    display: inline-block;
}

.recording-dropdown .btn {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dropdown-chevron {
    margin-left: 4px;
    transition: transform 0.2s;
}

.recording-dropdown.open .dropdown-chevron {
    transform: rotate(180deg);
}

.recording-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    min-width: 260px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s;
    z-index: 50;
}

.recording-dropdown.open .recording-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    flex-direction: column;
    width: 100%;
    padding: 12px 16px;
    text-align: left;
    border: none;
    background: none;
    cursor: pointer;
    transition: background 0.15s;
    color: var(--text-primary);
}

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

.dropdown-item:first-child {
    border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 var(--radius-md) var(--radius-md);
}

.dropdown-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.dropdown-icon {
    font-size: 10px;
    color: var(--accent-blue);
}

.dropdown-desc {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 4px;
    margin-left: 18px;
}

/* --- DOWNLOAD DROPDOWN --- */
.download-dropdown {
    position: relative;
    display: inline-block;
}

.download-dropdown .btn {
    display: flex;
    align-items: center;
    gap: 6px;
}

.download-dropdown.open .dropdown-chevron {
    transform: rotate(180deg);
}

.download-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 160px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all 0.2s;
    z-index: 50;
}

.download-dropdown.open .download-dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.download-dropdown .dropdown-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    font-size: 13px;
}

/* --- BATCH TOGGLE --- */
.batch-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    margin-left: 16px;
}

.batch-toggle input {
    display: none;
}

.toggle-slider {
    width: 36px;
    height: 20px;
    background: var(--bg-hover);
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
}

.toggle-slider::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.batch-toggle input:checked + .toggle-slider {
    background: var(--accent-green);
}

.batch-toggle input:checked + .toggle-slider::after {
    transform: translateX(16px);
}

.toggle-text {
    user-select: none;
}

/* --- RECORDING MODE BADGE --- */
.recording-mode-badge {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    font-weight: 500;
    margin-left: 16px;
}

.recording-mode-badge.batch {
    background: var(--accent-blue);
    color: white;
}

/* M80: Processing overlay removed - batch status shown in button */

/* Spinner animation (used by buttons) */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Spinner in buttons */
.btn .spinner {
    animation: spin 1s linear infinite;
}

/* --- SETTINGS MODAL --- */
.modal-overlay.active { opacity: 1; pointer-events: auto; }
.modal-overlay.active .modal { transform: scale(1); }

.settings-modal {
    width: 420px;
}

.input-with-button {
    display: flex;
    gap: 8px;
    align-items: center;
}

.input-with-button input {
    flex: 1;
}

.input-with-button .icon-btn {
    flex-shrink: 0;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.key-status {
    display: block;
    font-size: 12px;
    margin-top: 8px;
    color: var(--text-tertiary);
}

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

.key-status.warning {
    color: #f59e0b;
}

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

/* --- PROMPT EDITOR MODAL (M73) --- */
.prompt-editor-modal {
    width: 800px;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease-out;
}

.prompt-editor-modal.test-panel-open {
    width: 1200px;
}

.prompt-editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}

.prompt-editor-version-nav {
    display: flex;
    align-items: center;
    gap: 8px;
}

.prompt-editor-version-nav button {
    background: none;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prompt-editor-version-nav button:hover:not(:disabled) {
    border-color: var(--border-focus);
    color: var(--text-primary);
}

.prompt-editor-version-nav button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.version-display {
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 60px;
    text-align: center;
}

.prompt-editor-body {
    display: flex;
    flex: 1;
    min-height: 0;
    gap: 20px;
    overflow: hidden;
}

.prompt-editor-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.prompt-editor-main label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.prompt-editor-main textarea {
    flex: 1;
    width: 100%;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
}

.prompt-editor-main textarea:focus {
    border-color: var(--border-focus);
    outline: none;
}

/* Prompt editor input fields */
.prompt-editor-fields {
    margin-bottom: 16px;
}

.prompt-editor-fields .field-row {
    display: flex;
    gap: 16px;
}

.prompt-editor-fields .field-group {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.prompt-editor-fields .field-group label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.prompt-editor-fields .field-group label .optional {
    font-weight: 400;
    color: var(--text-tertiary);
    font-size: 11px;
}

.prompt-editor-fields .field-group input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
}

.prompt-editor-fields .field-group input:focus {
    border-color: var(--border-focus);
    outline: none;
}

.prompt-editor-fields .field-group input::placeholder {
    color: var(--text-tertiary);
}

/* Slide-out test panel */
.prompt-test-panel {
    width: 0;
    overflow: hidden;
    border-left: 0 solid var(--border);
    display: flex;
    flex-direction: column;
    background: var(--bg-secondary);
    transition: width 0.3s ease-out, border-width 0.3s ease-out, padding 0.3s ease-out;
}

.prompt-editor-modal.test-panel-open .prompt-test-panel {
    width: 400px;
    border-left-width: 1px;
}

.prompt-test-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    font-weight: 500;
    font-size: 14px;
}

.prompt-test-panel .close-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.prompt-test-panel .close-btn:hover {
    color: var(--text-primary);
}

.prompt-test-content {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
}

.prompt-test-panel .test-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 12px;
    color: var(--text-secondary);
}

.prompt-test-panel .test-output {
    font-size: 13px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.prompt-test-panel .test-error {
    color: var(--accent-red);
    font-size: 13px;
}

.prompt-editor-modal .modal-actions {
    margin-top: 20px;
}

/* M75: Prompt editor state indicators */
.prompt-editor-header .dirty-indicator {
    color: var(--accent-orange, #f59e0b);
    font-size: 18px;
    font-weight: bold;
    margin-left: 4px;
}

.prompt-editor-header .publish-marker {
    color: var(--accent-green, #22c55e);
    font-size: 12px;
    padding: 2px 8px;
    background: rgba(34, 197, 94, 0.1);
    border-radius: var(--radius-sm);
    margin-left: 8px;
}

.prompt-editor-modal .prompt-error {
    color: var(--accent-red, #ef4444);
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.prompt-editor-modal .fork-notification {
    color: var(--accent-blue, #3b82f6);
    font-size: 13px;
    padding: 8px 12px;
    background: rgba(59, 130, 246, 0.1);
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
}

.prompt-editor-modal .fork-notification .source-title {
    font-weight: 600;
}

/* Action dropdown: gear icon and create buttons */
.edit-action-btn {
    background: none;
    border: none;
    padding: 2px 6px;
    cursor: pointer;
    font-size: 14px;
    opacity: 0.6;
    transition: opacity 0.2s;
    margin-left: auto;
}

.edit-action-btn:hover {
    opacity: 1;
}

.action-create-buttons {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border-top: 1px solid var(--border);
}

.action-create-buttons .create-webhook-btn,
.action-create-buttons .create-ai-action-btn {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    cursor: pointer;
    text-align: left;
    transition: all 0.2s;
}

.action-create-buttons .create-webhook-btn:hover,
.action-create-buttons .create-ai-action-btn:hover {
    border-color: var(--border-focus);
    color: var(--text-primary);
    background: var(--bg-hover);
    border-style: solid;
}

/* Mobile responsiveness for prompt editor */
@media (max-width: 1024px) {
    .prompt-editor-modal {
        width: 95vw;
    }

    .prompt-editor-modal.test-panel-open {
        width: 95vw;
    }

    .prompt-editor-modal.test-panel-open .prompt-test-panel {
        width: 300px;
    }
}

@media (max-width: 768px) {
    .prompt-editor-header {
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
    }

    .prompt-editor-modal.test-panel-open .prompt-test-panel {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        width: 100%;
        background: var(--bg-card);
        z-index: 1;
    }
}

/* --- TOAST NOTIFICATIONS (Task 134 PR3) --- */
.toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-primary);
    box-shadow: var(--shadow-md);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 10000;
    border: 1px solid var(--border);
    max-width: 400px;
    text-align: center;
}

.toast.visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast-warning {
    border-left: 4px solid #f59e0b; /* Amber warning */
}

.toast-info {
    border-left: 4px solid var(--accent-blue);
}

.toast-error {
    border-left: 4px solid var(--accent-red);
}

/* --- SERVICE SETTINGS (Milestone 12) --- */
.service-settings {
    border-top: 1px solid var(--border);
    padding-top: 16px;
    margin-top: 8px;
}

.service-settings.hidden {
    display: none;
}

.service-url {
    display: block;
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-bottom: 12px;
    font-family: monospace;
}

/* Whisper status styling */
#whisperStatus {
    display: block;
    margin-top: 8px;
}

/* --- TAGS (Milestone 15) --- */

/* Sidebar tag pills (compact) */
.sidebar-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 8px;
}

.tag-pill-sm {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    padding: 2px 6px;
    background: var(--bg-hover);
    color: var(--text-secondary);
    border-radius: 4px;
    white-space: nowrap;
}

/* Tag color dot (Milestone 16) */
.tag-color-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tag-overflow {
    font-size: 10px;
    padding: 2px 6px;
    color: var(--text-tertiary);
}

/* Transcript header tags section */
.tags-section {
    margin-top: 12px;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.tag-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    padding: 4px 8px;
    background: var(--bg-hover);
    color: var(--text-primary);
    border-radius: 4px;
    transition: background 0.15s;
}

.tag-pill:hover {
    background: var(--bg-active);
}

.tag-remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    font-size: 14px;
    line-height: 1;
    color: var(--text-tertiary);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    margin-left: 2px;
    border-radius: 50%;
    transition: all 0.15s;
}

.tag-remove:hover {
    color: var(--accent-red);
    background: var(--accent-red-bg);
}

.tag-add-btn {
    font-size: 12px;
    padding: 4px 8px;
    color: var(--text-tertiary);
    background: none;
    border: 1px dashed var(--border);
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.tag-add-btn:hover {
    color: var(--text-primary);
    border-color: var(--text-tertiary);
    background: var(--bg-hover);
}

.tag-input {
    font-size: 12px;
    padding: 4px 8px;
    margin: 4px 8px;
    min-width: 120px;
    max-width: 200px;
    border: 1px solid var(--border-focus);
    border-radius: 4px;
    background: var(--bg-app);
    color: var(--text-primary);
    outline: none;
}

.tag-input::placeholder {
    color: var(--text-tertiary);
}

/* Tag dropdown (CM-005) */
.tag-dropdown {
    position: relative;
    display: inline-block;
}

.tag-dropdown-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    min-width: 180px;
    margin-top: 4px;
}

.tag-dropdown.open .tag-dropdown-list {
    display: block;
}

/* Reuses existing .dropdown-item styles */
.tag-dropdown-item {
    flex-direction: row !important;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
}

.tag-dropdown-item.hidden {
    display: none;
}

.tag-dropdown-name {
    flex: 1;
}

/* Tag delete button in dropdown (CM-007) */
.tag-delete-btn {
    margin-left: auto;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    line-height: 1;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.tag-dropdown-item:hover .tag-delete-btn {
    opacity: 1;
}

.tag-delete-btn:hover {
    color: var(--status-recording);
    background: rgba(239, 68, 68, 0.1);
}

/* ═══════════════════════════════════════════════════════════════
 * M97: HOVER DROPDOWN PATTERNS
 * ═══════════════════════════════════════════════════════════════ */

/* Tags hover dropdown wrapper */
.tags-dropdown-wrapper {
    position: relative;
    display: inline-block;
}

.tags-dropdown-wrapper .tag-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 100;
    padding: 4px 0;
}

/* M97.1: Override .tag-dropdown-list styles when inside hover menu */
.tags-dropdown-wrapper .tag-dropdown-list {
    display: block;
    position: static;
    background: none;
    border: none;
    box-shadow: none;
    margin-top: 0;
    padding: 0;
    max-height: none;
}

.tags-dropdown-wrapper:hover .tag-dropdown-menu,
.tags-dropdown-wrapper.focus-locked .tag-dropdown-menu {
    display: block;
}

/* Speaker hover dropdown wrapper */
.speaker-dropdown-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.speaker-dropdown-wrapper .speaker-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 0;
}

.speaker-dropdown-wrapper:hover .speaker-dropdown-menu,
.speaker-dropdown-wrapper.focus-locked .speaker-dropdown-menu {
    display: block;
}

/* Touch device fallback */
@media (hover: none) {
    .tags-dropdown-wrapper.touch-open .tag-dropdown-menu,
    .speaker-dropdown-wrapper.touch-open .speaker-dropdown-menu {
        display: block;
    }
}

/* Action trigger tab (WF-007) */
.action-trigger-tab {
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 4px;
    color: var(--text-secondary);
    padding: 4px 12px;
    margin-left: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    min-width: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-trigger-tab:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.action-trigger-tab:disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.queued-badge {
    background: var(--accent);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
}

/* Action trigger dropdown */
.action-trigger-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    min-width: 220px;
    max-width: 300px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

/* Wrapper for positioning context */
.action-trigger-wrapper {
    position: relative;
    display: inline-block;
}

/* Show dropdown on hover */
.action-trigger-wrapper:hover .action-trigger-dropdown {
    display: block;
}

.action-trigger-dropdown .dropdown-note {
    padding: 8px 12px;
    font-size: 12px;
    color: var(--text-tertiary);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border);
}

.action-trigger-dropdown .dropdown-empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
}

.action-trigger-list {
    max-height: 240px;
    overflow-y: auto;
}

.action-trigger-item {
    width: 100%;
    padding: 10px 12px;
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    text-align: left;
    color: var(--text-primary);
    font-size: 13px;
    transition: background 0.15s;
}

.action-trigger-item:hover:not(:disabled) {
    background: var(--bg-hover);
}

.action-trigger-item:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.action-trigger-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Dropdown divider and new action button */
.dropdown-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.action-new-btn {
    color: var(--accent);
}

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

.queued-indicator {
    font-size: 11px;
    color: var(--accent);
    margin-left: 8px;
    flex-shrink: 0;
}

.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* --- ACTION TABS (WF-009) --- */

/* Action tab styling */
.transcript-tab.action-tab {
    position: relative;
    padding-right: 24px; /* Space for close button */
    max-width: 150px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.transcript-tab.action-tab .tab-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.transcript-tab .tab-close {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
    color: var(--text-tertiary);
    opacity: 0;
    transition: opacity 0.2s, background-color 0.2s;
}

.transcript-tab.action-tab:hover .tab-close {
    opacity: 1;
}

.transcript-tab .tab-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Disabled action in dropdown (has existing tab) */
.action-trigger-item.has-tab {
    opacity: 0.5;
    cursor: not-allowed;
}

.action-trigger-item .has-tab-indicator {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-left: 8px;
}

/* Tab content - pending state */
.action-tab-pending {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    color: var(--text-secondary);
}

.action-tab-pending .processing-spinner {
    margin-bottom: 16px;
}

.action-tab-subtitle {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
}

/* Tab content - error state */
.action-tab-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px 0;
    color: var(--status-recording);
}

.action-tab-error .error-icon {
    margin-bottom: 16px;
    stroke: var(--status-recording);
}

.action-tab-error-message {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 8px;
    max-width: 400px;
    text-align: center;
}

/* Tab content - result state */
.action-tab-result {
    padding: 0 10px 0 0;
    flex: 1;
    overflow-y: auto;
}

.action-output-raw {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    overflow-x: auto;
    font-size: 12px;
    color: var(--text-secondary);
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.action-tab-empty {
    color: var(--text-tertiary);
    text-align: center;
    padding: 20px 0;
}

/* Tab content wrapper (M22 v3) */
.action-tab-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header bar with delete button (M22 v3) */
.action-tab-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 4px 8px;
}

/* Circular delete button (M22 v3) */
.action-tab-delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-primary);
    color: var(--text-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.action-tab-delete-btn:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: white;
}

.action-tab-delete-btn svg {
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════════════
 * TAB CONTENT STRUCTURE (M80)
 * Shared wrapper pattern for transcript and action tabs
 * ═══════════════════════════════════════════════════════════════ */

.tab-content-wrapper {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.tab-content-header {
    display: flex;
    align-items: center;
    padding: 4px 16px 8px;
    gap: 12px;
    flex-shrink: 0;
}

.tab-content-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    scroll-behavior: smooth;  /* M97: Moved from .transcript-container */
    padding-top: 8px;
}

/* Transcript and action tab headers - controls aligned right */
.tab-content-header--transcript,
.tab-content-header--action {
    justify-content: flex-end;
}

/* Batch button processing state */
#batchProcessBtn.batch-processing {
    pointer-events: none;
    opacity: 0.8;
}

#batchProcessBtn.batch-processing .spinner {
    display: inline-block;
}

/* --- TASK CARDS (M68) --- */
.task-cards-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 8px 0;
}

.task-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.task-card:hover {
    border-color: var(--text-tertiary);
    box-shadow: var(--shadow-sm);
}

.task-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.task-card-checkbox {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 2px;
    border: 2px solid var(--border);
    border-radius: 4px;
    background: transparent;
}

.task-card-title {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
}

.task-card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-left: 28px;
}

.priority-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 500;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.priority-badge.priority-high {
    background: var(--accent-red-bg);
    color: var(--accent-red);
}

.priority-badge.priority-medium {
    background: #fef3c7;
    color: #d97706;
}

.priority-badge.priority-low {
    background: var(--accent-green-bg);
    color: var(--accent-green);
}

@media (prefers-color-scheme: dark) {
    .priority-badge.priority-medium {
        background: #451a03;
        color: #fbbf24;
    }
}

.assignee-badge,
.due-date-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-hover);
    border-radius: 4px;
}

.assignee-badge::before {
    content: "@";
    margin-right: 2px;
    color: var(--text-tertiary);
}

.task-card-context {
    margin-left: 28px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.task-cards-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* --- MARKDOWN OUTPUT STYLES (M23 Plan D) --- */
.action-output-markdown {
    padding: 0;
    line-height: 1.6;
    color: var(--text-primary);
}

.action-output-markdown h1,
.action-output-markdown h2,
.action-output-markdown h3,
.action-output-markdown h4,
.action-output-markdown h5,
.action-output-markdown h6 {
    margin-top: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.3;
}

.action-output-markdown h1 { font-size: 24px; }
.action-output-markdown h2 { font-size: 20px; border-bottom: 1px solid var(--border); padding-bottom: 8px; }
.action-output-markdown h3 { font-size: 16px; }
.action-output-markdown h4 { font-size: 14px; }
.action-output-markdown h5 { font-size: 13px; }
.action-output-markdown h6 { font-size: 12px; color: var(--text-secondary); }

.action-output-markdown h1:first-child,
.action-output-markdown h2:first-child,
.action-output-markdown h3:first-child,
.action-output-markdown h4:first-child {
    margin-top: 0;
}

.action-output-markdown p {
    margin: 12px 0;
}

.action-output-markdown p:first-child {
    margin-top: 0;
}

.action-output-markdown p:last-child {
    margin-bottom: 0;
}

.action-output-markdown ul,
.action-output-markdown ol {
    margin: 12px 0;
    padding-left: 24px;
}

.action-output-markdown li {
    margin: 6px 0;
}

.action-output-markdown li > ul,
.action-output-markdown li > ol {
    margin: 4px 0;
}

.action-output-markdown strong {
    font-weight: 600;
    color: var(--text-primary);
}

.action-output-markdown em {
    font-style: italic;
}

.action-output-markdown code {
    font-family: var(--font-mono);
    background: var(--bg-hover);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 13px;
}

.action-output-markdown pre {
    background: var(--bg-sidebar);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    margin: 16px 0;
}

.action-output-markdown pre code {
    background: none;
    padding: 0;
    font-size: 13px;
}

.action-output-markdown blockquote {
    border-left: 3px solid var(--accent-blue);
    padding-left: 16px;
    margin: 16px 0;
    color: var(--text-secondary);
}

.action-output-markdown hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 24px 0;
}

.action-output-markdown a {
    color: var(--accent-blue);
    text-decoration: none;
}

.action-output-markdown a:hover {
    text-decoration: underline;
}

.action-output-markdown table {
    width: 100%;
    border-collapse: collapse;
    margin: 16px 0;
}

.action-output-markdown th,
.action-output-markdown td {
    border: 1px solid var(--border);
    padding: 8px 12px;
    text-align: left;
}

.action-output-markdown th {
    background: var(--bg-sidebar);
    font-weight: 600;
}

.action-output-markdown img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-md);
}

/* ========================================
   AUDIO PLAYER (AP-001)
   ======================================== */

.audio-player {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.audio-player.visible {
    display: flex;
}

.audio-player-btn {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: var(--accent-primary);
    color: var(--accent-text);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    transition: opacity 0.15s ease;
}

.audio-player-btn:hover {
    opacity: 0.9;
}

/* Toggle play/pause icons */
.audio-player-btn .pause-icon {
    display: none;
}

.audio-player.playing .audio-player-btn .play-icon {
    display: none;
}

.audio-player.playing .audio-player-btn .pause-icon {
    display: block;
}

.audio-time {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 45px;
    text-align: center;
}

/* Styled range input as progress bar */
.audio-seek {
    flex: 1;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-hover);
    border-radius: 3px;
    cursor: pointer;
}

.audio-seek::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    background: var(--accent-blue);
    border-radius: 50%;
    cursor: pointer;
}

.audio-seek::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--accent-blue);
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

/* ========================================
   AUTH MODALS (M38)
   ======================================== */

.auth-modal {
    width: 380px;
    text-align: center;
}

.auth-modal h3 {
    font-size: 20px;
    margin-bottom: 4px;
}

.auth-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px !important;
}

.auth-modal .form-group {
    text-align: left;
}

.auth-modal .form-group label {
    font-size: 13px;
}

.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    justify-content: center;
    margin-top: 40px;
}

.form-error {
    display: none;
    color: var(--accent-red);
    font-size: 13px;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: var(--accent-red-bg);
    border-radius: var(--radius-sm);
    text-align: left;
}

.auth-switch {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 20px;
    margin-bottom: 0 !important;
}

.auth-switch a {
    color: var(--accent-blue);
    text-decoration: none;
    font-weight: 500;
}

.auth-switch a:hover {
    text-decoration: underline;
}

/* OAuth Buttons (M44) */
.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, opacity 0.2s;
}

.oauth-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.oauth-btn-google {
    background: #fff;
    color: #333;
    border: 1px solid #ddd;
}

.oauth-btn-google:hover:not(:disabled) {
    background: #f8f8f8;
}

.oauth-btn-microsoft {
    background: #2f2f2f;
    color: #fff;
    border: 1px solid #2f2f2f;
}

.oauth-btn-microsoft:hover:not(:disabled) {
    background: #3f3f3f;
}

.oauth-icon {
    flex-shrink: 0;
}

.oauth-divider {
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-tertiary);
    margin: 16px 0;
}

.oauth-divider::before,
.oauth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border);
}

.oauth-divider span {
    padding: 0 12px;
    font-size: 13px;
}

.oauth-error {
    display: none;
    color: var(--accent-red);
    font-size: 13px;
    margin-bottom: 16px;
    padding: 10px 12px;
    background: var(--accent-red-bg);
    border-radius: var(--radius-sm);
    text-align: center;
}

.oauth-error.visible {
    display: block;
}

/* Profile Dropdown */
.profile-dropdown {
    position: relative;
}

.profile-btn {
    border-radius: var(--radius-sm);
}

.profile-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    min-width: 180px;
    z-index: 100;
    overflow: hidden;
}

.profile-dropdown.open .profile-menu {
    display: block;
}

.profile-email {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.profile-menu-item {
    width: 100%;
    padding: 10px 16px;
    text-align: left;
    font-size: 14px;
    color: var(--text-primary);
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.profile-menu-item:hover {
    background: var(--bg-hover);
}

/* --- M45: CLICK-TO-PLAY TRANSCRIPT SEGMENTS --- */

/* Clickable segment spans */
.transcript-segment {
    cursor: pointer;
    padding: 2px 4px;
    margin: 0 -2px;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s ease;
}

/* Hover state for segments */
.message-text[data-has-audio="true"] .transcript-segment:hover {
    background-color: var(--bg-hover);
}

/* Currently playing segment highlight */
.transcript-segment.segment-playing {
    background-color: var(--accent-green-bg);
    color: var(--accent-green);
    font-weight: 500;
}

/* --- M110: AUTO-SCROLL INDICATOR --- */

.autoscroll-indicator {
    position: sticky;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 16px;
    background: var(--primary-color, #3b82f6);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 0.875rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 10;
    display: block;
    margin: 0 auto;
}

.autoscroll-indicator:hover {
    filter: brightness(1.1);
}

/* --- M46: CALENDAR SECTION --- */

.sidebar-section {
    border-bottom: 1px solid var(--border);  /* M97: Changed from border-top since calendar now at top */
    padding: 12px;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.calendar-header h3 {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0;
}

.calendar-empty,
.calendar-loading,
.calendar-error {
    font-size: 12px;
    color: var(--text-tertiary);
    padding: 8px 0;
}

.calendar-loading .spinner {
    display: inline-block;
    width: 12px;
    height: 12px;
    border: 2px solid var(--border);
    border-top-color: var(--accent-blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.calendar-error {
    color: var(--accent-red);
}

/* M50: Calendar connect button section */
.calendar-connect {
    padding: 12px 0;
}

.calendar-connect p {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0 0 12px 0;
}

.calendar-connect-btn {
    display: block;
    width: 100%;
    margin-bottom: 8px;
    font-size: 12px;
    padding: 8px 12px;
}

.calendar-connect-error {
    font-size: 11px;
    color: var(--accent-red);
    margin-top: 8px;
    padding: 6px 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-sm);
}

.calendar-events {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.calendar-event {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background 0.15s;
    border: 1px solid rgba(128, 128, 128, 0.15);
}

.calendar-event:hover {
    background: var(--bg-hover);
}

.calendar-event.selected {
    background: var(--bg-active);
    border: 1px solid var(--accent-primary);
}

.calendar-event-time {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-tertiary);
    white-space: nowrap;
}

.calendar-event-separator {
    color: var(--text-tertiary);
    font-size: 12px;
}

.calendar-event-title {
    flex: 1;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.calendar-event-provider {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-top: 2px;
}

.provider-icon {
    display: inline-block;
    width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
    font-size: 9px;
    font-weight: 600;
    border-radius: 2px;
    background: var(--bg-hover);
}

/* Calendar event expansion styles (M57) */
.calendar-event-expanded {
    margin-top: 10px;
    margin-left: 38px; /* align with content (icon width + gap) */
    padding-top: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
}

.event-attendees {
    margin-bottom: 8px;
}

.event-attendees strong {
    font-size: 11px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.event-attendees ul {
    margin: 4px 0 0 0;
    padding: 0;
    list-style: none;
}

.event-attendees li {
    padding: 2px 0;
    color: var(--text-secondary);
}

.event-description {
    color: var(--text-secondary);
    margin-bottom: 10px;
    line-height: 1.4;
    max-height: 150px;
    overflow-y: auto;
}

/* M77: Scrollbar hidden until hover */
.event-description::-webkit-scrollbar {
    width: 6px;
}

.event-description::-webkit-scrollbar-track {
    background: transparent;
}

.event-description::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 3px;
}

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

.event-actions {
    margin-top: 12px;
}

.join-record-btn {
    width: 100%;
    background: var(--accent-blue);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
}

.join-record-btn:hover:not(:disabled) {
    filter: brightness(0.9);
}

.join-record-btn:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* M63: Calendar event layout */
.calendar-event-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.calendar-platform-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    flex-shrink: 0;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.calendar-platform-icon.zoom {
    background-image: url("/assets/icons/zoom.svg");
    background-size: 20px;
    background-position: center;
    background-repeat: no-repeat;
}

.calendar-platform-icon.teams {
    background-image: url("/assets/icons/teams.svg");
    background-size: 20px;
    background-position: center;
    background-repeat: no-repeat;
}

.calendar-platform-icon.meet {
    background-image: url("/assets/icons/meet.svg");
    background-size: 20px;
    background-position: center;
    background-repeat: no-repeat;
}

.calendar-platform-icon.generic {
    background-image: url("/assets/icons/calendar.svg");
    background-size: 18px;
    background-position: center;
    background-repeat: no-repeat;
}

.calendar-event-content {
    flex: 1;
    min-width: 0;
}

.calendar-event-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 2px;
}

/* Expanded event styling */
.calendar-event.expanded {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
}

.expand-chevron {
    font-size: 10px;
    color: var(--text-tertiary);
    transition: transform 0.2s ease;
}

.calendar-event.expanded .expand-chevron {
    color: var(--text-primary);
}

.calendar-event-badges {
    display: flex;
    gap: 6px;
}

.event-badge {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    color: var(--text-tertiary);
}

.attendees-badge {
    gap: 3px;
}

/* Smooth expansion animation */
.calendar-event-expanded {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =============================================================================
 * M82: Meeting Participants Circles
 * ========================================================================== */

.participant-circles {
    display: flex;
    align-items: center;
    margin-top: 8px;
}

.participant-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-active);
    border: 2px solid var(--bg-card);
    color: var(--text-primary);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -8px;
    cursor: default;
    transition: transform 0.15s ease;
}

.participant-circle:first-child {
    margin-left: 0;
}

.participant-circle:hover {
    transform: scale(1.1);
    z-index: 100 !important;
}

/* Host has distinct styling */
.participant-circle--host {
    background: var(--accent-primary);
    color: var(--accent-text);
    border-color: var(--bg-card);
}

/* =============================================================================
 * M89: Speaker-Participant Linking Dropdown
 * ========================================================================== */

/* Clickable speaker name with dropdown */
.speaker-name--clickable {
    cursor: pointer;
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background-color 0.15s ease;
}

.speaker-name--clickable:hover {
    background-color: var(--bg-active);
}

.speaker-name--clickable .dropdown-chevron {
    opacity: 0.5;
    transition: transform 0.15s ease, opacity 0.15s ease;
}

.speaker-name--clickable:hover .dropdown-chevron {
    opacity: 1;
}

/* Linked badge indicator */
.speaker-linked-badge {
    color: var(--accent-primary);
    font-size: 8px;
    margin-left: 2px;
    vertical-align: middle;
}

/* Speaker dropdown menu */
.speaker-dropdown-menu {
    position: absolute;  /* M97: Changed from fixed to scroll with content */
    z-index: 1000;
    min-width: 220px;
    max-width: 280px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 4px 0;
}

/* Speaker filter input */
.speaker-filter-input {
    width: calc(100% - 16px);
    margin: 4px 8px 8px;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-main);
    color: var(--text-primary);
    font-size: 13px;
}

.speaker-filter-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

.speaker-filter-input::placeholder {
    color: var(--text-muted);
}

/* Speaker dropdown items container */
.speaker-dropdown-items {
    max-height: 200px;
    overflow-y: auto;
}

/* Speaker dropdown item */
.speaker-dropdown-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background-color 0.1s ease;
}

.speaker-dropdown-item:hover {
    background-color: var(--bg-active);
}

.speaker-dropdown-item .participant-name {
    color: var(--text-primary);
    font-weight: 500;
    font-size: 13px;
}

.speaker-dropdown-item .participant-email {
    color: var(--text-muted);
    font-size: 11px;
}

.speaker-dropdown-items .no-results {
    padding: 12px;
    color: var(--text-muted);
    font-size: 13px;
    text-align: center;
}

/* M115: Create participant option in speaker dropdown */
.speaker-dropdown-create {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    cursor: pointer;
    color: var(--accent-color);
    border-bottom: 1px solid var(--border-color);
}

.speaker-dropdown-create:hover {
    background: var(--hover-bg);
}

.speaker-dropdown-create .create-icon {
    font-weight: bold;
    font-size: 1.1em;
}

.speaker-dropdown-create .create-text {
    font-style: italic;
}
