/* ==========================================================================
   Deep Research — CIATA Corporate Design System
   Colors, typography, and patterns match ciata.io
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   Extracted from ciata.io: midnight (dark navy), sunrise (amber/orange),
   zinc (neutral grays), serif headings + sans body
   -------------------------------------------------------------------------- */
:root {
    /* CIATA Brand Colors */
    --midnight:       #0f172a;
    --midnight-light: #1e293b;
    --midnight-muted: #334155;

    --sunrise-300: #fcd34d;
    --sunrise-400: #fbbf24;
    --sunrise-500: #f59e0b;
    --sunrise-600: #d97706;
    --sunrise-700: #b45309;

    /* Neutrals */
    --white:     #ffffff;
    --zinc-50:   #fafafa;
    --zinc-100:  #f4f4f5;
    --zinc-200:  #e4e4e7;
    --zinc-300:  #d4d4d8;
    --zinc-400:  #a1a1aa;
    --zinc-500:  #71717a;
    --zinc-600:  #52525b;
    --zinc-700:  #3f3f46;

    /* Semantic */
    --success:  #22c55e;
    --error:    #ef4444;
    --info:     #3b82f6;

    /* Typography */
    --font-serif: 'Source Serif 4', 'Georgia', serif;
    --font-sans:  'Inter', system-ui, -apple-system, sans-serif;

    /* Spacing */
    --space-xs:  0.25rem;
    --space-sm:  0.5rem;
    --space-md:  1rem;
    --space-lg:  1.5rem;
    --space-xl:  2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Layout */
    --max-width: 1280px;
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Shadows */
    --shadow-sm:  0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md:  0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg:  0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl:  0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --transition-fast: 150ms ease;
    --transition-base: 250ms ease;
    --transition-slow: 400ms ease;
}

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

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    color: var(--midnight);
    background: var(--zinc-50);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* --------------------------------------------------------------------------
   Header — Fixed top bar (matches ciata.io nav style)
   -------------------------------------------------------------------------- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--white);
    border-bottom: 1px solid var(--zinc-200);
    z-index: 100;
    height: 4rem;
}

.header-nav {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-brand {
    display: flex;
    align-items: center;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    color: var(--midnight);
}

.logo-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
}

.logo-text {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
}

.logo-badge {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--zinc-500);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.15rem 0.5rem;
    background: var(--zinc-100);
    border-radius: 9999px;
}

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

.gdpr-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--zinc-600);
    padding: 0.25rem 0.75rem;
    background: var(--zinc-100);
    border: 1px solid var(--zinc-200);
    border-radius: 9999px;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--transition-fast), border-color var(--transition-fast),
                box-shadow var(--transition-fast);
    font-family: inherit;
}

.gdpr-badge:hover {
    background: var(--white);
    border-color: var(--sunrise-300);
    box-shadow: 0 0 0 3px rgba(251, 146, 60, 0.12);
    color: var(--zinc-800);
}

.gdpr-flag {
    font-size: 0.875rem;
}

/* --------------------------------------------------------------------------
   Privacy Indicator (dynamic dot + inline bar)
   -------------------------------------------------------------------------- */

.privacy-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
    flex-shrink: 0;
    transition: background 0.3s, box-shadow 0.3s;
}

.privacy-dot-green {
    background: #16a34a;
    box-shadow: 0 0 6px rgba(22, 163, 74, 0.4);
}

.privacy-dot-yellow {
    background: #d97706;
    box-shadow: 0 0 6px rgba(217, 119, 6, 0.4);
}

.privacy-dot-red {
    background: #dc2626;
    box-shadow: 0 0 6px rgba(220, 38, 38, 0.4);
}

/* Inline privacy indicator (below research form) */
.privacy-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--zinc-500);
    padding: 8px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--zinc-100);
    background: var(--zinc-50);
    margin-top: var(--space-sm);
    transition: all 0.3s ease;
    line-height: 1.5;
}

.privacy-indicator.level-green {
    border-color: rgba(22, 163, 74, 0.2);
    background: rgba(22, 163, 74, 0.03);
}

.privacy-indicator.level-yellow {
    border-color: rgba(217, 119, 6, 0.2);
    background: rgba(217, 119, 6, 0.03);
}

.privacy-indicator.level-red {
    border-color: rgba(220, 38, 38, 0.2);
    background: rgba(220, 38, 38, 0.03);
}

/* GDPR table: active engine row */
.gdpr-table-active {
    background: rgba(22, 163, 74, 0.06) !important;
}

/* Data Processing Footer (shown on reports) */
.data-processing-footer {
    margin-top: var(--space-xl);
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--zinc-200);
    background: var(--zinc-50);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--zinc-600);
    transition: border-color 0.3s;
}

.data-processing-footer.level-green {
    border-color: rgba(22, 163, 74, 0.3);
    background: rgba(22, 163, 74, 0.02);
}

.data-processing-footer.level-yellow {
    border-color: rgba(217, 119, 6, 0.3);
    background: rgba(217, 119, 6, 0.02);
}

.data-processing-footer.level-red {
    border-color: rgba(220, 38, 38, 0.3);
    background: rgba(220, 38, 38, 0.02);
}

.dpf-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 0.85rem;
    color: var(--zinc-700);
}

.dpf-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 24px;
    margin-bottom: 14px;
}

.dpf-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dpf-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--zinc-400);
}

.dpf-value {
    font-size: 0.8rem;
    color: var(--zinc-700);
}

.dpf-notice {
    margin: 0;
    padding-top: 12px;
    border-top: 1px solid var(--zinc-200);
    font-size: 0.75rem;
    color: var(--zinc-400);
    line-height: 1.5;
}

.dpf-notice a {
    color: var(--sunrise-600);
    text-decoration: none;
}

.dpf-notice a:hover {
    text-decoration: underline;
}

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

/* --------------------------------------------------------------------------
   Main layout
   -------------------------------------------------------------------------- */
#app-main {
    flex: 1;
    margin-top: 4rem; /* header height */
    display: flex;
    flex-direction: column;
}

/* View switching */
.view {
    display: none;
    animation: fadeIn var(--transition-base);
}

.view-active {
    display: block;
}

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

/* --------------------------------------------------------------------------
   View 1: Input — Hero with large text input
   -------------------------------------------------------------------------- */
.input-hero {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-lg) var(--space-xl);
    text-align: center;
}

.input-title {
    font-family: var(--font-serif);
    font-size: clamp(2.5rem, 5vw, 3.5rem);
    font-weight: 700;
    color: var(--midnight);
    letter-spacing: -0.035em;
    margin-bottom: var(--space-sm);
    line-height: 1.15;
}

.input-subtitle {
    font-size: 1.15rem;
    font-weight: 300;
    color: var(--zinc-500);
    margin-bottom: var(--space-2xl);
    line-height: 1.5;
}

.input-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    text-align: left;
}

.input-field-wrapper {
    position: relative;
    border: 2px solid var(--zinc-200);
    border-radius: var(--radius-lg);
    background: var(--white);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.input-field-wrapper:focus-within {
    border-color: var(--sunrise-500);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.input-field {
    width: 100%;
    padding: var(--space-lg);
    padding-bottom: var(--space-sm);
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--midnight);
    background: transparent;
    border: none;
    outline: none;
    resize: vertical;
    min-height: 100px;
    line-height: 1.6;
}

.input-field::placeholder {
    color: var(--zinc-400);
    font-weight: 300;
}

.input-meta {
    display: flex;
    justify-content: flex-end;
    padding: 0 var(--space-lg) var(--space-sm);
}

.char-count {
    font-size: 0.75rem;
    color: var(--zinc-400);
}

/* Advanced options (collapsible) */
.options-details {
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-md);
    background: var(--white);
}

.options-summary {
    padding: var(--space-sm) var(--space-md);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--zinc-500);
    cursor: pointer;
    user-select: none;
    list-style: none;
}

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

.options-summary::before {
    content: '▸ ';
}

details[open] .options-summary::before {
    content: '▾ ';
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-md);
    padding: 0 var(--space-md) var(--space-md);
}

.option-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--zinc-600);
    margin-bottom: var(--space-xs);
}

.option-select {
    width: 100%;
    padding: var(--space-sm) var(--space-sm);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--midnight);
    background: var(--zinc-50);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    cursor: pointer;
}

/* Submit button — CIATA sunrise gradient */
.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-md) var(--space-xl);
    font-family: var(--font-sans);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--midnight);
    background: linear-gradient(135deg, var(--sunrise-400), var(--sunrise-500));
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-fast);
    width: 100%;
}

.submit-btn:hover {
    background: linear-gradient(135deg, var(--sunrise-300), var(--sunrise-500));
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

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

.submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.submit-icon {
    font-size: 1.2rem;
}

/* History section */
.history-section {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 var(--space-lg) var(--space-2xl);
}

.history-title {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--midnight);
    margin-bottom: var(--space-md);
    letter-spacing: -0.02em;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.history-card {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    text-decoration: none;
    color: var(--midnight);
    transition: all var(--transition-fast);
}

.history-card:hover {
    border-color: var(--sunrise-400);
    box-shadow: var(--shadow-sm);
}

.history-card-question {
    flex: 1;
    font-size: 0.95rem;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.history-card-meta {
    font-size: 0.75rem;
    color: var(--zinc-400);
    white-space: nowrap;
}

.history-card-status {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-completed { background: #dcfce7; color: #166534; }
.status-running   { background: #fef3c7; color: #92400e; }
.status-failed    { background: #fee2e2; color: #991b1b; }
.status-queued    { background: var(--zinc-100); color: var(--zinc-600); }

/* --------------------------------------------------------------------------
   View 2: Progress — Live research tracking
   -------------------------------------------------------------------------- */
.progress-container {
    max-width: 800px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    background: none;
    border: none;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--zinc-500);
    cursor: pointer;
    padding: var(--space-sm) 0;
    margin-bottom: var(--space-lg);
    transition: color var(--transition-fast);
}

.back-btn:hover {
    color: var(--midnight);
}

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

.progress-question {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--midnight);
    letter-spacing: -0.02em;
    line-height: 1.3;
    flex: 1;
}

.progress-status-badge {
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background: #fef3c7;
    color: #92400e;
    white-space: nowrap;
}

.progress-bar-wrapper {
    margin-bottom: var(--space-xl);
}

.progress-bar {
    height: 8px;
    background: var(--zinc-200);
    border-radius: 9999px;
    overflow: hidden;
    margin-bottom: var(--space-sm);
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--sunrise-400), var(--sunrise-600));
    border-radius: 9999px;
    transition: width var(--transition-slow);
    min-width: 2%;
}

.progress-stats {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--zinc-500);
}

/* Activity feed */
.activity-feed {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 60vh;
    overflow-y: auto;
    padding-right: var(--space-sm);
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    animation: slideIn var(--transition-base);
}

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

.activity-item:nth-child(odd) {
    background: var(--zinc-50);
}

.activity-icon {
    flex-shrink: 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.activity-text {
    flex: 1;
    color: var(--zinc-700);
    line-height: 1.6;
}

.activity-time {
    flex-shrink: 0;
    font-size: 0.7rem;
    color: var(--zinc-400);
    font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   View 3: Report
   -------------------------------------------------------------------------- */
.report-container {
    max-width: 900px;
    margin: 0 auto;
    padding: var(--space-xl) var(--space-lg) var(--space-3xl);
}

.report-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
}

.report-actions {
    display: flex;
    gap: var(--space-sm);
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--zinc-700);
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.action-btn:hover {
    border-color: var(--zinc-300);
    box-shadow: var(--shadow-sm);
}

.action-btn-primary {
    background: linear-gradient(135deg, var(--sunrise-400), var(--sunrise-500));
    border-color: var(--sunrise-500);
    color: var(--midnight);
    font-weight: 600;
}

.action-btn-primary:hover {
    box-shadow: var(--shadow-md);
}

.report-meta-bar {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-xl);
    font-size: 0.85rem;
    color: var(--zinc-600);
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    white-space: nowrap;
}

.meta-value {
    font-weight: 600;
    color: var(--midnight);
}

/* Report body — styled markdown */
.report-body {
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-lg);
    padding: var(--space-2xl) var(--space-2xl);
    box-shadow: var(--shadow-sm);
    line-height: 1.75;
    color: var(--midnight-muted);
}

.report-body h1 {
    font-family: var(--font-serif);
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--midnight);
    letter-spacing: -0.025em;
    margin: var(--space-2xl) 0 var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--sunrise-400);
}

.report-body h1:first-child {
    margin-top: 0;
}

.report-body h2 {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--midnight);
    letter-spacing: -0.02em;
    margin: var(--space-xl) 0 var(--space-sm);
}

.report-body h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--midnight);
    margin: var(--space-lg) 0 var(--space-sm);
}

.report-body p {
    margin-bottom: var(--space-md);
}

.report-body ul, .report-body ol {
    margin-bottom: var(--space-md);
    padding-left: var(--space-xl);
}

.report-body li {
    margin-bottom: var(--space-xs);
}

.report-body a {
    color: var(--sunrise-600);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition-fast);
}

.report-body a:hover {
    border-bottom-color: var(--sunrise-600);
}

.report-body blockquote {
    border-left: 3px solid var(--sunrise-400);
    padding: var(--space-sm) var(--space-lg);
    margin: var(--space-md) 0;
    background: var(--zinc-50);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--zinc-700);
    font-style: italic;
}

.report-body table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--space-md) 0;
    font-size: 0.9rem;
}

.report-body th {
    background: var(--midnight);
    color: var(--white);
    font-weight: 600;
    text-align: left;
    padding: var(--space-sm) var(--space-md);
}

.report-body th:first-child { border-radius: var(--radius-sm) 0 0 0; }
.report-body th:last-child  { border-radius: 0 var(--radius-sm) 0 0; }

.report-body td {
    padding: var(--space-sm) var(--space-md);
    border-bottom: 1px solid var(--zinc-100);
}

.report-body tr:hover td {
    background: var(--zinc-50);
}

.report-body code {
    font-size: 0.85em;
    padding: 0.15em 0.4em;
    background: var(--zinc-100);
    border-radius: var(--radius-sm);
    color: var(--midnight);
}

.report-body pre {
    padding: var(--space-md);
    background: var(--midnight);
    color: #e2e8f0;
    border-radius: var(--radius-md);
    overflow-x: auto;
    margin: var(--space-md) 0;
}

.report-body pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.report-body hr {
    border: none;
    height: 1px;
    background: var(--zinc-200);
    margin: var(--space-xl) 0;
}

.report-body strong {
    color: var(--midnight);
    font-weight: 600;
}

/* --------------------------------------------------------------------------
   Error overlay
   -------------------------------------------------------------------------- */
.error-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    animation: fadeIn var(--transition-fast);
}

.error-card {
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: var(--space-2xl);
    max-width: 420px;
    width: 90%;
    box-shadow: var(--shadow-xl);
    text-align: center;
}

.error-card h3 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    margin-bottom: var(--space-sm);
    color: var(--error);
}

.error-card p {
    color: var(--zinc-600);
    margin-bottom: var(--space-lg);
    font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   Footer — CIATA sunrise gradient
   -------------------------------------------------------------------------- */
.app-footer {
    background: linear-gradient(135deg, var(--sunrise-400), var(--sunrise-600));
    padding: var(--space-lg);
    text-align: center;
}

.app-footer p {
    font-size: 0.8rem;
    color: var(--midnight);
    margin: 0;
}

.app-footer a {
    color: var(--midnight);
    font-weight: 600;
    text-decoration: none;
}

.app-footer a:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Account page
   -------------------------------------------------------------------------- */

.account-page {
    max-width: 720px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-md);
}

.account-title {
    font-family: var(--font-serif);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--zinc-900);
    margin: var(--space-md) 0 var(--space-lg);
}

.account-card {
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
    transition: box-shadow var(--transition-fast);
}

.account-card:hover {
    box-shadow: var(--shadow-sm);
}

.account-card-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--zinc-800);
    margin: 0 0 var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--zinc-100);
}

.account-description {
    font-size: 0.85rem;
    color: var(--zinc-500);
    margin: 0 0 var(--space-md);
    line-height: 1.5;
}

/* Profile */
.account-profile {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.account-avatar-lg {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sunrise-500), var(--sunrise-600));
    color: var(--white);
    font-weight: 700;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    text-transform: uppercase;
}

.account-email {
    font-weight: 600;
    color: var(--zinc-800);
    font-size: 1rem;
}

.account-meta {
    color: var(--zinc-400);
    font-size: 0.8rem;
    margin-top: 2px;
}

/* Stats */
.account-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

.account-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: var(--space-sm) var(--space-xs);
    border-radius: var(--radius-md);
    background: var(--zinc-50);
    border: 1px solid var(--zinc-100);
}

.account-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--zinc-800);
}

.account-stat-label {
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--zinc-400);
    margin-top: 2px;
}

/* Forms */
.account-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.account-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.account-field label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--zinc-600);
}

.account-input {
    font-family: var(--font-sans);
    font-size: 0.85rem;
    padding: 8px 12px;
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-sm);
    background: var(--white);
    color: var(--zinc-800);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.account-input:focus {
    outline: none;
    border-color: var(--sunrise-400);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.account-form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: var(--space-sm);
    gap: var(--space-sm);
}

.account-status {
    font-size: 0.8rem;
    line-height: 1.4;
}

.account-status.success { color: #16a34a; }
.account-status.error   { color: #dc2626; }

.account-btn {
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid var(--midnight);
    border-radius: var(--radius-sm);
    background: var(--midnight);
    color: var(--white);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.account-btn:hover {
    background: var(--midnight-light);
    border-color: var(--midnight-light);
}

.account-btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.account-btn-danger {
    background: #dc2626;
    border-color: #dc2626;
}

.account-btn-danger:hover {
    background: #b91c1c;
    border-color: #b91c1c;
}

/* Inline form (create key) */
.account-form-inline {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

.account-form-inline .account-input {
    flex: 1;
}

/* Tables */
.account-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-bottom: var(--space-sm);
}

.account-table th {
    text-align: left;
    font-weight: 600;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--zinc-400);
    padding: 6px 8px;
    border-bottom: 1px solid var(--zinc-200);
}

.account-table td {
    padding: 8px 8px;
    color: var(--zinc-700);
    border-bottom: 1px solid var(--zinc-50);
    vertical-align: middle;
}

.account-table tbody tr:hover {
    background: var(--zinc-50);
}

.account-table-empty {
    text-align: center;
    color: var(--zinc-400);
    padding: var(--space-md) !important;
}

.account-table .revoke-btn {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    padding: 3px 8px;
    border: 1px solid #fca5a5;
    border-radius: var(--radius-sm);
    background: #fff5f5;
    color: #dc2626;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.account-table .revoke-btn:hover {
    background: #fef2f2;
    border-color: #dc2626;
}

/* API Key reveal */
.api-key-reveal {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    animation: fadeIn 0.3s ease;
}

.api-key-reveal-header {
    font-weight: 600;
    font-size: 0.85rem;
    color: #1d4ed8;
    margin-bottom: var(--space-xs);
}

.api-key-reveal-body {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xs);
}

.api-key-code {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    padding: 8px 12px;
    background: var(--white);
    border: 1px solid #bfdbfe;
    border-radius: var(--radius-sm);
    word-break: break-all;
    color: var(--zinc-800);
}

.api-key-copy-btn {
    padding: 6px 10px;
    border: 1px solid #93c5fd;
    border-radius: var(--radius-sm);
    background: var(--white);
    cursor: pointer;
    font-size: 0.9rem;
    transition: background var(--transition-fast);
}

.api-key-copy-btn:hover {
    background: #dbeafe;
}

.api-key-reveal-warning {
    font-size: 0.75rem;
    color: #92400e;
    margin: 0;
}

/* Danger Zone */
.danger-zone {
    border-color: #fca5a5;
}

.danger-zone .account-card-title {
    color: #dc2626;
    border-bottom-color: #fee2e2;
}

@media (max-width: 640px) {
    .account-page {
        padding: var(--space-md) var(--space-sm);
    }

    .account-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: var(--space-xs);
    }

    .account-form-inline {
        flex-direction: column;
    }

    .account-table {
        font-size: 0.7rem;
    }
}

/* --------------------------------------------------------------------------
   GDPR slide-over panel
   -------------------------------------------------------------------------- */
.gdpr-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.gdpr-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.gdpr-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 440px;
    max-width: 92vw;
    background: var(--white);
    z-index: 301;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.1);
}

.gdpr-panel.open {
    transform: translateX(0);
}

.gdpr-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-lg) var(--space-xl);
    border-bottom: 1px solid var(--zinc-200);
    flex-shrink: 0;
}

.gdpr-panel-header h2 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--zinc-900);
    margin: 0;
}

.gdpr-panel-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-md);
    background: var(--zinc-50);
    color: var(--zinc-500);
    font-size: 1.25rem;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.gdpr-panel-close:hover {
    background: var(--zinc-100);
    color: var(--zinc-800);
}

.gdpr-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-xl);
}

.gdpr-intro {
    font-size: 0.95rem;
    color: var(--zinc-600);
    line-height: 1.65;
    margin-bottom: var(--space-lg);
}

.gdpr-intro a {
    color: var(--sunrise-600);
    font-weight: 500;
}

.gdpr-section {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid var(--zinc-100);
}

.gdpr-section:last-of-type {
    border-bottom: none;
}

.gdpr-section h3 {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 600;
    color: var(--zinc-900);
    margin-bottom: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.gdpr-section p {
    font-size: 0.875rem;
    color: var(--zinc-600);
    line-height: 1.65;
    margin-bottom: var(--space-sm);
}

/* Status indicators */
.gdpr-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    flex-shrink: 0;
}

.gdpr-ok {
    background: #dcfce7;
    color: #16a34a;
}

.gdpr-warn {
    background: #fef3c7;
    color: #d97706;
}

/* Detail rows */
.gdpr-detail {
    display: flex;
    gap: var(--space-sm);
    padding: var(--space-xs) 0;
    font-size: 0.825rem;
    color: var(--zinc-600);
}

.gdpr-detail-label {
    font-weight: 600;
    color: var(--zinc-500);
    min-width: 80px;
    flex-shrink: 0;
}

/* Search engine comparison table */
.gdpr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
    margin-top: var(--space-sm);
}

.gdpr-table th {
    text-align: left;
    padding: var(--space-xs) var(--space-sm);
    font-weight: 600;
    color: var(--zinc-500);
    border-bottom: 2px solid var(--zinc-200);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gdpr-table td {
    padding: var(--space-xs) var(--space-sm);
    border-bottom: 1px solid var(--zinc-100);
    color: var(--zinc-700);
    vertical-align: top;
}

.gdpr-table-highlight td {
    background: rgba(34, 197, 94, 0.06);
    border-bottom: 1px solid rgba(34, 197, 94, 0.15);
    font-weight: 500;
}

.gdpr-badge-eu {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(34, 197, 94, 0.12);
    color: #16a34a;
    padding: 1px 6px;
    border-radius: 9999px;
    vertical-align: middle;
    margin-left: 4px;
}

.gdpr-hint {
    margin-top: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(34, 197, 94, 0.06);
    border-left: 3px solid rgba(34, 197, 94, 0.4);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: var(--zinc-600);
    line-height: 1.5;
}

/* Rights section */
.gdpr-rights h3 {
    color: var(--zinc-700);
}

.gdpr-rights a {
    color: var(--sunrise-600);
    font-weight: 500;
}

/* Panel footer */
.gdpr-footer {
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--zinc-100);
}

.gdpr-footer p {
    font-size: 0.75rem;
    color: var(--zinc-400);
    text-align: center;
}

.gdpr-footer-link {
    color: var(--sunrise-600);
    font-weight: 500;
    text-decoration: none;
}

.gdpr-footer-link:hover {
    text-decoration: underline;
}

/* --------------------------------------------------------------------------
   Credits Purchase Panel (slide-over)
   -------------------------------------------------------------------------- */

.credits-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 399;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.credits-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.credits-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 460px;
    max-width: 94vw;
    background: var(--white);
    z-index: 400;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
}

.credits-panel.open {
    transform: translateX(0);
}

.credits-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md) var(--space-lg);
    border-bottom: 1px solid var(--zinc-100);
    flex-shrink: 0;
}

.credits-panel-header h2 {
    font-family: var(--font-serif);
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--zinc-900);
    margin: 0;
}

.credits-panel-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--zinc-400);
    cursor: pointer;
    padding: 0 var(--space-xs);
    transition: color 0.15s;
    line-height: 1;
}

.credits-panel-close:hover {
    color: var(--zinc-700);
}

.credits-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-lg);
}

/* Balance bar */
.credits-balance-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm) var(--space-md);
    background: var(--zinc-50);
    border-radius: var(--radius-md);
    border: 1px solid var(--zinc-100);
    margin-bottom: var(--space-lg);
    font-family: var(--font-sans);
    font-size: 0.85rem;
    color: var(--zinc-600);
}

.credits-balance-bar strong {
    color: var(--zinc-900);
    font-weight: 600;
}

/* Pricing cards */
.pricing-cards {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.pricing-card {
    position: relative;
    padding: var(--space-lg) var(--space-md);
    border: 1px solid var(--zinc-150, var(--zinc-100));
    border-radius: var(--radius-lg);
    text-align: center;
    background: var(--white);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.pricing-card:hover {
    border-color: var(--zinc-200);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.pricing-card-featured {
    border-color: var(--sunrise-300);
    background: linear-gradient(
        180deg,
        rgba(251, 146, 60, 0.03) 0%,
        rgba(251, 146, 60, 0) 100%
    );
    box-shadow: 0 2px 12px rgba(251, 146, 60, 0.08);
}

.pricing-card-featured:hover {
    border-color: var(--sunrise-400);
    box-shadow: 0 4px 20px rgba(251, 146, 60, 0.12);
}

.pricing-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--sunrise-500), var(--sunrise-600));
    color: white;
    font-family: var(--font-sans);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 3px 12px;
    border-radius: 9999px;
}

.pricing-credits {
    font-family: var(--font-serif);
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--zinc-900);
    line-height: 1;
    margin-bottom: 2px;
}

.pricing-label {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--zinc-400);
    margin-bottom: var(--space-sm);
}

.pricing-price {
    font-family: var(--font-sans);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--zinc-800);
    margin-bottom: 2px;
}

.pricing-per {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--zinc-400);
    margin-bottom: var(--space-md);
}

.pricing-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.6rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--zinc-700);
    background: var(--zinc-50);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
}

.pricing-btn:hover {
    background: var(--zinc-100);
    border-color: var(--zinc-300);
    color: var(--zinc-900);
}

.pricing-btn-featured {
    color: white;
    background: linear-gradient(135deg, var(--sunrise-500), var(--sunrise-600));
    border-color: var(--sunrise-500);
}

.pricing-btn-featured:hover {
    background: linear-gradient(135deg, var(--sunrise-600), var(--sunrise-700));
    border-color: var(--sunrise-600);
    color: white;
}

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

/* EU payment note */
.credits-eu-note {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    color: var(--zinc-500);
    text-align: center;
    padding: var(--space-sm) var(--space-md);
    background: rgba(34, 197, 94, 0.04);
    border-radius: var(--radius-md);
    border: 1px solid rgba(34, 197, 94, 0.1);
    line-height: 1.5;
}

/* Credits status (error messages) */
.credits-status {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    font-family: var(--font-sans);
    font-size: 0.8rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.credits-status.error {
    background: rgba(239, 68, 68, 0.06);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

/* --------------------------------------------------------------------------
   Toast Notification
   -------------------------------------------------------------------------- */

.toast {
    position: fixed;
    top: var(--space-lg);
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    z-index: 9999;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.7rem 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    white-space: nowrap;
}

.toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast.toast-success {
    background: #16a34a;
    color: white;
}

.toast.toast-warn {
    background: #d97706;
    color: white;
}

.toast.toast-error {
    background: #dc2626;
    color: white;
}

/* --------------------------------------------------------------------------
   Header: Login button (unauthenticated state)
   -------------------------------------------------------------------------- */
.header-login-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 0.35rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--midnight);
    background: linear-gradient(135deg, var(--sunrise-400), var(--sunrise-500));
    border: none;
    border-radius: 9999px;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.header-login-btn:hover {
    background: linear-gradient(135deg, var(--sunrise-300), var(--sunrise-500));
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   Header: Account menu (authenticated state)
   -------------------------------------------------------------------------- */
.account-menu {
    position: relative;
}

.account-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.3rem 0.65rem;
    background: var(--zinc-50);
    border: 1px solid var(--zinc-200);
    border-radius: 9999px;
    cursor: pointer;
    font-family: var(--font-sans);
    font-size: 0.8rem;
    color: var(--midnight);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.account-trigger:hover {
    border-color: var(--zinc-300);
    background: var(--white);
    box-shadow: var(--shadow-sm);
}

.account-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--sunrise-400), var(--sunrise-600));
    color: var(--midnight);
    font-weight: 700;
    font-size: 0.7rem;
    flex-shrink: 0;
}

.account-email {
    font-weight: 500;
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.credits-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.1rem 0.5rem;
    background: linear-gradient(135deg, var(--sunrise-400), var(--sunrise-500));
    color: var(--midnight);
    font-size: 0.65rem;
    font-weight: 700;
    border-radius: 9999px;
    letter-spacing: 0.02em;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 0.15s;
}

.credits-badge:hover {
    opacity: 0.85;
}

.account-caret {
    color: var(--zinc-400);
    transition: transform var(--transition-fast);
    flex-shrink: 0;
}

.account-menu.open .account-caret {
    transform: rotate(180deg);
}

/* Dropdown */
.account-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 220px;
    background: var(--white);
    border: 1px solid var(--zinc-200);
    border-radius: var(--radius-lg);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.12), 0 4px 12px rgba(0, 0, 0, 0.06);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px) scale(0.97);
    transition: opacity var(--transition-fast), transform var(--transition-fast), visibility var(--transition-fast);
    z-index: 150;
    overflow: hidden;
}

.account-menu.open .account-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.account-dropdown-header {
    padding: 0.75rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.account-dropdown-email {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--midnight);
}

.account-dropdown-credits {
    font-size: 0.7rem;
    color: var(--zinc-500);
}

.account-dropdown-divider {
    height: 1px;
    background: var(--zinc-100);
}

.account-dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.55rem 1rem;
    font-size: 0.825rem;
    font-weight: 500;
    color: var(--zinc-700);
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}

.account-dropdown-item:hover {
    background: var(--zinc-50);
    color: var(--midnight);
}

.account-dropdown-logout:hover {
    background: #fef2f2;
    color: var(--error);
}

.dropdown-icon {
    font-size: 0.9rem;
    width: 1.2rem;
    text-align: center;
    flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   View 0: Auth — Premium dark login / register
   -------------------------------------------------------------------------- */
#view-auth {
    position: relative;
    min-height: calc(100vh - 4rem);
    background: #0a0a0b;
    overflow: hidden;
}

.auth-backdrop {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.auth-glow {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    opacity: 0.35;
}

.auth-glow-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--sunrise-500), transparent 70%);
    top: -120px;
    right: -100px;
    animation: glowFloat 12s ease-in-out infinite;
}

.auth-glow-2 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--sunrise-700), transparent 70%);
    bottom: -80px;
    left: -60px;
    animation: glowFloat 15s ease-in-out infinite reverse;
}

@keyframes glowFloat {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50%      { transform: translate(30px, -20px) scale(1.1); }
}

.auth-container {
    position: relative;
    z-index: 1;
    max-width: 440px;
    margin: 0 auto;
    padding: var(--space-3xl) var(--space-lg) var(--space-xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: calc(100vh - 4rem);
    justify-content: center;
}

.auth-brand {
    text-align: center;
    margin-bottom: var(--space-2xl);
}

.auth-brand-title {
    font-family: var(--font-serif);
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 700;
    color: var(--white);
    letter-spacing: -0.035em;
    margin-bottom: var(--space-sm);
    line-height: 1.15;
    background: linear-gradient(135deg, var(--white) 0%, var(--sunrise-300) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.auth-brand-sub {
    font-size: 1rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.5;
}

/* Card — glass morphism */
.auth-card {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: var(--radius-xl);
    padding: 0;
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4),
                inset 0 1px 0 rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

/* Tabs */
.auth-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.auth-tab {
    flex: 1;
    padding: 0.85rem 1rem;
    font-family: var(--font-sans);
    font-size: 0.85rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.4);
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color var(--transition-fast), border-color var(--transition-fast),
                background var(--transition-fast);
    position: relative;
}

.auth-tab:hover {
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.02);
}

.auth-tab-active {
    color: var(--sunrise-400);
    border-bottom-color: var(--sunrise-400);
}

/* Forms */
.auth-form {
    padding: 1.75rem 1.75rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
    animation: fadeIn var(--transition-base);
}

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.auth-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.02em;
}

.auth-input {
    width: 100%;
    padding: 0.7rem 0.85rem;
    font-family: var(--font-sans);
    font-size: 0.9rem;
    color: var(--white);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-md);
    outline: none;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast),
                background var(--transition-fast);
}

.auth-input::placeholder {
    color: rgba(255, 255, 255, 0.22);
}

.auth-input:focus {
    border-color: var(--sunrise-500);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
    background: rgba(255, 255, 255, 0.08);
}

/* Primary button */
.auth-btn {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--midnight);
    background: linear-gradient(135deg, var(--sunrise-400), var(--sunrise-500));
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: var(--space-xs);
}

.auth-btn:hover {
    background: linear-gradient(135deg, var(--sunrise-300), var(--sunrise-500));
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.auth-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.auth-btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    box-shadow: none;
    color: var(--white);
}

/* Switch link */
.auth-switch {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.4);
    margin: 0;
}

.auth-switch a {
    color: var(--sunrise-400);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--transition-fast);
}

.auth-switch a:hover {
    color: var(--sunrise-300);
    text-decoration: underline;
}

/* Error message */
.auth-error {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.65rem 1rem;
    margin: 0 1.75rem 1.25rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    border-radius: var(--radius-md);
    font-size: 0.8rem;
    color: #fca5a5;
    animation: fadeIn var(--transition-fast);
}

.auth-error-icon {
    flex-shrink: 0;
    font-size: 0.9rem;
}

/* Verification message */
.auth-verify {
    padding: 2.5rem 1.75rem;
    text-align: center;
    animation: fadeIn var(--transition-base);
}

.auth-verify-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.auth-verify-title {
    font-family: var(--font-serif);
    font-size: 1.35rem;
    font-weight: 600;
    color: var(--white);
    margin-bottom: var(--space-sm);
}

.auth-verify-text {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    line-height: 1.6;
    margin-bottom: var(--space-xl);
}

.auth-verify-text strong {
    color: var(--sunrise-400);
    font-weight: 600;
}

/* Footer note */
.auth-footer-note {
    margin-top: var(--space-xl);
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.25);
    text-align: center;
}

/* --------------------------------------------------------------------------
   Print styles (for PDF export via Ctrl+P / Cmd+P)
   -------------------------------------------------------------------------- */
@media print {
    .header, .app-footer, .report-toolbar, .back-btn, .gdpr-badge,
    .gdpr-panel, .gdpr-backdrop, .credits-panel, .credits-backdrop, .toast,
    #view-auth, .account-menu, .header-login-btn {
        display: none !important;
    }

    #app-main {
        margin-top: 0;
    }

    .report-body {
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .report-meta-bar {
        border: none;
        background: none;
        padding: var(--space-sm) 0;
        border-bottom: 1px solid var(--zinc-200);
    }

    .data-processing-footer {
        break-inside: avoid;
        border-color: var(--zinc-300) !important;
        background: none !important;
    }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 640px) {
    .header-nav {
        padding: 0 var(--space-md);
    }

    .input-hero {
        padding: var(--space-xl) var(--space-md);
    }

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

    .report-body {
        padding: var(--space-lg);
    }

    .report-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .report-actions {
        justify-content: stretch;
    }

    .report-actions .action-btn {
        flex: 1;
        justify-content: center;
    }

    .progress-header {
        flex-direction: column;
    }

    .gdpr-panel {
        width: 100%;
        max-width: 100vw;
    }

    /* Auth responsive */
    .auth-container {
        padding: var(--space-xl) var(--space-md);
    }

    .auth-form {
        padding: 1.25rem 1.25rem 1rem;
    }

    .auth-brand-sub {
        font-size: 0.9rem;
    }

    .auth-error {
        margin: 0 1.25rem 1rem;
    }

    /* Account menu responsive */
    .account-email {
        display: none;
    }

    .account-dropdown {
        right: -0.5rem;
    }
}

/* --------------------------------------------------------------------------
   Loading spinner
   -------------------------------------------------------------------------- */
.spinner {
    display: inline-block;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--zinc-200);
    border-top-color: var(--sunrise-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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