/* ==============================================================================
   CLAY DESIGN SYSTEM
   Plagiarism Detector Pro - Text Similarity & Academic Diagnostics
   Anchors on cream canvas (#fffaf0), dark-navy CTAs (#0a0a0a), saturated cards
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
    /* Clay Core Color Palette */
    --primary: #0a0a0a;
    --primary-hover: #1f1f1f;
    --primary-active: #2a2a2a;
    --primary-disabled: #e5e5e5;
    --on-primary: #ffffff;

    --ink: #0a0a0a;
    --body-strong: #1a1a1a;
    --body: #3a3a3a;
    --muted: #6a6a6a;
    --muted-soft: #9a9a9a;

    --hairline: #e5e5e5;
    --hairline-soft: #f0f0f0;

    --canvas: #fffaf0;
    --surface-soft: #faf5e8;
    --surface-card: #f5f0e0;
    --surface-strong: #ebe6d6;
    --surface-white: #ffffff;
    --surface-dark: #0a1a1a;
    --surface-dark-elevated: #1a2a2a;
    --on-dark: #ffffff;
    --on-dark-soft: #a0a0a0;

    /* Saturated Feature Card Palette */
    --brand-teal: #1a3a3a;
    --brand-lavender: #b8a4ed;
    --brand-peach: #ffb084;
    --brand-ochre: #e8b94a;
    --brand-mint: #a4d4c5;
    --brand-coral: #ff6b5a;

    /* Semantic Feedback */
    --success: #22c55e;
    --success-bg: #dcfce7;
    --success-text: #166534;
    --warning: #f59e0b;
    --warning-bg: #fef3c7;
    --warning-text: #92400e;
    --error: #ef4444;
    --error-bg: #fee2e2;
    --error-text: #991b1b;
    --danger: #ef4444;
    --danger-bg: #fee2e2;
    --danger-text: #991b1b;

    /* Backward compatibility mappings */
    --bg-main: var(--canvas);
    --card-bg: var(--surface-white);
    --card-border: var(--hairline);
    --text-primary: var(--ink);
    --text-secondary: var(--body);
    --text-muted: var(--muted);
    --input-bg: var(--surface-white);
    --input-border: var(--hairline);
    --input-focus-border: var(--primary);
    --ai-purple: #7c3aed;
    --ai-purple-bg: #f3e8ff;

    /* Typography */
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    /* Rounded Scale */
    --rounded-xs: 6px;
    --rounded-sm: 8px;
    --rounded-md: 12px;
    --rounded-lg: 16px;
    --rounded-xl: 24px;
    --rounded-pill: 9999px;
    --radius-xs: 6px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Spacing 4px Rhythm */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-6: 24px;
    --space-8: 32px;
    --space-12: 48px;
    --space-section: 96px;

    /* Elevation & Depth */
    --shadow-subtle: 0 1px 2px 0 rgba(0, 0, 0, 0.04);
    --shadow-card: 0 4px 12px -2px rgba(10, 10, 10, 0.04), 0 0 0 1px var(--hairline);
    --shadow-float: 0 12px 32px -8px rgba(10, 10, 10, 0.08);
}

/* Base Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--body);
    background-color: var(--canvas);
    min-height: 100vh;
    padding: 0;
    position: relative;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Background Canvas - Clean Warm Texture */
#webgl-canvas {
    display: none;
}

.app-wrapper {
    position: relative;
    z-index: 1;
    max-width: 1280px;
    margin: 0 auto;
    padding: var(--space-4) var(--space-6) var(--space-12) var(--space-6);
}

/* ==============================================================================
   TOP NAVIGATION & BRAND BAR (Clay Top Nav)
   ============================================================================== */
.top-nav-container {
    width: 100%;
    background: var(--canvas);
    border-bottom: 1px solid var(--hairline);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(8px);
}

.top-nav {
    max-width: 1280px;
    margin: 0 auto;
    height: 64px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--space-6);
}

.brand-identity {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    text-decoration: none;
    color: var(--ink);
}

.brand-logo-icon {
    width: 34px;
    height: 34px;
    background: var(--primary);
    color: var(--on-primary);
    border-radius: var(--rounded-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
}

.brand-logo-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.5px;
    color: var(--ink);
}

.brand-badge-pill {
    background: var(--surface-card);
    color: var(--body-strong);
    font-size: 12px;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: var(--rounded-pill);
    border: 1px solid var(--hairline);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.top-nav-actions {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.nav-link-btn {
    background: transparent;
    color: var(--body);
    font-size: 14px;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: var(--rounded-pill);
    border: none;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.nav-link-btn:hover {
    background: var(--surface-card);
    color: var(--ink);
}

/* ==============================================================================
   HERO BAND (Clay Rounded Display Typography)
   ============================================================================== */
.hero-band {
    padding: var(--space-8) 0 var(--space-6) 0;
    text-align: left;
}

.hero-pill-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--surface-card);
    color: var(--ink);
    padding: 6px 14px;
    border-radius: var(--rounded-pill);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--hairline);
    margin-bottom: var(--space-4);
}

.brand-title {
    font-family: var(--font-display);
    font-size: 48px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: -1.5px;
    color: var(--ink);
    margin-bottom: var(--space-3);
}

.brand-subtitle {
    font-size: 18px;
    font-weight: 400;
    line-height: 1.5;
    color: var(--body);
    max-width: 820px;
    margin-bottom: var(--space-4);
}

.hero-features-chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
}

.chip-item {
    font-size: 13px;
    font-weight: 500;
    padding: 4px 12px;
    border-radius: var(--rounded-pill);
    background: var(--surface-soft);
    color: var(--body-strong);
    border: 1px solid var(--hairline);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

/* ==============================================================================
   CATEGORY NAVIGATION TABS (Clay Segmented Sub-Nav)
   ============================================================================== */
.tabs-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px;
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    margin-bottom: var(--space-6);
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.tabs-nav::-webkit-scrollbar {
    display: none;
}

.tab-btn {
    background: transparent;
    border: 1px solid transparent;
    color: var(--muted);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    padding: 9px 18px;
    border-radius: var(--rounded-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    outline: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.tab-btn:focus, .tab-btn:focus-visible {
    outline: none;
    box-shadow: none;
}

.tab-btn:hover {
    color: var(--ink);
    background: rgba(245, 240, 224, 0.7);
}

.tab-btn.active {
    background: var(--surface-white);
    color: var(--ink);
    font-weight: 600;
    border: 1px solid var(--hairline);
    box-shadow: 0 2px 6px rgba(10, 10, 10, 0.04);
}

/* Tab Panels */
.tab-panel {
    display: none;
    animation: clayFadeIn 0.2s ease-out;
}

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

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

/* ==============================================================================
   CLAY CARDS & MOCKUP CONTAINERS
   ============================================================================== */
.glass-card, .content-card {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-card);
    margin-bottom: var(--space-6);
    position: relative;
}

.section-title {
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.4px;
    color: var(--ink);
    margin-bottom: var(--space-3);
}

/* Saturated Feature Cards */
.card-teal, .phd-auditor-card {
    background: var(--brand-teal);
    color: var(--on-dark);
    border-radius: var(--rounded-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-lavender {
    background: var(--brand-lavender);
    color: var(--ink);
    border-radius: var(--rounded-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.card-peach {
    background: var(--brand-peach);
    color: var(--ink);
    border-radius: var(--rounded-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.card-ochre {
    background: var(--brand-ochre);
    color: var(--ink);
    border-radius: var(--rounded-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.card-cream {
    background: var(--surface-card);
    color: var(--ink);
    border-radius: var(--rounded-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

/* ==============================================================================
   EDITOR TOOLBAR, LIVE METRICS & WORD BUDGET
   ============================================================================== */
.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-4);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.preset-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    flex-wrap: wrap;
}

.toolbar-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.preset-btn {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-pill);
    color: var(--body);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.preset-btn:hover {
    background: var(--surface-card);
    color: var(--ink);
    border-color: var(--muted-soft);
}

.toolbar-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.toolbar-action-btn {
    background: transparent;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-pill);
    color: var(--body);
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.toolbar-action-btn:hover {
    background: var(--surface-white);
    color: var(--ink);
}

/* Form Controls */
.form-group {
    margin-bottom: var(--space-4);
}

label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--space-2);
}

.hotkey-tip {
    font-size: 12px;
    font-weight: 400;
    color: var(--muted);
}

textarea, input[type="text"], input[type="password"], input[type="number"], select {
    width: 100%;
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.6;
    padding: 12px 16px;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

textarea {
    min-height: 220px;
    resize: vertical;
}

textarea:focus, input:focus, select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(10, 10, 10, 0.08);
}

/* Live Stats Bar */
.live-stats-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: var(--space-2) var(--space-3);
    margin-bottom: var(--space-4);
}

.stat-pill {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-pill);
    padding: 3px 10px;
    font-size: 12px;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.stat-pill span {
    font-weight: 600;
    color: var(--ink);
}

.stat-pill.highlight {
    background: var(--surface-card);
    border-color: var(--brand-ochre);
}

.stat-pill.highlight span {
    color: var(--ink);
}

/* Word Budget Tracker */
.word-budget-tracker {
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-4);
}

.budget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
    flex-wrap: wrap;
    gap: var(--space-2);
}

.budget-title {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 13px;
    color: var(--ink);
}

.budget-status-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: var(--rounded-pill);
    background: var(--surface-card);
    color: var(--ink);
    border: 1px solid var(--hairline);
}

.budget-status-pill.on-track {
    background: var(--brand-mint);
    color: var(--ink);
}

.budget-status-pill.warning {
    background: var(--brand-peach);
    color: var(--ink);
}

.budget-target-controls {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.budget-select {
    width: auto;
    padding: 4px 10px;
    font-size: 12px;
    border-radius: var(--rounded-pill);
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    color: var(--ink);
}

.budget-progress-track {
    width: 100%;
    height: 8px;
    background: var(--surface-card);
    border-radius: var(--rounded-pill);
    overflow: hidden;
    margin-bottom: 6px;
}

.budget-progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: var(--rounded-pill);
    transition: width 0.3s ease;
}

.budget-metrics-subtext {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
}

/* Switch & Toggles */
.toggle-container {
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: var(--space-3) var(--space-4);
    margin-bottom: var(--space-6);
}

.switch-label {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
    color: var(--body);
    margin-bottom: var(--space-2);
}

.switch-label:last-child {
    margin-bottom: 0;
}

.switch-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.toggle-text strong {
    color: var(--ink);
}

/* ==============================================================================
   CLAY BUTTONS
   ============================================================================== */
.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 600;
    padding: 12px 24px;
    min-height: 46px;
    border-radius: var(--rounded-md);
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: all 0.15s ease;
    box-shadow: var(--shadow-subtle);
    width: 100%;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-primary:active {
    background: var(--primary-active);
    transform: translateY(0);
}

.btn-secondary {
    background: var(--canvas);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    padding: 10px 20px;
    min-height: 42px;
    border-radius: var(--rounded-md);
    border: 1px solid var(--hairline);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    transition: all 0.15s ease;
}

.btn-secondary:hover {
    background: var(--surface-card);
    border-color: var(--muted-soft);
}

.btn-pdf {
    background: var(--surface-white);
    color: var(--ink);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-pdf:hover {
    background: var(--surface-card);
}

/* ==============================================================================
   DROPZONE & FILE UPLOAD
   ============================================================================== */
.dropzone {
    border: 2px dashed var(--hairline);
    background: var(--surface-soft);
    border-radius: var(--rounded-lg);
    padding: var(--space-8) var(--space-6);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: var(--space-4);
}

.dropzone:hover, .dropzone.dragover {
    border-color: var(--primary);
    background: var(--surface-card);
}

.dropzone-icon {
    font-size: 40px;
    display: block;
    margin-bottom: var(--space-2);
}

.dropzone-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 4px;
}

.dropzone-desc {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: var(--space-3);
}

.format-pills {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.pill {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-pill);
    padding: 2px 8px;
    font-size: 11px;
    font-weight: 600;
    color: var(--body);
}

.file-preview {
    display: none;
    align-items: center;
    justify-content: space-between;
    background: var(--surface-card);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: 12px 16px;
    margin-bottom: var(--space-4);
}

.file-info {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.remove-file-btn {
    background: transparent;
    border: none;
    color: var(--muted);
    font-size: 18px;
    cursor: pointer;
}

.remove-file-btn:hover {
    color: var(--danger);
}

/* Primary document-upload workspace */
.upload-workspace {
    max-width: 900px;
    margin-left: auto;
    margin-right: auto;
    padding: 32px;
}

.upload-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-6);
    margin-bottom: var(--space-6);
}

.upload-eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.upload-heading h2 {
    margin-bottom: 6px;
    color: var(--ink);
    font-size: 26px;
    line-height: 1.2;
    letter-spacing: -0.5px;
}

.upload-heading p {
    max-width: 600px;
    color: var(--muted);
    font-size: 14px;
}

.privacy-note {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    padding: 10px 12px;
    border: 1px solid #bbdccf;
    border-radius: var(--rounded-md);
    background: #effaf5;
    color: #164e3b;
    font-size: 12px;
    line-height: 1.25;
}

.privacy-note > span:first-child {
    font-size: 18px;
}

.privacy-note strong,
.privacy-note small {
    display: block;
}

.privacy-note small {
    margin-top: 2px;
    color: #37705d;
}

.upload-dropzone {
    min-height: 250px;
    margin-bottom: var(--space-4);
    padding: 44px 24px;
    border-color: #c9c5b9;
    background: #fdfbf6;
    outline: none;
}

.upload-dropzone:hover,
.upload-dropzone.dragover,
.upload-dropzone:focus-visible {
    border-color: var(--ink);
    background: var(--surface-soft);
    box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.08);
}

.upload-dropzone.has-file {
    display: none;
}

.upload-dropzone .dropzone-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    margin: 0 auto 16px;
    border-radius: 50%;
    background: var(--ink);
    color: white;
    font-size: 28px;
    font-weight: 400;
    line-height: 1;
}

.upload-dropzone .dropzone-title {
    margin-bottom: 4px;
    font-size: 19px;
}

.upload-dropzone .dropzone-desc {
    margin-bottom: 18px;
    font-size: 14px;
}

.browse-link {
    color: var(--ink);
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.upload-dropzone .pill {
    padding: 3px 9px;
    background: transparent;
    color: var(--muted);
}

.upload-file-preview {
    min-height: 92px;
    padding: 18px 20px;
    border-color: #afd5c4;
    background: #f3fbf7;
}

.selected-file-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #d6f3e5;
    color: #166534;
    font-size: 20px;
    font-weight: 700;
}

.selected-file-name {
    max-width: 560px;
    overflow: hidden;
    color: var(--ink);
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selected-file-meta {
    margin-top: 2px;
    color: var(--muted);
    font-size: 12px;
}

.upload-file-preview .remove-file-btn {
    padding: 7px 10px;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-sm);
    background: white;
    color: var(--body);
    font-size: 12px;
    font-weight: 600;
}

.scan-options {
    margin: var(--space-4) 0;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    background: white;
}

.scan-options summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 13px 16px;
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.scan-options summary::-webkit-details-marker {
    display: none;
}

.scan-options summary::after {
    content: '+';
    color: var(--muted);
    font-size: 18px;
    font-weight: 400;
}

.scan-options[open] summary::after {
    content: '−';
}

.settings-summary {
    margin-left: auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
}

.scan-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0;
    padding: 0 16px 16px;
    border-top: 1px solid var(--hairline-soft);
}

.option-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 12px 8px 0;
    color: var(--body);
    cursor: pointer;
}

.option-row:nth-child(even) {
    padding-left: 12px;
}

.option-row input {
    width: 17px;
    height: 17px;
    margin-top: 2px;
    accent-color: var(--ink);
}

.option-row strong,
.option-row small {
    display: block;
}

.option-row strong {
    color: var(--ink);
    font-size: 13px;
}

.option-row small {
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.4;
}

.upload-submit {
    margin-top: var(--space-3);
}

.btn-primary:disabled {
    background: var(--primary-disabled);
    color: #888;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.upload-help {
    margin-top: 10px;
    color: var(--muted);
    font-size: 12px;
    text-align: center;
}

/* ==============================================================================
   BADGES & PILLS
   ============================================================================== */
.badge-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: var(--rounded-pill);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.1px;
    border: 1px solid transparent;
}

.badge-pill.success, .badge-pill.mint {
    background: var(--brand-mint);
    color: var(--ink);
    border-color: rgba(0, 0, 0, 0.08);
}

.badge-pill.warning, .badge-pill.peach {
    background: var(--brand-peach);
    color: var(--ink);
    border-color: rgba(0, 0, 0, 0.08);
}

.badge-pill.danger, .badge-pill.coral {
    background: var(--brand-coral);
    color: var(--ink);
    border-color: rgba(0, 0, 0, 0.08);
}

.badge-pill.info, .badge-pill.lavender {
    background: var(--brand-lavender);
    color: var(--ink);
    border-color: rgba(0, 0, 0, 0.08);
}

.badge-pill.teal {
    background: var(--brand-teal);
    color: var(--on-dark);
}

.badge-pill.ochre {
    background: var(--brand-ochre);
    color: var(--ink);
}

.badge-pill.cream {
    background: var(--surface-card);
    color: var(--ink);
    border-color: var(--hairline);
}

/* ==============================================================================
   STUDENT INTEGRITY CHECKLIST & PHD AUDITOR
   ============================================================================== */
.student-checklist-card {
    background: var(--surface-card);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-xl);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
}

.checklist-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-3);
}

.checklist-subitem {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: var(--space-3) var(--space-4);
}

.checklist-subitem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: var(--space-2);
}

.checklist-subitem-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.checklist-subitem-desc {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.4;
}

/* PhD Conference Auditor */
.phd-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-3);
}

.phd-subitem {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--rounded-md);
    padding: var(--space-3) var(--space-4);
}

.phd-subitem-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: var(--space-2);
}

.phd-subitem-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--on-dark);
}

.phd-subitem-desc {
    font-size: 12px;
    color: var(--on-dark-soft);
    line-height: 1.4;
}

/* ==============================================================================
   STUDENT INTEGRITY COACH & WRITING MODULES
   ============================================================================== */
.student-coach-card {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-card);
}

.coach-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
}

.coach-subcard {
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: var(--space-4);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.coach-subcard-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-3);
    gap: var(--space-2);
}

.coach-list-container {
    font-size: 13px;
    color: var(--body);
    line-height: 1.55;
}

.coach-list-container strong {
    color: var(--ink);
}

/* ==============================================================================
   DUAL HERO SCORE & ORIGINALITY VERDICT (.result-hero)
   ============================================================================== */
.result-hero {
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: var(--space-6);
}

.score-gauges {
    display: flex;
    align-items: flex-start;
    gap: var(--space-6);
    flex-wrap: wrap;
}

.score-gauge-card {
    width: 152px;
    text-align: center;
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    --gauge-color: var(--brand-mint);
    --score-angle: 0deg;
    background: conic-gradient(var(--gauge-color) var(--score-angle), var(--surface-strong) var(--score-angle));
    border: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-subtle);
    transition: transform 0.2s ease;
    position: relative;
    margin: 0 auto;
}

.score-circle::before {
    content: '';
    position: absolute;
    inset: 10px;
    border-radius: 50%;
    background: var(--surface-white);
}

.score-circle > * {
    position: relative;
    z-index: 1;
}

.score-circle:hover {
    transform: scale(1.03);
}

.score-circle.success {
    --gauge-color: var(--success);
}

.score-circle.warning {
    --gauge-color: var(--warning);
}

.score-circle.danger {
    --gauge-color: var(--danger);
}

.score-circle.ai-purple {
    --gauge-color: var(--ai-purple);
}

.score-number {
    font-size: 26px;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
    margin-bottom: 4px;
}

.score-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.score-band {
    margin-top: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--ink);
}

.score-formula {
    margin-top: 3px;
    font-size: 11px;
    line-height: 1.35;
    color: var(--muted);
}

.verdict-info {
    flex: 1;
    min-width: 280px;
}

.verdict-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 14px;
    border-radius: var(--rounded-pill);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
    background: var(--brand-mint);
    color: var(--ink);
    border: 1px solid rgba(0,0,0,0.08);
}

.verdict-badge.warning {
    background: var(--brand-peach);
}

.verdict-badge.danger {
    background: var(--brand-coral);
}

.verdict-title {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 6px;
    letter-spacing: -0.3px;
}

.verdict-desc {
    font-size: 14px;
    color: var(--body);
    line-height: 1.5;
}

.score-key {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    margin: calc(-1 * var(--space-3)) 0 var(--space-6);
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    font-size: 12px;
    color: var(--body);
}

.score-key-item {
    padding: 3px 9px;
    border-radius: var(--rounded-pill);
    font-weight: 700;
    color: var(--ink);
}

.score-key-item.low { background: var(--success-bg); }
.score-key-item.medium { background: var(--warning-bg); }
.score-key-item.high { background: var(--danger-bg); }

.pattern-review-card {
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-lg);
    background: var(--surface-white);
    box-shadow: var(--shadow-card);
}

.pattern-review-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.pattern-review-header h3 {
    margin-bottom: 4px;
    color: var(--ink);
    font-size: 18px;
}

.pattern-review-header p {
    color: var(--muted);
    font-size: 12px;
}

.pattern-provenance-alert {
    margin-bottom: var(--space-4);
    padding: var(--space-4);
    border: 1px solid var(--danger);
    border-radius: var(--rounded-md, 8px);
    background: var(--danger-bg);
}

.pattern-provenance-alert strong {
    display: block;
    margin-bottom: 4px;
    color: var(--danger-text);
    font-size: 14px;
}

.pattern-provenance-alert p {
    margin-bottom: 8px;
    color: var(--danger-text);
    font-size: 12px;
}

.pattern-provenance-alert ul {
    margin: 0;
    padding-left: 18px;
    color: var(--danger-text);
    font-size: 13px;
}

.pattern-provenance-alert li {
    margin-bottom: 4px;
}

.pattern-summary-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: var(--space-4);
}

.pattern-summary-item {
    padding: 14px;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    background: var(--surface-soft);
}

.pattern-summary-value,
.pattern-summary-item strong,
.pattern-summary-item small {
    display: block;
}

.pattern-summary-value {
    margin-bottom: 3px;
    color: var(--ink);
    font-size: 22px;
    font-weight: 700;
}

.pattern-summary-item strong {
    color: var(--body-strong);
    font-size: 12px;
}

.pattern-summary-item small {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.pattern-category-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.pattern-category-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    padding: 11px 12px;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-sm);
}

.pattern-category-item strong {
    color: var(--body-strong);
    font-size: 12px;
}

.pattern-category-item small {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 10px;
}

.pattern-category-score {
    min-width: 30px;
    padding: 2px 7px;
    border-radius: var(--rounded-pill);
    background: var(--success-bg);
    color: var(--success-text);
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.pattern-category-score.score-2 { background: var(--warning-bg); color: var(--warning-text); }
.pattern-category-score.score-3 { background: var(--danger-bg); color: var(--danger-text); }

.pattern-evidence-details {
    margin-top: var(--space-4);
    border-top: 1px solid var(--hairline);
}

.pattern-evidence-details summary {
    padding: 13px 0 5px;
    color: var(--ink);
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.pattern-evidence-list {
    display: grid;
    gap: 10px;
    padding-top: 10px;
}

.pattern-evidence-group {
    padding: 12px;
    border-left: 3px solid var(--brand-lavender);
    border-radius: 0 var(--rounded-sm) var(--rounded-sm) 0;
    background: var(--surface-soft);
}

.pattern-evidence-group h4 {
    margin-bottom: 5px;
    color: var(--ink);
    font-size: 12px;
}

.pattern-evidence-group p {
    color: var(--body);
    font-size: 11px;
    line-height: 1.45;
}

.pattern-evidence-quote {
    display: inline-block;
    margin: 3px 4px 3px 0;
    padding: 2px 6px;
    border-radius: 5px;
    background: white;
    color: var(--body-strong);
}

.pattern-disclaimer {
    margin-top: 12px;
    color: var(--muted);
    font-size: 11px;
}

.style-findings-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
}

.style-category-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.style-filter-btn {
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 11px;
    cursor: pointer;
}

.style-filter-btn.active {
    border-color: var(--primary);
    background: color-mix(in srgb, var(--primary) 12%, transparent);
    color: var(--primary);
    font-weight: 700;
}

.style-findings-list {
    display: grid;
    gap: 9px;
    margin-top: 12px;
    max-height: 440px;
    overflow: auto;
}

.style-finding {
    display: grid;
    grid-template-columns: minmax(120px, .34fr) minmax(0, 1fr);
    gap: 12px;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--primary);
    border-radius: 9px;
    padding: 11px;
    background: var(--bg-primary);
}

.style-finding.excluded { border-left-color: var(--text-muted); opacity: .82; }
.style-finding-meta { font-size: 11px; color: var(--text-secondary); }
.style-finding-meta strong { display: block; color: var(--text-primary); font-size: 12px; margin-bottom: 3px; }
.style-finding blockquote { margin: 0 0 6px; padding: 7px 9px; background: var(--bg-secondary); border-radius: 6px; font-size: 13px; }
.style-finding p { margin: 0; color: var(--text-secondary); font-size: 12px; }
.style-finding button { margin-top: 7px; border: 0; background: none; color: var(--primary); padding: 0; cursor: pointer; font-weight: 700; font-size: 11px; }

@media (max-width: 700px) {
    .style-findings-toolbar { align-items: flex-start; flex-direction: column; }
    .style-category-filters { justify-content: flex-start; }
    .style-finding { grid-template-columns: 1fr; }
}

.cleanup-edit-list {
    display: grid;
    gap: 6px;
    margin: 10px 0;
    padding: 0;
    list-style: none;
}

.cleanup-controls {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(190px, 1fr) auto;
    gap: 10px;
    align-items: end;
    margin: 12px 0 6px;
    padding: 12px;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    background: var(--surface-soft);
}
.cleanup-controls label { display: grid; gap: 4px; color: var(--ink); font-size: 11px; font-weight: 700; }
.cleanup-controls input, .cleanup-controls select { width: 100%; padding: 8px 9px; }
.cleanup-controls small { color: var(--muted); font-weight: 400; line-height: 1.3; }
.cleanup-controls .btn-secondary { margin: 0; white-space: nowrap; }

.cleanup-edit-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--rounded-sm);
    background: var(--surface-soft);
    font-size: 12px;
}

.cleanup-edit-row del {
    color: var(--danger-text, #991b1b);
    text-decoration: line-through;
}

.cleanup-edit-row ins {
    color: #166534;
    text-decoration: none;
    font-weight: 600;
}

.cleanup-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
}

.cleanup-apply-status {
    font-size: 11px;
    color: var(--muted);
}

.cleanup-result {
    margin-top: 12px;
}

.cleanup-result label {
    display: block;
    margin-bottom: 4px;
    font-size: 11px;
    font-weight: 700;
    color: var(--ink);
}

.cleanup-result-text {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-sm);
    background: var(--surface-white);
    font-family: inherit;
    font-size: 12px;
    line-height: 1.5;
    resize: vertical;
    margin-bottom: 8px;
}

.cleanup-comparison {
    display: grid;
    grid-template-columns: repeat(4, minmax(110px, 1fr));
    gap: 8px;
    margin: 0 0 10px;
}
.cleanup-comparison-item {
    padding: 9px;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-sm);
    background: var(--surface-soft);
    font-size: 11px;
    color: var(--muted);
}
.cleanup-comparison-item strong { display: block; margin-top: 3px; color: var(--ink); font-size: 13px; }
.cleanup-comparison-note { grid-column: 1 / -1; font-size: 10px; color: var(--muted); }

@media (max-width: 700px) {
    .cleanup-controls { grid-template-columns: 1fr; }
    .cleanup-comparison { grid-template-columns: 1fr 1fr; }
}

.suggestions-card {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-card);
}

.suggestions-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.suggestions-header h3 {
    font-size: 16px;
    color: var(--ink);
    margin-bottom: 3px;
}

.suggestions-header p {
    font-size: 12px;
    color: var(--muted);
}

.suggestions-list {
    display: grid;
    gap: 10px;
    padding-left: 22px;
    color: var(--body);
    font-size: 13px;
    line-height: 1.5;
}

.suggestions-list li::marker {
    color: var(--primary);
    font-weight: 700;
}

/* ==============================================================================
   INTERACTIVE FULL-TEXT MANUSCRIPT INSPECTOR
   ============================================================================== */
.manuscript-inspector-card {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-6);
    box-shadow: var(--shadow-card);
}

.inspector-legend {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.legend-tag {
    font-size: 12px;
    font-weight: 500;
    padding: 4px 10px;
    border-radius: var(--rounded-pill);
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    color: var(--body);
}

.manuscript-body-text {
    background: var(--canvas);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: 24px;
    font-size: 15px;
    line-height: 1.85;
    color: var(--body-strong);
    max-height: 480px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.sent-span {
    border-radius: 4px;
    padding: 2px 4px;
    margin: 0 1px;
    cursor: pointer;
    transition: all 0.15s ease;
    display: inline;
}

.sent-span:hover {
    filter: brightness(0.92);
}

.sent-span.orig {
    background: rgba(164, 212, 197, 0.25);
    color: var(--ink);
    border-bottom: 2px solid var(--brand-mint);
}

.sent-span.flag-high {
    background: rgba(255, 107, 90, 0.25);
    color: #991b1b;
    border-bottom: 2px solid var(--brand-coral);
    font-weight: 500;
}

.sent-span.flag-med {
    background: rgba(255, 176, 132, 0.25);
    color: #92400e;
    border-bottom: 2px solid var(--brand-peach);
}

.sent-span.has-cite {
    box-shadow: inset 0 -2px 0 var(--brand-ochre);
}

/* ==============================================================================
   SOURCES BREAKDOWN TABLE (.sources-table)
   ============================================================================== */
.sources-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    overflow: hidden;
    margin-bottom: var(--space-6);
}

.sources-table th {
    background: var(--surface-soft);
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    text-align: left;
    border-bottom: 1px solid var(--hairline);
}

.sources-table td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--body);
    border-bottom: 1px solid var(--hairline);
    vertical-align: middle;
}

.sources-table tr:last-child td {
    border-bottom: none;
}

.source-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: var(--rounded-pill);
    font-size: 11px;
    font-weight: 600;
    background: var(--surface-card);
    color: var(--ink);
    border: 1px solid var(--hairline);
}

.sim-bar-container {
    width: 100%;
    height: 6px;
    background: var(--surface-soft);
    border-radius: var(--rounded-pill);
    overflow: hidden;
    margin-top: 4px;
}

.sim-bar {
    height: 100%;
    border-radius: var(--rounded-pill);
    transition: width 0.3s ease;
}

.sim-bar.high {
    background: var(--brand-coral);
}

.sim-bar.med {
    background: var(--brand-peach);
}

.sim-bar.low {
    background: var(--brand-mint);
}

.text-viewer {
    background: var(--canvas);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: 20px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--body);
    margin-bottom: var(--space-6);
}

.sentence-chunk {
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s ease;
}

.sentence-chunk.plagiarized {
    background: rgba(255, 107, 90, 0.2);
    color: #991b1b;
    font-weight: 500;
    cursor: pointer;
    border-bottom: 1px dashed var(--brand-coral);
}

.sentence-chunk.plagiarized:hover {
    background: rgba(255, 107, 90, 0.35);
}

/* ==============================================================================
   CITATION CARDS & OUTPUTS
   ============================================================================== */
.citation-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-4);
}

.citation-card {
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: var(--space-4);
}

.citation-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-2);
    font-size: 13px;
    font-weight: 600;
    color: var(--ink);
}

.btn-copy-cite {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-pill);
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    cursor: pointer;
    color: var(--body);
}

.btn-copy-cite:hover {
    background: var(--surface-card);
    color: var(--ink);
}

.citation-box {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-sm);
    padding: 10px 12px;
    font-size: 13px;
    color: var(--body-strong);
    line-height: 1.5;
}

.citation-box-mono {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-sm);
    padding: 10px 12px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--body-strong);
    white-space: pre-wrap;
    word-break: break-all;
}

/* ==============================================================================
   INSTITUTIONAL SOURCES LIST
   ============================================================================== */
.sources-list {
    display: grid;
    gap: var(--space-2);
}

.source-item {
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.15s ease;
}

.source-item:hover {
    background: var(--surface-card);
}

.source-meta-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
}

.source-meta-info {
    font-size: 12px;
    color: var(--muted);
}

.btn-delete-source {
    background: transparent;
    border: 1px solid var(--hairline);
    color: var(--danger);
    border-radius: var(--rounded-pill);
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.btn-delete-source:hover {
    background: var(--error-bg);
}

/* ==============================================================================
   MODALS & OVERLAYS
   ============================================================================== */
.diff-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 10, 0.45);
    backdrop-filter: blur(6px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.diff-modal.active {
    display: flex !important;
    animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.96);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.diff-box {
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-lg);
    box-shadow: var(--shadow-float);
    width: 100%;
    max-width: 640px;
    padding: var(--space-6);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.diff-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-4);
    border-bottom: 1px solid var(--hairline);
    padding-bottom: var(--space-3);
}

/* ==============================================================================
   TOAST NOTIFICATIONS & HIGHLIGHT EFFECTS
   ============================================================================== */
.clay-toast {
    position: fixed;
    bottom: 32px;
    right: 32px;
    background: var(--ink);
    color: var(--on-primary);
    padding: 12px 20px;
    border-radius: var(--rounded-md);
    font-size: 14px;
    font-weight: 500;
    box-shadow: var(--shadow-float);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: toastSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 440px;
}

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

@keyframes pulseHighlight {
    0% { box-shadow: 0 0 0 3px var(--primary); background-color: var(--surface-card); }
    50% { box-shadow: 0 0 0 5px var(--brand-mint); background-color: rgba(164, 212, 197, 0.25); }
    100% { box-shadow: none; }
}

.pulse-highlight {
    animation: pulseHighlight 1.5s ease-out;
    border-radius: var(--rounded-md);
}

/* ==============================================================================
   FOOTER (Clay Warm Cream Footer)
   ============================================================================== */
.footer-container {
    width: 100%;
    background: var(--surface-soft);
    border-top: 1px solid var(--hairline);
    margin-top: var(--space-12);
}

.clay-footer {
    max-width: 1280px;
    margin: 0 auto;
    padding: 64px var(--space-6) 40px var(--space-6);
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: var(--space-8);
    margin-bottom: 48px;
}

.footer-col-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--space-3);
}

.footer-desc {
    font-size: 14px;
    color: var(--body);
    line-height: 1.6;
    margin-bottom: var(--space-4);
    max-width: 320px;
}

.visitor-counter {
    width: fit-content;
    margin: 18px auto 0;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 7px;
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-pill);
    background: var(--surface-white);
    color: var(--muted);
    font-size: 12px;
    box-shadow: var(--shadow-sm);
}

.visitor-counter strong { color: var(--ink); font-size: 14px; }
.visitor-counter-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--success); }

.visitor-email-form {
    max-width: 320px;
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--hairline);
    font-size: 12px;
}

.visitor-email-row { display: flex; gap: 8px; margin-top: 7px; }
.visitor-email-row input { min-width: 0; flex: 1; padding: 9px 10px; }
.visitor-email-row button {
    border: 0;
    border-radius: var(--rounded-md);
    background: var(--ink);
    color: var(--on-primary);
    padding: 8px 14px;
    font-weight: 600;
    cursor: pointer;
}
.visitor-email-row button:disabled { opacity: .55; cursor: wait; }
.visitor-consent { display: flex; align-items: flex-start; gap: 7px; margin-top: 8px; color: var(--muted); line-height: 1.35; }
.visitor-consent input { margin-top: 2px; }
.visitor-honeypot { position: absolute !important; left: -10000px !important; width: 1px !important; height: 1px !important; }
.visitor-email-status { min-height: 16px; margin-top: 6px; }
.visitor-email-status.success { color: var(--success); }
.visitor-email-status.error { color: var(--error); }

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 8px;
}

.footer-links a {
    color: var(--muted);
    font-size: 13px;
    text-decoration: none;
    transition: color 0.15s ease;
}

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

.footer-disclaimer-card {
    background: var(--surface-card);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: var(--space-3);
    font-size: 12px;
    color: var(--body);
    line-height: 1.5;
}

/* Stats Grid & Gradebook */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}

.stat-card {
    background: var(--surface-soft);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    padding: var(--space-3) var(--space-4);
    text-align: center;
}

.stat-val {
    font-size: 24px;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 2px;
}

.stat-lbl {
    font-size: 12px;
    color: var(--muted);
}

/* Batch Table */
.batch-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface-white);
    border: 1px solid var(--hairline);
    border-radius: var(--rounded-md);
    overflow: hidden;
}

.batch-table th {
    background: var(--surface-soft);
    padding: 10px 14px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink);
    border-bottom: 1px solid var(--hairline);
}

.batch-table td {
    padding: 10px 14px;
    font-size: 13px;
    color: var(--body);
    border-bottom: 1px solid var(--hairline);
}

.batch-table tr:last-child td {
    border-bottom: none;
}

.footer-bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--hairline);
    padding-top: var(--space-6);
    font-size: 13px;
    color: var(--muted);
    flex-wrap: wrap;
    gap: var(--space-2);
}

/* Responsive Adjustments */
@media (max-width: 900px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr;
    }
    .brand-title {
        font-size: 36px;
    }
}

@media (max-width: 600px) {
    .footer-grid {
        grid-template-columns: 1fr;
    }
    .top-nav {
        padding: 0 var(--space-4);
    }
    .app-wrapper {
        padding: var(--space-2) var(--space-4) var(--space-8) var(--space-4);
    }
    .brand-title {
        font-size: 28px;
    }
    .upload-workspace {
        padding: 20px;
    }
    .upload-heading {
        display: block;
    }
    .privacy-note {
        width: fit-content;
        margin-top: 16px;
    }
    .upload-dropzone {
        min-height: 220px;
        padding: 34px 16px;
    }
    .scan-options-grid {
        grid-template-columns: 1fr;
    }
    .option-row:nth-child(even) {
        padding-left: 0;
    }
    .settings-summary {
        display: none;
    }
    .selected-file-name {
        max-width: 190px;
    }
    .pattern-review-header {
        display: block;
    }
    .pattern-review-header .badge-pill {
        margin-top: 10px;
    }
    .pattern-summary-grid,
    .pattern-category-grid {
        grid-template-columns: 1fr;
    }
}
