/* --- 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;
    --accent-amber: #f59e0b;
    --accent-amber-bg: #fef3c7;

    /* Component backgrounds (Task 171 - fix undefined --bg-primary) */
    --bg-primary: #ffffff;

    /* 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) {
    /* Only apply OS dark preference when no explicit data-theme is set (Task 178) */
    :root:not([data-theme]) {
        --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;
        --accent-amber: #fbbf24;
        --accent-amber-bg: #451a03;
        --bg-primary: #171717;
    }
}

/* ═══════════════════════════════════════════════════════════════
   THEME OVERRIDES (Task 178)
   User preference via [data-theme] overrides @media (prefers-color-scheme)
   NOTE: Only dark override needed - :root already has light values.
   ═══════════════════════════════════════════════════════════════ */

html[data-theme="dark"] {
    --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;
    --accent-amber: #fbbf24;
    --accent-amber-bg: #451a03;
    --bg-primary: #171717;
}

/* ═══════════════════════════════════════════════════════════════
   THEME TOGGLE (Task 178)
   Segmented control in profile dropdown
   ═══════════════════════════════════════════════════════════════ */

.theme-toggle {
    display: flex;
    gap: 2px;
    padding: 8px;
    border-top: 1px solid var(--border);
    background-color: var(--bg-hover);
    border-radius: 0 0 8px 8px;
}

.theme-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

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

.theme-btn.active {
    color: var(--text-primary);
    background-color: var(--bg-card);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

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

/* --- 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 .app-logo {
    height: 40px;
    width: auto;
    vertical-align: middle;
    margin-top: 10px;
    margin-left: 15px;
}

.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); }

/* ─── Participant Filter (Task 189) ──────────────────────── */
.sidebar-filter {
    padding: 10px 12px 6px;
}

.sidebar-filter__input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.sidebar-filter__icon {
    position: absolute;
    left: 10px;
    color: var(--text-tertiary, var(--text-secondary));
    pointer-events: none;
    transition: color 0.2s;
}

.sidebar-filter__input-wrap:focus-within .sidebar-filter__icon {
    color: var(--text-secondary);
}

.sidebar-filter__input {
    width: 100%;
    padding: 8px 32px 8px 32px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--bg-hover);
    color: var(--text-primary);
    font-size: 0.8rem;
    outline: none;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.sidebar-filter__input:hover {
    background: var(--bg-active, var(--bg-hover));
}

.sidebar-filter__input:focus {
    background: var(--bg-primary);
    border-color: var(--accent-blue, var(--accent));
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.sidebar-filter__input::placeholder {
    color: var(--text-tertiary, var(--text-secondary));
}

.sidebar-filter__clear {
    position: absolute;
    right: 6px;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 4px;
    color: var(--text-tertiary, var(--text-secondary));
    cursor: pointer;
    font-size: 0.85rem;
    line-height: 1;
    transition: color 0.15s, background 0.15s;
}

.sidebar-filter__clear:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.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);
    margin-right: auto;
    min-width: 0;
    overflow: hidden;
}
.conv-id-text {
    display: inline-block;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conversation-item:hover .conv-id-text {
    overflow: visible;
    text-overflow: clip;
    max-width: none;
    animation: marquee-scroll var(--scroll-duration, 0s) linear infinite alternate;
}
@keyframes marquee-scroll {
    0%, 15% { transform: translateX(0); }
    85%, 100% { transform: translateX(var(--scroll-offset, 0px)); }
}
.conv-date { font-size: 12px; color: var(--text-tertiary); }

/* Task 183: Sidebar activity indicator */
.conv-activity-indicator {
    flex-shrink: 0;
    margin-left: 6px;
    font-size: 12px;
    line-height: 1;
}
.conv-activity-indicator.spinner-small {
    width: 12px;
    height: 12px;
    border-width: 1.5px;
}
.conv-activity-success { color: var(--accent-green); font-weight: 700; }
.conv-activity-error { color: var(--accent-red); font-weight: 700; }

.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); }

/* Task 254: Client cards in mixed sidebar */
.client-card {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 5px;
    cursor: pointer;
    border: 1px solid transparent;
    background-color: rgba(37, 99, 235, 0.06);
    transition: all 0.2s ease;
}
.client-card:hover {
    background-color: rgba(37, 99, 235, 0.1);
}
.client-card.active {
    background-color: rgba(37, 99, 235, 0.12);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}
.client-header {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}
.client-name {
    font-weight: 600;
    font-size: 13.5px;
    letter-spacing: -0.01em;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.client-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: var(--text-tertiary);
}
.client-conv-count {
    color: var(--text-secondary);
    font-size: 11.5px;
}
.client-last-activity {
    color: var(--text-tertiary);
    font-size: 11.5px;
}
/* Task 254: Client summary placeholder */
.client-summary-placeholder h3 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* Dark mode: shift tint to work on dark surfaces */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme]) .client-card { background-color: rgba(96, 165, 250, 0.08); }
    :root:not([data-theme]) .client-card:hover { background-color: rgba(96, 165, 250, 0.13); }
    :root:not([data-theme]) .client-card.active { background-color: rgba(96, 165, 250, 0.16); }
}
html[data-theme="dark"] .client-card { background-color: rgba(96, 165, 250, 0.08); }
html[data-theme="dark"] .client-card:hover { background-color: rgba(96, 165, 250, 0.13); }
html[data-theme="dark"] .client-card.active { background-color: rgba(96, 165, 250, 0.16); }

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

/* --- 4. MAIN CONTENT --- */
.main-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    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; }
.status-dot.paused { background-color: var(--accent-amber); animation: pulse-amber 2s infinite; }

@keyframes pulse-amber {
    0% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.4); }
    70% { box-shadow: 0 0 0 6px rgba(245, 158, 11, 0); }
    100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}

@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); }

/* Task 186: Inline button group for pause/resume + stop */
.btn-group { display: flex; gap: 8px; }
.btn-group .btn { flex: 1; }

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

/* Task 171: Secondary button with visible contrast in dark mode */
.btn-secondary {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}
.btn-secondary:hover {
    background-color: var(--bg-active);
    border-color: var(--text-tertiary);
}

/* Transcript View */
.transcript-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    min-width: 0;
    padding: 10px;
    overflow: hidden;
    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; }

/* Content header — step-specific section in client header bar (Task 264) */
#clientHeader .client-header-identity {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}
#clientHeader .content-header-divider {
    width: 1px;
    align-self: stretch;
    background: var(--border);
    margin: 0 0.25rem;
}
#clientHeader .content-header-step {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex: 1;
    min-width: 0;
    gap: 0.75rem;
}
#clientHeader .content-header-left {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}
#clientHeader .content-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.25rem;
    flex-shrink: 0;
}
/* Meeting header: 3-column grid (50% title, 25% participants, 25% tags) */
#clientHeader .content-header-step--meeting {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: flex-start;
}
#clientHeader .content-header-participants {
    display: flex;
    justify-content: center;
    overflow: hidden;
}
#clientHeader .content-header-tags {
    display: flex;
    justify-content: flex-end;
    overflow: hidden;
}
#clientHeader .content-header-tags .tag-pill {
    font-size: 10px;
    padding: 2px 6px;
}
#clientHeader .content-header-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    padding: 2px 4px;
    margin: -2px -4px;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
#clientHeader .content-header-title[contenteditable="true"]:hover {
    background-color: var(--bg-hover);
}
#clientHeader .content-header-title[contenteditable="true"]:focus {
    background-color: var(--bg-active);
    outline: none;
}
#clientHeader .content-header-subtitle {
    font-size: 0.8rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Content header bar — standalone mode (no client identity) */
.content-header-bar {
    display: flex;
    align-items: flex-start;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg-card);
    flex-shrink: 0;
}

/* Transcript Tab Bar (Milestone 18) */
.transcript-tabs {
    display: flex;
    gap: 4px;
    margin-top: 0;
    margin-bottom: 0;
    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: var(--bg-card);
    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;
    padding: 5px;
    position: relative;  /* For absolute-positioned overlays */
    font-size: 13px;
}

.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 15px 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.4;
    color: var(--text-secondary);
    font-size: 13px;
}

/* 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; }
    .close-sidebar-btn { display: block !important; }
}
.hamburger { display: none; margin-right: 16px; }
.close-sidebar-btn { display: none; }

/* --- 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);
}

/* --- ERROR MODAL (Task 176) --- */
.error-modal {
    text-align: center;
    max-width: 400px;
}

.error-modal .error-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-modal .error-icon.critical {
    background: rgba(239, 68, 68, 0.15);
}

.error-modal .error-icon.critical::before {
    content: '!';
    font-size: 24px;
    font-weight: bold;
    color: var(--accent-red);
}

.error-modal .error-icon.minor {
    background: rgba(245, 158, 11, 0.15);
}

.error-modal .error-icon.minor::before {
    content: '!';
    font-size: 24px;
    font-weight: bold;
    color: #f59e0b;
}

.error-modal .error-message {
    color: var(--text-secondary);
    margin-bottom: 16px;
    line-height: 1.5;
}

.error-modal .error-progress {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin-bottom: 16px;
    overflow: hidden;
}

.error-modal .error-progress::after {
    content: '';
    display: block;
    height: 100%;
    width: 100%;
    background: var(--accent-blue);
    animation: shrink 5s linear forwards;
}

.error-modal .error-progress.hidden {
    display: none;
}

@keyframes shrink {
    from { width: 100%; }
    to { width: 0%; }
}


/* --- 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 trigger inherits circle style from .action-tab-icon-btn */

.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: 640px;
    max-width: 95vw;
    padding: 0;
}

.settings-layout {
    display: flex;
    height: 620px;
}

.settings-nav {
    width: 140px;
    flex-shrink: 0;
    padding: 16px 0;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-nav-item {
    background: none;
    border: none;
    padding: 8px 16px;
    text-align: left;
    font-size: 13px;
    color: var(--text-secondary);
    cursor: pointer;
}

.settings-nav-item:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.settings-nav-item.active {
    color: var(--text-primary);
    font-weight: 600;
    background: var(--bg-hover);
}

.settings-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 16px 24px;
    min-width: 0;
    background: color-mix(in srgb, var(--bg) 85%, white);
}

.settings-page {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow-y: auto;
    padding-right: 8px;
}

.settings-page .form-group {
    margin-bottom: 8px;
}

.settings-page > .modal-actions {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding-top: 16px;
    background: var(--bg-card);
}

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

.settings-provider-value {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--text-primary);
    padding: 6px 0;
}

.settings-section-header {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.settings-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-primary);
}

.settings-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
}

.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: 1000px;
    max-width: 90vw;
    height: 90vh;
    display: flex;
    flex-direction: column;
    transition: width 0.3s ease-out;
}

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

.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;
}

/* --- VARIABLE REFERENCE PANEL (Task 272) --- */
.prompt-variable-panel {
    width: 200px;
    min-width: 200px;
    border-right: 1px solid var(--border);
    overflow-y: auto;
    flex-shrink: 0;
    transition: width 0.2s ease-out, min-width 0.2s ease-out,
                border-width 0.2s ease-out;
}

.prompt-variable-panel.collapsed {
    width: 36px;
    min-width: 36px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

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

.prompt-variable-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.prompt-variable-toggle {
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
}

.prompt-variable-toggle:hover {
    color: var(--text-primary);
    background: var(--hover-bg);
}

.prompt-variable-item {
    padding: 6px 8px;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 2px;
}

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

.prompt-variable-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.prompt-variable-key {
    font-family: 'SF Mono', 'Consolas', monospace;
    font-size: 11px;
    color: var(--text-secondary);
}

.prompt-variable-desc {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.prompt-variable-section {
    margin-bottom: 4px;
}

.prompt-variable-section-header {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    cursor: pointer;
    border-radius: 4px;
}

.prompt-variable-section-header:hover {
    background: var(--hover-bg);
}

.prompt-variable-chevron {
    transition: transform 0.15s ease;
    flex-shrink: 0;
    color: var(--text-tertiary);
}

.prompt-variable-section.collapsed .prompt-variable-chevron {
    transform: rotate(-90deg);
}

.prompt-variable-section.collapsed .prompt-variable-section-body {
    display: none;
}

.prompt-variable-empty {
    padding: 6px 8px;
    font-size: 11px;
    color: var(--text-tertiary);
    font-style: italic;
}

.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: 11px;
    line-height: 1.4;
    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);
}

.modal-actions .toggle-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: auto;
    padding-top: 4px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.modal-actions .toggle-field input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 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 {
    flex: 1;
    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;
    min-height: 0;
}

.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: 11px;
    line-height: 1.4;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'JetBrains Mono', monospace;
}

.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;
}

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

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

@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;
    }

    .prompt-variable-panel {
        display: none;
    }
}

/* --- 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: 0;
    flex-shrink: 0;
}

.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: 50%;
    color: var(--text-secondary);
    padding: 0;
    margin-left: 8px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
    width: 28px;
    height: 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-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;
}

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

.processing-spinner {
    width: 32px;
    height: 32px;
    border: 3px 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,
.proposal-trigger-item .has-tab-indicator {
    font-size: 10px;
    color: var(--text-tertiary);
    margin-left: 8px;
}

/* --- Proposal section in dropdown (Task 194) --- */

.proposal-section-divider {
    height: 1px;
    background: var(--border);
    margin: 8px 0;
}

.proposal-section-label {
    padding: 8px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-tertiary);
}

.proposal-trigger-list {
    overflow: visible;
}

/* Each insurance class group - positions the flyout */
.proposal-group {
    position: relative;
}

.proposal-group-label {
    padding: 10px 12px;
    font-size: 13px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background 0.15s;
}

.proposal-group-label:hover {
    background: var(--bg-hover);
}

.proposal-group-chevron {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* Flyout sub-menu - positioned via JS to escape dropdown clipping */
.proposal-group-flyout {
    display: none;
    position: fixed;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    z-index: 2000; /* above dropdown (~1000) */
    padding: 2px 0;
}

.proposal-trigger-item {
    width: 100%;
    padding: 8px 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;
    white-space: nowrap;
    transition: background 0.15s;
}

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

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

.proposal-trigger-item.has-tab {
    opacity: 0.5;
    cursor: not-allowed;
}

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

.proposal-templates-loading {
    padding: 12px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 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%;
}

/* Streaming content: shrink to fit so no spurious scrollbar */
.action-tab-content-wrapper:has(.action-output--streaming) {
    height: auto;
}

/* Proposal PDF viewer fills remaining space in tab content */
.proposal-pdf-viewer {
    flex: 1;
    width: 100%;
    border: none;
    min-height: 0;
}

/* Raw LLM output view */
.proposal-raw-output {
    flex: 1;
    overflow: auto;
    margin: 0;
    padding: 16px;
    font-size: 13px;
    line-height: 1.5;
    background: var(--bg-secondary);
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
}

/* Active state for raw toggle button */
.proposal-raw-toggle.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

/* Header bar with action buttons (M22 v3, Task 171: added edit button) */
.action-tab-header {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 8px;
    gap: 8px;
    flex-shrink: 0; /* Prevent header from shrinking */
}

/* Circular icon button (shared style for header buttons) */
.action-tab-icon-btn,
.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-icon-btn:hover,
.action-tab-delete-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-tertiary);
    color: var(--text-primary);
}

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

/* Task 171: Circular edit button in header (matches delete button style) */
.action-tab-edit-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-edit-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-tertiary);
    color: var(--text-primary);
}

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

/* Circular copy button in header (matches edit/delete button style) */
.action-tab-copy-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-copy-btn:hover {
    background: var(--bg-hover);
    border-color: var(--text-tertiary);
    color: var(--text-primary);
}

.action-tab-copy-btn.copied {
    color: var(--success, #22c55e);
    border-color: var(--success, #22c55e);
}

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

/* ═══════════════════════════════════════════════════════════════
 * EDITOR INTEGRATION (Task 162)
 * Styles for inline output editing
 * ═══════════════════════════════════════════════════════════════ */

/* Task 171: Removed .action-output-edit-btn float style - button moved to header */

.action-output-editor {
    padding: 0 10px 10px 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Required for flex child to scroll */
}

.editor-toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}

.editorjs-container {
    flex: 1;
    background: var(--bg-primary);
    min-height: 0; /* Required for flex child to scroll */
    overflow-y: auto;
}

/* Editor.js overrides for dark theme */
.editorjs-container .codex-editor {
    padding: 0;
}

.editorjs-container .ce-block__content {
    max-width: 100%;
}

.editor-error {
    color: var(--danger);
    font-size: 13px;
}

/* Task 171: Error bar above editor when save fails */
.editor-error-bar {
    padding: 8px 12px;
    background-color: rgba(239, 68, 68, 0.1);
    border-bottom: 1px solid var(--danger);
}

/* Task 171: Editor.js toolbar dark/light mode support */
.editorjs-container .ce-toolbar__plus,
.editorjs-container .ce-toolbar__settings-btn {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.editorjs-container .ce-toolbar__plus:hover,
.editorjs-container .ce-toolbar__settings-btn:hover {
    background-color: var(--bg-active);
}

/* Editor.js inline toolbar */
.editorjs-container .ce-inline-toolbar {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.editorjs-container .ce-inline-tool {
    color: var(--text-primary);
}

.editorjs-container .ce-inline-tool:hover {
    background-color: var(--bg-hover);
}

/* Editor.js conversion toolbar (block type dropdown) */
.editorjs-container .ce-conversion-toolbar {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
}

.editorjs-container .ce-conversion-tool {
    color: var(--text-primary);
}

.editorjs-container .ce-conversion-tool:hover {
    background-color: var(--bg-hover);
}

/* Editor.js popover menus */
.editorjs-container .ce-popover {
    background-color: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
}

.editorjs-container .ce-popover-item {
    color: var(--text-primary);
}

.editorjs-container .ce-popover-item:hover {
    background-color: var(--bg-hover);
}

.editorjs-container .ce-popover-item__icon {
    background-color: var(--bg-hover);
    border: 1px solid var(--border);
}

/* Editor.js block content text color */
.editorjs-container .ce-paragraph,
.editorjs-container .ce-header,
.editorjs-container .cdx-list__item,
.editorjs-container .cdx-quote__text,
.editorjs-container .tc-cell {
    color: var(--text-primary);
}

/* Editor.js code block */
.editorjs-container .ce-code__textarea {
    background-color: var(--bg-hover);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════════════════════
 * 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);
}

/* Streaming preview (Task 201) */
.action-output--streaming {
    opacity: 0.9;
    line-height: 1.6;
    color: var(--text-primary);
}

.action-generating-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

/* ========================================
   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);
}

/* --- Task 203/210: QUOTA TRACKERS (moved to settings modal) --- */

#settingsQuotaSection:empty { display: none; }

#settingsQuotaSection {
    padding: 0;
}

.quota-item {
    margin-bottom: 8px;
}

.quota-item:last-child {
    margin-bottom: 0;
}

.quota-label {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 4px;
}

.quota-name {
    color: var(--text-secondary);
}

.quota-value {
    color: var(--text-tertiary);
}

.quota-bar {
    height: 6px;
    background: var(--bg-active);
    border-radius: 3px;
    overflow: hidden;
}

.quota-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.quota-bar-fill.green { background: var(--accent-green); }
.quota-bar-fill.amber { background: var(--accent-amber); }
.quota-bar-fill.red { background: var(--accent-red); }

/* --- 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;
}

.sidebar-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 4px;
    padding: 12px 12px 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;
    padding-right: 12px;
    padding-bottom: 10px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    overflow-x: auto;
}

.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: 0;
    position: relative;
}

.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);
}

/* Task 181: Add participant "+" button */
.participant-circle--add {
    width: 28px;
    height: 28px;
    border: 1.5px dashed var(--border);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 400;
}

.participant-circle--add:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

/* Task 181: Add participant hover dropdown wrapper */
.add-participant-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-left: -8px;
}

.add-participant-popover {
    position: absolute;
    top: 100%;
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    box-shadow: var(--shadow-md);
    z-index: 200;
    display: none;
    flex-direction: column;
    gap: 8px;
    min-width: 240px;
}

.add-participant-wrapper:hover .add-participant-popover,
.add-participant-wrapper.focus-locked .add-participant-popover {
    display: flex;
}

.add-participant-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.add-participant-popover input {
    width: 100%;
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    background: var(--bg-primary);
    color: var(--text-primary);
    box-sizing: border-box;
}

.add-participant-popover input:focus {
    outline: none;
    border-color: var(--border-focus);
}

.add-participant-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

/* =============================================================================
 * 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-blue);
    border-bottom: 1px solid var(--border);
}

.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;
}

/* ═══════════════════════════════════════════════════════════════════════════
   UPLOAD MODAL (Task 167)
   ═══════════════════════════════════════════════════════════════════════════ */

.upload-modal {
    max-width: 480px;
    width: 90%;
}

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

.upload-modal .modal-header h3 {
    margin: 0;
    font-size: 18px;
}

.upload-modal .modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
}

.upload-modal .modal-close:hover {
    color: var(--text-primary);
}

.upload-modal .modal-body {
    padding: 24px;
}

.upload-drop-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    text-align: center;
    transition: all 0.2s ease;
    cursor: pointer;
}

.upload-drop-zone:hover,
.upload-drop-zone.drag-highlight {
    border-color: var(--accent-blue);
    background: var(--hover-bg);
}

.upload-drop-zone svg {
    color: var(--text-muted);
    margin-bottom: 16px;
}

.upload-drop-zone p {
    margin: 0;
    color: var(--text-secondary);
}

.upload-drop-zone .upload-or {
    margin: 12px 0;
    color: var(--text-muted);
    font-size: 13px;
}

.upload-file-label {
    cursor: pointer;
}

.upload-file-label .btn {
    pointer-events: none;
}

.upload-drop-zone .upload-hint {
    margin-top: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.upload-progress {
    margin-top: 20px;
    text-align: center;
}

.upload-progress-bar {
    height: 8px;
    background: var(--border);
    border-radius: 4px;
    overflow: hidden;
}

.upload-progress-fill {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 4px;
    transition: width 0.2s ease;
}

.upload-progress-text {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: var(--text-muted);
}

.upload-error {
    margin-top: 16px;
    padding: 12px;
    background: var(--danger-bg, rgba(220, 53, 69, 0.1));
    border: 1px solid var(--danger-color, #dc3545);
    border-radius: 4px;
    color: var(--danger-color, #dc3545);
    font-size: 13px;
    text-align: center;
}

.upload-error.hidden {
    display: none;
}

/* ── Task 208: Documents tab ───────────────────────────────── */

.document-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

.document-icon {
    flex-shrink: 0;
    color: var(--text-tertiary);
    display: flex;
    align-items: center;
    margin-right: 10px;
}

.document-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.document-filename {
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.document-meta {
    font-size: 0.85em;
    color: var(--text-secondary);
}

.document-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* document-download-btn inherits circle style from .action-tab-icon-btn */

.documents-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}

/* download-all-btn inherits circle style from .action-tab-icon-btn */

.documents-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-secondary);
}

.documents-list-box {
    margin: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
}

/* ── Task 213: Document upload zone ──────────────────────── */

.upload-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    margin: 8px 12px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    color: var(--text-secondary);
    transition: border-color 0.15s, background 0.15s;
}

.upload-zone--dragover {
    border-color: var(--accent-blue);
    background: color-mix(in srgb, var(--accent-blue) 8%, transparent);
}

.upload-btn {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    font-size: 0.85em;
}

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

.upload-progress-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
}

.upload-progress-filename {
    flex-shrink: 0;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.85em;
}

.upload-progress-bar-track {
    flex: 1;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.upload-progress-bar {
    height: 100%;
    background: var(--accent-blue);
    border-radius: 3px;
    transition: width 0.2s ease;
}

.upload-progress-percent {
    flex-shrink: 0;
    font-size: 0.8em;
    color: var(--text-secondary);
    min-width: 32px;
    text-align: right;
}

.upload-progress-error .upload-progress-filename {
    color: var(--error-color, #e53e3e);
}

.upload-progress-error-text {
    flex: 1;
    font-size: 0.8em;
    color: var(--error-color, #e53e3e);
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    margin-left: 6px;
    border-radius: 9px;
    background: var(--text-tertiary);
    color: white;
    font-size: 0.75em;
    font-weight: 600;
}


/* ═══════════════════════════════════════════════════════════════
   WORKFLOW RAIL (Task 224/226)
   Timeline-style side panel showing workflow steps
   ═══════════════════════════════════════════════════════════════ */

/* Content area: side-by-side rail + transcript */
.content-area {
    display: flex;
    flex-direction: row;
    flex: 1;
    min-height: 0;
    min-width: 0;
    overflow: hidden;
}

/* Rail panel */
.workflow-rail {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border);
    background: var(--bg-sidebar);
    overflow-y: auto;
    padding: 16px 12px;
    gap: 0;
}

/* Rail header — sticky above scrolling cards */
.workflow-rail-header {
    position: sticky;
    top: -16px;
    z-index: 2;
    background: var(--bg-sidebar);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: -16px -12px 12px;
    padding: 16px 12px 8px;
}
.workflow-sync-btn {
    padding: 4px;
    color: var(--text-tertiary);
}
.workflow-sync-btn:hover:not(:disabled) {
    color: var(--text-primary);
}
.workflow-sync-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.workflow-sync-btn svg.spinning {
    animation: spin 1s linear infinite;
}

/* Empty and loading states */
.workflow-empty,
.workflow-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 24px 12px;
    color: var(--text-tertiary);
    font-size: 0.85em;
    text-align: center;
}


/* ── Timeline card ─────────────────────────────────── */
.workflow-card {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 10px 7px 18px;
    margin-left: 12px;
    margin-bottom: 6px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    cursor: pointer;
    transition: background 0.15s ease;
    /* Timeline line: continuous vertical bar along left edge */
    border-left: 2px solid var(--border);
}

.workflow-card:hover {
    background: var(--bg-hover);
}

.workflow-card.selected {
    background: var(--bg-active);
}

/* Dim the icon for pending steps */
.workflow-card:has(.step-status-pending) .workflow-card-icon {
    opacity: 0.35;
}

/* Dim icon for failed steps */
.workflow-card:has(.step-status-failed) .workflow-card-icon {
    opacity: 0.5;
    filter: grayscale(1);
}

/* Dim icon for blocked steps */
.workflow-card:has(.step-status-blocked) .workflow-card-icon {
    opacity: 0.35;
    filter: grayscale(1);
}

/* Task 261: Condensed email rows */
.workflow-email-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px 4px 18px;
    margin-left: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary, #666);
    cursor: pointer;
    border-radius: 0 4px 4px 0;
    min-height: 28px;
    border-left: 2px solid var(--border);
}
.workflow-email-row:hover {
    background: var(--bg-hover, rgba(0,0,0,0.04));
}
.workflow-email-row.selected {
    background: var(--bg-active, rgba(59,130,246,0.08));
}
/* Envelope icon on timeline border — swish direction */
.workflow-email-row .workflow-card-icon {
    font-size: 1.4em;
}
.workflow-email-row .email-icon-inbound {
    transform: translateY(-50%) rotate(-15deg);
}
.workflow-email-row .email-icon-outbound {
    transform: translateY(-50%) rotate(15deg);
}
.email-row-subject {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.email-thread-count {
    flex-shrink: 0;
    background: var(--bg-badge, #e5e7eb);
    color: var(--text-secondary, #666);
    border-radius: 9px;
    padding: 0 6px;
    font-size: 0.7rem;
    line-height: 18px;
}

/* Task 270: Attachment indicator */
.email-attachment-indicator {
    flex-shrink: 0;
    font-size: 0.7rem;
    opacity: 0.6;
}

/* === Thread View (Task 270) === */
.transcript-tab-content:has(.thread-view) {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    padding: 0;
}
.transcript-tab-content:has(.thread-view) #emailContent {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
.thread-view {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}
.thread-view-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
}

.thread-truncation {
    text-align: center;
    padding: 8px 12px;
    margin-bottom: 12px;
    background: var(--accent-amber-bg);
    border-radius: var(--radius-md, 6px);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.thread-index {
    flex-shrink: 0;
    min-width: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    max-height: 40%;
    overflow-y: auto;
    overflow-x: hidden;
}
.thread-index-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1.4;
    min-width: 0;
}
.thread-index-row:last-child { border-bottom: none; }
.thread-index-row:hover { background: var(--bg-hover); }
.thread-index-row.active { background: var(--bg-active); }
.thread-index-sender {
    flex: 0 1 140px;
    min-width: 60px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}
.thread-index-row.active .thread-index-sender { font-weight: 600; }
.thread-index-snippet {
    flex: 1 1 0;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-secondary);
}
.thread-index-end {
    flex: 0 0 80px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    white-space: nowrap;
}
.thread-index-clip {
    font-size: 0.85em;
}
.thread-index-date {
    color: var(--text-secondary);
    font-size: 0.78rem;
}

.thread-date-separator {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    font-size: 0.75rem;
    color: var(--text-secondary);
}
.thread-date-separator::before,
.thread-date-separator::after {
    content: '';
    flex: 1;
    border-top: 1px dashed var(--border);
}
.thread-date-separator span {
    white-space: nowrap;
}

.thread-bubble {
    max-width: 80%;
    margin-bottom: 12px;
    padding: 10px 14px;
    border-radius: var(--radius-md, 6px);
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border);
}
.thread-bubble--inbound {
    margin-right: auto;
}
.thread-bubble--outbound {
    margin-left: auto;
}
.thread-bubble-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    background: var(--bg-hover);
    margin: -10px -14px 8px -14px;
    padding: 8px 14px 6px 14px;
    border-radius: var(--radius-md, 6px) var(--radius-md, 6px) 0 0;
}
.thread-bubble-header-from {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}
.thread-bubble-header-date {
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.thread-cc { font-size: 0.7rem; color: var(--text-secondary); margin-bottom: 4px; }
.thread-bubble-body { font-size: 0.8rem; line-height: 1.5; overflow: hidden; overflow-wrap: break-word; word-break: break-word; }
.thread-bubble-body img { max-width: 100%; height: auto; }
.thread-bubble-body table { max-width: 100%; table-layout: fixed; overflow: hidden; }
.thread-bubble-body pre { overflow-x: auto; max-width: 100%; }
.thread-bubble-body-text { white-space: pre-wrap; font-family: inherit; }

.thread-attachment-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.thread-attachment-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--bg-hover);
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.8rem;
    cursor: pointer;
}
.thread-attachment-chip:hover { background: var(--bg-active); }

.doc-highlight {
    outline: 2px solid var(--accent-blue);
    outline-offset: -2px;
    transition: outline-color 0.3s ease;
}

/* Icon */
.workflow-card-icon {
    position: absolute;
    left: -11px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.6em;
    line-height: 1;
    z-index: 1;
    background: var(--bg-primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Card body: title, badge, time stacked */
.workflow-card-body {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
    flex: 1;
}

.workflow-card-title {
    font-size: .9em;
    font-weight: 300;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workflow-card-time {
    font-size: 0.82em;
    color: var(--text-tertiary);
}

/* Step status icons (workflow card) */
.step-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    flex-shrink: 0;
    font-size: 0.8em;
    font-weight: 600;
    line-height: 1;
}

.step-status-pending {
    padding: 2px 8px;
    border-radius: 9px;
    font-size: 0.7em;
    text-transform: lowercase;
    background: var(--bg-hover);
    color: var(--text-secondary);
}

.step-status-running {
    color: var(--accent-blue);
}

.step-status-running .spinner-small {
    width: 12px;
    height: 12px;
    min-width: 12px;
    min-height: 12px;
    border-width: 1.5px;
}

.step-status-completed {
    color: var(--accent-green);
    animation: tick-fade 1.5s ease-out forwards;
}

@keyframes tick-fade {
    0%   { opacity: 1; }
    60%  { opacity: 1; }
    100% { opacity: 0; }
}

.step-status-failed {
    color: var(--accent-red);
    font-size: 0.9em;
}

.step-status-blocked {
    color: var(--text-secondary);
    font-size: 0.9em;
    opacity: 0.6;
}

/* Card menu (⋮ kebab) */
.workflow-card-menu {
    position: relative;
    flex-shrink: 0;
    align-self: center;
    opacity: 0;
    transition: opacity 0.15s;
}

.workflow-card:hover .workflow-card-menu {
    opacity: 1;
}

.workflow-card-menu-btn {
    width: 24px;
    height: 24px;
    border: none;
    background: none;
    color: var(--text-tertiary);
    font-size: 1.1em;
    line-height: 1;
    cursor: pointer;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

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

.workflow-card-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 100px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    z-index: 20;
    padding: 4px 0;
}

.workflow-card-menu-dropdown.hidden {
    display: none;
}

.workflow-step-delete {
    width: 100%;
    padding: 6px 12px;
    border: none;
    background: none;
    color: var(--accent-red);
    font-size: 0.85em;
    cursor: pointer;
    text-align: left;
    transition: background 0.12s;
}

.workflow-step-delete:hover {
    background: var(--accent-red-bg);
}

/* Document step variant */
.workflow-card--document {
    opacity: 0.7;
}

/* Drag & drop feedback */
.workflow-card[draggable="true"] {
    cursor: grab;
}

.workflow-card[draggable="true"]:active {
    cursor: grabbing;
}

.workflow-card.dragging {
    opacity: 0.4;
    background: var(--bg-hover);
}

/* ── Add step trigger ──────────────────────────────── */
.workflow-add-wrapper {
    position: relative;
    margin-left: 12px;
    padding: 10px 10px 10px 28px;
    border-left: 2px solid var(--border);
    border-radius: 0;
}

/* Dot on the timeline line, matching card dots */
.workflow-add-wrapper::before {
    content: '';
    position: absolute;
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px dashed var(--border);
    z-index: 1;
    transition: border-color 0.15s;
    pointer-events: none;
}

.workflow-add-wrapper:hover::before {
    border-color: var(--accent-blue);
}

.workflow-add-btn {
    width: 75%;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px dotted var(--border);
    background: none;
    color: var(--text-tertiary);
    font-size: 0.82em;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.workflow-add-btn:hover:not([disabled]) {
    color: var(--accent-blue);
    border-color: var(--accent-blue);
    background: rgba(37, 99, 235, 0.05);
}

.workflow-add-btn[disabled] {
    cursor: default;
    opacity: 0.6;
}

/* ── Dropdown menu ─────────────────────────────────── */
.workflow-add-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 240px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 50;
    padding: 6px 0;
    max-height: 380px;
    overflow-y: auto;
}

.workflow-add-dropdown.hidden {
    display: none;
}

.dropdown-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.82em;
}

.dropdown-note {
    padding: 6px 12px;
    font-size: 0.75em;
    color: var(--accent-amber);
    background: var(--accent-amber-bg);
    border-bottom: 1px solid var(--border);
}

.action-trigger-list {
    display: flex;
    flex-direction: column;
    max-height: none;
    overflow-y: visible;
}

.action-trigger-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--text-primary);
    font-size: 0.82em;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}

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

.action-trigger-item[disabled] {
    opacity: 0.5;
    cursor: default;
}

.action-trigger-item.has-tab {
    opacity: 0.6;
}

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

.has-tab-indicator {
    font-size: 0.75em;
    color: var(--text-tertiary);
    padding: 1px 6px;
    border-radius: 8px;
    background: var(--bg-active);
}

.edit-action-btn {
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s;
}

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

/* Review status badges (Task 229) */
.review-status-badge {
    display: inline-flex;
    align-items: center;
    height: 28px;
    font-size: 11px;
    padding: 0 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    margin-right: 8px;
}
.review-status-badge--ai-draft {
    background: var(--accent-amber-bg, #fef3c7);
    color: var(--accent-amber, #92400e);
}
.review-status-badge--user-draft {
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-blue, #1e40af);
}
.review-status-badge--approved {
    background: var(--accent-green-bg, #d1fae5);
    color: var(--accent-green, #065f46);
}
.review-status-icon {
    font-size: 10px;
    line-height: 1;
    cursor: default;
    background: none;
    display: flex;
    align-items: center;
    justify-content: center;
}
.workflow-card > .review-status-icon {
    align-self: center;
    margin-left: auto;
    font-size: 15px;
    line-height: 1;
    width: 20px;
    text-align: center;
}
.review-status-icon.review-status-badge--ai-draft {
    color: var(--accent-amber, #d97706);
}
.review-status-icon.review-status-badge--user-draft {
    color: var(--accent-blue, #2563eb);
    font-size: 120%;
}
.review-status-icon.review-status-badge--approved {
    color: var(--accent-green, #059669);
}
.approve-btn {
    font-size: 12px;
    padding: 6px 12px;
    border: 1px solid var(--accent-green, #065f46);
    border-radius: var(--radius-sm);
    background: var(--accent-green-bg, #d1fae5);
    cursor: pointer;
    font-weight: 500;
    color: var(--accent-green, #065f46);
}
.approve-btn:hover {
    background: var(--accent-green, #065f46);
    border-color: var(--accent-green, #065f46);
    color: #fff;
}
.revoke-btn {
    font-size: 12px;
    padding: 6px 12px;
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius-sm);
    background: var(--bg-card, #fff);
    cursor: pointer;
    font-weight: 500;
    color: var(--text-primary, #111);
}
.revoke-btn:hover {
    background: var(--accent-amber-bg, #fef3c7);
    border-color: var(--accent-amber, #92400e);
    color: var(--accent-amber, #92400e);
}

/* --- Task 230: Participant Detail Modal & Client Frontend --- */

/* Linked participant badge */
.participant-circle--linked {
    position: relative;
    cursor: pointer;
}

.participant-badge {
    position: absolute;
    bottom: -2px;
    right: -2px;
    width: 10px;
    height: 10px;
    background: var(--accent-green);
    border: 1.5px solid var(--bg-card);
    border-radius: 50%;
}

/* Participant detail modal overlay - visible on creation (no .visible toggle) */
.participant-detail-modal {
    opacity: 1;
    pointer-events: auto;
}

.participant-detail-modal .modal {
    transform: scale(1);
}

/* .modal base provides: bg, padding, radius, width, border, shadow, transform */
.participant-detail-modal__content {
    width: 416px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    padding: 16px 24px;
}

.participant-detail-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 4px 8px;
    line-height: 1;
}

.participant-detail-close-btn:hover {
    color: var(--text-primary);
}

/* .modal h3 provides: margin-bottom: 8px */
.participant-detail-modal__content h3 {
    margin-top: 0;
    font-size: 16px;
}

.participant-email {
    color: var(--text-secondary);
    margin: 0 0 8px;
    font-size: 13px;
}

.participant-readonly-note {
    color: var(--text-tertiary);
    font-style: italic;
    margin: 0;
}

/* Email edit mode */
.email-edit-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
}

.email-edit-input {
    flex: 1;
    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;
}

.email-edit-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

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

/* .btn .btn-primary handle all button styling */
.email-save-btn {
    white-space: nowrap;
}

/* Linked client info */
.participant-detail-modal__client-info {
    margin-bottom: 12px;
    font-size: 14px;
}

.client-label {
    color: var(--text-secondary);
}

.client-name {
    font-weight: 600;
}

/* Section labels for modal form groups */
.section-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

/* .btn handles base button styling; only override for red variant */
.unlink-btn {
    border: 1px solid var(--accent-red);
    color: var(--accent-red);
    background: none;
}

.unlink-btn:hover {
    background: var(--accent-red-bg);
}

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

/* Unlinked participant actions */
.participant-detail-modal__actions {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.participant-detail-modal__actions .modal-actions {
    margin-top: 4px;
}

.participant-detail-modal__actions .modal-actions .btn-primary {
    min-width: 80px;
    justify-content: center;
}

.client-selection-section {
    min-height: 0;
}

.client-panel.hidden {
    display: none;
}

.create-client-section {
    display: flex;
    flex-direction: column;
}

.client-name-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 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;
}

.client-name-input:focus {
    outline: none;
    border-color: var(--border-focus);
}

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

.create-client-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.create-client-btn--success {
    opacity: 1 !important;
    background-color: #22c55e;
    color: #fff;
}

/* Email chips (Task 233) */
.email-chips-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 4px 0;
    min-height: 28px;
}

.email-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.email-chip__remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
}

.email-chip__remove:hover {
    color: var(--text-primary);
}

.email-chip--fixed {
    opacity: 0.7;
    cursor: default;
}
.email-chip--fixed:hover { background: inherit; }

.email-add-row {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-app);
    margin-bottom: 4px;
    width: 100%;
}

.email-add-row:focus-within {
    border-color: var(--border-focus);
}

.email-add-input {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    font-size: 14px;
    font-family: inherit;
    color: var(--text-primary);
    outline: none;
    min-width: 0;
}

.email-add-btn {
    white-space: nowrap;
    flex-shrink: 0;
    margin-right: 4px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    background: var(--accent-primary);
    color: var(--accent-text);
    cursor: pointer;
    line-height: 1.4;
}
.email-add-btn:hover {
    opacity: 0.9;
}

/* Client dropdown */
.participant-detail-modal__actions .section-heading {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin: 0 0 8px;
}

.client-dropdown__select {
    width: 100%;
    padding: 8px 12px;
    padding-right: 36px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background-color: var(--bg-app);
    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;
    color: var(--text-primary);
    cursor: pointer;
    box-sizing: border-box;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.client-dropdown__select:focus {
    outline: none;
    border-color: var(--border-focus);
}

/* Conflict notification sub-modal */
.conflict-notification {
    margin-top: 16px;
    padding: 12px;
    background: var(--accent-amber-bg);
    border: 1px solid var(--accent-amber);
    border-radius: var(--radius-sm);
}

.conflict-notification h4 {
    margin: 0 0 8px;
    font-size: 14px;
    color: var(--text-primary);
}

.conflict-notification__list {
    margin: 0 0 8px;
    padding-left: 20px;
    font-size: 13px;
    color: var(--text-secondary);
}

.conflict-notification__item {
    margin-bottom: 4px;
}

/* .btn .btn-primary handle all button styling */
.conflict-ok-btn {
    /* selector kept for test queries only */
}

/* Task 234: Mode toggle */
.mode-toggle { display: flex; gap: 0; margin-bottom: 8px; }
.mode-toggle__btn {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    background: var(--bg-card);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 13px;
    transition: background-color 0.15s, color 0.15s;
}
.mode-toggle__btn:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.mode-toggle__btn:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.mode-toggle__btn--active {
    background: var(--accent-primary);
    color: var(--bg-app);
    border-color: var(--accent-primary);
}

/* Task 234: Conversation preview */
.conversation-preview {
    max-height: 280px;
    overflow-y: auto;
    margin: 0 0 8px;
}
.conversation-preview__empty,
.conversation-preview__loading {
    color: var(--text-muted);
    font-size: 13px;
    padding: 12px 0;
    text-align: center;
}
.conversation-preview-entry {
    padding: 8px 12px;
    margin-bottom: 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.conversation-preview-entry:last-child { margin-bottom: 0; }
.conversation-preview-entry--linked { opacity: 0.5; }
.conversation-preview-entry--excluded { display: none; }
.conversation-preview-entry__header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}
.conversation-preview-entry__title {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}
.conversation-preview-entry__date {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    flex-shrink: 0;
    margin-left: auto;
}
.conversation-preview-entry__remove {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-tertiary);
    font-size: 15px;
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}
.conversation-preview-entry__remove:hover { color: var(--text-primary); }
.conversation-preview-entry__body {
    margin-top: 2px;
}
.conversation-preview-entry__participants {
    font-size: 11px;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.conversation-preview-entry__client-label {
    font-size: 10px;
    color: var(--text-tertiary);
    font-style: italic;
    white-space: nowrap;
    flex-shrink: 0;
}
.conversation-preview-entry__client-label--will-link {
    font-style: normal;
    font-weight: 500;
    color: #fff;
    background: var(--danger, #ef4444);
    border-radius: 9px;
    padding: 1px 8px;
}

/* Email sync toggle + lookback (Task 236) */
.email-sync-toggle { display: flex; align-items: center; gap: 8px; margin: 8px 0; }
.email-sync-toggle input[type="checkbox"] { width: 16px; height: 16px; }
.lookback-row { display: flex; align-items: center; gap: 8px; margin: 4px 0 8px; }
.lookback-select { padding: 4px 8px; border: 1px solid var(--border-color); border-radius: 4px; }

/* Task 263: Client Dashboard Shell */

/* Content pane — flex column inside content-area, holds header + transcript */
.content-pane {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

/* Client header bar — persistent above transcript container.
   Scoped under #clientHeader to avoid colliding with sidebar .client-header (line ~428). */
#clientHeader .client-header {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  flex-shrink: 0;
}
#clientHeader .client-header-logo {
  width: 48px;
  height: 48px;
  min-width: 48px;
  border-radius: 8px;
  background: var(--bg-tertiary, #e5e7eb);
  border: 1px solid var(--border-color);
}
#clientHeader .client-header-info { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
#clientHeader .client-header-name { font-weight: 600; font-size: 0.95rem; }
#clientHeader .client-header-contact { display: flex; gap: 0.75rem; font-size: 0.8rem; color: var(--text-secondary); }
#clientHeader .client-header-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#clientHeader .client-header-phone { white-space: nowrap; }
#clientHeader .client-header-meta { display: flex; gap: 0.75rem; font-size: 0.75rem; color: var(--text-tertiary); }

/* Client dashboard — CRM grid layout */
.client-dashboard {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.75rem;
  overflow-y: auto;
}

/* Dashboard sections */
.dashboard-profile,
.dashboard-contacts,
.dashboard-activity,
.dashboard-description,
.dashboard-insurance-strategy,
.dashboard-portfolio,
.dashboard-claims {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
}

.dashboard-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

/* Profile fields */
.profile-field {
  display: flex;
  justify-content: space-between;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-light);
}
.profile-field:last-child { border-bottom: none; }
.profile-field-label { color: var(--text-secondary); font-size: 0.8rem; }
.profile-field-value { font-size: 0.8rem; color: var(--text-tertiary); }

/* Text field sections (description, insurance strategy) */
.dashboard-text-field {
  margin-bottom: 0.4rem;
}
.dashboard-text-field:last-child { margin-bottom: 0; }
.dashboard-text-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.2rem;
  display: block;
}
.dashboard-text-value {
  font-size: 0.85rem;
  color: var(--text-tertiary);
  margin: 0;
  line-height: 1.4;
}

/* Full-width sections */
.dashboard-insurance-strategy,
.dashboard-portfolio,
.dashboard-claims { grid-column: 1 / -1; }

/* Insurance strategy 2-col layout */
.insurance-strategy-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.insurance-strategy-right { display: flex; flex-direction: column; gap: 0.4rem; }

/* Portfolio table */
.dashboard-portfolio table { width: 100%; border-collapse: collapse; font-size: 0.85rem; table-layout: fixed; }
.dashboard-portfolio th {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  font-weight: 500;
  color: var(--text-secondary);
}
.dashboard-portfolio td {
  padding: 0.5rem;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-light);
}

/* Claims table */
.dashboard-claims table { width: 100%; border-collapse: collapse; font-size: 0.85rem; table-layout: fixed; }
.dashboard-claims th {
  text-align: left;
  padding: 0.5rem;
  border-bottom: 2px solid var(--border-color);
  font-weight: 500;
  color: var(--text-secondary);
}
.dashboard-claims td {
  padding: 0.5rem;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-light);
}
.dashboard-claims-empty { font-size: 0.85rem; color: var(--text-tertiary); }

/* Client documents list (Docs tab) */
.client-documents-list { padding: 1rem; }
.dashboard-doc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-light);
}
.dashboard-doc-download { font-size: 0.85rem; cursor: pointer; }

/* Notes tab — compose area (Task 271) */
.new-note-area {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}
.note-textarea {
    width: 100%;
    resize: vertical;
    min-height: 60px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    background: var(--bg-hover);
    color: var(--text-primary);
    transition: border-color 0.2s;
    box-sizing: border-box;
}
.note-textarea:focus {
    border-color: var(--text-primary);
    outline: none;
}
.note-textarea::placeholder {
    color: var(--text-tertiary);
}
.note-card { max-width: 100%; }
.note-save-btn {
    margin-top: 8px;
    float: right;
    padding: 4px 12px;
    font-size: 12px;
}
.note-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Notes tab — edit actions */
.note-edit-actions {
    padding: 4px 12px 8px;
    text-align: right;
}
.edit-note-btn,
.save-edit-btn,
.cancel-edit-btn {
    font-size: 0.75rem;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--primary-color);
    padding: 2px 6px;
}
.edit-note-btn:hover,
.save-edit-btn:hover,
.cancel-edit-btn:hover {
    text-decoration: underline;
}

/* Note card body — preserve multiline plain-text (Task 271) */
.note-card .thread-bubble-body { white-space: pre-wrap; }

/* Note save error feedback */
.note-error {
    color: var(--error-color, #d32f2f);
    font-size: 0.8rem;
    margin-top: 4px;
    padding: 0 4px;
}

/* Note card in editing mode */
.note-card.editing .note-edit-textarea {
    width: calc(100% - 24px);
    margin: 0 12px;
}
