:root {
    /* Ethereal Dark Palette */
    --black: #0a0a0a;
    --surface-dark: #111111;
    --glass-bg: rgba(255, 255, 255, 0.02);
    --glass-border: rgba(255, 255, 255, 0.06);
    --glass-highlight: rgba(255, 255, 255, 0.1);

    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.6);
    --text-dim: rgba(255, 255, 255, 0.35);

    /* Muted Luxury Accent */
    --accent-gold: #C9A84C;
    --accent-glow: rgba(201, 168, 76, 0.15);
    --accent-emerald: #10b981;
    --accent-amber: #fbbf24;

    /* Physics */
    --spring: cubic-bezier(0.32, 0.72, 0, 1);
    --expo: cubic-bezier(0.16, 1, 0.3, 1);

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-huge: 2rem;
    --radius-pill: 9999px;

    /* Spacing */
    --sp-xs: 0.25rem;
    --sp-sm: 0.5rem;
    --sp-md: 1.5rem;
    --sp-lg: 3rem;

    /* Z-index */
    --z-base: 0;
    --z-elevated: 10;
    --z-overlay: 20;
    --z-sticky: 50;
    --z-modal: 1000;
    --z-toast: 10000;

    /* Shadows */
    --shadow-sm: inset 0 1px 1px rgba(255,255,255,0.04);
    --shadow-md: inset 0 1px 2px rgba(255,255,255,0.06), 0 8px 24px -8px rgba(0,0,0,0.4);
    --shadow-lg: inset 0 1px 2px rgba(255,255,255,0.08), 0 24px 40px -10px rgba(0,0,0,0.5);
}

/* -------------------------------------
   Light Mode Variables
-------------------------------------- */
[data-theme="light"] {
    --black: #FAFAFA;
    --surface-dark: #FFFFFF;
    --glass-bg: rgba(0, 0, 0, 0.02);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.9);
    --text-primary: rgba(0, 0, 0, 0.88);
    --text-secondary: rgba(0, 0, 0, 0.52);
    --text-dim: rgba(0, 0, 0, 0.3);
    --accent-gold: #B8806A;
    --accent-glow: rgba(184, 128, 106, 0.12);
    --accent-emerald: #059669;
    --accent-amber: #d97706;
    --shadow-sm: inset 0 1px 1px rgba(0,0,0,0.04);
    --shadow-md: inset 0 1px 2px rgba(0,0,0,0.06), 0 8px 24px -8px rgba(0,0,0,0.08);
    --shadow-lg: inset 0 1px 2px rgba(0,0,0,0.06), 0 24px 40px -10px rgba(0,0,0,0.1);
}

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

body {
    background-color: var(--black);
    color: var(--text-primary);
    font-family: 'Satoshi', sans-serif;
    line-height: 1.6;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ambient Background Mesh */
.ambient-mesh {
    position: fixed;
    inset: 0;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(120px);
    will-change: transform, opacity;
}

.orb-1 {
    top: -15%; right: -10%;
    width: 55vw; height: 55vw;
    background: radial-gradient(circle,
        rgba(201, 168, 76, 0.4) 0%,
        rgba(201, 168, 76, 0.25) 20%,
        rgba(180, 140, 50, 0.12) 40%,
        rgba(160, 120, 40, 0.04) 60%,
        transparent 80%
    );
    animation: driftA 25s infinite cubic-bezier(0.32, 0.72, 0, 1),
               breathe 8s infinite ease-in-out;
}

.orb-2 {
    bottom: -20%; left: -15%;
    width: 50vw; height: 50vw;
    background: radial-gradient(circle,
        rgba(210, 170, 80, 0.18) 0%,
        rgba(200, 150, 60, 0.1) 25%,
        rgba(180, 130, 50, 0.04) 50%,
        transparent 75%
    );
    animation: driftB 30s infinite cubic-bezier(0.32, 0.72, 0, 1),
               breathe 10s -4s infinite ease-in-out;
}

.orb-3 {
    top: 50%; left: 50%;
    width: 30vw; height: 30vw;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle,
        rgba(255, 220, 130, 0.08) 0%,
        rgba(230, 190, 100, 0.03) 40%,
        transparent 70%
    );
    animation: driftC 22s infinite cubic-bezier(0.32, 0.72, 0, 1),
               breathe 12s -6s infinite ease-in-out;
}

@keyframes driftA {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
    25%  { transform: translate(-3%, 4%) scale(1.03) rotate(2deg); }
    50%  { transform: translate(-6%, 2%) scale(1.06) rotate(-1deg); }
    75%  { transform: translate(-2%, 6%) scale(1.02) rotate(3deg); }
    100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

@keyframes driftB {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
    20%  { transform: translate(4%, -3%) scale(1.04) rotate(-2deg); }
    40%  { transform: translate(2%, -6%) scale(1.07) rotate(1deg); }
    60%  { transform: translate(6%, -2%) scale(1.03) rotate(-3deg); }
    80%  { transform: translate(3%, -5%) scale(1.05) rotate(2deg); }
    100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

@keyframes driftC {
    0%   { transform: translate(0, 0) scale(1) rotate(0deg); }
    33%  { transform: translate(-5%, 3%) scale(1.08) rotate(-2deg); }
    66%  { transform: translate(3%, -4%) scale(0.95) rotate(2deg); }
    100% { transform: translate(0, 0) scale(1) rotate(0deg); }
}

@keyframes breathe {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.65; }
}

.noise-overlay {
    display: none;
}

/* Split Layout */
.app-layout {
    position: relative;
    z-index: var(--z-elevated);
    display: flex;
    height: 100dvh;
    width: 100%;
}

/* -------------------------------------
   LEFT: Editorial Panel
-------------------------------------- */
.editorial-panel {
    flex: 0 0 40%;
    max-width: 600px;
    height: 100dvh;
    padding: 4vw;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--glass-border);
    background: linear-gradient(to right, rgba(0,0,0,0.8), transparent);
    transition: transform 0.8s var(--spring), opacity 0.6s var(--spring), width 0.8s var(--spring);
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    position: relative;
    scrollbar-width: none;
}

.editorial-panel::-webkit-scrollbar {
    display: none;
}

/* Mobile-only panel header — hidden on desktop */
.mobile-panel-header {
    display: none;
}

/* Scroll capsule indicator */
.scroll-capsule {
    position: fixed;
    width: 3px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s ease, background 0.3s ease;
    z-index: var(--z-modal);
}

.scroll-capsule.visible {
    opacity: 1;
}

/* Focus Mode State */
.app-layout.focus-active .editorial-panel {
    flex: 0 0 0%;
    max-width: 0px;
    padding-left: 0;
    padding-right: 0;
    opacity: 0;
    border-right: none;
    transform: translateX(-100px);
}

.brand-tag {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--text-secondary);
    margin-bottom: auto;
}

.pulse-dot {
    width: 6px; height: 6px;
    background: var(--text-secondary);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(255,255,255,0.5);
    animation: pulse 3s infinite var(--spring);
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.8); }
}

.hero-text h1 {
    font-family: 'Noto Serif SC', serif;
    font-size: clamp(3rem, 6vw, 6rem);
    font-weight: 300;
    line-height: 1.1;
    letter-spacing: -0.05em;
    margin-bottom: 24px;
    background: linear-gradient(180deg, #fff 0%, rgba(255,255,255,0.5) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-text p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 320px;
    font-weight: 300;
}

.history-module { margin-top: auto; padding-top: 4rem; }

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.module-header h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-dim);
    font-weight: 500;
}

.action-link {
    background: none; border: none;
    color: var(--text-secondary);
    font-family: inherit; font-size: 0.85rem;
    cursor: pointer;
    transition: color 0.3s ease;
}
.action-link:hover:not(:disabled) { color: var(--text-primary); }
.action-link:disabled { opacity: 0.3; cursor: not-allowed; }

.history-search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.history-search {
    flex: 1;
    min-width: 0;
    min-height: 2.5rem;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.03);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.85rem;
    padding: 0 0.85rem;
    outline: none;
    transition: border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}
.history-search::placeholder {
    color: var(--text-dim);
}
.history-search:focus {
    background: rgba(255,255,255,0.05);
    border-color: rgba(201, 168, 76, 0.28);
    box-shadow: 0 0 0 3px rgba(201, 168, 76, 0.08);
}
.history-search-submit {
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    background: rgba(201, 168, 76, 0.12);
    color: var(--accent-gold);
    cursor: pointer;
    transition: border-color 0.25s ease, background 0.25s ease, color 0.25s ease, transform 0.2s ease;
}
.history-search-submit:hover,
.history-search-submit:focus-visible {
    background: rgba(201, 168, 76, 0.18);
    border-color: rgba(201, 168, 76, 0.32);
    color: var(--text-primary);
    outline: none;
}
.history-search-submit:active {
    transform: translateY(1px);
}

.history-track {
    display: flex; flex-direction: column; gap: 8px;
    max-height: none;
    overflow: visible;
    padding-right: 0;
}
.history-load-more {
    padding: 14px 0 4px;
    text-align: center;
    color: var(--text-dim);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-family: 'JetBrains Mono', monospace;
}

.history-item {
    padding: var(--sp-md);
    border-radius: var(--radius-lg);
    border: 1px solid transparent;
    border-left: 3px solid transparent;
    cursor: pointer;
    transition: background 0.4s var(--expo), transform 0.4s var(--expo), border-color 0.4s var(--expo), box-shadow 0.4s var(--expo);
    background: rgba(255,255,255,0.01);
}
.history-item:hover {
    background: var(--glass-bg);
    transform: translateX(4px);
    border-left-color: rgba(201, 168, 76, 0.2);
}
.history-item:focus-visible {
    outline: none;
    border-color: rgba(255,255,255,0.18);
    border-left-color: rgba(201, 168, 76, 0.3);
    background: var(--glass-bg);
}
.history-item.active {
    background: var(--glass-bg);
    border-color: var(--glass-border);
    border-left-color: var(--accent-gold);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.05), inset 4px 0 12px -4px rgba(201, 168, 76, 0.1);
}
.history-item.is-deleting {
    opacity: 0.62;
    pointer-events: none;
}
.history-item.is-unavailable {
    border-color: rgba(255,255,255,0.1);
}
.history-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 4px;
}
.history-title {
    min-width: 0;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-primary);
    overflow-wrap: anywhere;
}
.history-delete-btn {
    flex: 0 0 auto;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    opacity: 0.48;
    transition: opacity 0.2s ease, color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.history-item:hover .history-delete-btn,
.history-item:focus-within .history-delete-btn {
    opacity: 1;
}
.history-delete-btn:hover,
.history-delete-btn:focus-visible {
    color: #f87171;
    background: rgba(248, 113, 113, 0.08);
    border-color: rgba(248, 113, 113, 0.2);
    outline: none;
}
.history-delete-btn:active {
    transform: scale(0.94);
}
.history-delete-btn:disabled {
    cursor: wait;
    opacity: 0.45;
    transform: none;
}
.history-date { font-size: 0.72rem; color: var(--text-dim); margin-bottom: 10px; font-family: 'JetBrains Mono', monospace; letter-spacing: 0.04em; }
.history-preview {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.4em;
}
.history-preview.is-placeholder {
    color: var(--text-dim);
}
.history-note {
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    margin-top: 0;
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--accent-amber);
    transition: max-height 0.35s var(--spring), opacity 0.25s ease, margin-top 0.35s var(--spring);
}
.history-note.visible {
    max-height: 3rem;
    opacity: 1;
    margin-top: 10px;
}

.glass-panel {
    background: rgba(255,255,255,0.025);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 1.25rem;
    box-shadow: var(--shadow-md);
}

.module-header-tight {
    margin-bottom: 0.9rem;
}

.module-meta {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.daily-dream-module {
    margin-top: 2rem;
}

.daily-dream-card {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.daily-dream-loading {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.daily-dream-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    color: var(--text-primary);
    line-height: 1.5;
}

.daily-dream-prediction {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.daily-dream-source {
    font-size: 0.75rem;
    color: var(--accent-gold);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.daily-dream-action {
    align-self: flex-start;
    background: rgba(201, 168, 76, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.2);
    color: var(--text-primary);
    padding: 0.65rem 1rem;
    border-radius: var(--radius-pill);
    cursor: pointer;
    transition: transform 0.3s var(--spring), border-color 0.3s var(--spring), box-shadow 0.3s var(--spring);
}

.daily-dream-action:hover {
    transform: translateY(-1px);
    border-color: rgba(201, 168, 76, 0.4);
    box-shadow: 0 8px 24px rgba(201, 168, 76, 0.12);
}

.bookmark-module {
    margin-top: 2rem;
}

.bookmark-item {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.bookmark-item .history-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bookmark-mark {
    color: var(--accent-gold);
}

.bookmark-empty {
    padding: 1rem 0;
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* -------------------------------------
   RIGHT: Oracle Feed Panel
-------------------------------------- */
.oracle-panel {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    transition: flex 0.8s var(--spring);
}

.app-layout.focus-active .oracle-panel {
    flex: 1;
}

.meta-header {
    position: absolute; top: 0; left: 0; right: 0;
    padding: 2rem 4vw;
    display: flex; justify-content: space-between; align-items: flex-start;
    z-index: var(--z-overlay);
    background: linear-gradient(to bottom, var(--black) 10%, transparent);
    pointer-events: none;
}
.meta-header button { pointer-events: auto; }

.meta-hud {
    display: flex;
    gap: 40px;
}

.meta-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 14px;
    flex-wrap: wrap;
    position: relative;
}

.auth-entry {
    position: relative;
    min-width: 0;
    pointer-events: auto;
}

.meta-item { display: flex; flex-direction: column; align-items: flex-start; }
.meta-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.2em; color: var(--accent-gold); opacity: 0.78; text-shadow: 0 0 10px rgba(212, 175, 55, 0.08); margin-bottom: 4px; }
.meta-value { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; color: var(--text-secondary); transition: color 0.4s ease; }
.meta-item:first-child {
    min-width: 96px;
}
.meta-item:last-child {
    min-width: 132px;
}
.status-waiting { color: var(--text-secondary); }
.status-analyzing { color: var(--accent-gold); text-shadow: 0 0 10px rgba(245, 158, 11, 0.22); }
.status-clarify { color: var(--accent-amber); text-shadow: 0 0 10px rgba(245, 158, 11, 0.18); }
.status-complete { color: var(--accent-emerald); text-shadow: 0 0 10px rgba(16, 185, 129, 0.24); }
.sync-high { color: var(--accent-emerald) !important; text-shadow: 0 0 10px rgba(16, 185, 129, 0.4); }
.sync-med { color: var(--accent-amber) !important; }
.sync-low { color: var(--text-secondary) !important; }

@media (max-width: 720px) {
    .meta-header {
        gap: 16px;
        flex-wrap: wrap;
    }

    .meta-hud {
        gap: 24px;
        flex-wrap: wrap;
    }

    .meta-actions {
        width: 100%;
        justify-content: flex-start;
    }
}

.feed-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 8rem 4vw 12rem;
}
.feed-scroll::-webkit-scrollbar { display: none; }

.feed-track {
    max-width: 720px;
    margin: 0 auto;
    display: flex; flex-direction: column; gap: 4rem;
}

/* -------------------------------------
   Cards & Content Architecture
-------------------------------------- */
.revelation-card {
    opacity: 0;
    transform: translateY(40px);
    animation: slideUpFade 1s var(--spring) forwards;
}
.revelation-entry {
    opacity: 0;
    transform: translateY(24px);
    animation: slideUpFade 0.7s var(--spring) forwards;
}

@keyframes slideUpFade {
    to { opacity: 1; transform: translateY(0); }
}

.card-eyebrow {
    display: inline-block;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    color: var(--accent-gold);
    background: rgba(201, 168, 76, 0.08);
    border: 1px solid rgba(201, 168, 76, 0.15);
    border-radius: var(--radius-pill);
    padding: 4px 14px;
    margin-bottom: 1.5rem;
}

.serif-quote {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.5rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-weight: 300;
}
.entry-eyebrow {
    font-size: 0.72rem;
    color: var(--text-dim);
    letter-spacing: 0.12em;
    margin-bottom: 0.75rem;
}

.glass-card {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-huge);
    padding: var(--sp-lg);
    backdrop-filter: blur(24px);
    box-shadow: var(--shadow-lg);
    transition: transform 0.4s var(--spring), border-color 0.4s var(--spring), box-shadow 0.4s var(--spring);
}
.glass-card:hover {
    transform: translateY(-2px);
    border-color: rgba(255,255,255,0.12);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.08), 0 16px 32px -8px rgba(0,0,0,0.5);
}
.glass-card:active {
    transform: scale(0.995);
}

.processing-block h4 { font-size: 0.9rem; font-weight: 500; margin-bottom: 1rem; color: var(--text-primary); }
.highlight-amber { color: var(--accent-amber) !important; }
.highlight-emerald { color: var(--accent-emerald) !important; }
.dim-text { color: var(--text-dim); font-size: 0.85rem; }
.mt-sm { margin-top: 0.5rem; }
.mt-lg { margin-top: 3rem; }

.retrieval-status {
    font-family: 'Noto Serif SC', serif;
    font-size: 1rem;
    color: var(--text-secondary);
    padding: 0.75rem 0;
    min-height: 2.5rem;
    transition: opacity 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.process-inline {
    margin-top: 1rem;
}
.process-clarification {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--glass-border);
}
.process-clarification .card-eyebrow {
    margin-bottom: 1rem;
}
.clarification-debug {
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-dim);
}
.clarification-debug summary {
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.clarification-debug summary:hover {
    color: var(--text-primary);
}
.clarification-debug .debug-content {
    margin-top: 0.5rem;
    padding: 0.75rem;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.78rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
    color: var(--accent-emerald, #34d399);
}
.loading-pulse {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}
.loading-pulse::before {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255,255,255,0.12);
    border-top-color: var(--accent-emerald, #34d399);
    border-radius: 50%;
    animation: loadingSpin 0.8s cubic-bezier(0.4, 0, 0.2, 1) infinite;
    flex-shrink: 0;
}
.loading-pulse .loading-dots {
    display: inline-flex;
    gap: 3px;
    margin-left: 2px;
}
.loading-pulse .loading-dots span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-emerald, #34d399);
    opacity: 0.4;
    animation: dotPulse 1.4s ease-in-out infinite;
}
.loading-pulse .loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-pulse .loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes loadingSpin {
    to { transform: rotate(360deg); }
}
@keyframes dotPulse {
    0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
    40% { opacity: 1; transform: scale(1.2); }
}

/* Streaming answer indicator */
.streaming-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.streaming-indicator .stream-bars {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 14px;
}
.streaming-indicator .stream-bars span {
    width: 3px;
    height: 100%;
    border-radius: 2px;
    background: var(--accent-emerald, #34d399);
    animation: streamBar 1s ease-in-out infinite;
}
.streaming-indicator .stream-bars span:nth-child(1) { animation-delay: 0s; height: 6px; }
.streaming-indicator .stream-bars span:nth-child(2) { animation-delay: 0.15s; height: 10px; }
.streaming-indicator .stream-bars span:nth-child(3) { animation-delay: 0.3s; height: 14px; }
.streaming-indicator .stream-bars span:nth-child(4) { animation-delay: 0.45s; height: 10px; }
.streaming-indicator .stream-bars span:nth-child(5) { animation-delay: 0.6s; height: 6px; }

@keyframes streamBar {
    0%, 100% { transform: scaleY(0.5); opacity: 0.5; }
    50% { transform: scaleY(1); opacity: 1; }
}

.focus-list {
    list-style: none;
    border-left: 1px solid var(--glass-border);
    padding-left: 1.5rem;
    display: flex; flex-direction: column; gap: 0.5rem;
}
.focus-list li { color: var(--text-secondary); font-size: 0.95rem; }
.focus-list li::before { content: '→'; color: var(--text-dim); margin-right: 12px; }

.serif-question {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.25rem;
    color: var(--accent-amber);
    line-height: 1.6;
}

/* Premium Details Toggle */
.premium-details summary {
    font-size: 0.85rem; color: var(--text-secondary);
    cursor: pointer; list-style: none;
    padding-top: 1.5rem; border-top: 1px solid var(--glass-border);
    transition: color 0.3s ease;
}
.premium-details summary:hover { color: var(--text-primary); }
.premium-details summary::-webkit-details-marker { display: none; }

/* Vector Chunks */
.chunks-grid { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.chunk-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.04);
    border-radius: calc(var(--radius-xl) + 6px);
    padding: 6px;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.03);
}
.chunk-card-inner {
    background: rgba(255,255,255,0.02);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--sp-md);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.06);
}
.chunk-header { display: flex; justify-content: space-between; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 1rem; }
.chunk-title { font-size: 1rem; font-weight: 500; color: var(--text-primary); margin-bottom: 0.5rem; }
.chunk-text { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; }
.matched-query { display: inline-block; padding: 4px 10px; background: rgba(255,255,255,0.05); border-radius: var(--radius-sm); font-size: 0.7rem; color: var(--text-secondary); margin-bottom: 1rem; }

/* Final Resolution Markdown */
.resolution-header { display: flex; justify-content: space-between; align-items: flex-start; }
.icon-button { background: none; border: none; color: var(--text-dim); cursor: pointer; transition: color 0.3s var(--spring), transform 0.3s var(--spring); }
.icon-button:hover { color: var(--text-primary); transform: scale(1.1); }

/* Action Row — glass pill icon buttons */
.action-row { display: flex; gap: 6px; }
.action-row .icon-button {
    width: 2.25rem; height: 2.25rem;
    border-radius: 9999px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--glass-border);
    display: flex; align-items: center; justify-content: center;
    transition: color 0.3s var(--spring), transform 0.3s var(--spring), background 0.3s var(--spring), border-color 0.3s var(--spring), box-shadow 0.3s var(--spring);
}
.action-row .icon-button:hover {
    color: var(--accent-gold);
    background: rgba(201, 168, 76, 0.08);
    border-color: rgba(201, 168, 76, 0.25);
    transform: scale(1.08);
}
.action-row .icon-button:active {
    transform: scale(0.95);
}
.action-row .icon-button.is-active {
    color: var(--accent-gold);
    background: rgba(201, 168, 76, 0.1);
    border-color: rgba(201, 168, 76, 0.3);
    box-shadow: 0 0 12px -4px rgba(201, 168, 76, 0.3);
    animation: bookmarkGlow 2s infinite var(--spring);
}
@keyframes bookmarkGlow {
    0%, 100% { box-shadow: 0 0 12px -4px rgba(201, 168, 76, 0.3); }
    50% { box-shadow: 0 0 20px -2px rgba(201, 168, 76, 0.5); }
}
.icon-button.is-active {
    color: var(--accent-gold);
}
.icon-button.is-active:hover {
    color: var(--accent-gold);
}
.icon-button.is-copied {
    color: var(--accent-emerald);
    pointer-events: none;
}
.icon-button.is-loading {
    pointer-events: none;
    color: var(--accent-gold);
}
.spin-icon {
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

.serif-body {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.15rem;
    line-height: 2;
    color: var(--text-primary);
    font-weight: 300;
}
.serif-body h1, .serif-body h2, .serif-body h3 { font-weight: 500; margin: 2.5rem 0 1rem; }
.serif-body p { margin-bottom: 1.5rem; }
.serif-body blockquote {
    padding: 2rem 3rem;
    border-radius: 24px;
    background: rgba(212, 175, 55, 0.05); /* very subtle gold */
    color: var(--text-primary);
    margin: 3rem 0;
    position: relative;
}

.hidden { display: none !important; }

/* -------------------------------------
   Auth Modal & User Badge
-------------------------------------- */

.auth-trigger-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    min-width: 128px;
    padding: 0 16px;
    border-radius: var(--radius-pill);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.03) 100%);
    border: 1px solid rgba(212, 175, 55, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.82);
    font-family: 'Satoshi', sans-serif;
    font-size: 0.76rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s var(--spring), color 0.3s var(--spring), border-color 0.3s var(--spring), box-shadow 0.3s var(--spring);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    white-space: nowrap;
    backdrop-filter: blur(18px);
}

.auth-trigger-btn:hover {
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.12) 0%, rgba(255, 255, 255, 0.05) 100%);
    color: var(--text-primary);
    border-color: rgba(212, 175, 55, 0.32);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.auth-trigger-btn:focus-visible,
.user-badge:focus-visible,
.user-menu-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.42), 0 0 0 4px rgba(212, 175, 55, 0.12);
}

.user-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 40px;
    max-width: min(220px, 42vw);
    padding: 0 12px 0 10px;
    border-radius: var(--radius-pill);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06) 0%, rgba(255, 255, 255, 0.025) 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    cursor: pointer;
    position: relative;
    pointer-events: auto;
    backdrop-filter: blur(18px);
    transition: border-color 0.25s ease, background 0.25s ease, transform 0.25s var(--spring);
}

.user-avatar {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
    border-radius: 50%;
    border: 1px solid var(--glass-border);
    object-fit: cover;
}

.user-name {
    min-width: 0;
    flex: 1 1 auto;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.78);
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-badge-chevron {
    flex: 0 0 auto;
    color: var(--accent-gold);
    opacity: 0.72;
    transition: transform 0.25s var(--spring), opacity 0.2s ease;
}

.user-badge:hover,
.user-badge:focus-visible,
.user-badge.menu-open {
    background: linear-gradient(180deg, rgba(212, 175, 55, 0.12) 0%, rgba(255, 255, 255, 0.04) 100%);
    border-color: rgba(212, 175, 55, 0.24);
}

.user-badge:hover .user-name,
.user-badge:focus-visible .user-name,
.user-badge.menu-open .user-name {
    color: var(--text-primary);
}

.user-badge.menu-open .user-badge-chevron {
    transform: rotate(180deg);
    opacity: 1;
}

.user-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: rgba(15, 15, 15, 0.95);
    backdrop-filter: blur(24px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 4px;
    min-width: 140px;
    box-shadow: 0 16px 32px -8px rgba(0, 0, 0, 0.6);
}

.user-menu-item {
    display: block;
    width: 100%;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'Satoshi', sans-serif;
    font-size: 0.85rem;
    padding: 8px 12px;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.2s ease, color 0.2s ease;
}

.user-menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.user-menu-item--danger {
    color: #ef4444;
}

.user-menu-item--danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.user-menu-item--active {
    color: var(--accent-gold);
    font-weight: 500;
}

a.user-menu-item {
    text-decoration: none;
    display: block;
}

.user-menu-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 4px 8px;
}

/* Avatar Initials Fallback */
.user-avatar-initial {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--accent-glow);
    border: 1px solid rgba(201, 168, 76, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--accent-gold);
    flex-shrink: 0;
    line-height: 1;
}

/* Profile Modal */
.profile-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s var(--spring);
}

.profile-modal {
    background: #151517;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    width: min(420px, 92vw);
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.5);
    animation: modalSlide 0.35s var(--expo);
}

@keyframes modalSlide {
    from { opacity: 0; transform: translateY(12px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.profile-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.profile-close-btn:hover {
    color: var(--text-primary);
    background: var(--glass-bg);
}

.profile-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.2rem;
    font-weight: 500;
    margin-bottom: 1.5rem;
}

.profile-avatar-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 1.5rem;
}

.profile-avatar-wrap {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 0.5rem;
}

.profile-avatar-img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--glass-border);
}

.profile-avatar-initial {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-glow);
    border: 2px solid rgba(201, 168, 76, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-gold);
}

.profile-avatar-edit {
    position: absolute;
    bottom: 0;
    right: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--surface-dark);
    border: 1.5px solid var(--glass-border);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s var(--spring);
}

.profile-avatar-edit:hover {
    background: var(--glass-highlight);
    color: var(--text-primary);
}

.profile-avatar-hint {
    font-size: 0.75rem;
    color: var(--text-dim);
}

.profile-field {
    margin-bottom: 1rem;
}

.profile-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.35rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.profile-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: 'Satoshi', sans-serif;
    outline: none;
    transition: border-color 0.3s var(--spring);
}

.profile-input::placeholder {
    color: var(--text-dim);
}

.profile-input:focus {
    border-color: var(--accent-gold);
}

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

.profile-divider {
    height: 1px;
    background: var(--glass-border);
    margin: 1.25rem 0;
}

.profile-section-title {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.profile-message {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    margin-bottom: 1rem;
}

.profile-message.info {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
}

.profile-message.success {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-emerald);
}

.profile-message.error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.profile-save-btn {
    width: 100%;
    padding: 0.7rem;
    background: var(--accent-gold);
    border: none;
    border-radius: var(--radius-md);
    color: #0a0a0a;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: 'Satoshi', sans-serif;
    cursor: pointer;
    transition: all 0.25s var(--spring);
}

.profile-save-btn:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.profile-save-btn:active {
    transform: scale(0.98);
}

/* Light mode: profile modal */
[data-theme="light"] .profile-overlay {
    background: rgba(255, 255, 255, 0.7);
}

[data-theme="light"] .profile-modal {
    background: #FFFFFF;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .profile-close-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .profile-avatar-edit {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.12);
}

[data-theme="light"] .profile-avatar-edit:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .profile-avatar-initial {
    background: rgba(184, 128, 106, 0.1);
    border-color: rgba(184, 128, 106, 0.3);
    color: var(--accent-gold);
}

[data-theme="light"] .profile-save-btn {
    background: var(--accent-gold);
    color: #fff;
}

[data-theme="light"] .user-menu-item--danger:hover {
    background: rgba(239, 68, 68, 0.06);
}

[data-theme="light"] .user-avatar-initial {
    background: rgba(184, 128, 106, 0.1);
    border-color: rgba(184, 128, 106, 0.3);
    color: var(--accent-gold);
}

@media (max-width: 720px) {
    .auth-entry {
        order: -1;
    }

    .auth-trigger-btn,
    .user-badge {
        max-width: 100%;
    }
}

/* Auth Modal Overlay */
.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s var(--spring);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.auth-modal {
    background: var(--surface-dark);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: var(--sp-lg);
    width: 90%;
    max-width: 400px;
    position: relative;
    box-shadow: inset 0 1px 1px var(--glass-highlight), 0 32px 64px -16px rgba(0, 0, 0, 0.8);
    animation: modalSlideUp 0.4s var(--expo);
    overflow: hidden;
}
.auth-modal::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    border-radius: inherit;
    z-index: 0;
}
.auth-modal > * {
    position: relative;
    z-index: 1;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(20px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-close-btn {
    position: absolute;
    top: 1rem;
    right: 1.25rem;
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s ease;
    line-height: 1;
}

.auth-close-btn:hover { color: var(--text-primary); }

.auth-header {
    margin-bottom: 2rem;
}

.auth-header h2 {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.75rem;
    font-weight: 300;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.auth-header p {
    font-size: 0.9rem;
    color: var(--text-dim);
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--glass-border);
}

.auth-tab {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-dim);
    font-family: 'Satoshi', sans-serif;
    font-size: 0.9rem;
    padding: 0.75rem 0;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.3s ease, border-color 0.3s ease;
}

.auth-tab:hover { color: var(--text-secondary); }

.auth-tab.active {
    color: var(--text-primary);
    border-bottom-color: var(--accent-gold);
}

.auth-field {
    margin-bottom: 1rem;
}

.auth-field input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.25rem;
    color: var(--text-primary);
    font-family: 'Satoshi', sans-serif;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.3s var(--spring), box-shadow 0.3s var(--spring), background 0.3s var(--spring);
}

.auth-field input::placeholder { color: var(--text-dim); }
.auth-field input:focus {
    border-color: rgba(201, 168, 76, 0.3);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 1px 2px rgba(255,255,255,0.06), 0 0 0 3px rgba(201, 168, 76, 0.08);
}

.auth-submit {
    width: 100%;
    background: var(--text-primary);
    color: var(--black);
    border: none;
    border-radius: var(--radius-pill);
    padding: 0.85rem;
    font-family: 'Satoshi', sans-serif;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.3s var(--spring), transform 0.3s var(--spring), box-shadow 0.3s var(--spring);
    margin-top: 0.5rem;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.2), 0 8px 24px -8px rgba(0,0,0,0.4);
}

.auth-submit:hover { opacity: 0.95; transform: scale(0.98); box-shadow: inset 0 1px 1px rgba(255,255,255,0.25), 0 12px 32px -8px rgba(0,0,0,0.5); }
.auth-submit:active { transform: scale(0.96); }

.auth-forgot-btn {
    display: block;
    width: fit-content;
    margin: -0.25rem 0 0.75rem auto;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    padding: 0.15rem 0;
    transition: color 0.2s ease;
}

.auth-forgot-btn:hover,
.auth-forgot-btn:focus-visible {
    color: var(--accent-gold);
    outline: none;
}

.auth-forgot-header {
    text-align: center;
    margin-bottom: 1.75rem;
}

.auth-forgot-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: var(--accent-glow);
    border: 1px solid rgba(201, 168, 76, 0.2);
    color: var(--accent-gold);
    margin-bottom: 1rem;
}

.auth-forgot-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    letter-spacing: 0.02em;
}

.auth-forgot-desc {
    font-size: 0.82rem;
    color: var(--text-dim);
    line-height: 1.5;
    max-width: 260px;
    margin: 0 auto;
}

.auth-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    margin-top: 0.75rem;
    border: none;
    background: transparent;
    color: var(--text-dim);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    padding: 0.55rem 0;
    transition: color 0.2s ease, transform 0.15s var(--spring);
}

.auth-back-btn:hover,
.auth-back-btn:focus-visible {
    color: var(--accent-gold);
    outline: none;
}

.auth-back-btn:active {
    transform: translateX(-2px);
}

.auth-message {
    font-size: 0.85rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.auth-message.error { background: rgba(239, 68, 68, 0.1); color: #fca5a5; }
.auth-message.success { background: rgba(16, 185, 129, 0.1); color: #6ee7b7; }
.auth-message.info { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); }

.auth-divider {
    text-align: center;
    margin: 1.5rem 0;
    position: relative;
}

.auth-divider::before {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    height: 1px;
    background: var(--glass-border);
}

.auth-divider span {
    position: relative;
    background: var(--surface-dark);
    padding: 0 1rem;
    font-size: 0.8rem;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.auth-oauth {
    display: flex;
    gap: 12px;
}

.oauth-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    padding: 0.75rem;
    color: var(--text-secondary);
    font-family: 'Satoshi', sans-serif;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.3s var(--spring), border-color 0.3s var(--spring), color 0.3s var(--spring);
}

.oauth-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.15);
    color: var(--text-primary);
}

/* -------------------------------------
   Immersive Loading States & Prompts
-------------------------------------- */
.loading-matrix {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    background: linear-gradient(120deg, rgba(255,255,255,0.4) 0%, #fff 40%, #fff 60%, rgba(255,255,255,0.4) 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    opacity: 0.8;
    animation: sweep-shimmer 3s infinite linear;
}

@keyframes sweep-shimmer {
    0% { background-position: -100% 0%; }
    100% { background-position: 200% 0%; }
}

.matrix-text {
    display: inline;
    white-space: pre-wrap;
    border-right: none;
}

.animated-character-stream {
    white-space: pre-wrap;
    will-change: contents;
}

.streaming-text-active {
    white-space: pre-wrap;
}

.streaming-plain-text {
    line-height: inherit;
}

.qwen-style-stream {
    white-space: pre-wrap;
}

.stream-fade-chunk {
    display: inline;
    opacity: 0;
    animation: streamTextFadeIn 0.72s ease-out forwards;
    animation-delay: var(--stream-fade-delay, 0ms);
}

@keyframes streamTextFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.char-fade-in {
    display: inline-block;
    opacity: 0;
    transform: translateY(0.38em);
    filter: blur(0.12em);
    animation: char-fade-in 0.34s var(--spring) forwards;
    animation-delay: var(--char-delay, 0ms);
}

@keyframes char-fade-in {
    0% {
        opacity: 0;
        transform: translateY(0.38em);
        filter: blur(0.12em);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
        filter: blur(0);
    }
}

/* Scroll-to-bottom button */
.scroll-bottom-btn {
    position: sticky;
    bottom: 12px;
    float: right;
    margin-right: 12px;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid var(--glass-border);
    border-radius: 9999px;
    background: rgba(15, 12, 8, 0.85);
    backdrop-filter: blur(12px);
    color: var(--accent-gold);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    opacity: 1;
    transition: opacity 0.25s var(--spring), transform 0.25s var(--spring);
}

.scroll-bottom-btn:hover {
    background: rgba(15, 12, 8, 0.95);
    transform: translateY(-1px);
}

.scroll-bottom-btn.hidden {
    opacity: 0;
    pointer-events: none;
}

.suggested-prompt-btn {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
    padding: 8px 16px;
    border-radius: 9999px;
    font-size: 0.85rem;
    font-family: 'Noto Serif SC', serif;
    cursor: pointer;
    transition: background 0.3s var(--spring), color 0.3s var(--spring), transform 0.3s var(--spring), border-color 0.3s var(--spring);
    opacity: 0;
    transform: translateY(12px);
    animation: promptEnter 0.5s var(--spring) forwards;
}

.suggested-prompt-btn:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
    transform: translateY(-1px);
    border-color: rgba(201, 168, 76, 0.3);
}

@keyframes promptEnter {
    to { opacity: 1; transform: translateY(0); }
}

/* Print Card Styles (Hidden normally) */
.card-watermark {
    display: none;
}
.exporting-card .card-watermark {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 40px;
    padding-top: 20px;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: rgba(255,255,255,0.4);
}
.exporting-card {
    background: #0a0a0a !important;
    padding: 40px !important;
    border-radius: 0 !important;
}
.island-wrapper {
    position: absolute;
    bottom: 3rem; left: 0; right: 0;
    display: flex; justify-content: center;
    pointer-events: none; z-index: var(--z-sticky);
    transition: transform 0.6s var(--spring), opacity 0.4s ease-out;
    transform-origin: bottom center;
}

.island-wrapper.dock-hidden {
    transform: translateY(calc(100% + 6rem)) scale(0.9);
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* Prevents invisible clicks */
}

.dynamic-island {
    pointer-events: auto;
    background: rgba(20, 20, 20, 0.6);
    backdrop-filter: blur(24px) saturate(1.5);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-huge);
    padding: 0.5rem;
    width: 90%; max-width: 720px;
    box-shadow: var(--shadow-lg);
    transition: background 0.5s var(--spring), border-color 0.5s var(--spring), box-shadow 0.5s var(--spring);
}

.dynamic-island:focus-within {
    background: rgba(30, 30, 30, 0.8);
    border-color: rgba(255,255,255,0.15);
}

.dynamic-island.glow-amber {
    border-color: rgba(251, 191, 36, 0.4);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.1), 0 0 40px -10px rgba(251, 191, 36, 0.3);
    animation: pulse-amber 3s infinite var(--spring);
}

@keyframes pulse-amber {
    0%, 100% { box-shadow: inset 0 1px 1px rgba(255,255,255,0.1), 0 0 40px -10px rgba(251, 191, 36, 0.3); }
    50% { box-shadow: inset 0 1px 1px rgba(255,255,255,0.1), 0 0 60px -5px rgba(251, 191, 36, 0.5); }
}

.input-orchestrator {
    display: flex; align-items: flex-end; gap: 12px;
}

.voice-btn {
    width: 3rem;
    height: 3rem;
    border-radius: 9999px;
    border: 1px solid var(--glass-border);
    background: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.voice-btn:hover {
    background: rgba(255,255,255,0.08);
    transform: scale(1.04);
}

.voice-btn.is-recording {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.35);
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.08);
}

textarea {
    flex: 1;
    background: transparent; border: none; outline: none;
    color: var(--text-primary);
    font-family: 'Satoshi', sans-serif; font-size: 1.1rem;
    padding: 1rem 1.5rem;
    resize: none;
    max-height: 200px;
    scrollbar-width: none;
}
textarea::-webkit-scrollbar { display: none; }
textarea::placeholder { color: var(--text-dim); }
textarea:focus-visible { outline: none; }

/* Magnetic Nested Button */
.magnetic-btn {
    background: var(--text-primary);
    color: var(--black);
    border: none;
    border-radius: var(--radius-pill);
    width: 3.5rem; height: 3.5rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.4s var(--spring), background 0.4s var(--spring), opacity 0.4s var(--spring);
}

.btn-inner-circle {
    width: 2rem; height: 2rem;
    background: rgba(0,0,0,0.1);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.4s var(--spring);
}

.magnetic-btn:hover:not(:disabled) {
    transform: scale(0.95);
    background: #fff;
}
.magnetic-btn:hover:not(:disabled) .btn-inner-circle {
    transform: scale(1.1) translateX(2px);
}
.magnetic-btn:disabled {
    opacity: 0.3; cursor: not-allowed;
}


/* Loading state for send buttons */
.magnetic-btn.loading {
    opacity: 0.7;
    pointer-events: none;
}

.magnetic-btn.loading .btn-inner-circle {
    animation: spin 0.8s linear infinite;
}

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

/* Completed state (brief success feedback) */
.magnetic-btn.completed {
    animation: pulse-check 0.6s ease-out forwards;
}

@keyframes pulse-check {
    0% { transform: scale(1); }
    50% { transform: scale(1.15); }
    100% { transform: scale(1); }
}

/* -------------------------------------
   Focus Visible (global)
-------------------------------------- */
:focus-visible {
    outline: 2px solid rgba(201, 168, 76, 0.5);
    outline-offset: 2px;
}
.history-item:focus-visible,
.auth-trigger-btn:focus-visible,
.user-badge:focus-visible,
.user-menu-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 1px rgba(201, 168, 76, 0.42), 0 0 0 4px rgba(201, 168, 76, 0.12);
}

/* -------------------------------------
   Active / Pressed Feedback
-------------------------------------- */
.magnetic-btn:active:not(:disabled),
.auth-submit:active,
.daily-dream-action:active,
.suggested-prompt-btn:active,
.oauth-btn:active,
.action-link:active:not(:disabled) {
    transform: scale(0.97);
    opacity: 0.85;
}
.icon-button:active {
    transform: scale(0.9);
}
.auth-tab:active {
    opacity: 0.7;
}

/* -------------------------------------
   Confirm Modal
-------------------------------------- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--z-toast);
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.25s var(--spring);
}

.confirm-modal {
    background: #151517;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    padding: 2rem;
    width: min(400px, 92vw);
    position: relative;
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.06), 0 32px 64px -16px rgba(0, 0, 0, 0.6);
    animation: modalSlideUp 0.35s var(--expo);
    overflow: hidden;
}

.confirm-modal::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E");
    pointer-events: none;
    border-radius: inherit;
    z-index: 0;
}

.confirm-modal > * {
    position: relative;
    z-index: 1;
}

.confirm-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-bottom: 1.25rem;
}

.confirm-icon--danger {
    background: rgba(248, 113, 113, 0.06);
    border: 1px solid rgba(248, 113, 113, 0.12);
    color: #f87171;
}

.confirm-icon--warning {
    background: rgba(251, 191, 36, 0.06);
    border: 1px solid rgba(251, 191, 36, 0.12);
    color: var(--accent-amber);
}

.confirm-icon--info {
    background: var(--accent-glow);
    border: 1px solid rgba(201, 168, 76, 0.15);
    color: var(--accent-gold);
}

.confirm-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.15rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.confirm-body {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.75rem;
}

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

.confirm-btn {
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-pill);
    font-family: 'Satoshi', sans-serif;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s var(--spring);
    border: none;
    min-width: 80px;
}

.confirm-btn:active {
    transform: scale(0.96);
}

.confirm-btn-cancel {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-secondary);
}

.confirm-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--glass-highlight);
}

.confirm-btn-danger {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: #f87171;
}

.confirm-btn-danger:hover {
    background: rgba(248, 113, 113, 0.18);
    border-color: rgba(248, 113, 113, 0.35);
}

.confirm-btn-primary {
    background: var(--accent-gold);
    color: #0a0a0a;
}

.confirm-btn-primary:hover {
    opacity: 0.9;
    box-shadow: 0 8px 20px rgba(201, 168, 76, 0.2);
}

/* Light mode */
[data-theme="light"] .confirm-overlay {
    background: rgba(255, 255, 255, 0.6);
}

[data-theme="light"] .confirm-modal {
    background: #FFFFFF;
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 32px 64px -16px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .confirm-modal::before {
    display: none;
}

[data-theme="light"] .confirm-btn-cancel {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .confirm-btn-cancel:hover {
    background: rgba(0, 0, 0, 0.08);
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .confirm-btn-danger {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

[data-theme="light"] .confirm-btn-danger:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.25);
}

[data-theme="light"] .confirm-btn-primary {
    background: var(--accent-gold);
    color: #fff;
}

/* -------------------------------------
   Toast Notifications (Double-Bezel)
-------------------------------------- */
.toast-container {
    position: fixed;
    top: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    pointer-events: none;
    width: max-content;
    max-width: 90vw;
}
/* Outer Shell */
.toast {
    pointer-events: auto;
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
    padding: 3px;
    min-width: 340px;
    max-width: 520px;
    width: 100%;
    animation: toastIn 0.65s cubic-bezier(0.32, 0.72, 0, 1);
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.6), 0 0 0 0.5px rgba(255, 255, 255, 0.04);
}
/* Inner Core */
.toast-inner {
    display: flex;
    align-items: flex-start;
    gap: 0.85rem;
    padding: 1rem 1.3rem;
    border-radius: calc(var(--radius-xl) - 3px);
    background: rgba(10, 10, 10, 0.9);
    backdrop-filter: blur(40px);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.06);
    position: relative;
    overflow: hidden;
}
/* Icon */
.toast-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    margin-top: 1px;
    opacity: 0.9;
}
/* Text */
.toast-text {
    font-size: 0.92rem;
    font-family: 'Satoshi', sans-serif;
    line-height: 1.55;
    letter-spacing: 0.01em;
    flex: 1;
    padding-right: 0.5rem;
}
/* Progress bar */
.toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2px;
    border-radius: 0 0 0 calc(var(--radius-xl) - 3px);
    animation: toastProgress 4s linear forwards;
    opacity: 0.5;
}

/* --- Variants --- */
.toast-error .toast-icon { color: #f87171; }
.toast-error .toast-text { color: #fecaca; }
.toast-error .toast-progress { background: #f87171; }

.toast-success .toast-icon { color: var(--accent-gold); }
.toast-success .toast-text { color: #e8d5a3; }
.toast-success .toast-progress { background: var(--accent-gold); }

.toast-info .toast-icon { color: rgba(255, 255, 255, 0.5); }
.toast-info .toast-text { color: var(--text-secondary); }
.toast-info .toast-progress { background: rgba(255, 255, 255, 0.2); }

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateY(-16px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}
@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* -------------------------------------
   Skeleton Loader
-------------------------------------- */
.skeleton-line {
    height: 1em;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,0.03) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
}
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 85%; }
.skeleton-line.long { width: 100%; }
@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* -------------------------------------
   Skip-to-Content Link
-------------------------------------- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: var(--z-toast);
    padding: 0.75rem 1.5rem;
    background: var(--accent-gold);
    color: var(--black);
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    font-weight: 500;
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 0;
}

/* -------------------------------------
   Utility Classes
-------------------------------------- */
.section-label {
    display: inline-block;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--accent-gold);
    background: rgba(201, 168, 76, 0.06);
    border: 1px solid rgba(201, 168, 76, 0.12);
    border-radius: var(--radius-pill);
    padding: 3px 12px;
    margin-bottom: 1rem;
}
.prompt-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.audio-toggle-inner {
    display: flex;
    align-items: center;
    gap: 8px;
}
.mt-top-lg { margin-top: 2rem; }

/* -------------------------------------
   Light Mode — Hardcoded Color Overrides
-------------------------------------- */

/* Background — ambient orbs */
[data-theme="light"] .orb-1,
[data-theme="light"] .orb-2,
[data-theme="light"] .orb-3 {
    opacity: 0;
}

/* Editorial panel */
[data-theme="light"] .editorial-panel {
    background: linear-gradient(to right, rgba(255,255,255,0.9), transparent);
    border-right-color: rgba(0,0,0,0.06);
}

/* Scroll capsule */
[data-theme="light"] .scroll-capsule {
    background: rgba(0,0,0,0.1);
}

/* History items */
[data-theme="light"] .history-item {
    background: rgba(0,0,0,0.01);
}
[data-theme="light"] .history-item:hover {
    background: rgba(0,0,0,0.03);
    border-left-color: rgba(184, 128, 106, 0.25);
}
[data-theme="light"] .history-item:focus-visible {
    border-color: rgba(0,0,0,0.1);
    border-left-color: rgba(184, 128, 106, 0.3);
    background: rgba(0,0,0,0.03);
}
[data-theme="light"] .history-search {
    background: rgba(255,255,255,0.65);
    border-color: rgba(0,0,0,0.08);
    color: var(--text-primary);
}
[data-theme="light"] .history-search:focus {
    background: rgba(255,255,255,0.9);
    border-color: rgba(184, 128, 106, 0.28);
    box-shadow: 0 0 0 3px rgba(184, 128, 106, 0.08);
}
[data-theme="light"] .history-search-submit {
    background: rgba(184, 128, 106, 0.08);
    border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .history-search-submit:hover,
[data-theme="light"] .history-search-submit:focus-visible {
    background: rgba(184, 128, 106, 0.14);
    border-color: rgba(184, 128, 106, 0.22);
}
[data-theme="light"] .history-item.active {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
    border-left-color: var(--accent-gold);
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.03), inset 4px 0 12px -4px rgba(184, 128, 106, 0.08);
}
[data-theme="light"] .history-item.is-unavailable {
    border-color: rgba(0,0,0,0.06);
}

/* Glass panel */
[data-theme="light"] .glass-panel {
    background: rgba(0,0,0,0.02);
}

/* Glass card */
[data-theme="light"] .glass-card {
    background: rgba(255,255,255,0.7);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 8px 24px -8px rgba(0,0,0,0.06);
}
[data-theme="light"] .glass-card:hover {
    border-color: rgba(0,0,0,0.12);
    box-shadow: 0 16px 32px -8px rgba(0,0,0,0.08);
}

/* Chunk cards */
[data-theme="light"] .chunk-card {
    background: rgba(0,0,0,0.02);
    border-color: rgba(0,0,0,0.06);
    box-shadow: inset 0 1px 1px rgba(0,0,0,0.02);
}
[data-theme="light"] .chunk-card-inner {
    background: rgba(255,255,255,0.8);
    border-color: rgba(0,0,0,0.06);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.8);
}
[data-theme="light"] .matched-query {
    background: rgba(0,0,0,0.03);
}

/* Action row buttons */
[data-theme="light"] .action-row .icon-button {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .action-row .icon-button:hover {
    color: var(--accent-gold);
    background: rgba(184, 128, 106, 0.08);
    border-color: rgba(184, 128, 106, 0.2);
}
[data-theme="light"] .action-row .icon-button.is-active {
    color: var(--accent-gold);
    background: rgba(184, 128, 106, 0.08);
    border-color: rgba(184, 128, 106, 0.2);
    box-shadow: 0 0 12px -4px rgba(184, 128, 106, 0.15);
    animation-name: bookmarkGlowLight;
}
@keyframes bookmarkGlowLight {
    0%, 100% { box-shadow: 0 0 12px -4px rgba(184, 128, 106, 0.15); }
    50% { box-shadow: 0 0 20px -2px rgba(184, 128, 106, 0.25); }
}

/* Blockquote */
[data-theme="light"] .serif-body blockquote {
    background: rgba(0,0,0,0.02);
    border-left-color: var(--accent-gold);
}

/* Auth trigger button */
[data-theme="light"] .auth-trigger-btn {
    background: linear-gradient(180deg, rgba(0,0,0,0.04) 0%, rgba(0,0,0,0.02) 100%);
    border-color: rgba(184, 128, 106, 0.2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
    color: rgba(0,0,0,0.7);
}
[data-theme="light"] .auth-trigger-btn:hover {
    background: linear-gradient(180deg, rgba(184, 128, 106, 0.1) 0%, rgba(0,0,0,0.03) 100%);
    color: var(--text-primary);
    border-color: rgba(184, 128, 106, 0.3);
    box-shadow: 0 8px 20px rgba(0,0,0,0.06), inset 0 1px 0 rgba(255,255,255,0.9);
}

/* User badge */
[data-theme="light"] .user-badge {
    background: linear-gradient(180deg, rgba(0,0,0,0.04) 0%, rgba(0,0,0,0.02) 100%);
    border-color: rgba(0,0,0,0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}
[data-theme="light"] .user-name {
    color: rgba(0,0,0,0.7);
}
[data-theme="light"] .user-badge:hover,
[data-theme="light"] .user-badge:focus-visible,
[data-theme="light"] .user-badge.menu-open {
    background: linear-gradient(180deg, rgba(184, 128, 106, 0.08) 0%, rgba(0,0,0,0.03) 100%);
    border-color: rgba(184, 128, 106, 0.2);
}

/* User menu */
[data-theme="light"] .user-menu {
    background: rgba(255, 255, 255, 0.95);
    box-shadow: 0 16px 48px rgba(0,0,0,0.12);
    border: 1px solid rgba(0,0,0,0.06);
}
[data-theme="light"] .user-menu-item:hover {
    background: rgba(0,0,0,0.04);
}

/* Auth overlay */
[data-theme="light"] .auth-overlay {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(24px);
}

/* Auth modal */
[data-theme="light"] .auth-modal {
    background: #FFFFFF;
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 32px 64px -16px rgba(0,0,0,0.15);
}
[data-theme="light"] .auth-modal::before {
    display: none;
}
[data-theme="light"] .auth-close-btn {
    color: rgba(0,0,0,0.3);
}
[data-theme="light"] .auth-close-btn:hover {
    color: var(--text-primary);
}
[data-theme="light"] .auth-tabs {
    border-bottom-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .auth-tab {
    color: rgba(0,0,0,0.35);
}
[data-theme="light"] .auth-tab:hover {
    color: rgba(0,0,0,0.52);
}
[data-theme="light"] .auth-tab.active {
    color: var(--text-primary);
}

/* Auth fields */
[data-theme="light"] .auth-field input {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
    color: var(--text-primary);
}
[data-theme="light"] .auth-field input:focus {
    border-color: rgba(184, 128, 106, 0.35);
    background: rgba(255,255,255,0.9);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.04), 0 0 0 3px rgba(184, 128, 106, 0.1);
}

/* Auth submit */
[data-theme="light"] .auth-submit {
    background: #111111;
    color: #fff;
    box-shadow: 0 8px 24px -8px rgba(0,0,0,0.2);
}
[data-theme="light"] .auth-submit:hover {
    background: #000;
    box-shadow: 0 12px 32px -8px rgba(0,0,0,0.25);
}

/* Auth messages */
[data-theme="light"] .auth-message.error {
    background: rgba(239, 68, 68, 0.08);
    color: #dc2626;
}
[data-theme="light"] .auth-message.success {
    background: rgba(16, 185, 129, 0.08);
    color: #059669;
}
[data-theme="light"] .auth-message.info {
    background: rgba(0,0,0,0.03);
    color: var(--text-secondary);
}

[data-theme="light"] .auth-forgot-btn:hover,
[data-theme="light"] .auth-forgot-btn:focus-visible {
    color: var(--accent-gold);
}

[data-theme="light"] .auth-back-btn:hover,
[data-theme="light"] .auth-back-btn:focus-visible {
    color: var(--accent-gold);
}

[data-theme="light"] .auth-forgot-icon {
    background: rgba(184, 128, 106, 0.08);
    border-color: rgba(184, 128, 106, 0.2);
}

/* OAuth buttons */
[data-theme="light"] .oauth-btn {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
    color: var(--text-primary);
}
[data-theme="light"] .oauth-btn:hover {
    background: rgba(0,0,0,0.06);
    border-color: rgba(0,0,0,0.12);
}

/* Daily dream action */
[data-theme="light"] .daily-dream-action {
    background: rgba(184, 128, 106, 0.06);
    border-color: rgba(184, 128, 106, 0.15);
}
[data-theme="light"] .daily-dream-action:hover {
    background: rgba(184, 128, 106, 0.1);
    border-color: rgba(184, 128, 106, 0.3);
    box-shadow: 0 8px 20px rgba(184, 128, 106, 0.08);
}

/* Card eyebrow & section label */
[data-theme="light"] .card-eyebrow {
    color: var(--accent-gold);
    background: rgba(184, 128, 106, 0.06);
    border-color: rgba(184, 128, 106, 0.12);
}
[data-theme="light"] .section-label {
    color: var(--accent-gold);
    background: rgba(184, 128, 106, 0.05);
    border-color: rgba(184, 128, 106, 0.1);
}

/* Meta HUD — status text shadows */
[data-theme="light"] .status-analyzing {
    text-shadow: 0 0 8px rgba(217, 119, 6, 0.15);
}
[data-theme="light"] .status-clarify {
    text-shadow: 0 0 8px rgba(217, 119, 6, 0.12);
}
[data-theme="light"] .status-complete {
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
}
[data-theme="light"] .sync-high {
    text-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}
[data-theme="light"] .meta-label {
    text-shadow: none;
}

/* Pulse dot */
[data-theme="light"] .pulse-dot {
    box-shadow: 0 0 6px 2px rgba(0,0,0,0.15);
}

/* Suggested prompt buttons */
[data-theme="light"] .suggested-prompt-btn {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
    color: var(--text-secondary);
}
[data-theme="light"] .suggested-prompt-btn:hover {
    background: rgba(0,0,0,0.06);
    color: var(--text-primary);
    border-color: rgba(184, 128, 106, 0.25);
}

/* Dynamic island */
[data-theme="light"] .dynamic-island {
    background: rgba(255, 255, 255, 0.8);
    border-color: rgba(0,0,0,0.08);
    box-shadow: 0 24px 40px -10px rgba(0,0,0,0.08);
}
[data-theme="light"] .dynamic-island:focus-within {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(0,0,0,0.12);
    outline: none;
}
[data-theme="light"] .dynamic-island.glow-amber {
    border-color: rgba(217, 119, 6, 0.3);
    box-shadow: inset 0 1px 1px rgba(255,255,255,0.5), 0 0 40px -10px rgba(217, 119, 6, 0.15);
    animation-name: pulseAmberLight;
}
@keyframes pulseAmberLight {
    0%, 100% { box-shadow: inset 0 1px 1px rgba(255,255,255,0.5), 0 0 40px -10px rgba(217, 119, 6, 0.15); }
    50% { box-shadow: inset 0 1px 1px rgba(255,255,255,0.5), 0 0 60px -5px rgba(217, 119, 6, 0.25); }
}

/* Textarea */
[data-theme="light"] textarea {
    color: var(--text-primary);
}

/* Voice button */
[data-theme="light"] .voice-btn {
    background: rgba(0,0,0,0.03);
    border-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .voice-btn:hover {
    background: rgba(0,0,0,0.06);
}
[data-theme="light"] .voice-btn.is-recording {
    color: #dc2626;
    border-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.05);
}

/* Magnetic button (inverted — dark on light) */
[data-theme="light"] .magnetic-btn {
    background: #111111;
    color: #fff;
}
[data-theme="light"] .magnetic-btn:hover:not(:disabled) {
    background: #000;
}
[data-theme="light"] .btn-inner-circle {
    background: rgba(255,255,255,0.2);
}

/* Loading matrix shimmer */
[data-theme="light"] .loading-matrix {
    background: linear-gradient(90deg, #111 25%, #666 50%, #111 75%);
    background-size: 200% 100%;
}

/* Skeleton loader */
[data-theme="light"] .skeleton-line {
    background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.08) 50%, rgba(0,0,0,0.04) 75%);
}

/* Toast notifications */
[data-theme="light"] .toast {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.08);
    box-shadow: 0 20px 60px -12px rgba(0, 0, 0, 0.1), 0 0 0 0.5px rgba(0, 0, 0, 0.06);
}
[data-theme="light"] .toast-inner {
    background: rgba(255, 255, 255, 0.9);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.9);
}
[data-theme="light"] .toast-error .toast-icon { color: #dc2626; }
[data-theme="light"] .toast-error .toast-text { color: #991b1b; }
[data-theme="light"] .toast-error .toast-progress { background: #dc2626; }
[data-theme="light"] .toast-success .toast-icon { color: var(--accent-gold); }
[data-theme="light"] .toast-success .toast-text { color: #92400e; }
[data-theme="light"] .toast-success .toast-progress { background: var(--accent-gold); }
[data-theme="light"] .toast-info .toast-icon { color: rgba(0, 0, 0, 0.4); }
[data-theme="light"] .toast-info .toast-text { color: var(--text-secondary); }
[data-theme="light"] .toast-info .toast-progress { background: rgba(0, 0, 0, 0.15); }

/* Focus visible */
[data-theme="light"] :focus-visible {
    outline: 2px solid rgba(184, 128, 106, 0.5);
}
[data-theme="light"] textarea:focus-visible,
[data-theme="light"] input:focus-visible {
    outline: none;
}
[data-theme="light"] .history-item:focus-visible,
[data-theme="light"] .auth-trigger-btn:focus-visible,
[data-theme="light"] .user-badge:focus-visible,
[data-theme="light"] .user-menu-item:focus-visible {
    outline: none;
    box-shadow: 0 0 0 1px rgba(184, 128, 106, 0.3), 0 0 0 4px rgba(184, 128, 106, 0.1);
}

/* Card watermark */
[data-theme="light"] .card-watermark {
    color: rgba(0,0,0,0.3);
    border-top-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .exporting-card .card-watermark {
    color: rgba(255,255,255,0.4);
    border-top-color: rgba(255,255,255,0.1);
}

/* Export card — always dark */
[data-theme="light"] .exporting-card {
    --text-primary: rgba(255, 255, 255, 0.95);
    --text-secondary: rgba(255, 255, 255, 0.66);
    --text-dim: rgba(255, 255, 255, 0.38);
    --accent-gold: #C9A84C;
    --accent-emerald: #10b981;
    --accent-amber: #fbbf24;
    background: #0a0a0a !important;
    color: var(--text-primary);
}

/* Hero text */
[data-theme="light"] .hero-text h1 {
    background: linear-gradient(180deg, #111 0%, #444 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Serif text colors */
[data-theme="light"] .serif-quote {
    color: var(--text-primary);
}
[data-theme="light"] .serif-question {
    color: #b45309;
}
[data-theme="light"] .serif-body {
    color: var(--text-primary);
}

/* Focus list */
[data-theme="light"] .focus-list {
    border-left-color: rgba(0,0,0,0.08);
}
[data-theme="light"] .focus-list li {
    color: var(--text-secondary);
}
[data-theme="light"] .focus-list li::before {
    color: var(--text-dim);
}

/* Chunk text */
[data-theme="light"] .chunk-title {
    color: var(--text-primary);
}
[data-theme="light"] .chunk-text {
    color: var(--text-secondary);
}
[data-theme="light"] .chunk-header {
    color: var(--text-dim);
}

/* Dim text & highlights */
[data-theme="light"] .dim-text {
    color: var(--text-dim);
}
[data-theme="light"] .highlight-amber {
    color: #b45309 !important;
}
[data-theme="light"] .highlight-emerald {
    color: #059669 !important;
}
[data-theme="light"] .exporting-card .highlight-amber {
    color: var(--accent-amber) !important;
}
[data-theme="light"] .exporting-card .highlight-emerald {
    color: var(--accent-emerald) !important;
}

/* Premium details */
[data-theme="light"] .premium-details summary {
    color: var(--text-secondary);
    border-top-color: rgba(0,0,0,0.06);
}
[data-theme="light"] .premium-details summary:hover {
    color: var(--text-primary);
}

/* Bookmark count */
[data-theme="light"] .bookmark-count {
    color: var(--text-dim);
}

/* Action link */
[data-theme="light"] .action-link {
    color: var(--text-dim);
}
[data-theme="light"] .action-link:hover:not(:disabled) {
    color: var(--text-primary);
}

/* Skip link */
[data-theme="light"] .skip-link {
    background: var(--accent-gold);
    color: #fff;
}

/* -------------------------------------
   prefers-reduced-motion
-------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    .orb { animation: none; opacity: 0.2; }
    .pulse-dot { animation: none; }
    .loading-matrix { animation: none; }
    .char-fade-in { animation: none; opacity: 1; transform: none; filter: none; }
    .stream-fade-chunk { animation: none; opacity: 1; }
}

/* -------------------------------------
   Responsive: Tablet
-------------------------------------- */
@media (max-width: 1024px) {
    .editorial-panel {
        flex: 0 0 35%;
        padding: 3vw;
    }
    .glass-card {
        padding: 2rem;
    }
    .feed-track {
        gap: 3rem;
    }
    .meta-hud {
        gap: 24px;
    }
    .serif-body {
        font-size: 1.05rem;
    }
}

/* -------------------------------------
   Responsive: Mobile
-------------------------------------- */
@media (max-width: 720px) {
    .app-layout {
        flex-direction: column;
    }

    .editorial-panel {
        flex: 0 0 auto;
        height: auto;
        max-width: none;
        border-right: none;
        border-bottom: 1px solid var(--glass-border);
    }

    .editorial-panel.is-scrolling::after {
        display: none;
    }

    .hero-text h1 {
        font-size: clamp(2rem, 8vw, 3.5rem);
    }

    .hero-text p {
        font-size: 0.95rem;
        max-width: none;
    }

    .brand-tag {
        margin-bottom: var(--sp-sm);
    }

    .daily-dream-module {
        margin-top: var(--sp-md);
    }

    .history-module {
        padding-top: var(--sp-md);
    }

    .bookmark-module {
        margin-top: var(--sp-md);
    }

    .oracle-panel {
        flex: 1;
        min-height: 0;
    }

    .feed-scroll {
        padding: 6rem 5vw 10rem;
    }

    .feed-track {
        gap: 2.5rem;
    }

    .glass-card {
        padding: 1.5rem;
        border-radius: var(--radius-xl);
    }

    .serif-quote {
        font-size: 1.2rem;
    }

    .serif-body {
        font-size: 1rem;
        line-height: 1.8;
    }

    .serif-body blockquote {
        padding: 1.25rem 1.5rem;
        margin: 2rem 0;
    }

    .card-eyebrow {
        margin-bottom: 1rem;
    }

    .chunk-card {
        padding: 4px;
        border-radius: calc(var(--radius-lg) + 4px);
    }
    .chunk-card-inner {
        padding: var(--sp-sm) var(--sp-md);
        border-radius: var(--radius-lg);
    }

    .action-row .icon-button {
        width: 2rem;
        height: 2rem;
    }

    .dynamic-island {
        width: 95%;
        border-radius: 1.5rem;
        padding: 0.4rem;
    }

    .island-wrapper {
        bottom: 1.5rem;
    }

    textarea {
        font-size: 1rem;
        padding: 0.75rem 1rem;
    }

    .magnetic-btn {
        width: 3rem;
        height: 3rem;
    }

    .btn-inner-circle {
        width: 1.75rem;
        height: 1.75rem;
    }

    .meta-header {
        padding: 1.25rem 5vw;
    }

    .meta-hud {
        gap: 16px;
    }

    .meta-item:first-child,
    .meta-item:last-child {
        min-width: auto;
    }

    .meta-actions {
        gap: 8px;
    }

    .auth-trigger-btn {
        min-width: auto;
        min-height: 36px;
        padding: 0 12px;
        font-size: 0.7rem;
    }

    .user-badge {
        max-width: 160px;
        min-height: 36px;
    }

    .auth-modal {
        padding: 2rem 1.5rem;
        width: 95%;
        border-radius: var(--radius-xl);
    }

    .auth-header h2 {
        font-size: 1.4rem;
    }

    .chunks-grid {
        gap: 0.75rem;
    }

    .chunk-card {
        padding: 1rem;
    }

    .suggested-prompt-btn {
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .toast-container {
        top: 1rem;
        left: 50%;
        transform: translateX(-50%);
        right: auto;
        bottom: auto;
        width: auto;
        max-width: 90vw;
    }

    .toast {
        min-width: 280px;
        max-width: 90vw;
    }

    /* ── Mobile: Collapsible Editorial Panel ── */
    .mobile-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 0.75rem 0;
        flex-shrink: 0;
    }

    .mobile-brand {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 0.8rem;
        text-transform: uppercase;
        letter-spacing: 0.15em;
        color: var(--text-secondary);
    }

    .mobile-panel-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        border: 1px solid var(--glass-border);
        background: rgba(255, 255, 255, 0.04);
        color: var(--text-secondary);
        cursor: pointer;
        transition: background 0.3s ease, transform 0.3s var(--spring), color 0.3s ease;
    }

    .mobile-panel-toggle:hover {
        background: rgba(255, 255, 255, 0.08);
        color: var(--text-primary);
    }

    .mobile-panel-toggle:active {
        transform: scale(0.92);
    }

    .toggle-chevron {
        transition: transform 0.4s var(--spring);
    }

    /* Collapsed state (default on mobile) */
    .editorial-panel {
        max-height: 52px;
        padding: 0 5vw;
        overflow: hidden;
        transition: max-height 0.5s var(--spring), padding 0.4s var(--spring);
    }

    .editorial-panel > *:not(.mobile-panel-header) {
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    /* Expanded state */
    .editorial-panel.panel-expanded {
        max-height: 70vh;
        padding: 2rem 5vw;
        overflow-y: auto;
    }

    .editorial-panel.panel-expanded > *:not(.mobile-panel-header) {
        opacity: 1;
    }

    .editorial-panel.panel-expanded .toggle-chevron {
        transform: rotate(180deg);
    }

    .editorial-panel.panel-expanded .mobile-panel-toggle {
        background: rgba(255, 255, 255, 0.08);
    }

    /* When panel is collapsed, give chat more space */
    .editorial-panel:not(.panel-expanded) ~ .oracle-panel .feed-scroll {
        padding-top: 5rem;
    }
}

/* =============================================
   Dream Management Page (manage.html)
   ============================================= */

/* Override body overflow for manage page */
body:has(.manage-app) {
    overflow: auto;
    height: auto;
    scrollbar-gutter: stable;
}

/* Auth Gate */
.auth-gate {
    position: fixed;
    inset: 0;
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    background: var(--black);
}

.auth-gate-spinner {
    width: 32px;
    height: 32px;
    border: 2px solid var(--glass-border);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.auth-gate-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Manage App Shell */
.manage-app {
    min-height: 100dvh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 4rem;
}

/* Header */
.manage-header {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 5vw;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
}

.manage-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.manage-back-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s var(--spring);
}

.manage-back-btn:hover {
    color: var(--text-primary);
    background: var(--glass-bg);
}

.manage-title {
    font-family: 'Noto Serif SC', serif;
    font-size: 1.1rem;
    font-weight: 500;
    letter-spacing: 0.05em;
}

.manage-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Body Grid Layout */
.manage-body {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2.5rem;
    padding: 2.5rem 5vw;
    max-width: 1280px;
    margin: 0 auto;
}

.manage-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
}

.manage-main {
    min-width: 0;
}

/* Calendar */
.manage-calendar {
    width: 100%;
}

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

.cal-month-label {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0.04em;
    cursor: pointer;
    border: none;
    background: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.2s var(--spring);
}

.cal-month-label:hover {
    background: var(--glass-bg);
}

.cal-nav-btn {
    width: 32px;
    height: 32px;
}

.cal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 0.5rem;
}

.cal-weekdays span {
    text-align: center;
    font-size: 0.7rem;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    padding: 0.25rem 0;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.cal-day {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
    border: none;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    cursor: default;
    transition: all 0.2s var(--spring);
}

.cal-day--other {
    color: var(--text-dim);
    opacity: 0.4;
}

.cal-day--today {
    box-shadow: inset 0 0 0 1px var(--accent-gold);
    color: var(--accent-gold);
}

.cal-day--has-dream {
    cursor: pointer;
    font-weight: 600;
    color: var(--text-primary);
}

.cal-day--has-dream::after {
    content: '';
    position: absolute;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent-gold);
    transition: all 0.2s var(--spring);
}

.cal-day--has-dream:hover {
    background: var(--glass-bg);
}

.cal-day--has-dream:hover::after {
    width: 6px;
    height: 6px;
    bottom: 2px;
}

.cal-day--selected {
    background: var(--accent-glow) !important;
    color: var(--accent-gold) !important;
    font-weight: 700;
}

.cal-day--selected::after {
    background: var(--accent-gold);
}

/* Year/Month Inline Input */
.cal-ym-input {
    width: 3.2em;
    border: none;
    border-bottom: 1px solid var(--accent-gold);
    background: transparent;
    color: var(--accent-gold);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 600;
    text-align: center;
    padding: 2px 0;
    outline: none;
    -moz-appearance: textfield;
}

.cal-ym-input::-webkit-inner-spin-button,
.cal-ym-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.cal-ym-input:focus {
    border-bottom-width: 2px;
}

.cal-ym-sep {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Stats */
.manage-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    overflow: hidden;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1.4rem 1rem;
    position: relative;
    transition: background 0.25s var(--spring);
}

.stat-item:hover {
    background: var(--glass-bg);
}

.stat-item + .stat-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 20%;
    height: 60%;
    width: 1px;
    background: var(--glass-border);
}

.stat-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.6rem;
    font-weight: 500;
    color: var(--accent-gold);
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-dim);
    margin-top: 0.35rem;
    letter-spacing: 0.06em;
}

/* Quick Filters */
.manage-quick-filters {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0.5rem;
}

.quick-filter {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: 'Satoshi', sans-serif;
    font-size: 0.82rem;
    font-weight: 400;
    padding: 0.75rem 0.85rem;
    text-align: left;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.2s var(--spring);
}

.quick-filter:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-sm);
}

.quick-filter:last-child {
    border-radius: var(--radius-sm) var(--radius-sm) var(--radius-lg) var(--radius-lg);
}

.quick-filter:first-child:last-child {
    border-radius: var(--radius-lg);
}

.quick-filter:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.03);
}

.quick-filter.active {
    color: var(--accent-gold);
    background: rgba(201, 168, 76, 0.08);
    font-weight: 500;
}

/* Toolbar */
.manage-toolbar {
    margin: 0;
    padding: 1.25rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.toolbar-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.toolbar-row-main {
    /* Maintained by manage-toolbar flex gap */
}

.toolbar-row-sub:empty,
.toolbar-row-sub:has(.hidden) {
    display: none;
}

.toolbar-row-select {
    gap: 0.75rem;
}

.toolbar-search-wrap {
    position: relative;
    flex: 1;
}

.manage-search {
    width: 100%;
    padding: 0.7rem 0.85rem 0.7rem 2.4rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: 'Satoshi', sans-serif;
    outline: none;
    transition: all 0.3s var(--spring);
}

.manage-search::placeholder {
    color: var(--text-dim);
}

.manage-search:focus {
    border-color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-dim);
    pointer-events: none;
}

.toolbar-select {
    padding: 0.6rem 2rem 0.6rem 0.75rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.8rem;
    font-family: 'Satoshi', sans-serif;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%239a9590' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    cursor: pointer;
    transition: border-color 0.3s var(--spring);
}

.toolbar-select:focus {
    border-color: var(--accent-gold);
}

.bookmark-filter-btn {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    color: var(--text-secondary);
    transition: all 0.3s var(--spring);
}

.bookmark-filter-btn.active {
    color: var(--accent-gold);
    background: var(--accent-glow);
}

.select-all-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.select-all-label input[type="checkbox"] {
    display: none;
}

.select-all-label .custom-check {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--glass-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--spring);
    flex-shrink: 0;
}

.select-all-label input:checked + .custom-check {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
}

.select-all-label input:checked + .custom-check::after {
    content: '';
    width: 5px;
    height: 9px;
    border: solid var(--black);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

.date-filter-tag {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.75rem;
    background: var(--accent-glow);
    border: 1px solid rgba(201, 168, 76, 0.2);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-gold);
}

.date-filter-clear {
    background: none;
    border: none;
    color: var(--accent-gold);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.date-filter-clear:hover {
    opacity: 1;
}

/* Batch Bar */
.batch-bar {
    position: sticky;
    top: 68px;
    z-index: calc(var(--z-sticky) - 1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin: 1rem 0 0;
    background: transparent;
    border-top: 1px solid var(--glass-border);
    border-bottom: 1px solid var(--glass-border);
    animation: slideDown 0.3s var(--expo);
}

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

.batch-count {
    font-size: 0.8rem;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
}

.batch-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.batch-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.85rem;
    border: none;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
    font-family: 'Satoshi', sans-serif;
    cursor: pointer;
    transition: all 0.25s var(--spring);
}

.batch-btn:active {
    transform: scale(0.96);
}

.batch-btn-ghost {
    background: var(--glass-bg);
    color: var(--text-secondary);
    border: 1px solid var(--glass-border);
}

.batch-btn-ghost:hover {
    color: var(--text-primary);
    border-color: var(--glass-highlight);
}

.batch-btn-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.batch-btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.batch-btn-primary {
    background: var(--accent-glow);
    color: var(--accent-gold);
    border: 1px solid rgba(201, 168, 76, 0.2);
}

.batch-btn-primary:hover {
    background: rgba(201, 168, 76, 0.25);
}

/* Dream List */
.manage-list-area {
    padding: 1.25rem 0;
}

.dream-list {
    display: flex;
    flex-direction: column;
    gap: 1.125rem;
}

/* Dream Card — Double-Bezel */
.dream-card {
    opacity: 0;
    transform: translateY(24px);
    filter: blur(4px);
    transition: opacity 0.6s var(--spring), transform 0.6s var(--spring), filter 0.6s var(--spring);
    transition-delay: calc(var(--reveal-index, 0) * 50ms);
}

.dream-card.is-visible {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
}

.dream-card-shell {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding: 12px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-xl);
    transition: all 0.3s var(--spring);
}

.dream-card-shell:hover {
    border-color: var(--glass-highlight);
    background: rgba(255, 255, 255, 0.035);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
}

.dream-card--expanded .dream-card-shell {
    border-color: var(--accent-glow);
}

.dream-card--expanded .dream-card-preview {
    display: none;
}

.dream-card-select {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    flex-shrink: 0;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s var(--spring);
    align-self: stretch;
}

.dream-card:hover .dream-card-select {
    opacity: 1;
    pointer-events: auto;
}

.dream-card.is-checked .dream-card-select {
    opacity: 1;
    pointer-events: auto;
}

/* Selection mode: all checkboxes visible */
.dream-list.selection-mode .dream-card-select {
    opacity: 1;
    pointer-events: auto;
}

@media (hover: none), (pointer: coarse) {
    .dream-card-select {
        opacity: 1;
        pointer-events: auto;
    }
}

.dream-card-checkbox {
    display: none;
}

.dream-card-select .custom-check {
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--glass-border);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--spring);
    background: var(--black);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.dream-card:hover .dream-card-select .custom-check {
    border-color: var(--text-dim);
}

.dream-card-select .custom-check:hover {
    border-color: var(--accent-gold);
    transform: scale(1.1);
}

.dream-card-checkbox:checked + .custom-check {
    background: var(--accent-gold);
    border-color: var(--accent-gold);
}

.dream-card-checkbox:checked + .custom-check::after {
    content: '';
    width: 5px;
    height: 10px;
    border: solid var(--black);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

.dream-card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.dream-card-core {
    flex: 1;
    min-width: 0;
    padding: 0.9rem;
    cursor: pointer;
    border-radius: var(--radius-lg);
    transition: background 0.2s var(--spring);
}

.dream-card-core:hover {
    background: rgba(255, 255, 255, 0.015);
}

.dream-card-core:focus-visible {
    outline: 2px solid var(--accent-gold);
    outline-offset: 2px;
}

.dream-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.dream-card-title {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.dream-card-actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-shrink: 0;
}

.dream-card-actions .icon-button {
    width: 28px;
    height: 28px;
    color: var(--text-dim);
    transition: all 0.2s var(--spring);
}

.dream-card-actions .icon-button:hover {
    color: var(--text-primary);
    background: var(--glass-bg);
}

.dream-card-actions .bookmark-toggle[data-bookmarked="true"] {
    color: var(--accent-gold);
}

.dream-card-actions .card-delete-btn:hover {
    color: #ef4444;
}

.dream-card-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.dream-card-date {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-dim);
}

.dream-card-state {
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-pill);
    letter-spacing: 0.03em;
}

.state-answered {
    background: rgba(16, 185, 129, 0.1);
    color: var(--accent-emerald);
    border: 1px solid rgba(16, 185, 129, 0.15);
}

.state-amber {
    background: rgba(251, 191, 36, 0.1);
    color: var(--accent-amber);
    border: 1px solid rgba(251, 191, 36, 0.15);
}

.state-dim {
    background: var(--glass-bg);
    color: var(--text-dim);
    border: 1px solid var(--glass-border);
}

.dream-card-preview {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Expanded content */
.dream-card-expanded {
    padding: 0.25rem 1rem 1rem;
    animation: expandIn 0.35s var(--expo);
}

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

.dream-card-answer {
    padding-top: 1rem;
    border-top: 1px solid var(--glass-border);
    font-family: 'Satoshi', sans-serif;
    font-size: 0.85rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-weight: 400;
}

.dream-card-answer h1,
.dream-card-answer h2,
.dream-card-answer h3 {
    font-family: 'Noto Serif SC', serif;
    color: var(--accent-gold);
    margin: 1rem 0 0.35rem;
    font-weight: 500;
    line-height: 1.4;
}

.dream-card-answer h1 { font-size: 1rem; }
.dream-card-answer h2 { font-size: 0.92rem; }
.dream-card-answer h3 { font-size: 0.87rem; }

.dream-card-answer p {
    margin-bottom: 0.6rem;
}

.dream-card-answer ul,
.dream-card-answer ol {
    padding-left: 1.25rem;
    margin-bottom: 0.6rem;
}

.dream-card-answer li {
    margin-bottom: 0.15rem;
}

.dream-card-answer strong {
    color: var(--text-primary);
    font-weight: 600;
}

.dream-card-answer em {
    color: var(--accent-gold);
    font-style: italic;
}

.dream-card-answer code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78em;
    padding: 0.1em 0.3em;
    background: var(--glass-bg);
    border-radius: 3px;
    color: var(--accent-gold);
}

.dream-card-answer blockquote {
    border-left: 2px solid var(--accent-gold);
    padding: 0.4rem 0.75rem;
    margin: 0.6rem 0;
    color: var(--text-secondary);
    font-style: italic;
    border-radius: var(--radius-sm);
    background: rgba(201, 168, 76, 0.04);
}

/* Override .serif-body in card context — card needs compact typography */
.dream-card-answer.serif-body {
    font-size: 0.85rem;
    line-height: 1.8;
    font-weight: 400;
    font-family: 'Satoshi', sans-serif;
}

.dream-card-answer.serif-body h1,
.dream-card-answer.serif-body h2,
.dream-card-answer.serif-body h3,
.dream-card-answer.serif-body h4,
.dream-card-answer.serif-body h5 {
    margin: 1rem 0 0.35rem;
    line-height: 1.4;
    font-size: 1rem;
}

.dream-card-answer.serif-body p {
    margin-bottom: 0.6rem;
}

.dream-card-answer.serif-body ul,
.dream-card-answer.serif-body ol {
    margin-bottom: 0.6rem;
    padding-left: 1.25rem;
}

.dream-card-answer.serif-body li {
    margin-bottom: 0.25rem;
}

.dream-card-answer.serif-body blockquote {
    padding: 0.4rem 0.75rem;
    margin: 0.6rem 0;
    border-radius: var(--radius-sm);
    background: rgba(201, 168, 76, 0.04);
    font-style: italic;
}

/* Empty State */
.list-empty {
    text-align: center;
    padding: 5rem 2rem;
}

.list-empty-icon {
    font-size: 3.5rem;
    margin-bottom: 1.25rem;
    opacity: 0.4;
    filter: grayscale(0.3);
}

.list-empty-text {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 1.25rem;
    letter-spacing: 0.02em;
}

.list-empty-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--accent-gold);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.55rem 1.25rem;
    border: 1px solid var(--accent-glow);
    border-radius: var(--radius-pill);
    transition: all 0.25s var(--spring);
}

.list-empty-link:hover {
    background: var(--accent-glow);
    border-color: rgba(201, 168, 76, 0.3);
}

/* Sentinel */
.list-sentinel {
    height: 1px;
}

/* ── Light Mode Overrides ── */
[data-theme="light"] .manage-header {
    background: rgba(253, 251, 247, 0.85);
    border-bottom-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .manage-toolbar {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .manage-search,
[data-theme="light"] .toolbar-select {
    background: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .manage-search:focus,
[data-theme="light"] .toolbar-select:focus {
    border-color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(184, 128, 106, 0.1);
}

[data-theme="light"] .cal-day--selected {
    background: rgba(184, 128, 106, 0.12) !important;
}

[data-theme="light"] .batch-bar {
    background: transparent;
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .batch-btn-ghost {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .batch-btn-danger {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.15);
}

[data-theme="light"] .batch-btn-primary {
    background: rgba(184, 128, 106, 0.1);
    border-color: rgba(184, 128, 106, 0.2);
}

[data-theme="light"] .dream-card-shell {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .dream-card-shell:hover {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.12);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
}

[data-theme="light"] .dream-card--expanded .dream-card-shell {
    border-color: rgba(184, 128, 106, 0.2);
}

[data-theme="light"] .dream-card-core:hover {
    background: rgba(0, 0, 0, 0.015);
}

[data-theme="light"] .dream-card-select .custom-check {
    background: #fff;
    border-color: rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .dream-card:hover .dream-card-select .custom-check {
    border-color: rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .dream-card-actions .icon-button {
    color: var(--text-dim);
}

[data-theme="light"] .dream-card-actions .icon-button:hover {
    color: var(--text-primary);
    background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .dream-card-actions .bookmark-toggle[data-bookmarked="true"] {
    color: var(--accent-gold);
}

[data-theme="light"] .date-filter-tag {
    background: rgba(184, 128, 106, 0.1);
    border-color: rgba(184, 128, 106, 0.2);
    color: var(--accent-gold);
}

[data-theme="light"] .manage-stats {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .stat-item + .stat-item::before {
    background: rgba(0, 0, 0, 0.08);
}

[data-theme="light"] .stat-value {
    color: var(--accent-gold);
}

[data-theme="light"] .quick-filter:hover {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .quick-filter.active {
    background: rgba(184, 128, 106, 0.1);
    color: var(--accent-gold);
}

[data-theme="light"] .bookmark-filter-btn.active {
    color: var(--accent-gold);
    background: rgba(184, 128, 106, 0.1);
}

[data-theme="light"] .list-empty-link {
    border-color: rgba(184, 128, 106, 0.2);
}

[data-theme="light"] .list-empty-link:hover {
    background: rgba(184, 128, 106, 0.08);
    border-color: rgba(184, 128, 106, 0.3);
}

/* ── Mobile Responsive ── */
@media (max-width: 860px) {
    .manage-body {
        grid-template-columns: 1fr;
        padding: 1.25rem 4vw;
        gap: 1.5rem;
    }

    .manage-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 1.25rem;
    }

    .manage-calendar {
        flex: 1 1 100%;
        padding: 1rem;
    }

    .manage-stats {
        flex: 1 1 100%;
    }

    .manage-quick-filters {
        flex: 1 1 100%;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.4rem;
        padding: 0.6rem;
    }

    .quick-filter {
        flex: 1;
        text-align: center;
        font-size: 0.75rem;
        padding: 0.55rem;
        border-radius: var(--radius-sm) !important;
    }

    .manage-header {
        padding: 0.65rem 4vw;
    }

    .manage-title {
        font-size: 0.95rem;
    }

    .cal-day {
        font-size: 0.72rem;
    }

    .cal-day--has-dream::after {
        width: 3px;
        height: 3px;
        bottom: 2px;
    }

    .manage-toolbar {
        margin: 0;
        padding: 1rem;
    }

    .toolbar-row-main {
        flex-wrap: wrap;
    }

    .toolbar-search-wrap {
        width: 100%;
        flex: none;
    }

    .batch-bar {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.75rem 4vw;
        top: 48px;
    }

    .batch-actions {
        flex-wrap: wrap;
        justify-content: center;
    }

    .manage-list-area {
        padding: 1.25rem 0;
    }

    .dream-card-title {
        font-size: 0.82rem;
    }

    .dream-card-expanded {
        padding: 0.25rem 0.75rem 0.75rem;
    }

    .dream-card-shell {
        padding: 9px;
    }

    .dream-card-select {
        width: 28px;
    }
}
