    <style>
        * { box-sizing: border-box; margin: 0; padding: 0; }
        
        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            min-height: 100vh;
            padding: 20px;
        }
        
        .container {
            max-width: 1200px;
            margin: 0 auto;
            background: white;
            border-radius: 16px;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
            overflow: hidden;
        }
        
        header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 30px;
            text-align: center;
        }
        
        header h1 {
            font-size: 2.5em;
            margin-bottom: 10px;
        }
        
        header p {
            opacity: 0.9;
            font-size: 1.1em;
        }
        
        .content {
            padding: 30px;
        }
        
        /* Login Form */
        #login-form {
            max-width: 400px;
            margin: 50px auto;
            text-align: center;
        }
        
        #login-form h2 {
            margin-bottom: 30px;
            color: #333;
        }
        
        input[type="text"], 
        input[type="password"], 
        textarea, 
        select {
            width: 100%;
            padding: 12px;
            margin: 10px 0;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            font-size: 16px;
            transition: border-color 0.3s;
        }
        
        input:focus, textarea:focus, select:focus {
            outline: none;
            border-color: #667eea;
        }
        
        textarea {
            min-height: 150px;
            font-family: 'Courier New', monospace;
            resize: vertical;
        }
        
        button {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border: none;
            padding: 12px 30px;
            font-size: 16px;
            border-radius: 8px;
            cursor: pointer;
            transition: transform 0.2s, box-shadow 0.2s;
            margin: 5px;
        }
        
        button:hover {
            transform: translateY(-2px);
            box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
        }
        
        button:active {
            transform: translateY(0);
        }
        
        button.secondary {
            background: #6c757d;
        }
        
        button.danger {
            background: #dc3545;
        }
        
        button.delete-btn {
            background: #dc3545;
            margin-right: 10px;
        }
        
        button.delete-btn:hover {
            background: #c82333;
        }
        
        button.archive-btn {
            background: #6c757d;
        }
        
        button.archive-btn:hover {
            background: #5a6268;
        }
        
        .archived-badge {
            background: #6c757d;
            color: white;
            padding: 2px 8px;
            border-radius: 4px;
            font-size: 11px;
            margin-left: 8px;
        }
        
        .book-card.archived {
            opacity: 0.7;
            border: 2px dashed #6c757d;
        }
        
        button.success {
            background: #28a745;
        }
        
        /* Navigation Tabs */
        .tabs {
            display: flex;
            gap: 10px;
            border-bottom: 2px solid #e0e0e0;
            margin-bottom: 30px;
        }
        
        .tab {
            padding: 15px 30px;
            background: transparent;
            border: none;
            border-bottom: 3px solid transparent;
            cursor: pointer;
            font-size: 16px;
            font-weight: 500;
            color: #666;
            transition: all 0.3s;
        }
        
        .tab:hover {
            color: #667eea;
            transform: none;
            box-shadow: none;
        }
        
        .tab.active {
            color: #667eea;
            border-bottom-color: #667eea;
        }
        
        .tab-content {
            display: none;
        }
        
        .tab-content.active {
            display: block;
        }
        
        /* Stats Cards */
        .stats-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
            margin-bottom: 30px;
        }
        
        .stat-card {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px;
            border-radius: 12px;
            text-align: center;
        }
        
        .stat-card h3 {
            font-size: 2em;
            margin-bottom: 5px;
        }
        
        .stat-card p {
            opacity: 0.9;
        }
        
        /* Book Cards */
        .books-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 20px;
        }
        
        .book-card {
            background: #f8f9fa;
            border: 2px solid #e0e0e0;
            border-radius: 12px;
            padding: 20px;
            transition: transform 0.2s, box-shadow 0.2s;
            cursor: pointer;
        }
        
        .book-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 10px 30px rgba(0,0,0,0.1);
            border-color: #667eea;
        }
        
        .book-card h3 {
            color: #333;
            margin-bottom: 10px;
        }
        
        .book-card .status {
            display: inline-block;
            padding: 5px 12px;
            border-radius: 20px;
            font-size: 12px;
            font-weight: bold;
            margin-bottom: 10px;
        }
        
        .status.draft { background: #ffc107; color: #000; }
        .status.generating { background: #17a2b8; color: #fff; }
        .status.completed { background: #28a745; color: #fff; }
        
        .progress-bar {
            width: 100%;
            height: 8px;
            background: #e0e0e0;
            border-radius: 4px;
            overflow: hidden;
            margin: 10px 0;
        }
        
        .progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
            transition: width 0.3s;
        }
        
        /* Form Sections */
        .form-section {
            margin-bottom: 30px;
        }
        
        .form-section h3 {
            color: #333;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 2px solid #e0e0e0;
        }
        
        .form-row {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 15px;
            margin-bottom: 15px;
        }
        
        .form-row.full {
            grid-template-columns: 1fr;
        }
        
        label {
            display: block;
            margin-bottom: 5px;
            color: #666;
            font-weight: 500;
        }
        
        /* Section List */
        .section-list {
            max-height: 400px;
            overflow-y: auto;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            padding: 15px;
        }
        
        .section-item {
            padding: 15px;
            background: #f8f9fa;
            border-left: 4px solid #667eea;
            margin-bottom: 10px;
            border-radius: 4px;
        }
        
        .section-item.review-failed {
            border-left-color: #dc3545;
        }
        
        .section-item h4 {
            margin-bottom: 5px;
            color: #333;
        }
        
        .section-meta {
            font-size: 14px;
            color: #666;
        }
        
        /* Output Display */
        .output-box {
            background: #f8f9fa;
            border: 2px solid #e0e0e0;
            border-radius: 8px;
            padding: 20px;
            margin-top: 20px;
            max-height: 600px;
            overflow-y: auto;
        }
        
        .output-box pre {
            white-space: pre-wrap;
            word-wrap: break-word;
            font-family: 'Courier New', monospace;
            line-height: 1.6;
        }
        
        /* Utility Classes */
        .text-center { text-align: center; }
        .mt-20 { margin-top: 20px; }
        .mb-20 { margin-bottom: 20px; }
        .hidden { display: none; }
        
        /* Loading Spinner */
        .spinner {
            border: 4px solid #f3f3f3;
            border-top: 4px solid #667eea;
            border-radius: 50%;
            width: 40px;
            height: 40px;
            animation: spin 1s linear infinite;
            margin: 20px auto;
        }
        
        @keyframes spin {
            0% { transform: rotate(0deg); }
            100% { transform: rotate(360deg); }
        }
        
        .alert {
            padding: 15px;
            border-radius: 8px;
            margin-bottom: 20px;
        }
        
        .alert.success {
            background: #d4edda;
            color: #155724;
            border: 1px solid #c3e6cb;
        }
        
        .alert.error {
            background: #f8d7da;
            color: #721c24;
            border: 1px solid #f5c6cb;
        }
        
        .alert.info {
            background: #d1ecf1;
            color: #0c5460;
            border: 1px solid #bee5eb;
        }
        
        /* Phase 1A: Book Detail Styles */
        .book-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 30px;
            border-radius: 12px;
            margin-bottom: 30px;
        }
        
        .book-header h2 {
            margin: 0 0 10px 0;
            font-size: 2em;
        }
        
        .book-meta {
            display: flex;
            gap: 30px;
            flex-wrap: wrap;
            opacity: 0.95;
        }
        
        .book-meta-item {
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .progress-bar-container {
            background: #e0e0e0;
            height: 30px;
            border-radius: 15px;
            overflow: hidden;
            margin: 20px 0;
        }
        
        .progress-bar {
            background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
            height: 100%;
            transition: width 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
        }
        
        .sections-table {
            width: 100%;
            border-collapse: collapse;
            margin: 20px 0;
            background: white;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: 0 2px 10px rgba(0,0,0,0.05);
        }
        
        .sections-table th {
            background: #667eea;
            color: white;
            padding: 15px;
            text-align: left;
            font-weight: 600;
        }
        
        .sections-table td {
            padding: 12px 15px;
            border-bottom: 1px solid #e0e0e0;
        }
        
        .sections-table tr:hover {
            background: #f8f9fa;
        }
        
        .section-status {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 12px;
            font-size: 0.85em;
            font-weight: 600;
        }
        
        .section-status.passed {
            background: #d4edda;
            color: #155724;
        }
        
        .section-status.failed {
            background: #fff3cd;
            color: #856404;
        }
        
        .action-buttons {
            display: flex;
            gap: 5px;
        }
        
        .action-buttons button {
            padding: 6px 12px;
            font-size: 0.85em;
        }
        
        /* Modal */
        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.7);
            z-index: 1000;
            align-items: center;
            justify-content: center;
        }
        
        .modal.active {
            display: flex;
        }
        
        .modal-content {
            background: white;
            border-radius: 16px;
            max-width: 800px;
            max-height: 90vh;
            overflow-y: auto;
            position: relative;
            box-shadow: 0 20px 60px rgba(0,0,0,0.3);
        }
        
        .modal-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px 30px;
            border-radius: 16px 16px 0 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .modal-header h3 {
            margin: 0;
        }
        
        .modal-close {
            background: rgba(255,255,255,0.2);
            border: none;
            color: white;
            font-size: 24px;
            cursor: pointer;
            width: 36px;
            height: 36px;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .modal-close:hover {
            background: rgba(255,255,255,0.3);
            transform: none;
        }
        
        .modal-body {
            padding: 30px;
        }
        
        .section-content {
            background: #f8f9fa;
            padding: 20px;
            border-radius: 8px;
            white-space: pre-wrap;
            font-family: 'Courier New', monospace;
            font-size: 14px;
            line-height: 1.6;
            max-height: 400px;
            overflow-y: auto;
        }
        
        .section-meta {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
            gap: 15px;
            margin: 20px 0;
        }
        
        .meta-item {
            background: #f8f9fa;
            padding: 12px;
            border-radius: 8px;
            text-align: center;
        }
        
        .meta-item strong {
            display: block;
            color: #667eea;
            font-size: 1.5em;
            margin-bottom: 5px;
        }
        
        .meta-item small {
            color: #666;
        }
        
        /* Section Illustration Styles */
        .illustration-section {
            margin-top: 25px;
            padding: 20px;
            background: #f0f7ff;
            border-radius: 12px;
            border: 2px solid #d0e3ff;
        }
        
        .illustration-section h4 {
            margin: 0 0 15px 0;
            color: #333;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .illustration-tag-preview {
            background: #fff;
            padding: 12px 15px;
            border-radius: 8px;
            border: 1px solid #d0e3ff;
            font-family: 'Courier New', monospace;
            font-size: 13px;
            color: #555;
            margin-bottom: 15px;
        }
        
        .illustration-tag-preview .tag-label {
            color: #667eea;
            font-weight: bold;
        }
        
        .illustration-preview-area {
            text-align: center;
            padding: 20px;
            background: #fff;
            border-radius: 8px;
            border: 2px dashed #d0e3ff;
            min-height: 150px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
        }
        
        .illustration-preview-area.has-image {
            border-style: solid;
            border-color: #28a745;
        }
        
        .illustration-preview-area img {
            max-width: 100%;
            max-height: 350px;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }
        
        .illustration-preview-area .placeholder-icon {
            font-size: 48px;
            opacity: 0.3;
            margin-bottom: 10px;
        }
        
        .illustration-preview-area .placeholder-text {
            color: #999;
            font-size: 14px;
        }
        
        .illustration-meta {
            display: flex;
            gap: 15px;
            justify-content: center;
            margin-top: 12px;
            flex-wrap: wrap;
        }
        
        .illustration-meta .meta-badge {
            background: #e9ecef;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 12px;
            color: #555;
        }
        
        .illustration-meta .meta-badge.success {
            background: #d4edda;
            color: #155724;
        }
        
        .illustration-actions {
            margin-top: 15px;
            display: flex;
            gap: 10px;
            justify-content: center;
            flex-wrap: wrap;
        }
        
        .illustration-actions button {
            padding: 10px 20px;
            font-size: 14px;
        }
        
        .illustration-error {
            background: #f8d7da;
            color: #721c24;
            padding: 12px;
            border-radius: 8px;
            margin-top: 10px;
            font-size: 13px;
        }
        
        .illustration-generating {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 15px;
        }
        
        .illustration-generating .spinner {
            width: 40px;
            height: 40px;
            border: 4px solid #e0e0e0;
            border-top-color: #667eea;
            border-radius: 50%;
            animation: spin 1s linear infinite;
        }
        
        @keyframes spin {
            to { transform: rotate(360deg); }
        }
        
        .no-reference-warning {
            background: #fff3cd;
            color: #856404;
            padding: 15px;
            border-radius: 8px;
            text-align: center;
        }
        
        .no-reference-warning a {
            color: #667eea;
            text-decoration: underline;
            cursor: pointer;
        }
        
        /* Section list illustration icon */
        .illus-icon {
            font-size: 16px;
            margin-left: 5px;
        }
        
        .illus-icon.complete { color: #28a745; }
        .illus-icon.pending { color: #ffc107; }
        .illus-icon.failed { color: #dc3545; }
        .illus-icon.none { color: #ccc; }

        .stats-summary {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
            margin: 30px 0;
        }
        
        .stat-box {
            background: #f8f9fa;
            border: 2px solid #e0e0e0;
            border-radius: 12px;
            padding: 20px;
            text-align: center;
        }
        
        .stat-box h4 {
            color: #667eea;
            margin: 0 0 10px 0;
            font-size: 2em;
        }
        
        .stat-box p {
            color: #666;
            margin: 0;
        }
        
        /* Export Dropdown */
        .dropdown {
            position: relative;
            display: inline-block;
        }
        
        .dropdown-content {
            display: none;
            position: absolute;
            background: white;
            min-width: 200px;
            box-shadow: 0 8px 16px rgba(0,0,0,0.2);
            border-radius: 8px;
            z-index: 100;
            overflow: hidden;
            top: 100%;
            left: 0;
        }
        
        .dropdown-content.show {
            display: block;
        }
        
        .dropdown-content a,
        .dropdown-content button {
            display: block;
            width: 100%;
            padding: 12px 16px;
            text-align: left;
            background: white;
            border: none;
            color: #333;
            text-decoration: none;
            font-size: 14px;
            cursor: pointer;
            transition: background 0.2s;
            margin: 0;
            border-radius: 0;
        }
        
        .dropdown-content a:hover,
        .dropdown-content button:hover {
            background: #f0f0ff;
            transform: none;
            box-shadow: none;
        }
        
        .dropdown-header {
            padding: 8px 16px;
            font-weight: bold;
            color: #667eea;
            background: #f8f9fa;
            border-bottom: 1px solid #e0e0e0;
            font-size: 12px;
            text-transform: uppercase;
        }
        
        .dropdown-divider {
            height: 1px;
            background: #e0e0e0;
            margin: 0;
        }
        
        /* Author Cards */
        .authors-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
            gap: 20px;
        }
        
        .author-card {
            background: #f8f9fa;
            border: 2px solid #e0e0e0;
            border-radius: 12px;
            padding: 20px;
            position: relative;
        }
        
        .author-card.default {
            border-color: #667eea;
            background: linear-gradient(135deg, #f0f0ff 0%, #fff 100%);
        }
        
        .author-card .default-badge {
            position: absolute;
            top: 10px;
            right: 10px;
            background: #667eea;
            color: white;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 12px;
        }
        
        .author-card h3 {
            color: #333;
            margin-bottom: 10px;
        }
        
        .author-card p {
            color: #666;
            font-size: 14px;
            margin: 5px 0;
        }
        
        .author-card .bio-preview {
            background: white;
            padding: 10px;
            border-radius: 8px;
            margin: 10px 0;
            font-size: 13px;
            max-height: 80px;
            overflow: hidden;
        }
        
        .author-card .actions {
            margin-top: 15px;
            display: flex;
            gap: 10px;
            flex-wrap: wrap;
        }
        
        /* Wizard Confirmation UI */
        .wizard-confirmation {
            max-width: 600px;
            margin: 0 auto;
        }
        
        .wizard-confirmation h2 {
            text-align: center;
            margin-bottom: 30px;
            color: #333;
        }
        
        .wizard-confirmation .form-group {
            margin-bottom: 20px;
        }
        
        .wizard-confirmation .form-group label {
            display: block;
            margin-bottom: 8px;
            font-weight: 500;
            color: #333;
        }
        
        .wizard-confirmation .title-input-wrapper {
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .wizard-confirmation .title-input-wrapper input {
            flex: 1;
            margin: 0;
        }
        
        .wizard-confirmation .edit-icon {
            color: #667eea;
            font-size: 18px;
        }
        
        .wizard-summary {
            background: #f8f9fa;
            border: 2px solid #e0e0e0;
            border-radius: 12px;
            padding: 20px;
            margin: 25px 0;
        }
        
        .wizard-summary h4 {
            color: #667eea;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .wizard-summary ul {
            list-style: none;
            padding: 0;
            margin: 0;
        }
        
        .wizard-summary li {
            padding: 8px 0;
            color: #555;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .wizard-summary li::before {
            content: "•";
            color: #667eea;
            font-weight: bold;
        }
        
        .mock-mode-toggle {
            background: #fff3cd;
            border: 2px solid #ffc107;
            border-radius: 12px;
            padding: 15px 20px;
            margin: 20px 0;
            display: flex;
            align-items: center;
            gap: 12px;
        }
        
        .mock-mode-toggle label {
            display: flex;
            align-items: center;
            gap: 10px;
            cursor: pointer;
            margin: 0;
            font-weight: 500;
        }
        
        .mock-mode-toggle input[type="checkbox"] {
            width: auto;
            margin: 0;
        }
        
        .mock-mode-toggle small {
            color: #856404;
            font-size: 12px;
            margin-left: auto;
        }
        
        /* Mode Switch Toggle in Book Detail */
        .mode-switch {
            position: relative;
            display: inline-block;
            width: 50px;
            height: 26px;
        }
        
        .mode-switch input {
            opacity: 0;
            width: 0;
            height: 0;
        }
        
        .mode-slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: #dc3545;
            transition: 0.3s;
            border-radius: 26px;
        }
        
        .mode-slider:before {
            position: absolute;
            content: "";
            height: 20px;
            width: 20px;
            left: 3px;
            bottom: 3px;
            background-color: white;
            transition: 0.3s;
            border-radius: 50%;
        }
        
        .mode-switch input:checked + .mode-slider {
            background-color: #ffc107;
        }
        
        .mode-switch input:checked + .mode-slider:before {
            transform: translateX(24px);
        }
        
        /* Mock Sections Toggle */
        .show-mock-toggle {
            display: flex;
            align-items: center;
            gap: 8px;
            font-size: 14px;
            color: #666;
            margin-left: 15px;
        }
        
        .show-mock-toggle input {
            width: auto;
            margin: 0;
        }
        
        /* Mock Section Styling */
        .section-row-mock {
            background: #f5f5f5 !important;
            opacity: 0.7;
        }
        
        .section-row-mock td {
            color: #888;
        }
        
        .mock-badge {
            background: #6c757d;
            color: white;
            padding: 2px 6px;
            border-radius: 4px;
            font-size: 10px;
            margin-left: 5px;
            font-weight: bold;
        }
        
        .advanced-settings-toggle {
            background: transparent;
            border: none;
            color: #667eea;
            cursor: pointer;
            padding: 10px 0;
            font-size: 14px;
            display: flex;
            align-items: center;
            gap: 8px;
            margin: 0;
        }
        
        .advanced-settings-toggle:hover {
            transform: none;
            box-shadow: none;
            text-decoration: underline;
        }
        
        .advanced-settings {
            display: none;
            background: #f8f9fa;
            border: 2px solid #e0e0e0;
            border-radius: 12px;
            padding: 20px;
            margin-top: 10px;
        }
        
        .advanced-settings.show {
            display: block;
        }
        
        .wizard-confirmation .button-row {
            display: flex;
            justify-content: center;
            gap: 15px;
            margin-top: 30px;
        }
        
        .new-author-input {
            display: none;
            margin-top: 10px;
        }
        
        .new-author-input.show {
            display: block;
        }
        
        /* Matter Modal */
        .matter-modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
        }
        
        .matter-modal.show {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .matter-modal-content {
            background: white;
            border-radius: 16px;
            max-width: 900px;
            width: 95%;
            max-height: 90vh;
            overflow-y: auto;
        }
        
        .matter-modal-header {
            background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
            color: white;
            padding: 20px;
            border-radius: 16px 16px 0 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .matter-modal-body {
            padding: 20px;
        }
        
        .matter-tabs {
            display: flex;
            border-bottom: 2px solid #e0e0e0;
            margin-bottom: 20px;
        }
        
        .matter-tab {
            padding: 10px 20px;
            background: transparent;
            border: none;
            cursor: pointer;
            font-weight: 500;
            color: #666;
            border-bottom: 3px solid transparent;
        }
        
        .matter-tab.active {
            color: #28a745;
            border-bottom-color: #28a745;
        }
        
        .matter-tab:hover {
            color: #28a745;
            transform: none;
            box-shadow: none;
        }
        
        .matter-section {
            display: none;
        }
        
        .matter-section.active {
            display: block;
        }
        
        .matter-preview {
            background: #f8f9fa;
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 20px;
            margin: 15px 0;
            white-space: pre-wrap;
            font-family: 'Georgia', serif;
            max-height: 300px;
            overflow-y: auto;
        }
        
        .matter-preview h4 {
            color: #667eea;
            margin-bottom: 10px;
            font-family: 'Segoe UI', sans-serif;
        }
        
        /* Image Settings Modal */
        .image-settings-modal {
            display: none;
            position: fixed;
            z-index: 1000;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.5);
        }
        
        .image-settings-modal.show {
            display: flex;
            align-items: center;
            justify-content: center;
        }
        
        .image-settings-modal-content {
            background: white;
            border-radius: 16px;
            max-width: 900px;
            width: 95%;
            max-height: 90vh;
            overflow-y: auto;
        }
        
        .image-settings-modal-header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 20px;
            border-radius: 16px 16px 0 0;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }
        
        .image-settings-modal-body {
            padding: 20px;
        }
        
        .character-entry {
            display: grid;
            grid-template-columns: 150px 1fr 40px;
            gap: 10px;
            align-items: start;
            margin-bottom: 10px;
            padding: 10px;
            background: #f8f9fa;
            border-radius: 8px;
        }
        
        .character-entry input[type="text"] {
            padding: 8px 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
        }
        
        .character-entry textarea {
            padding: 8px 12px;
            border: 1px solid #ddd;
            border-radius: 6px;
            font-size: 14px;
            min-height: 60px;
            resize: vertical;
        }
        
        .character-entry .remove-btn {
            background: #dc3545;
            color: white;
            border: none;
            border-radius: 6px;
            padding: 8px;
            cursor: pointer;
            font-size: 16px;
        }
        
        .character-entry .remove-btn:hover {
            background: #c82333;
        }
        
        .reference-image-preview {
            background: #f8f9fa;
            border: 2px dashed #ddd;
            border-radius: 12px;
            padding: 30px;
            text-align: center;
            margin: 15px 0;
        }
        
        .reference-image-preview img {
            max-width: 300px;
            max-height: 300px;
            border-radius: 8px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
        }
        
        .reference-image-preview .placeholder {
            color: #999;
            font-size: 48px;
            margin-bottom: 10px;
        }
        
        .settings-section {
            margin-bottom: 25px;
            padding-bottom: 20px;
            border-bottom: 1px solid #eee;
        }
        
        .settings-section:last-child {
            border-bottom: none;
        }
        
        .settings-section h4 {
            color: #667eea;
            margin-bottom: 15px;
            display: flex;
            align-items: center;
            gap: 8px;
        }
        
        .image-settings-status {
            padding: 10px 15px;
            border-radius: 8px;
            margin-bottom: 15px;
            display: none;
        }
        
        .image-settings-status.success {
            background: #d4edda;
            color: #155724;
            display: block;
        }
        
        .image-settings-status.error {
            background: #f8d7da;
            color: #721c24;
            display: block;
        }
        
        /* Batch Generation Modal */
        .batch-modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.7);
            z-index: 2000;
            justify-content: center;
            align-items: center;
        }
        
        .batch-modal.active {
            display: flex;
        }
        
        .batch-modal-content {
            background: white;
            border-radius: 16px;
            padding: 30px;
            width: 90%;
            max-width: 600px;
            max-height: 80vh;
            overflow-y: auto;
        }
        
        .batch-progress-bar {
            width: 100%;
            height: 30px;
            background: #e0e0e0;
            border-radius: 15px;
            overflow: hidden;
            margin: 20px 0;
        }
        
        .batch-progress-fill {
            height: 100%;
            background: linear-gradient(90deg, #667eea, #764ba2);
            border-radius: 15px;
            transition: width 0.3s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-weight: bold;
            font-size: 14px;
        }
        
        .batch-stats {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 15px;
            margin: 20px 0;
        }
        
        .batch-stat {
            text-align: center;
            padding: 15px;
            background: #f8f9fa;
            border-radius: 10px;
        }
        
        .batch-stat.passed { background: #d4edda; }
        .batch-stat.failed { background: #f8d7da; }
        .batch-stat.cost { background: #fff3cd; }
        
        .batch-stat h3 {
            margin: 0;
            font-size: 24px;
        }
        
        .batch-stat p {
            margin: 5px 0 0 0;
            font-size: 12px;
            color: #666;
        }
        
        .batch-status {
            padding: 15px;
            background: #e8f4f8;
            border-radius: 10px;
            margin: 15px 0;
            text-align: center;
        }
        
        .batch-log {
            max-height: 150px;
            overflow-y: auto;
            background: #f1f1f1;
            padding: 10px;
            border-radius: 8px;
            font-family: monospace;
            font-size: 12px;
            margin-top: 15px;
        }
        
        .batch-log-entry {
            padding: 3px 0;
            border-bottom: 1px solid #ddd;
        }
        
        .batch-log-entry.success { color: #28a745; }
        .batch-log-entry.fail { color: #dc3545; }
        .batch-log-entry.info { color: #17a2b8; }
        
        .batch-buttons {
            display: flex;
            gap: 10px;
            margin-top: 20px;
            justify-content: center;
        }
        
        /* Grok Review Results */
        .grok-review-results {
            margin-top: 20px;
            padding: 20px;
            background: #f0f8ff;
            border-radius: 12px;
            border: 2px solid #667eea;
        }
        
        .grok-score {
            font-size: 48px;
            font-weight: bold;
            text-align: center;
            color: #667eea;
        }
        
        .grok-flagged-section {
            background: #fff3cd;
            padding: 10px;
            margin: 5px 0;
            border-radius: 6px;
            border-left: 4px solid #ffc107;
        }
        
        .grok-strength {
            background: #d4edda;
            padding: 8px 12px;
            margin: 3px 0;
            border-radius: 6px;
            display: inline-block;
        }
        
        /* ============================================
           Cover Generator Styles
           ============================================ */
        
        .cover-display {
            text-align: center;
            width: 100%;
        }
        
        .cover-image {
            max-width: 100%;
            max-height: 400px;
            border-radius: 4px;
            box-shadow: 0 4px 12px rgba(0,0,0,0.15);
            cursor: pointer;
            transition: transform 0.2s;
        }
        
        .cover-image:hover {
            transform: scale(1.02);
        }
        
        .cover-meta {
            margin: 10px 0;
            font-size: 12px;
            color: #666;
        }
        
        .cover-method {
            background: #e8f4ff;
            padding: 2px 8px;
            border-radius: 12px;
            margin-right: 8px;
        }
        
        .cover-style {
            background: #f0f0f0;
            padding: 2px 8px;
            border-radius: 12px;
        }
        
        .cover-actions {
            margin-top: 15px;
            display: flex;
            gap: 10px;
            justify-content: center;
            flex-wrap: wrap;
        }
        
        .cover-placeholder {
            text-align: center;
            color: #666;
        }
        
        .cover-placeholder .placeholder-icon {
            font-size: 64px;
            margin-bottom: 15px;
        }
        
        .cover-placeholder .placeholder-text {
            font-size: 16px;
            margin-bottom: 20px;
        }
        
        .cover-generating {
            text-align: center;
            padding: 40px;
        }
        
        .cover-error {
            text-align: center;
            color: #dc3545;
        }
        
        .cover-error .error-icon {
            font-size: 48px;
            margin-bottom: 10px;
        }
        
        /* Fullscreen cover preview */
        .cover-fullscreen-overlay {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0,0,0,0.9);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 10000;
        }
        
        .cover-fullscreen-content {
            position: relative;
            max-width: 90%;
            max-height: 90%;
        }
        
        .cover-fullscreen-content img {
            max-width: 100%;
            max-height: 90vh;
            border-radius: 4px;
        }
        
        .cover-fullscreen-close {
            position: absolute;
            top: -40px;
            right: 0;
            background: none;
            border: none;
            color: white;
            font-size: 36px;
            cursor: pointer;
        }
        
        /* Character info for covers */
        .cover-character-item {
            padding: 5px 0;
            border-bottom: 1px solid #eee;
            display: flex;
            align-items: center;
            gap: 10px;
        }
        
        .cover-character-item .char-name {
            font-weight: 500;
        }
        
        .cover-character-item .char-count {
            color: #666;
            font-size: 12px;
        }
        
        .cover-character-item .char-ref {
            font-size: 11px;
            padding: 2px 6px;
            border-radius: 10px;
        }
        
        .cover-character-item .char-ref.has-ref {
            background: #d4edda;
            color: #155724;
        }
        
        .cover-character-item .char-ref.no-ref {
            background: #fff3cd;
            color: #856404;
        }
        
        #cover-characters-info h6 {
            margin-bottom: 10px;
            color: #333;
        }
        
        /* Cover art style dropdown */
        #cover-art-style {
            min-width: 280px;
        }
        
        #cover-art-style option[disabled] {
            color: #999;
            font-weight: normal;
            font-size: 10px;
        }
    </style>
