/* ==========================================================================
   1. Design System & Variables (Light Theme)
   ========================================================================== */
:root {
    --font-primary: 'Inter', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: 150ms var(--ease);
    --transition-medium: 300ms var(--ease);
    --transition-slow: 500ms var(--ease);

    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.07);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.08);
    --shadow-glow: 0 0 0 3px;

    /* New Light Palette - Sapphire Blue Theme */
    --color-primary: #0f52ba; /* Sapphire blue */
    --color-primary-light: #e0ecff;
    --color-primary-glow: #0f52ba4d;
    --color-success: #22c55e;
    --color-success-light: #dcfce7;
    --color-warning: #f97316;
    --color-warning-light: #ffedd5;
    --color-error: #ef4444;
    --color-error-light: #fee2e2;

    --text-primary: #1f2937; /* Dark charcoal */
    --text-secondary: #4b5563;
    --text-muted: #6b7280;
    --text-inverted: #ffffff;
    --text-accent: #0b3c82;

    --bg-main: #f3f7ff; /* Soft blue-tinted background */
    --bg-panel: #ffffff;
    --bg-muted: #f3f4f6;
    --border-color: #e5e7eb;
    --border-color-strong: #d1d5db;
}

/* ==========================================================================
   2. Base & Global Styles
   ========================================================================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-primary);
    background: linear-gradient(135deg, #f3f7ff 0%, #e0ecff 100%);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition-medium), color var(--transition-medium);
}

/* Orange theme override */
body.theme-orange {
    /* Override design tokens for orange theme */
    --color-primary: #f97316;
    --color-primary-light: #fff7ed;
    --color-primary-glow: #f973164d;
    --text-accent: #c2410c;
    --bg-main: #fff7ed;
    --bg-panel: #ffffff;
    --bg-muted: #fff1e6;
    --border-color: #fed7aa;
    --border-color-strong: #fdba74;

    background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
}

/* UNC Blue theme override (used on homepage toggle) */
body.theme-unc {
    --color-primary: #4b9cd3; /* UNC Blue */
    --color-primary-light: #e6f2fa;
    --color-primary-glow: #4b9cd34d;
    --text-accent: #13294b; /* Carolina navy */
    --bg-main: #f1f8ff;
    --bg-panel: #ffffff;
    --bg-muted: #eaf4fb;
    --border-color: #b6d7ee;
    --border-color-strong: #242628;

    background: linear-gradient(135deg, #f1f8ff 0%, #e6f2fa 100%);
}

#particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background-color: rgba(199, 210, 254, 0.2); /* #c7d2fe at 20% opacity */
    filter: blur(40px);
    animation: float-particle linear infinite;
}

body.theme-orange .particle {
    /* Softer orange glow for particles */
    background-color: rgba(253, 186, 116, 0.24); /* #fdba74 at ~24% opacity */
}

@keyframes float-particle {
    0% {
        transform: translateY(110vh) translateX(0) scale(1);
    }
    50% {
        transform: translateY(50vh) translateX(50px) scale(1.2);
    }
    100% {
        transform: translateY(-20vh) translateX(-20px) scale(1);
    }
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    color: var(--text-primary);
}

p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-muted);
}
::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Respect users who prefer reduced motion: cut animations and transitions. */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
        scroll-behavior: auto !important;
    }
    #particles {
        display: none;
    }
}

/* ==========================================================================
   3. Keyframe Animations
   ========================================================================== */
@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeInUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes gentle-float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}
@keyframes cardSlideIn {
    from { transform: translateY(30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes pulse-dot {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(34, 197, 94, 0); }
}
@keyframes dot-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes toastIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes toastOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(120%); opacity: 0; }
}

/* ==========================================================================
   4. Layout & Containers
   ========================================================================== */
.main-container {
    display: flex;
    gap: 1.5rem;
    padding: 1.5rem;
    padding-top: calc(60px + 1.5rem); /* 60px topnav height */
    height: calc(100vh - 60px);
    min-height: calc(100vh - 60px);
    max-width: 1600px;
    margin: 0 auto;
    box-sizing: border-box;
    animation: fadeInUp 0.8s var(--ease) both;
}

.sidebar {
    width: 320px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.editor-panel-wrapper {
    flex: 0 0 60%;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.feedback-panel-wrapper {
    flex: 0 0 40%;
    min-height: 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   5. Solid Panel Style
   ========================================================================== */
.panel {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-medium), box-shadow var(--transition-medium);
}
.panel:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border-color);
}
.panel-header h3 {
    font-size: 1rem;
    font-weight: 600;
}
.panel-header .header-left, .panel-header .header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.panel-header i {
    color: var(--text-muted);
}

.panel-content {
    padding: 1.25rem;
}

/* ==========================================================================
   6. Top Navigation
   ========================================================================== */
.topnav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1.5rem;
    height: 60px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--bg-panel);
    border-bottom: 1px solid var(--border-color);
    animation: slideDown 0.6s var(--ease) both;
}

.topnav-left, .topnav-center, .topnav-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}
/* Equal-width flanks keep the center workflow truly page-centered,
   regardless of how wide the left brand or right buttons get. */
.topnav-left, .topnav-right {
    flex: 1 1 0;
    min-width: 0;
}
.topnav-right {
    justify-content: flex-end;
}

.topnav-brand-link {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    color: inherit;
}
.topnav-brand-link:hover {
    opacity: 0.9;
}

.brand-icon {
    width: 32px;
    height: 32px;
    display: block;
    flex-shrink: 0;
}

.brand-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    vertical-align: middle;
}

.brand-name, .home-brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--color-primary); /* orange / UNC blue depending on theme */
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.85),
                 0 2px 0 rgba(253, 186, 116, 0.95),
                 0 3px 6px rgba(0, 0, 0, 0.28);
}

.brand-badge {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 0.2rem 0.5rem;
    border-radius: var(--radius-full);
    background: var(--color-primary-light);
    color: var(--text-accent);
    text-transform: uppercase;
}

.tagline {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Top nav workflow (replaces tagline) */
.topnav-workflow {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-accent);
    white-space: nowrap;
}
.topnav-workflow .workflow-sep {
    color: var(--text-muted);
    font-weight: 600;
}
.topnav-workflow .workflow-word {
    color: var(--text-accent);
}

.session-stat {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-muted);
    color: var(--text-secondary);
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
    font-weight: 600;
}
.session-stat i {
    color: var(--text-muted);
}

.icon-button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    transition: color var(--transition-medium), background-color var(--transition-medium);
}
.icon-button:hover {
    color: var(--text-primary);
    background-color: var(--bg-muted);
}

/* ==========================================================================
   7. Sidebar Components
   ========================================================================== */
/* Persona Selector */
.persona-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-color);
    cursor: pointer;
    transition: background-color var(--transition-medium), border-color var(--transition-medium);
    position: relative;
}
.persona-card:not(:last-child) {
    margin-bottom: 0.75rem;
}
.persona-card:hover {
    background-color: var(--bg-muted);
    border-color: var(--border-color-strong);
}
.persona-card.selected {
    background-color: var(--color-primary-light);
    border-color: var(--color-primary);
}

.persona-avatar {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--bg-muted);
    color: var(--text-muted);
    display: grid;
    place-items: center;
    font-size: 1.5rem;
    transition: all var(--transition-medium);
}
.persona-card.selected .persona-avatar {
    background: var(--color-primary);
    color: white;
    transform: scale(1.1);
}

.persona-details h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}
.persona-details p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.selection-indicator {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 1.25rem;
    color: var(--color-primary);
    transform: scale(0);
    opacity: 0;
    transition: all var(--transition-medium);
}
.persona-card.selected .selection-indicator {
    transform: scale(1);
    opacity: 1;
}

/* Quick Tips Carousel */
.tips-carousel {
    position: relative;
    height: 60px; /* Adjust as needed */
    overflow: hidden;
}
.tip-slide {
    position: absolute;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--transition-slow), transform var(--transition-slow);
    font-style: italic;
    color: var(--text-muted);
    text-align: center;
}
.tip-slide.active {
    opacity: 1;
    transform: translateY(0);
}
.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 1rem;
}
.carousel-dots .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border-color-strong);
    cursor: pointer;
    transition: background-color var(--transition-medium);
}
.carousel-dots .dot.active {
    background: var(--color-primary);
}

/* ==========================================================================
   8. Editor Panel
   ========================================================================== */
.editor-panel {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    /* Clip the editor's scrollbar to the panel's rounded corners. */
    overflow: hidden;
}
.editor-panel .panel-content {
    flex-grow: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
}

/* Editor panel header: Chrome-like tabs, no borders, fill header */
.editor-panel .panel-header {
    padding: 0;
    min-height: 40px;
    align-items: stretch;
    border-bottom: 1px solid var(--border-color);
}
.editor-panel .panel-header .header-left {
    flex: 1;
    gap: 0;
    min-width: 0;
}
/* Inset the word-count badge from the panel's rounded top-right corner
   so the pill's radius no longer collides with the panel radius. */
.editor-panel .panel-header .header-right {
    padding: 0 0.9rem;
}
.editor-tabs {
    display: flex;
    align-items: stretch;
    height: 100%;
    gap: 0;
}
.persona-tab {
    border: none;
    border-radius: 0;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-size: 0.9rem;
    font-weight: 700;
    padding: 0 1.25rem;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}
.persona-tab:hover,
.persona-tab[aria-selected="true"] {
    background: var(--border-color-strong);
    color: var(--text-accent);
    box-shadow: 0 -1px 0 0 var(--border-color-strong);
}

.word-count-badge {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-full);
    background: var(--bg-muted);
    color: var(--text-muted);
}

/* Quill Editor Styles */
#editor-container {
    flex: 1 1 0;
    min-height: 0;
    font-size: 16px;
    line-height: 1.7;
    overflow-y: auto;
}
.ql-container.ql-snow {
    border: none;
}
.ql-editor {
    font-family: var(--font-primary);
    color: var(--text-primary);
    padding: 1.25rem;
}
.ql-editor.ql-blank::before {
    color: var(--text-muted);
    font-style: normal;
    left: 1.25rem;
}
.ql-toolbar.ql-snow {
    border: none;
    border-bottom: 1px solid var(--border-color);
    padding: 12px 8px;
}
.ql-snow .ql-stroke { stroke: var(--text-muted); }
.ql-snow .ql-fill { fill: var(--text-muted); }
.ql-snow .ql-picker { color: var(--text-muted); }
.ql-toolbar.ql-snow .ql-picker-label:hover,
.ql-toolbar.ql-snow .ql-picker-item:hover,
.ql-toolbar.ql-snow button:hover .ql-stroke {
    stroke: var(--color-primary);
}
.ql-toolbar.ql-snow button:hover .ql-fill {
    fill: var(--color-primary);
}
.ql-toolbar.ql-snow .ql-picker-label.ql-active,
.ql-toolbar.ql-snow .ql-picker-item.ql-selected,
.ql-toolbar.ql-snow button.ql-active .ql-stroke {
    stroke: var(--color-primary);
}
.ql-snow.ql-toolbar button.ql-active .ql-fill {
    fill: var(--color-primary);
}

/* Editor Footer Toolbar */
.editor-toolbar-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}
.footer-group {
    display: flex;
    gap: 0.75rem;
}

/* ==========================================================================
   9. Buttons
   ========================================================================== */
.button {
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    border: 2px solid transparent;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}
.button:hover {
    transform: translateY(-2px);
}
.button:active {
    transform: translateY(0);
}

/* Ripple Effect */
.button .ripple {
    position: absolute;
    border-radius: 50%;
    transform: scale(0);
    animation: ripple 600ms linear;
    background-color: rgba(255, 255, 255, 0.7);
}

/* Darker ripple for light-background buttons */
.button.secondary .ripple,
.button.ghost .ripple {
    background-color: rgba(0, 0, 0, 0.1);
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Primary Button */
.button.primary {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-sm);
}
.button.primary:hover {
    filter: brightness(1.1);
    box-shadow: var(--shadow-md);
}
.button.primary .btn-spinner {
    display: none;
}
.button.primary.loading .btn-text,
.button.primary.loading .btn-icon {
    display: none;
}
.button.primary.loading .btn-spinner {
    display: block;
    font-size: 1.2em;
    animation: spin 1s linear infinite;
}

/* Secondary/Outlined Button */
.button.secondary {
    background-color: transparent;
    border-color: var(--border-color-strong);
    color: var(--text-secondary);
}
.button.secondary:hover {
    background-color: var(--bg-muted);
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

/* Ghost Button */
.button.ghost {
    background-color: transparent;
    color: var(--text-muted);
}
.button.ghost:hover {
    background-color: var(--bg-muted);
    color: var(--text-primary);
}

/* ==========================================================================
   10. Feedback Panel
   ========================================================================== */
.feedback-panel {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
}
.feedback-panel .panel-content {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 1.25rem;
}
/* Empty/loading states: take space and center their content */
#feedback-empty,
#feedback-loading {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
/* Results area: fill remaining space and scroll when cards overflow */
#feedback-results {
    flex: 1 1 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    text-align: left;
    overflow-y: auto;
    overflow-x: hidden;
}
/* Cards view: vertical list with consistent spacing and scroll */
#feedback-results.feedback-cards-view {
    gap: 0;
}
#feedback-results.feedback-cards-view .challenge-card:last-child {
    margin-bottom: 0;
}

/* Status Indicator */
.status-indicator .status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    transition: background-color var(--transition-medium);
}
.status-indicator.waiting .status-dot { background-color: var(--text-muted); }
.status-indicator.active .status-dot {
    background-color: var(--color-success);
    animation: pulse-dot 2s infinite;
}
.status-indicator.done .status-dot { background-color: var(--color-primary); }
.status-indicator .status-text {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
}

/* Feedback view switcher (Tabs ON / Cards OFF) */
.feedback-view-switcher {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.switcher-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
}
.switcher-toggle {
    display: flex;
    align-items: center;
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: var(--radius-full);
}
.switcher-track {
    width: 40px;
    height: 22px;
    border-radius: var(--radius-full);
    background: var(--border-color);
    position: relative;
    transition: background var(--transition-fast);
}
.switcher-on .switcher-track {
    background: var(--color-primary);
}
.switcher-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--bg-panel);
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition-fast);
}
.switcher-on .switcher-thumb {
    transform: translateX(18px);
}

/* Feedback tabs (when switcher is ON) -- same height as editor persona tabs (40px) */
.feedback-tabs-wrap {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    margin-top: -1.25rem; /* sit tabs right below panel header */
}
.feedback-tabs {
    display: flex;
    flex-shrink: 0;
    align-items: stretch;
    min-height: 38px;
    gap: 0;
    border-bottom: 1px solid var(--border-color);
    margin: 0 -1.25rem 0 -1.25rem;
    padding: 0 1.25rem;
}
.feedback-tab-btn {
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 0 1.25rem;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}
.feedback-tab-btn:hover {
    color: var(--text-primary);
}
.feedback-tab-btn[aria-selected="true"] {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}
.feedback-tab-panels {
    flex: 1 1 0;
    min-height: 0;
    overflow-y: auto;
    padding-top: 1rem;
}
.feedback-tab-panel {
    display: none;
    padding-bottom: 1rem;
}
.feedback-tab-panel[aria-hidden="false"] {
    display: block;
}
.feedback-tab-panel .challenge-card {
    margin-bottom: 1rem;
}
.feedback-tab-panel .reflection-section {
    margin-top: 0;
}

/* Feedback States */
.feedback-state {
    text-align: center;
    padding: 1rem;
    animation: cardSlideIn 0.6s var(--ease) both;
}
/* Empty State */
.floating-icon {
    width: 70px;
    height: 70px;
    margin: 0 auto 1.5rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 2.2rem;
    animation: gentle-float 3s ease-in-out infinite;
    background: var(--color-primary-light);
    color: var(--color-primary);
}
.scanner-icon {
    background: var(--color-warning-light);
    color: var(--color-warning);
}

#feedback-empty h3 { font-size: 1.2rem; margin-bottom: 0.75rem; }

.empty-state-steps {
    text-align: left;
    max-width: 360px;
    margin: 0 auto;
}
.empty-state-step {
    margin-bottom: 1rem;
}
.empty-state-step:last-child {
    margin-bottom: 0;
}
.empty-state-step-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.35rem;
}
.empty-state-step-desc {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

/* Empty state: present content inside a challenge-card and keep it centered */
.empty-challenge-card {
    width: 100%;
    max-width: 560px;
    margin: 0;
}
.empty-challenge-card .challenge-card-header {
    text-transform: none;
    font-size: 1rem;
    color: var(--text-primary);
}
.empty-challenge-card .challenge-card-header::before {
    content: '';
    margin-right: 0;
}
.empty-challenge-card .challenge-card-body {
    padding-top: 0.85rem;
}
.empty-challenge-card .empty-state-steps {
    max-width: none;
    margin: 0;
}

.workflow-steps {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}
.workflow-steps .step {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    background: var(--bg-muted);
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.workflow-steps .step span {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    display: grid;
    place-items: center;
    font-size: 0.75rem;
}

/* Loading State */
#feedback-loading h3 { font-size: 1.2rem; margin-bottom: 0.5rem; }
#feedback-loading p { max-width: 300px; margin: 0 auto 1.5rem; }
.loader-dots {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
}
.loader-dots div {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--color-primary);
    animation: dot-bounce 1.4s infinite ease-in-out both;
}
.loader-dots div:nth-child(1) { animation-delay: -0.32s; }
.loader-dots div:nth-child(2) { animation-delay: -0.16s; }

/* Results/Challenge Cards */
.challenge-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    border-left: 4px solid var(--color-primary);
    animation: cardSlideIn 0.5s var(--ease) backwards;
}
.challenge-card-header {
    padding: 0.75rem 1rem;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    color: var(--color-primary);
    border-bottom: 1px solid var(--border-color);
}
.challenge-card-header::before {
    content: '';
    margin-right: 0;
}
.challenge-card-body {
    padding: 1rem;
    font-size: 0.95rem;
}
.challenge-card.gated {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}

/* Reflection Section */
.reflection-section {
    margin-top: 1.5rem;
    animation: cardSlideIn 0.5s var(--ease) backwards;
    animation-delay: 0.2s;
}
.reflection-section label,
.reflection-section .reflection-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}
.reflection-section textarea,
.reflection-section .reflection-input {
    width: 100%;
    min-height: 100px;
    background: var(--bg-muted);
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    font-family: var(--font-primary);
    color: var(--text-primary);
    resize: vertical;
    transition: border-color var(--transition-medium), box-shadow var(--transition-medium);
}
.reflection-section textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow) var(--color-primary-glow);
}
.reflection-section .button {
    width: 100%;
    margin-top: 0.75rem;
    background: var(--color-primary);
}

.reflection-coaching {
    margin-top: 0.75rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(245, 158, 11, 0.45);
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius-md);
    background: rgba(245, 158, 11, 0.1);
    color: var(--text-primary);
    font-size: 0.9rem;
}

.reflection-coaching-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.3rem;
    color: #b45309;
    font-weight: 700;
}

.reflection-coaching p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Refusal variant: Prober declines to produce the deliverable (firmer red, not amber). */
.reflection-coaching--refusal {
    border-color: rgba(239, 68, 68, 0.45);
    border-left-color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}
.reflection-coaching--refusal .reflection-coaching-title {
    color: #b91c1c;
}
/* Reward Block */
.reward-block {
    animation: cardSlideIn 0.5s var(--ease) backwards;
    animation-delay: 0.4s;
}
.reward-block h4 {
    font-size: 1.1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--color-success);
}
.reward-block h4::before {
    content: '\f058'; /* Font Awesome check-circle */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
}
.suggestion-card {
    background: var(--color-success-light);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
    font-size: 0.95rem;
}
.tip-blockquote {
    margin: 0;
    padding: 1rem;
    border-left: 4px solid var(--color-primary);
    background: var(--color-primary-light);
    border-radius: var(--radius-md);
    font-style: italic;
}

/* Suggestion content: preserve formatting from the safe Markdown renderer */
.suggestion-card .suggestion-text p {
    margin: 0 0 0.75rem;
    color: var(--text-primary);
}
.suggestion-card .suggestion-text p:last-child {
    margin-bottom: 0;
}
.suggestion-card .suggestion-text code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: rgba(0, 0, 0, 0.06);
    padding: 0.1em 0.35em;
    border-radius: var(--radius-sm);
}

/* Close-the-loop actions under an unlocked suggestion */
.suggestion-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}
.suggestion-actions .button {
    padding: 0.4rem 0.9rem;
    font-size: 0.82rem;
    width: auto;
    margin-top: 0;
}

/* Empty-state lead-in */
.empty-state-lead {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0 0 1rem;
    line-height: 1.5;
}

/* ==========================================================================
   11. Toast Notifications
   ========================================================================== */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    /* Notifications must stay visible above modal backdrops and dialogs. */
    z-index: 2147483647;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.toast {
    width: 350px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    padding: 1rem;
    gap: 1rem;
    border-left-width: 4px;
    animation: toastIn 0.5s var(--ease);
    pointer-events: auto;
}
.toast.exiting {
    animation: toastOut 0.5s var(--ease) forwards;
}

.toast-icon { font-size: 1.5rem; }
.toast-body h5 { font-size: 1rem; font-weight: 600; }
.toast-body p { font-size: 0.9rem; margin: 0; }

.toast.success { border-left-color: var(--color-success); }
.toast.success .toast-icon { color: var(--color-success); }
.toast.error { border-left-color: var(--color-error); }
.toast.error .toast-icon { color: var(--color-error); }
.toast.info { border-left-color: var(--color-primary); }
.toast.info .toast-icon { color: var(--color-primary); }

/* ==========================================================================
   12. Responsive Design
   ========================================================================== */
@media (max-width: 1100px) {
    .main-container {
        flex-direction: column;
        /* Stop forcing both panels into a single viewport height -- let the
           page grow and scroll so the editor stays usable on small screens. */
        height: auto;
        min-height: calc(100vh - 60px);
    }
    .sidebar,
    .editor-panel-wrapper,
    .feedback-panel-wrapper {
        width: 100%;
    }
    .editor-panel-wrapper,
    .feedback-panel-wrapper {
        flex: 1 1 auto;
    }
    .editor-panel-wrapper {
        min-height: 60vh;
    }
    .feedback-panel-wrapper {
        min-height: 50vh;
    }
    .topnav-center {
        display: none;
    }
}

@media (max-width: 900px) {
    .main-container {
        padding: 1rem;
        padding-top: calc(60px + 1rem);
    }
    .sidebar {
        flex-direction: row;
        gap: 1rem;
    }
    .sidebar .panel {
        width: 50%;
    }
    .topnav-right .session-stat {
        display: none;
    }
}

@media (max-width: 600px) {
    body {
        font-size: 14px;
    }
    .main-container {
        padding-top: calc(60px + 1rem);
    }
    .sidebar {
        flex-direction: column;
    }
    .sidebar .panel {
        width: 100%;
    }
    .editor-toolbar-footer {
        flex-direction: column;
        align-items: stretch;
    }
    .button.primary {
        width: 100%;
    }
    .footer-group {
        justify-content: center;
    }
    .brand-name {
        display: none;
    }
    .study-status-badge {
        display: none;
    }
    #toast-container {
        right: 1rem;
        left: 1rem;
        bottom: 1rem;
        align-items: center;
    }
    .toast {
        width: 100%;
    }

    .study-setup-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }
}

/* ==========================================================================
   13. Home Landing (Minimal Orange Skeleton)
   ========================================================================== */
body.home-skeleton {
    --home-bg-from: #fff7ed;
    --home-bg-to: #ffedd5;
    --home-card-bg: var(--color-primary-light);
    background: linear-gradient(135deg, var(--home-bg-from) 0%, var(--home-bg-to) 100%);
    color: var(--text-primary);
}

body.theme-unc.home-skeleton {
    --home-bg-from: #f1f8ff;
    --home-bg-to: #e6f2fa;
}

.home-logo {
    width: 32px;
    height: 32px;
    display: block;
    flex-shrink: 0;
}

.home-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    vertical-align: middle;
}

.home-nav-right {
    gap: 0.75rem;
}

.home-pill {
    width: 110px;
    height: 32px;
    border-radius: var(--radius-full);
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
}

.home-moon {
    color: var(--text-accent);
}

.home-main {
    position: relative;
    z-index: 1;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.75rem;
    padding-top: calc(60px + 1.75rem);
    padding-bottom: 3.5rem;
    display: flex;
    flex-direction: column;
    gap: 3rem;
    min-height: calc(100vh - 60px);
}

.home-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1.25rem;
    padding-top: 0.5rem;
}

.home-slogan {
    margin: 0;
    max-width: 20ch;
    font-size: clamp(2rem, 4.6vw, 3rem);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.home-slogan-accent {
    color: var(--color-primary);
}

.home-lede {
    margin: 0;
    max-width: 62ch;
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.6;
    color: var(--text-secondary);
}

.home-shot {
    width: 100%;
    max-width: 1000px;
    margin: 1rem 0 0;
}

.home-shot-img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.home-cards {
    display: grid;
    flex: 1 1 auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.75rem;
}

.home-card {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 0.75rem;
    min-height: 320px;
    height: 100%;
    border-radius: 10px;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-md);
    padding: 2rem 0rem 1.25rem;
    text-align: center;
    border: 1px solid var(--border-color);
    background: var(--home-card-bg);
    filter: brightness(1);
    transition: transform var(--transition-medium), box-shadow var(--transition-medium), filter var(--transition-medium);
}

.home-card--left,
.home-card--right {
    background: var(--home-card-bg);
}

.home-card .persona-avatar {
    width: 64px;
    height: 64px;
    border-radius: 9999px;
    background: var(--bg-panel);
    color: var(--text-accent);
    border: 1px solid var(--border-color);
    display: grid;
    place-items: center;
    font-size: 1.75rem;
}

.home-card-label {
    font-family: var(--font-mono);
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-accent);
}

.home-card-description {
    font-size: 0.98rem;
    color: var(--text-secondary);
    max-width: 34ch;
}

.home-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    filter: brightness(0.9);
}

.home-card:focus-visible {
    outline: none;
    box-shadow: var(--shadow-lg), var(--shadow-glow) var(--color-primary-glow);
}

@media (max-width: 800px) {
    .home-main {
        padding: 1.25rem;
        padding-top: calc(60px + 1.25rem);
    }
}

@media (max-width: 700px) {
    .home-cards {
        grid-template-columns: 1fr;
    }
    .home-card {
        min-height: 260px;
        padding: 1.75rem 2rem;
    }
}

/* ==========================================================================
   Managed Access Page
   ========================================================================== */
.login-page {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.login-card {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem 2rem;
    width: 100%;
    max-width: 460px;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.login-logo {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

.login-logo-img {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.login-brand {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.125rem;
    color: var(--color-primary);
}

.login-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.375rem;
}

.login-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.login-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.login-input {
    width: 100%;
    padding: 0.625rem 2.5rem 0.625rem 0.875rem;
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-md);
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    color: var(--text-primary);
    background: var(--bg-muted);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    outline: none;
}

.login-input:focus {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow) var(--color-primary-glow);
    background: var(--bg-panel);
}

.login-input.login-input-error {
    border-color: var(--color-error);
    box-shadow: var(--shadow-glow) rgba(239, 68, 68, 0.2);
}

.login-eye-btn {
    position: absolute;
    right: 0.625rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0.25rem;
    display: flex;
    align-items: center;
    transition: color var(--transition-fast);
}

.login-eye-btn:hover {
    color: var(--color-primary);
}

.login-error {
    font-size: 0.8125rem;
    color: var(--color-error);
    min-height: 1.2em;
}

.login-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-md);
    font-family: var(--font-primary);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: filter var(--transition-fast), transform var(--transition-fast);
}

.login-submit:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.login-submit:active {
    transform: translateY(0);
}

.login-help {
    font-size: 0.8125rem;
    color: var(--text-muted);
    display: flex;
    align-items: baseline;
    gap: 0.375rem;
    flex-wrap: wrap;
}

.login-help a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: 500;
}

.login-help a:hover {
    text-decoration: underline;
}

/* Small pill nav button */
.change-key-btn {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.8125rem;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    padding: 0.25rem 0.75rem;
    cursor: pointer;
    font-family: var(--font-primary);
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.change-key-btn:hover {
    color: var(--color-primary);
    border-color: var(--color-primary);
}

.study-setup-btn {
    border-style: solid;
}

.study-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--font-mono);
    color: var(--text-accent);
    background: var(--color-primary-light);
    border: 1px solid var(--color-primary);
    border-radius: var(--radius-full);
    padding: 0.3rem 0.7rem;
    white-space: nowrap;
}
/* The badge has a filled background + border, so an empty one still renders
   as a stray pill. Honor the [hidden] attribute the app sets when idle. */
.study-status-badge[hidden] {
    display: none;
}

.study-status-badge strong {
    font-weight: 800;
}

/* ==========================================================================
   15.5 Study Setup Modal
   ========================================================================== */

.study-setup-modal[hidden] {
    display: none;
}

body.study-setup-open {
    overflow: hidden;
}

.study-setup-modal {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.study-setup-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
}

.study-setup-dialog {
    position: relative;
    width: min(100%, 560px);
    z-index: 1;
    padding: 1.5rem;
}

.study-setup-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.study-setup-header h2 {
    font-size: 1.2rem;
    margin-bottom: 0.35rem;
}

.study-setup-header p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.study-close-btn {
    flex-shrink: 0;
}

.study-setup-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.study-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: var(--bg-muted);
    border: 1px solid var(--border-color);
}

.study-toggle-row span {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.study-toggle-row small {
    color: var(--text-muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

.study-toggle-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--color-primary);
    flex-shrink: 0;
}

.study-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.study-field span {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.study-field input {
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 1px solid var(--border-color-strong);
    border-radius: var(--radius-md);
    background: var(--bg-muted);
    color: var(--text-primary);
    font-family: var(--font-mono);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background-color var(--transition-fast);
}

.study-field input:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow) var(--color-primary-glow);
    background: var(--bg-panel);
}

.study-field input:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.study-setup-note {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.82rem;
}

.inline-help-link {
    color: var(--color-primary);
    font-weight: 700;
    text-decoration: none;
}

.inline-help-link:hover {
    text-decoration: underline;
}

.study-setup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ==========================================================================
   15. Demo Banner
   ========================================================================== */

.demo-banner {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 99;
    background: var(--color-primary);
    color: white;
    text-align: center;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.demo-banner a.demo-banner-cta {
    color: white;
    font-weight: 700;
    text-decoration: underline;
    opacity: 0.9;
}

.demo-banner a.demo-banner-cta:hover {
    opacity: 1;
}

.has-demo-banner .main-container {
    padding-top: calc(60px + 36px + 1.5rem);
}

/* First-run onboarding banner (sits below the fixed topnav) */
.onboarding-banner {
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 0.6rem 1.25rem;
    font-size: 0.875rem;
    color: var(--text-accent);
    background: var(--color-primary-light);
    border-bottom: 1px solid var(--color-primary);
    animation: slideDown 0.5s var(--ease) both;
}
.onboarding-banner-text {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: center;
    text-align: center;
}
.onboarding-banner-text i {
    color: var(--color-primary);
}
.onboarding-dismiss {
    flex-shrink: 0;
    background: var(--color-primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-full);
    padding: 0.35rem 0.9rem;
    font-family: var(--font-primary);
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    transition: filter var(--transition-fast);
}
.onboarding-dismiss:hover {
    filter: brightness(1.1);
}

/* Push page content down by the banner's measured height (set in JS) */
body.has-onboarding-banner .main-container {
    padding-top: calc(60px + var(--onboarding-banner-h, 48px) + 1.5rem);
}

@media (max-width: 600px) {
    .onboarding-banner {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.6rem 1rem;
        font-size: 0.8rem;
    }
}

.demo-mode-badge {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    background: rgba(255,255,255,0.25);
    border-radius: var(--radius-full);
    padding: 0.15rem 0.6rem;
    border: 1px solid rgba(255,255,255,0.4);
}

/* ==========================================================================
   16. Home -- How It Works + Comparison sections
   ========================================================================== */

.home-section-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-accent);
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: 0.02em;
}

/* How It Works */
.home-how-it-works {
    padding: 0 0 1.5rem 0;
    animation: fadeInUp 0.6s var(--ease) both;
}

.hiw-steps {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
}

.hiw-step {
    flex: 1 1 0;
    max-width: 240px;
    text-align: center;
    padding: 1.5rem 1rem 1.25rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    position: relative;
}

.hiw-step-num {
    position: absolute;
    top: -14px;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--color-primary);
    color: white;
    font-size: 0.85rem;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.hiw-step-icon {
    font-size: 1.5rem;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
    margin-top: 0.25rem;
}

.hiw-step-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.hiw-step-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}

.hiw-connector {
    flex: 0 0 auto;
    font-size: 1rem;
    color: var(--text-muted);
    padding: 0 0.5rem;
    margin-top: 2.75rem;
}

/* Comparison grid */
.home-comparison {
    padding: 0 0 1.5rem 0;
    animation: fadeInUp 0.7s var(--ease) both;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.comparison-col {
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.comparison-col--them {
    background: var(--bg-muted);
}

.comparison-col--us {
    background: var(--color-primary-light);
    border-color: var(--color-primary);
}

.comparison-col-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
}

.comparison-col--them .comparison-col-header {
    color: var(--text-secondary);
    background: var(--bg-muted);
}

.comparison-col--us .comparison-col-header {
    color: var(--color-primary);
    background: var(--color-primary-light);
}

.comparison-list {
    list-style: none;
    padding: 0.75rem 1rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.comparison-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.comparison-list li i {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.comparison-col--them .comparison-list .fa-xmark {
    color: var(--color-error);
}

.comparison-col--us .comparison-list .fa-check {
    color: var(--color-success);
}

/* Demo CTA on home page */
.home-demo-cta {
    display: flex;
    justify-content: center;
    padding: 2.5rem 0 2rem 0;
}

.home-demo-btn {
    font-size: 0.95rem;
    padding: 0.75rem 1.75rem;
    border: 2px solid var(--color-primary);
    color: var(--color-primary);
    background: transparent;
    border-radius: var(--radius-full);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
    cursor: pointer;
}

.home-demo-btn:hover {
    background: var(--color-primary);
    color: white;
    text-decoration: none;
}

/* Team / contact footer on home page */
.home-footer {
    position: relative;
    z-index: 1;
    background: var(--bg-panel);
    border-top: 1px solid var(--border-color);
}

.home-footer-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 2.5rem 1.75rem;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem 3rem;
}

.home-footer-brand {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.home-footer-brand-top {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.home-footer-logo {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: block;
}

.home-footer-logo-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.home-footer-name {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: 0.03em;
    color: var(--color-primary);
}

.home-footer-slogan {
    margin: 0;
    max-width: 32ch;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.home-team {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 2.5rem;
}

.home-team-member {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

.home-team-name {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.home-team-email {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

.home-team-email:hover {
    color: var(--color-primary);
    text-decoration: underline;
}

.home-team-linkedin {
    display: inline-flex;
    font-size: 1.4rem;
    line-height: 1;
    color: var(--text-muted);
    transition: color var(--transition-fast), transform var(--transition-fast);
}

.home-team-linkedin:hover {
    color: var(--color-primary);
    transform: translateY(-2px);
}

/* Demo link on login page */
.login-demo-link {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.login-demo-link a {
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    justify-content: center;
}

.login-demo-link a:hover {
    text-decoration: underline;
}

/* ==========================================================================
   17. Progress Tracker + Export Button
   ========================================================================== */

.progress-tracker {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.78rem;
    font-weight: 700;
    font-family: var(--font-mono);
    padding: 0.25rem 0.625rem;
    border-radius: var(--radius-full);
    background: var(--bg-muted);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    transition: all var(--transition-medium);
    white-space: nowrap;
}

.progress-tracker i {
    font-size: 0.75rem;
}

.progress-tracker--complete {
    background: var(--color-success-light);
    color: var(--color-success);
    border-color: var(--color-success);
}

.export-btn {
    font-size: 0.78rem;
    padding: 0.25rem 0.625rem;
    gap: 0.35rem;
    white-space: nowrap;
}

/* Make feedback panel header right flex with gap */
.feedback-panel .header-right {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

/* Responsive tweaks for new sections */
@media (max-width: 700px) {
    .hiw-steps {
        flex-direction: column;
        align-items: center;
    }

    .hiw-connector {
        transform: rotate(90deg);
        margin: 0.25rem 0;
        padding: 0;
    }

    .hiw-step {
        max-width: 100%;
        width: 100%;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
    }
}
