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

/* Visually hidden but accessible to screen readers and search engines */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:root {
    /* Notch Brand Palette */
    --ink: #121314;
    --bone: #F4F2EC;
    --blue: #64b5f6;
    --blue-dark: #42a5f5;
    --sage: #6E8C78;
    --graphite: #2A2C2E;
    --copper: #C75B2A; /* Deprecated - kept for reference */

    /* Semantic colors mapped to brand */
    --primary: var(--blue);
    --primary-hover: var(--blue-dark);
    --secondary: var(--sage);
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: var(--bone);
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: var(--ink);
    --text-muted: var(--graphite);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
    --radius: 14px;
    --font-mono: 'SF Mono', 'Consolas', 'Monaco', monospace;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(180deg, #F8F6F1 0%, #F4F2EC 100%);
    color: var(--text);
    line-height: 1.6;
    font-weight: 400;
    min-height: 100vh;
}

.app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0.5rem 1.5rem 2rem;
}

/* Top Navigation */
.top-nav {
    padding: 1rem 0 0.75rem;
    text-align: center;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
}

.nav-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 2.5rem;
    flex-wrap: wrap;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: var(--ink);
}

.nav-link-btn {
    background: none;
    border: none;
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
}

.nav-link-btn:hover {
    color: var(--blue);
}

.nav-sample-highlight {
    background: #E3F2FD;
    border: 1px solid #90CAF9;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: #1565C0;
}

.nav-sample-highlight:hover {
    background: #BBDEFB;
    color: #0D47A1;
    border-color: #64B5F6;
}

header {
    text-align: center;
    padding: 1rem 1rem 1rem;
    max-width: 1200px;
    margin: 0 auto;
}

header img {
    margin-bottom: 8px;
    height: 200px !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    filter: grayscale(0);
}

/* Logo disabled state (not enough input) */
header img.logo-disabled {
    cursor: not-allowed;
    opacity: 0.3;
    filter: grayscale(0);
}

header img.logo-disabled:hover {
    transform: none;
}

/* Logo ready state (inputs valid, ready to click) */
header img.logo-ready {
    cursor: pointer;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        filter: drop-shadow(0 0 8px rgba(199, 91, 42, 0.3));
        transform: scale(1);
    }
    50% {
        filter: drop-shadow(0 0 16px rgba(199, 91, 42, 0.6));
        transform: scale(1.02);
    }
}

header img.logo-ready:hover {
    transform: scale(1.05) rotate(-5deg);
    filter: drop-shadow(0 0 20px rgba(199, 91, 42, 0.8));
    animation: none;
}

/* Logo running state (analysis in progress) */
header img.logo-running {
    cursor: wait;
    animation: spin-pulse 1.5s ease-in-out infinite;
}

@keyframes spin-pulse {
    0%, 100% {
        transform: rotate(0deg) scale(1);
        opacity: 1;
    }
    25% {
        transform: rotate(5deg) scale(1.03);
        opacity: 0.9;
    }
    50% {
        transform: rotate(0deg) scale(1.05);
        opacity: 0.8;
    }
    75% {
        transform: rotate(-5deg) scale(1.03);
        opacity: 0.9;
    }
}

header img:not(.logo-disabled):not(.logo-running):hover {
    transform: rotate(-5deg) scale(1.05);
}

header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--ink);
    font-size: 1rem;
    margin-bottom: 0.5rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.6;
}

.header-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 1px solid #bae6fd;
    border-radius: 20px;
    color: #0c4a6e;
    font-size: 0.8125rem;
    font-weight: 500;
    margin-top: 0.5rem;
}

.header-badge svg {
    color: #0284c7;
}

/* Quick Start Guide */
.quick-start-guide {
    position: relative;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem 1.5rem;
    margin: 2rem auto 0;
    max-width: 900px;
}

.quick-start-guide h3 {
    margin-bottom: 0.5rem;
    color: var(--ink);
    font-size: 1rem;
}

.quick-start-guide ol {
    margin: 0.5rem 0 0.75rem 1.5rem;
    line-height: 1.5;
    font-size: 0.9rem;
}

.quick-start-guide li {
    margin-bottom: 0.25rem;
}

.close-guide {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.close-guide:hover {
    background: rgba(0, 0, 0, 0.1);
}

/* Main Grid Layout */
.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1.4fr;
    gap: 1.5rem;
    margin-top: 3rem;
    padding: 0;
    align-items: start;
}

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

/* Panes */
.pane {
    background: var(--surface);
    border-radius: var(--radius);
    border: 1px solid #E8E5DD;
    box-shadow: 0 2px 8px rgba(18, 19, 20, 0.06), 0 1px 3px rgba(18, 19, 20, 0.03);
    display: flex;
    flex-direction: column;
    min-height: 600px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.pane:hover {
    box-shadow: 0 8px 24px rgba(18, 19, 20, 0.1), 0 4px 12px rgba(18, 19, 20, 0.05);
    transform: translateY(-2px);
}

.pane-header {
    padding: 2rem 2rem 1.75rem;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(244, 242, 236, 0.4) 0%, rgba(255, 255, 255, 0) 100%);
}

.pane-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.pane-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0.75rem;
}

.pane-header h2 {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
    padding: 0;
    color: var(--ink);
    letter-spacing: -0.02em;
    flex-shrink: 0;
    line-height: 1.5;
}

.help-icon {
    font-size: 1rem;
    cursor: help;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.help-icon:hover {
    opacity: 1;
}

.char-counter {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.01em;
    white-space: nowrap;
    line-height: 1.5;
}

.pane textarea {
    flex: 1;
    padding: 2rem;
    border: none;
    resize: none;
    font-family: inherit;
    font-size: 0.975rem;
    line-height: 1.75;
    outline: none;
    color: var(--ink);
    transition: background 0.2s ease;
}

.pane textarea:focus {
    background: linear-gradient(180deg, rgba(100, 181, 246, 0.02) 0%, rgba(255, 255, 255, 0) 10%);
}

.pane textarea::placeholder {
    color: #9ca3af;
    font-size: 0.95rem;
}

/* Toolbar */
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 0.75rem;
    position: relative;
}

.cta-helper {
    width: 100%;
    font-size: 0.875rem;
    color: var(--text-muted);
    margin: 0.625rem 0 0 0;
    font-weight: 400;
    line-height: 1.6;
}

.toolbar-group {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.975rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(199, 91, 42, 0.25);
    transition: all 0.2s ease;
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(199, 91, 42, 0.35);
    transform: translateY(-1px);
}

.btn-notch {
    background: var(--ink);
    color: white;
    box-shadow: 0 3px 12px rgba(18, 19, 20, 0.25);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    font-weight: 700;
    font-size: 1rem;
    padding: 0.875rem 1.75rem;
    letter-spacing: 0.005em;
}

.btn-notch:hover:not(:disabled) {
    background: var(--graphite);
    box-shadow: 0 5px 18px rgba(18, 19, 20, 0.35);
    transform: translateY(-2px);
}

.btn-notch svg {
    flex-shrink: 0;
}

.btn-notch .spinner {
    display: inline-block;
    border: 2px solid transparent;
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
}

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

.btn-secondary {
    background: white;
    color: var(--text);
    border: 1.5px solid var(--border);
    font-weight: 600;
}

.btn-secondary:hover:not(:disabled) {
    background: var(--bg);
    border-color: var(--ink);
    color: var(--ink);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(18, 19, 20, 0.08);
}

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

.btn-icon {
    font-size: 1.1rem;
}

/* Remember/Recall buttons */
.btn-remember {
    padding: 0.5rem 0.875rem;
    font-size: 0.8125rem;
    background: var(--ink);
    border: 1px solid var(--ink);
    border-radius: 6px;
    cursor: pointer;
    color: white;
    font-weight: 600;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
}

.btn-remember:hover {
    background: #000;
    border-color: #000;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(18, 19, 20, 0.15);
}

/* Settings Panel */
.settings-panel {
    padding: 1rem 2rem;
    background: linear-gradient(180deg, rgba(244, 242, 236, 0.3) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.toggle-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.toggle-label {
    font-size: 0.9rem;
    color: var(--text);
    font-weight: 500;
}

.tone-selector {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tone-selector label {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.tone-selector select {
    padding: 0.5rem 0.75rem;
    border: 1.5px solid var(--border);
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--ink);
    transition: all 0.2s ease;
}

.tone-selector select:hover {
    border-color: var(--ink);
}

.tone-selector select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(100, 181, 246, 0.1);
}

/* Output Content */
.output-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.empty-state h3 {
    font-size: 1.5rem;
    color: var(--text);
    margin-bottom: 1rem;
}

.empty-state p {
    margin-bottom: 0.75rem;
    font-size: 0.975rem;
    line-height: 1.6;
}

.empty-state-features {
    display: flex;
    gap: 2.5rem;
    justify-content: center;
    margin-top: 3rem;
    flex-wrap: wrap;
}

.feature {
    font-size: 0.875rem;
    color: var(--text);
    font-weight: 500;
    position: relative;
}

.feature::before {
    content: '✓';
    color: var(--success);
    font-weight: 700;
    margin-right: 0.5rem;
}

.hint {
    font-size: 0.9rem;
}

kbd {
    background: white;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    padding: 0.15rem 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--ink);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
}

.card-content {
    color: var(--text);
    line-height: 1.7;
    font-weight: 400;
}

/* Collapsible sections */
.collapsible-header {
    cursor: pointer;
    user-select: none;
}

.collapsible-header:hover {
    background: var(--bg);
    margin: -0.5rem;
    padding: 0.5rem;
    border-radius: var(--radius);
}

.collapse-icon {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.collapsible-content {
    transition: max-height 0.3s ease-out, opacity 0.2s;
}

.collapsible-card.collapsed .collapsible-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
}

/* Coverage Matrix */
.coverage-grid {
    display: grid;
    gap: 0.75rem;
}

.coverage-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg);
    border-radius: 6px;
}

.coverage-number {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
    min-width: 1.5rem;
    flex-shrink: 0;
}

.coverage-icon {
    font-size: 1.2rem;
    flex-shrink: 0;
}

.coverage-text {
    flex: 1;
}

.coverage-keyword {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.25rem;
}

.coverage-evidence {
    font-size: 0.85rem;
    color: var(--success);
    margin-top: 0.25rem;
    font-style: italic;
    background: #f0fdf4;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.coverage-suggestion {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Keywords Pills */
.keywords-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.keyword-pill {
    background: var(--bg);
    border: 1px solid var(--border);
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.keyword-pill.clickable {
    cursor: pointer;
    transition: all 0.2s;
}

.keyword-pill.clickable:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    transform: translateY(-1px);
}

/* Risk Flags */
.risk-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    padding: 0.75rem;
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    margin-bottom: 0.75rem;
}

.risk-text {
    flex: 1;
    color: var(--text);
}

.btn-fix {
    padding: 0.375rem 0.75rem;
    background: var(--warning);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
    white-space: nowrap;
}

.btn-fix:hover {
    opacity: 0.9;
}

/* Bullet Rewrites */
.bullet-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.bullet-original {
    padding: 1rem;
    background: var(--bg);
    border-left: 3px solid var(--secondary);
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.bullet-variants {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.variant {
    position: relative;
    padding: 1rem;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

/* Make it clear variants are clickable */
.variant::after {
    content: 'Click to select';
    position: absolute;
    bottom: 0.5rem;
    right: 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: #6b7280;
    background: rgba(255, 255, 255, 0.95);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}

/* Color coding for variant types - Using Notch brand palette */
.variant[data-variant="a"] {
    border-left: 4px solid var(--graphite);
    background: #fafaf9;
}

.variant[data-variant="b"] {
    border-left: 4px solid var(--sage);
    background: #f6f8f7;
}

.variant[data-variant="c"] {
    border-left: 4px solid #90caf9;
    background: #f5f9fc;
}

.variant:hover {
    border-color: #90caf9;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.variant:hover::after {
    opacity: 1;
}

.variant.selected {
    border-color: #64b5f6;
    box-shadow: 0 3px 10px rgba(100, 181, 246, 0.15);
}

.variant.selected::after {
    content: '✓ Selected';
    opacity: 1;
    color: #1565C0;
    font-weight: 600;
    background: rgba(225, 242, 255, 0.95);
}

.variant.selected[data-variant="a"] {
    background: #f5f5f5;
    border-color: #9e9e9e;
}

.variant.selected[data-variant="b"] {
    background: #e8f5e9;
    border-color: #66bb6a;
}

.variant.selected[data-variant="c"] {
    background: #e3f2fd;
    border-color: #64b5f6;
}

/* Honesty Lock: Blocked variants */
.variant.blocked {
    opacity: 0.6;
    background: #fee2e2 !important;
    border: 2px solid #dc2626;
    cursor: not-allowed;
}

.variant.blocked .variant-text {
    text-decoration: line-through;
    color: #991b1b;
}

.variant.blocked .btn-copy-bullet {
    background: #dc2626;
    color: white;
    cursor: not-allowed;
}

.variant.blocked .btn-copy-bullet:disabled {
    opacity: 1;
}

.variant-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.variant-radio {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.variant-label {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
    min-height: 24px;
}

/* Color-coded variant labels - Using Notch brand palette */
.variant[data-variant="a"] .variant-label {
    color: var(--graphite);
}

.variant[data-variant="b"] .variant-label {
    color: var(--sage);
}

.variant[data-variant="c"] .variant-label {
    color: #64b5f6;
}

.variant-text {
    margin-left: 2rem;
    line-height: 1.7;
    color: var(--text);
    font-weight: 400;
}

.variant-footer {
    margin-left: 2rem;
    margin-top: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.btn-copy-bullet {
    padding: 0.375rem 0.75rem;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 0.85rem;
    cursor: pointer;
}

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

/* Long Bullet Warning */
.bullet-warning {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    background: #fef3c7;
    border-radius: 12px;
    font-size: 0.85rem;
    color: #92400e;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--ink);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(18, 19, 20, 0.2), 0 4px 12px rgba(18, 19, 20, 0.15);
    transform: translateY(200%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
    font-weight: 500;
    font-size: 0.9375rem;
}

.toast.show {
    transform: translateY(0);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
}

.modal-content h3 {
    margin-bottom: 1rem;
    font-size: 1.5rem;
}

.modal-content p {
    margin-bottom: 1.5rem;
    color: var(--text-muted);
}

.modal-content textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    margin-bottom: 0.75rem;
    font-family: inherit;
    resize: vertical;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Saved Versions List */
.saved-versions-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 400px;
    overflow-y: auto;
    margin-bottom: 1rem;
}

.saved-version-card {
    width: 100%;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
}

.saved-version-card:hover {
    background: var(--surface-hover, #f9fafb);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.saved-version-name {
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.25rem;
    font-size: 1rem;
}

.saved-version-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Loading State */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    color: var(--text-muted);
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Collapsible Sections */
.collapsible-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 0.75rem 0;
}

.collapsible-header:hover {
    opacity: 0.8;
}

.collapse-icon {
    transition: transform 0.2s;
}

.collapsed .collapse-icon {
    transform: rotate(-90deg);
}

.collapsible-content {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.collapsed .collapsible-content {
    max-height: 0;
}

/* Thematic Gaps */
.thematic-gaps-card {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
}

.themes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1rem;
}

.theme-item {
    background: white;
    border-radius: 8px;
    padding: 1rem;
    border-left: 4px solid var(--border);
}

.theme-item.theme-strong {
    border-left-color: var(--success);
}

.theme-item.theme-partial {
    border-left-color: var(--warning);
}

.theme-item.theme-weak {
    border-left-color: var(--danger);
}

.theme-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.theme-status {
    font-size: 0.85rem;
    font-weight: 600;
}

.theme-name {
    flex: 1;
    font-weight: 600;
    color: var(--text);
}

.theme-coverage {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--primary);
}

.theme-description {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.theme-frequency {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.theme-recommendation {
    background: #fef3c7;
    border: 1px solid #fbbf24;
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text);
}

.theme-evidence {
    background: #f0fdf4;
    border: 1px solid #86efac;
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text);
}

.theme-repeated {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 6px;
    padding: 0.75rem;
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--text);
    font-style: italic;
}

/* Progress Indicator */
.progress-indicator {
    padding: 2.5rem 2rem;
    background: linear-gradient(180deg, rgba(244, 242, 236, 0.3) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}

.progress-time-estimate {
    text-align: center;
    margin-top: 1.25rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
}

.progress-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    position: relative;
}

.progress-steps::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 10%;
    right: 10%;
    height: 2px;
    background: var(--border);
    z-index: 0;
}

.progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    position: relative;
    z-index: 1;
}

.step-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s;
}

.progress-step.active .step-icon {
    border-color: var(--primary);
    background: var(--primary);
    animation: pulse 1.5s infinite;
}

.progress-step.complete .step-icon {
    border-color: var(--success);
    background: var(--success);
}

.step-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-align: center;
}

.progress-step.active .step-label {
    color: var(--primary);
    font-weight: 600;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(37, 99, 235, 0);
    }
}

/* Tooltips */
.tooltip-container {
    position: relative;
}

.tooltip {
    position: absolute;
    bottom: 100%;
    left: 0;
    background: var(--text);
    color: white;
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    width: 250px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    z-index: 100;
}

.tooltip-container:hover .tooltip {
    opacity: 1;
}

.badge-locked {
    display: inline-block;
    padding: 0.125rem 0.4rem;
    background: #10b981;
    color: white;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    opacity: 0.9;
}

/* Anti-fabrication Warning */
.fabrication-warning {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    margin: 0 0 1.5rem 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* Suggested Additions */
.suggested-additions-card {
    border: 2px dashed var(--border);
}

.suggested-additions-card.collapsed .collapsible-content {
    max-height: 0;
    overflow: hidden;
}

.suggested-additions-card:not(.collapsed) .collapse-icon {
    transform: rotate(180deg);
}

.suggestion-item {
    padding: 1rem;
    background: var(--bg);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.suggestion-text {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.suggestion-rationale {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 0.5rem;
}

/* Role Sections */
.role-section {
    margin-bottom: 2.5rem;
}

.role-header {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

/* Risk Flags - Structured Format */
.risk-item.structured {
    padding: 1rem;
    margin-bottom: 1rem;
    background: #fef2f2;
    border-left: 4px solid var(--danger);
    border-radius: 4px;
}

.risk-quote {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    color: var(--danger);
}

.risk-why {
    margin-bottom: 0.75rem;
    color: var(--text);
    font-size: 0.9rem;
}

.risk-fix {
    padding: 0.75rem;
    background: #f0fdf4;
    border-left: 3px solid var(--success);
    border-radius: 4px;
    font-size: 0.9rem;
    color: #166534;
}

.risk-item.structured strong {
    font-weight: 600;
}

/* Export dropdown styles */
.export-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-menu {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 4px;
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    z-index: 1000;
    min-width: 150px;
}

.dropdown-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 12px;
    border: none;
    background: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background-color: #f3f4f6;
}

.dropdown-item:first-child {
    border-radius: 6px 6px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 6px 6px;
}

/* === SINGLE-PANEL FLOW LAYOUT === */

/* Flow Progress Indicator */
.flow-progress {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin: 0 auto 1.5rem;
    max-width: 300px;
    padding: 0.5rem 0 0 0;
}

.flow-step {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: var(--text-muted);
    transition: all 0.3s ease;
}

.flow-step.active {
    background: var(--ink);
    border-color: var(--ink);
    color: white;
    transform: scale(1.1);
}

.flow-step.completed {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.flow-connector {
    flex: 1;
    height: 2px;
    background: var(--border);
    transition: background 0.3s ease;
}

.flow-connector.completed {
    background: var(--success);
}

/* Main Content Well */
.main-content-well {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
}

/* Flow Panels */
.flow-panel {
    display: none !important;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.flow-panel.active {
    display: block !important;
    opacity: 1;
    transform: translateX(0);
}

.flow-panel.sliding-out-left {
    animation: slideOutLeft 0.4s ease forwards;
}

.flow-panel.sliding-in-right {
    animation: slideInRight 0.4s ease forwards;
}

.flow-panel.sliding-out-right {
    animation: slideOutRight 0.4s ease forwards;
}

.flow-panel.sliding-in-left {
    animation: slideInLeft 0.4s ease forwards;
}

@keyframes slideOutLeft {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50px);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(50px);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Flow Navigation */
.flow-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0;
    background: none;
    border-top: none;
}

.flow-navigation button:only-child {
    margin-left: auto;
}

/* Override main-grid for single-panel mode */
.main-grid {
    display: none;
}

/* Panes in single-panel mode get full width */
.flow-panel .pane {
    width: 100%;
    max-width: 100%;
}

/* Make resume panel shorter so analyze button is visible */
.flow-panel[data-panel="2"] .pane {
    min-height: 400px;
}

.flow-panel[data-panel="2"] .pane textarea {
    min-height: 300px;
    max-height: 400px;
}

/* Floating Analyze Prompt */
.floating-analyze-prompt {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    border: 2px solid var(--ink);
    border-radius: var(--radius);
    box-shadow: 0 20px 60px rgba(18, 19, 20, 0.3);
    padding: 2rem;
    z-index: 10000;
    max-width: 500px;
    width: 90%;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.floating-analyze-prompt.show {
    opacity: 1;
}

.floating-prompt-content {
    text-align: center;
}

.floating-prompt-content p {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 1.5rem;
}

.floating-prompt-content button {
    margin: 0.5rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .flow-progress {
        gap: 0.5rem;
        max-width: 250px;
    }

    .flow-step {
        width: 32px;
        height: 32px;
        font-size: 0.9rem;
    }

    .flow-navigation {
        flex-direction: column;
        gap: 0.75rem;
    }

    .flow-navigation button {
        width: 100%;
    }

    .floating-analyze-prompt {
        padding: 1.5rem;
    }

    .floating-prompt-content p {
        font-size: 1.1rem;
    }
}

