/* ==========================================================================
   PREMIUM DARK AURORA — ROOT VARIABLES
   ========================================================================== */
* {
    box-sizing: border-box;
}

:root {
    --bg: #041018;
    --bg-card: rgba(7, 20, 31, 0.8);
    --glass-border: rgba(148, 163, 184, 0.24);
    --text: #f8fafc;
    --text-muted: #dbe6f2;
    --text-dim: #a8b9cb;
    --accent: #4df4d5;
    --accent-strong: #d3fff6;
    --accent-border: rgba(77, 244, 213, 0.42);
    --accent-surface: rgba(77, 244, 213, 0.16);
    --accent-surface-hover: rgba(77, 244, 213, 0.24);
    --accent-shadow: rgba(77, 244, 213, 0.18);
    --focus-ring: #8af7e2;
    --focus-ring-shadow: rgba(77, 244, 213, 0.28);
    --status-success: #baf6cf;
    --status-error: #ffc3c3;
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-pill: 9999px;
    --shadow-card: 0 18px 45px rgba(0, 0, 0, 0.34), 0 3px 10px rgba(0, 0, 0, 0.18);
    --blur-glass: blur(24px);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html[data-theme="light"] {
    --bg: #f3f6fb;
    --bg-card: rgba(255, 255, 255, 0.9);
    --glass-border: rgba(15, 23, 42, 0.16);
    --text: #0f172a;
    --text-muted: #334155;
    --text-dim: #475569;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --accent-border: rgba(15, 118, 110, 0.28);
    --accent-surface: rgba(15, 118, 110, 0.1);
    --accent-surface-hover: rgba(15, 118, 110, 0.16);
    --accent-shadow: rgba(15, 118, 110, 0.14);
    --focus-ring: #0f766e;
    --focus-ring-shadow: rgba(15, 118, 110, 0.18);
    --status-success: #166534;
    --status-error: #b91c1c;
    --shadow-card: 0 18px 48px rgba(15, 23, 42, 0.12), 0 2px 10px rgba(15, 23, 42, 0.06);
}

/* ==========================================================================
   RESET & GLOBAL STYLES
   ========================================================================== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

[hidden] {
    display: none !important;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    line-height: 1.6;
    cursor: default;
    display: flex;
    height: 100vh;
    overflow: hidden;
    margin: 0;
    position: relative;
}

body.home-page {
    display: block;
    min-height: 100vh;
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
}

body.editor-page {
    overflow: hidden;
}

html[data-theme="light"] body {
    background: var(--bg);
}

body.custom-cursor-enabled,
body.custom-cursor-enabled * {
    cursor: none !important;
}

button,
a[href],
label[for],
select,
summary,
[role="button"] {
    cursor: pointer;
}

input[type="text"],
input[type="search"],
input[type="email"],
input[type="url"],
input[type="password"],
textarea,
[contenteditable="true"] {
    cursor: text;
}

:where(a[href], button, input, select, textarea, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px var(--focus-ring-shadow);
}

/* ==========================================================================
   AURORA BACKGROUND LAYER
   ========================================================================== */
.aurora-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

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

.aurora-orb.orb-1 {
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(210, 210, 230, 0.08) 50%, transparent 70%);
    top: -250px;
    left: -200px;
    animation: orbDrift1 22s ease-in-out infinite alternate;
}

.aurora-orb.orb-2 {
    width: 650px;
    height: 650px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(180, 190, 210, 0.07) 50%, transparent 70%);
    top: 15%;
    right: -150px;
    animation: orbDrift2 28s ease-in-out infinite alternate;
}

.aurora-orb.orb-3 {
    width: 560px;
    height: 560px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.18) 0%, rgba(200, 220, 210, 0.06) 50%, transparent 70%);
    bottom: -120px;
    left: 25%;
    animation: orbDrift3 34s ease-in-out infinite alternate;
}

@keyframes orbDrift1 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(90px, 70px) scale(1.12); }
}

@keyframes orbDrift2 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(-70px, 90px) scale(1.07); }
}

@keyframes orbDrift3 {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(50px, -60px) scale(1.09); }
}

/* ==========================================================================
   CUSTOM MAGNETIC CURSOR
   ========================================================================== */
#cursor-reticle {
    position: fixed;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    will-change: transform;
    transition: opacity 0.12s ease;
}

#cursor-reticle::before {
    content: '';
    position: absolute;
    width: 5px;
    height: 5px;
    background: #ffffff;
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 8px rgba(255, 255, 255, 0.9);
}

#cursor-reticle::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    border: 1.5px solid rgba(255, 255, 255, 0.85);
    border-radius: 50%;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s;
}

.cursor-grabbing #cursor-reticle::after {
    width: 14px;
    height: 14px;
    border-color: var(--accent);
}

html[data-theme="light"] #cursor-reticle::before {
    background: #0f172a;
    box-shadow: 0 0 8px rgba(15, 23, 42, 0.25);
}

html[data-theme="light"] #cursor-reticle::after {
    border-color: rgba(15, 23, 42, 0.5);
}

.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    height: 42px;
    padding: 0 16px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: rgba(4, 16, 24, 0.74);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    letter-spacing: 0.01em;
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.home-link-btn {
    position: fixed;
    bottom: 24px;
    left: 20px;
    z-index: 60;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 16px;
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    box-shadow: var(--shadow-card);
    transition: var(--transition);
}

.home-link-btn:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.08);
}

.home-link-icon {
    font-size: 1rem;
    line-height: 1;
}

html[data-theme="light"] .home-link-btn {
    background: rgba(255, 255, 255, 0.82);
}

.theme-toggle:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.08);
}

html[data-theme="light"] .theme-toggle {
    background: rgba(255, 255, 255, 0.82);
}

.theme-toggle-icon {
    font-size: 1rem;
    line-height: 1;
}

.theme-toggle-label {
    line-height: 1;
}

.theme-toggle-state {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    background: var(--accent-surface);
    border: 1px solid var(--accent-border);
    color: var(--accent-strong);
    font-size: 0.75rem;
    line-height: 1;
}

html[data-theme="light"] .aurora-orb.orb-1 {
    background: radial-gradient(circle, rgba(41, 182, 246, 0.18) 0%, rgba(129, 140, 248, 0.12) 48%, transparent 72%);
}

html[data-theme="light"] .aurora-orb.orb-2 {
    background: radial-gradient(circle, rgba(16, 185, 129, 0.16) 0%, rgba(56, 189, 248, 0.1) 48%, transparent 72%);
}

html[data-theme="light"] .aurora-orb.orb-3 {
    background: radial-gradient(circle, rgba(244, 114, 182, 0.14) 0%, rgba(96, 165, 250, 0.1) 50%, transparent 74%);
}

/* ==========================================================================
   APP SIDEBAR
   ========================================================================== */
.app-sidebar {
    width: 320px;
    height: 100vh;
    background: rgba(5, 5, 5, 0.8);
    border-right: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.editor-shell {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    position: relative;
    z-index: 4;
}

.editor-main {
    flex: 1;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ==========================================================================
   EDITOR WRAPPER
   ========================================================================== */
.editor-wrapper {
    flex: 1;
    height: auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 4rem;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.editor-page textarea,
.editor-page input[type="text"],
.editor-page input[type="search"],
.editor-page input[type="email"],
.editor-page input[type="url"],
.editor-page input[type="password"],
.editor-page [contenteditable="true"],
body.show-native-text-cursor,
body.show-native-text-cursor * {
    cursor: text !important;
}

/* ==========================================================================
   DOCUMENT CANVAS
   ========================================================================== */
.document-canvas {
    background: rgba(0, 0, 0, 0.3);
    padding: 3rem 4rem;
    border-radius: 12px;
    max-width: 900px;
    width: 100%;
    min-width: 0;
    margin: 0 auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    overflow: hidden;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.editor-topbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.45);
    border-bottom: 1px solid var(--glass-border);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.toolbar-group:last-child {
    border-right: none;
    padding-right: 0;
}

.toolbar-group-grow {
    margin-left: auto;
}

.toolbar-btn,
.toolbar-select {
    height: 36px;
    padding: 0 12px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font: inherit;
    transition: var(--transition);
}

.toolbar-btn:hover,
.toolbar-select:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
}

.toolbar-btn.active {
    border-color: var(--accent-border);
    color: var(--accent);
}

.toolbar-select-shell {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.toolbar-select-shell::after {
    content: "";
    position: absolute;
    right: 12px;
    width: 12px;
    height: 12px;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23f8fafc' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.7' d='M2 4.25 6 8l4-3.75'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 12px 12px;
}

html[data-theme="light"] .toolbar-select-shell::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%23475569' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.7' d='M2 4.25 6 8l4-3.75'/%3E%3C/svg%3E");
}

.toolbar-select {
    min-width: 110px;
    appearance: none;
    -webkit-appearance: none;
    padding-right: 2.4rem;
    background: rgba(12, 12, 12, 0.96);
    color: var(--text);
    color-scheme: dark;
    background-image: none;
}

.toolbar-select option {
    background: #101010;
    color: var(--text);
}

.toolbar-color {
    width: 38px;
    height: 38px;
    padding: 0;
    border: none;
    background: transparent;
}

.toolbar-swatch {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    padding: 0;
}

.toolbar-swatch[data-highlight-color="#fff3a3"] {
    background: #fff3a3;
}

.toolbar-swatch[data-highlight-color="#b8f2c9"] {
    background: #b8f2c9;
}

.toolbar-swatch[data-highlight-color="#ffbfd8"] {
    background: #ffbfd8;
}

.toolbar-size-control {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 10px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
}

.toolbar-size-input {
    width: 52px;
    border: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    outline: none;
    text-align: center;
}

.toolbar-size-unit {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ==========================================================================
   CANVAS TEXTAREA
   ========================================================================== */
.canvas-textarea {
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    width: 100%;
    resize: none;
    overflow: hidden;
    min-height: 40px;
    color: var(--text);
    font-size: 1.1rem;
    line-height: 1.6;
    padding: 0;
    margin-bottom: 2rem;
}

.canvas-editor {
    min-height: 40px;
    color: var(--text);
    font-size: 1.08rem;
    line-height: 1.7;
    outline: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

.canvas-editor:empty::before {
    content: attr(data-placeholder);
    color: var(--text-dim);
    font-style: italic;
}

.note-section-body {
    margin-left: 0.35rem;
    padding-left: 1.35rem;
    border-left: 1px solid rgba(255, 255, 255, 0.12);
}

html[data-theme="light"] .note-section-body {
    border-left-color: rgba(15, 23, 42, 0.12);
}

.canvas-editor p,
.canvas-editor ul,
.canvas-editor ol,
.canvas-editor pre,
.canvas-editor blockquote,
.canvas-editor hr,
 .canvas-editor h2,
 .canvas-editor h3,
 .canvas-editor h4,
 .canvas-editor h5,
 .canvas-editor h6 {
    margin: 0 0 1rem;
}

.canvas-editor hr {
    border: 0;
    border-top: 1px solid rgba(148, 163, 184, 0.45);
}

.canvas-editor h2,
.canvas-editor h3,
.canvas-editor h4,
.canvas-editor h5,
.canvas-editor h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--text);
}

.canvas-editor h2 {
    font-size: 1.45rem;
    margin-top: 0.35rem;
}

.canvas-editor h3 {
    font-size: 1.25rem;
}

.canvas-editor h4 {
    font-size: 1.12rem;
}

.canvas-editor h5,
.canvas-editor h6 {
    font-size: 1rem;
    color: var(--text-muted);
}

.canvas-editor ul,
.canvas-editor ol {
    padding-left: 1.5rem;
}

.canvas-editor strong {
    font-weight: 700;
}

.canvas-editor em {
    font-style: italic;
}

.canvas-editor mark {
    padding: 0.04em 0.2em;
    border-radius: 0.25em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.canvas-editor span[style*="background-color"] {
    padding: 0.04em 0.2em;
    border-radius: 0.25em;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

.canvas-editor mark.user-highlight,
.canvas-editor mark.ai-highlight,
.canvas-editor span[style*="background-color"] {
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.formula-inline {
    display: inline-block;
    padding: 0.05rem 0.4rem;
    margin: 0 0.1rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    font-family: "Times New Roman", serif;
}

.formula-block {
    margin: 1rem 0;
    padding: 1rem 1.2rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-family: "Times New Roman", serif;
    overflow-x: auto;
}

.formula-inline .katex,
.formula-block .katex {
    font-size: 1em;
}

.formula-block .katex-display {
    margin: 0;
}

html[data-theme="light"] .formula-inline {
    background: rgba(15, 23, 42, 0.05);
    border-color: rgba(15, 23, 42, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92), 0 1px 4px rgba(15, 23, 42, 0.05);
    color: var(--text);
}

html[data-theme="light"] .formula-block {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.94));
    border-color: rgba(15, 23, 42, 0.16);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.95), 0 10px 26px rgba(15, 23, 42, 0.08);
    color: var(--text);
}

html[data-theme="light"] .formula-inline .katex,
html[data-theme="light"] .formula-block .katex {
    color: var(--text);
}

/* ==========================================================================
   SIDEBAR TABS
   ========================================================================== */
.sidebar-tabs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 1rem 0;
    gap: 6px;
}

.tab-btn {
    flex: 1;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 600;
    transition: var(--transition);
}

.tab-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

/* ==========================================================================
   SIDEBAR PANEL
   ========================================================================== */
.sidebar-panel {
    flex: 1;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    padding: 1.5rem;
}

html[data-theme="light"] .app-sidebar,
html[data-theme="light"] .editor-topbar,
html[data-theme="light"] .document-canvas,
html[data-theme="light"] .sidebar-panel,
html[data-theme="light"] .console-block,
html[data-theme="light"] .account-panel,
html[data-theme="light"] .account-card,
html[data-theme="light"] .persona-selector-card,
html[data-theme="light"] #suggestions-box,
html[data-theme="light"] #active-note-box,
html[data-theme="light"] .report-row,
html[data-theme="light"] .suggestion-btn,
html[data-theme="light"] .source-item,
html[data-theme="light"] .outline-item,
html[data-theme="light"] .modal-card,
html[data-theme="light"] .glass-input,
html[data-theme="light"] .glass-textarea,
html[data-theme="light"] .custom-input-row input,
html[data-theme="light"] .source-item textarea,
html[data-theme="light"] .account-tab-btn,
html[data-theme="light"] .toolbar-btn,
html[data-theme="light"] .toolbar-select,
html[data-theme="light"] .toolbar-size-control {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(15, 23, 42, 0.12);
    color: var(--text);
}

html[data-theme="light"] .toolbar-select option {
    background: #ffffff;
    color: var(--text);
}

html[data-theme="light"] .cmd-btn.secondary,
html[data-theme="light"] .custom-input-row,
html[data-theme="light"] .tab-btn:hover {
    background: rgba(15, 23, 42, 0.04);
}

/* ==========================================================================
   TERMINAL CONTAINER & CONSOLE BLOCKS
   ========================================================================== */
.skip-link {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 90;
    padding: 10px 14px;
    border-radius: 999px;
    background: var(--accent);
    color: #041018;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-140%);
    transition: transform 0.2s ease;
}

.skip-link:focus-visible {
    transform: translateY(0);
}

.home-header,
.home-main {
    position: relative;
    z-index: 4;
}

.home-header {
    max-width: 1180px;
    margin: 0 auto;
    padding: 40px 24px 0;
}

.home-header-bar {
    display: block;
    text-align: center;
}

.home-brand-lockup {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}

.terminal-container {
    position: relative;
    z-index: 4;
    max-width: 980px;
    margin: 0 auto;
    padding: 120px 24px 80px;
}

.home-page .terminal-container {
    display: flex;
    flex-direction: column;
    gap: 28px;
    min-height: auto;
    padding-top: 32px;
    padding-bottom: 36px;
}

.home-hero {
    text-align: center;
    padding-top: 8px;
}

.home-hero-kicker {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.home-hero-title {
    margin: 0;
    font-size: clamp(2.8rem, 8vw, 5.2rem);
    line-height: 0.95;
    letter-spacing: -0.04em;
}

.home-hero-slogan {
    max-width: 620px;
    margin: 16px auto 0;
    color: var(--text-muted);
    font-size: 1.03rem;
    line-height: 1.7;
}

.panel-kicker {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.section-copy {
    margin: 10px 0 0;
    color: var(--text-muted);
    max-width: 62ch;
}

.auth-session-shell {
    position: relative;
    z-index: 4;
    max-width: 1180px;
    margin: 24px auto 0;
    padding: 0 24px;
}

.auth-session-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    padding: 22px 24px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at top left, rgba(77, 244, 213, 0.1), transparent 38%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    box-shadow: var(--shadow-card);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
}

.auth-session-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.auth-session-chip {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: var(--radius-pill);
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.auth-session-chip[data-mode="cloud"] {
    background: var(--accent-surface);
    border-color: var(--accent-border);
    color: var(--accent-strong);
}

.auth-session-chip[data-mode="guest"] {
    background: rgba(245, 158, 11, 0.14);
    border-color: rgba(245, 158, 11, 0.28);
    color: #facc15;
}

.auth-session-chip[data-mode="local"],
.auth-session-chip[data-mode="loading"] {
    background: rgba(148, 163, 184, 0.12);
    border-color: rgba(148, 163, 184, 0.24);
    color: var(--text-muted);
}

.account-shell {
    position: relative;
    z-index: 4;
    max-width: 1080px;
    margin: 0 auto;
    padding: 110px 24px 80px;
}

.account-panel {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-card);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
}

.account-summary-row {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin-top: 20px;
}

.account-tabs {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 28px;
}

.account-tab-btn {
    height: 42px;
    padding: 0 18px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    transition: var(--transition);
}

.account-tab-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.account-tab-btn.is-active {
    background: var(--accent-surface);
    border-color: var(--accent-border);
    color: var(--accent-strong);
}

.account-panels {
    margin-top: 22px;
}

.account-card {
    padding: 24px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.account-card + .account-card {
    margin-top: 18px;
}

.account-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

.account-form {
    display: grid;
    gap: 12px;
}

.account-setting-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.account-setting-title {
    margin: 0;
    font-size: 1rem;
}

.account-theme-toggle {
    min-width: 170px;
    justify-content: center;
}

.account-status-copy {
    min-height: 24px;
    margin-top: 14px;
}

.account-status-copy[data-tone="success"] {
    color: var(--status-success);
}

.account-status-copy[data-tone="error"] {
    color: var(--status-error);
}

.saved-notes-shell {
    position: relative;
    z-index: 4;
    max-width: 1180px;
    margin: 0 auto 80px;
    padding: 0 24px 40px;
}

.saved-notes-panel {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-card);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
}

.saved-notes-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.saved-notes-kicker {
    color: var(--accent);
    font-size: 0.8rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    margin-bottom: 6px;
}

.saved-notes-title {
    margin: 0;
    font-size: 1.5rem;
}

.saved-notes-copy {
    margin-top: 10px;
}

.saved-notes-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 18px;
}

.saved-note-card {
    padding: 20px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    transition: var(--transition);
}

.saved-note-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent-border);
}

html[data-theme="light"] .saved-note-card {
    background: rgba(255, 255, 255, 0.92);
    border-color: rgba(15, 23, 42, 0.12);
}

.saved-note-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.saved-note-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.saved-note-chip {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.saved-note-chip.is-pinned {
    background: var(--accent-surface);
    border-color: var(--accent-border);
    color: var(--accent-strong);
}

.saved-note-utility-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.note-icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 999px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    transition: var(--transition);
}

.note-icon-btn svg {
    width: 18px;
    height: 18px;
}

.note-icon-btn:hover,
.note-icon-btn.is-pinned {
    background: var(--accent-surface);
    border-color: var(--accent-border);
    color: var(--accent-strong);
}

.note-icon-btn-danger:hover {
    background: rgba(255, 107, 107, 0.16);
    border-color: rgba(255, 107, 107, 0.32);
    color: #ffb1b1;
}

.saved-note-card-title {
    margin: 0 0 8px;
    font-size: 1.12rem;
    color: var(--text);
}

.saved-note-details {
    display: grid;
    gap: 14px;
}

.saved-note-detail {
    display: grid;
    gap: 4px;
}

.saved-note-detail dt {
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.saved-note-detail dd {
    margin: 0;
    color: var(--text-muted);
}

.saved-note-card-preview {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.6;
}

.saved-note-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 18px;
}

.saved-note-open-btn {
    width: fit-content;
}

.cmd-btn.danger {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.3);
    color: #ff9d9d;
}

.cmd-btn.danger:hover {
    background: rgba(255, 107, 107, 0.2);
    border-color: rgba(255, 107, 107, 0.45);
}

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

.saved-notes-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 20px 0;
}

.saved-notes-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-height: 260px;
    padding: 28px;
    border-radius: var(--radius-md);
    border: 1px dashed var(--glass-border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    text-align: center;
}

.saved-notes-empty-title {
    margin: 0;
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
}

.empty-vault-illustration {
    width: min(180px, 100%);
    height: auto;
    color: var(--accent);
}

.review-note-actions {
    align-items: center;
}

.review-option-btn.is-selected {
    background: var(--accent-surface);
    border-color: var(--accent-border);
    color: var(--accent-strong);
    box-shadow: 0 8px 18px var(--accent-shadow);
}

.review-option-btn.is-selected:hover {
    background: var(--accent-surface-hover);
}

.review-note-status {
    margin: 12px 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
    line-height: 1.5;
}

html[data-theme="light"] .creation-hub {
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 28%),
        rgba(255, 255, 255, 0.92);
}

html[data-theme="light"] .workspace-shell,
html[data-theme="light"] .saved-notes-empty-state {
    background: rgba(255, 255, 255, 0.88);
    border-color: rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .saved-note-chip,
html[data-theme="light"] .note-icon-btn {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.1);
}

.review-note-status.is-loading {
    color: var(--accent-strong);
}

.review-note-status.is-success {
    color: var(--status-success);
}

.review-note-status.is-error {
    color: var(--status-error);
}

.review-output-modal-card {
    width: min(880px, 100%);
    max-height: min(82vh, 920px);
    display: flex;
    flex-direction: column;
}

.review-output-shell {
    min-height: 0;
    overflow: auto;
}

.review-output-state {
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.review-loading-pill,
.review-error-copy {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.review-error-copy {
    border-radius: 14px;
    align-items: flex-start;
    padding: 12px 14px;
    color: var(--status-error);
    background: rgba(255, 107, 107, 0.08);
    border-color: rgba(255, 107, 107, 0.18);
}

.review-result-section + .review-result-section {
    margin-top: 18px;
}

.review-result-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.review-result-head h4,
.review-result-section h4 {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.review-result-copy {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.7;
    white-space: pre-wrap;
}

.review-podcast-audio {
    width: 100%;
    margin-bottom: 14px;
    border-radius: 999px;
    filter: saturate(0.96);
}

.review-flashcard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.review-flashcard {
    display: block;
    width: 100%;
    position: relative;
    min-height: 220px;
    padding: 0;
    border-radius: 14px;
    border: none;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    perspective: 1200px;
    text-align: left;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.review-flashcard:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 26px rgba(0, 0, 0, 0.16);
}

.review-flashcard:focus-visible {
    outline: 2px solid rgba(0, 255, 204, 0.55);
    outline-offset: 3px;
}

.review-flashcard-inner {
    position: relative;
    display: block;
    width: 100%;
    min-height: 220px;
    border-radius: inherit;
    transform-style: preserve-3d;
    transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.review-flashcard.is-flipped .review-flashcard-inner {
    transform: rotateY(180deg);
}

.review-flashcard-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    border-radius: inherit;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.12);
    overflow: hidden;
}

.review-flashcard-front {
    justify-content: space-between;
}

.review-flashcard-back {
    transform: rotateY(180deg);
    justify-content: space-between;
}

.review-flashcard-label {
    margin: 0;
    color: var(--accent);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.review-flashcard-copy {
    margin: 0;
    color: var(--text);
    line-height: 1.6;
    white-space: normal;
}

.review-flashcard-hint {
    color: var(--text-dim);
    font-size: 0.8rem;
    line-height: 1.5;
}

.review-fact-list {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--text-muted);
}

.review-fact-list li + li {
    margin-top: 8px;
}

html[data-theme="light"] .review-output-state,
html[data-theme="light"] .review-flashcard-face {
    background: rgba(255, 255, 255, 0.82);
    border-color: rgba(15, 23, 42, 0.12);
}

.console-block {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 32px;
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
    box-shadow: var(--shadow-card);
}

.creation-hub {
    background:
        radial-gradient(circle at top right, rgba(77, 244, 213, 0.12), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    border-color: var(--accent-border);
}

.creation-hub-header {
    margin-bottom: 28px;
}

.creation-flow {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.field-group {
    display: grid;
    gap: 8px;
}

.field-label {
    color: var(--text);
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.field-help {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.custom-persona-field {
    margin-top: 12px;
}

.creation-actions {
    display: flex;
    justify-content: flex-start;
}

/* ==========================================================================
   SETUP VIEW (View A)
   ========================================================================== */
#setup-view {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: stretch;
}

.persona-selector-card {
    padding: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-md);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
}

.persona-selector-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.persona-selector-title {
    margin: 0 0 4px;
    font-size: 1rem;
    color: var(--text);
}

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

.persona-select-wrap {
    position: relative;
}

.persona-select {
    appearance: none;
    padding-right: 44px;
}

.persona-select-wrap::after {
    content: "▾";
    position: absolute;
    top: 50%;
    right: 16px;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
}

.persona-description {
    margin-top: 12px;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.persona-select-wrap::after {
    content: "\25BE";
}

.glass-textarea {
    width: 100%;
    min-height: 110px;
    padding: 14px 16px;
    margin-top: 12px;
    background: rgba(4, 16, 24, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: var(--transition);
}

.glass-textarea:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-shadow);
}

.glass-input {
    width: 100%;
    height: 48px;
    padding: 0 16px;
    background: rgba(4, 16, 24, 0.5);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    color: var(--text);
    font-size: 16px;
    outline: none;
    transition: var(--transition);
}

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

.glass-input:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 3px var(--accent-shadow);
}

.cmd-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 48px;
    padding: 0 32px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    text-decoration: none;
    font-family: inherit;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.02em;
    transition: var(--transition);
}

.cmd-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-1px);
}

.cmd-btn.secondary {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.08);
}

.cmd-btn.secondary:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
}

.cmd-btn:disabled,
.toolbar-btn:disabled,
.note-icon-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ==========================================================================
   WORKSPACE VIEW (View B)
   ========================================================================== */
.workspace-shell {
    margin-top: 28px;
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.12);
    padding: 28px;
}

.workspace-header {
    margin-bottom: 20px;
}

.workspace-copy {
    max-width: 60ch;
}

.workspace-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.workspace-column {
    display: grid;
    gap: 12px;
}

.workspace-column-title {
    margin: 0;
    font-size: 1rem;
    color: var(--text);
}

.workspace-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    justify-content: space-between;
}

.text-center {
    text-align: center;
}

#workspace-title {
    margin-bottom: 8px;
}

#workspace-view {
    overflow: visible;
}

#suggestions-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    min-height: 200px;
}

#loading-text {
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.workspace-empty {
    color: var(--text-muted);
    text-align: center;
    padding: 20px;
}

.workspace-empty.is-error {
    color: var(--status-error);
}

.suggestion-btn {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    justify-content: flex-start;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text);
    text-align: left;
    font-size: 14px;
    transition: var(--transition);
    cursor: grab !important;
}

.suggestion-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateX(4px);
}

.suggestion-btn:active {
    cursor: grabbing !important;
}

#active-note-box {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-md);
    min-height: 200px;
}

/* ==========================================================================
   REPORT ROW (Active Note Items)
   ========================================================================== */
.report-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: grab !important;
}

.report-row:hover {
    background: rgba(255, 255, 255, 0.06);
}

.report-row:active {
    cursor: grabbing !important;
}

.report-row input[type="number"] {
    width: 60px;
    height: 32px;
    padding: 0 8px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    text-align: center;
}

.report-row .roman-numeral {
    min-width: 40px;
    font-weight: 700;
    color: var(--text-muted);
    text-align: center;
}

.report-row .heading-text {
    flex: 1;
    color: var(--text);
    font-size: 15px;
}

.remove-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 50%;
    color: #ff6b6b;
    font-size: 14px;
    font-weight: 700;
    transition: var(--transition);
}

.remove-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.5);
    transform: scale(1.1);
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 768px) {
    .home-header {
        padding-top: 92px;
    }

    .home-header-bar {
        flex-direction: column;
    }

    .theme-toggle {
        top: 18px;
        right: 16px;
    }

    .workspace-layout {
        grid-template-columns: 1fr;
    }

    .terminal-container {
        padding: 60px 16px 40px;
    }

    .saved-notes-shell {
        padding: 0 16px 32px;
    }

    .saved-notes-panel,
    .console-block,
    .workspace-shell {
        padding: 22px;
    }

    .saved-notes-list {
        grid-template-columns: 1fr;
    }

    .editor-wrapper {
        padding: 1.5rem;
    }

    .document-canvas {
        padding: 2rem 1.25rem;
    }

    .editor-shell {
        flex-direction: column;
        height: auto;
    }

    .app-sidebar {
        width: 100%;
        height: auto;
    }

    .editor-topbar {
        padding: 1rem;
    }

    .toolbar-group {
        border-right: none;
        padding-right: 0;
        flex-wrap: wrap;
    }

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

    .editor-toolbar-actions {
        justify-content: space-between;
    }

    .note-section-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .home-link-btn {
        left: 16px;
        bottom: 16px;
    }
}

@media (max-width: 520px) {
    .theme-toggle {
        width: calc(100% - 32px);
        justify-content: center;
    }

    .workspace-actions,
    .saved-notes-head {
        flex-direction: column;
        align-items: stretch;
    }

    .saved-note-card-top {
        flex-direction: column;
    }
}

/* ==========================================================================
   DRAG AND DROP STYLES
   ========================================================================== */
.dragging {
    opacity: 0.4;
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--accent, #00ffcc);
}

.drag-over {
    border-top: 2px solid var(--accent, #00ffcc);
}

/* ==========================================================================
   AI BADGE
   ========================================================================== */
.ai-badge {
    color: var(--accent);
    font-weight: bold;
    background: var(--accent-surface);
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 8px;
    font-size: 0.75rem;
    letter-spacing: 1px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* ==========================================================================
   DROP INDICATORS (box-shadow instead of borders to prevent layout shift)
   ========================================================================== */
.drop-above {
    box-shadow: 0 -3px 5px -1px var(--accent, #00ffcc) !important;
    transition: box-shadow 0.1s ease;
}

.drop-below {
    box-shadow: 0 3px 5px -1px var(--accent, #00ffcc) !important;
    transition: box-shadow 0.1s ease;
}

/* ==========================================================================
   CUSTOM INPUT ROW (Glassmorphic command line style)
   ========================================================================== */
.custom-input-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 16px;
    padding: 12px;
    background: var(--accent-surface);
    border: 1px solid var(--accent-border);
    border-radius: var(--radius-sm);
}

.custom-input-row input {
    flex: 1;
    height: 36px;
    padding: 0 12px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 6px;
    color: var(--text);
    font-size: 14px;
    outline: none;
    transition: var(--transition);
}

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

.custom-input-row input:focus {
    border-color: var(--accent-border);
    box-shadow: 0 0 0 2px var(--accent-shadow);
}

.custom-input-row button {
    width: 36px;
    height: 36px;
    padding: 0;
    background: var(--accent-surface);
    border: 1px solid var(--accent-border);
    border-radius: 6px;
    color: var(--accent);
    font-size: 18px;
    font-weight: 700;
    transition: var(--transition);
}

.custom-input-row button:hover {
    background: var(--accent-surface-hover);
    border-color: var(--accent-border);
    transform: scale(1.05);
}

/* ==========================================================================
   EDITOR VIEW (View C)
   ========================================================================== */
#editor-view {
    padding: 32px;
}

#editor-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 32px;
}

#editor-content h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text);
    margin-top: 24px;
    margin-bottom: 12px;
}

.empty-content-area {
    min-height: 120px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-style: italic;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
}

.empty-content-area::before {
    content: attr(placeholder);
}

/* ==========================================================================
   WORKSPACE GRID LAYOUT FOR EDITOR
   ========================================================================== */
.workspace-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 2rem;
    height: calc(100vh - 100px);
    align-items: start;
}

/* ==========================================================================
   SIDEBAR PANEL
   ========================================================================== */
.sidebar-panel {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    height: 100%;
    flex: 1;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
}

.sidebar-panel h3 {
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* ==========================================================================
   TOGGLE SWITCH
   ========================================================================== */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 1.5rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.toggle-input {
    position: relative;
    width: 44px;
    height: 24px;
    appearance: none;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    outline: none;
    cursor: pointer;
    transition: var(--transition);
}

.toggle-input:checked {
    background: linear-gradient(45deg, #00ffcc, #00aaff);
}

.toggle-input::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    top: 50%;
    left: 2px;
    background: white;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    transform: translateY(-50%);
}

.toggle-input:checked::before {
    transform: translate(20px, -50%);
}

/* ==========================================================================
   SOURCE ITEMS
   ========================================================================== */
.source-panel-copy {
    margin: -0.2rem 0 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.6;
}

.source-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 1rem;
}

.source-item {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 14px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.025));
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    margin-bottom: 10px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.source-item-liveLecture {
    border-color: rgba(0, 255, 204, 0.2);
}

.source-item-website {
    border-color: rgba(96, 165, 250, 0.2);
}

.source-item-title-group {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: wrap;
}

.source-item-label {
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-dim);
}

.source-type-chip {
    display: inline-flex;
    align-items: center;
    height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.source-type-chip-text {
    background: rgba(255, 255, 255, 0.06);
}

.source-type-chip-file {
    background: rgba(255, 214, 102, 0.12);
    color: #ffe59a;
    border-color: rgba(255, 214, 102, 0.22);
}

.source-type-chip-liveLecture {
    background: var(--accent-surface);
    color: var(--accent-strong);
    border-color: var(--accent-border);
}

.source-type-chip-website {
    background: rgba(96, 165, 250, 0.12);
    color: #a8cfff;
    border-color: rgba(96, 165, 250, 0.22);
}

.source-card-copy {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

.source-helper-text {
    margin: 0;
    color: var(--text-dim);
    font-size: 0.78rem;
    line-height: 1.45;
}

.source-inline-form {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.source-inline-form .cmd-btn.small {
    flex-shrink: 0;
}

.source-mini-input,
.source-url-input {
    flex: 1 1 180px;
}

.source-file-input {
    width: 100%;
    padding: 12px;
    border: 1px dashed rgba(255, 255, 255, 0.16);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-muted);
    font-size: 0.83rem;
}

.source-status-pill,
.source-status-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    min-height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.78rem;
    line-height: 1.4;
}

.source-status-text {
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
}

.source-status-pill.is-live,
.source-status-text.is-live {
    background: var(--accent-surface);
    border-color: var(--accent-border);
    color: var(--accent-strong);
}

.source-status-pill.is-success,
.source-status-text.is-success {
    background: rgba(134, 239, 172, 0.12);
    border-color: rgba(134, 239, 172, 0.22);
    color: var(--status-success);
}

.source-status-pill.is-error,
.source-status-text.is-error {
    background: rgba(255, 107, 107, 0.12);
    border-color: rgba(255, 107, 107, 0.22);
    color: var(--status-error);
}

.source-status-pill.is-neutral,
.source-status-text.is-neutral {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

.source-recorder-shell {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(0, 255, 204, 0.08), rgba(0, 255, 204, 0.02));
    border: 1px solid rgba(0, 255, 204, 0.14);
}

.source-item textarea {
    width: 100%;
    min-height: 108px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.875rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: var(--transition);
}

.source-item textarea:focus {
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.1);
}

.source-item input[type="file"] {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.source-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
}

.source-remove-btn {
    width: 28px;
    height: 28px;
    padding: 0;
    background: rgba(255, 0, 0, 0.1);
    border: 1px solid rgba(255, 0, 0, 0.3);
    border-radius: 50%;
    color: #ff6b6b;
    font-size: 12px;
    font-weight: 700;
    transition: var(--transition);
}

.source-remove-btn:hover {
    background: rgba(255, 0, 0, 0.2);
    border-color: rgba(255, 0, 0, 0.5);
    transform: scale(1.1);
}

.cmd-btn.small {
    height: 36px;
    padding: 0 16px;
    font-size: 0.875rem;
}

@media (max-width: 420px) {
    .source-action-grid {
        grid-template-columns: 1fr;
    }

    .source-inline-form {
        flex-direction: column;
        align-items: stretch;
    }

    .source-inline-form .cmd-btn.small {
        width: 100%;
    }
}

@media (max-width: 720px) {
    .auth-choice-grid {
        grid-template-columns: 1fr;
    }

    .account-shell {
        padding-top: 96px;
    }

    .account-panel {
        padding: 24px;
    }

    .account-setting-row {
        align-items: flex-start;
    }

    .account-theme-toggle {
        width: 100%;
    }

    .auth-session-panel {
        padding: 20px;
    }

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

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    .aurora-orb,
    .aurora-lamp,
    .review-flashcard-inner {
        animation: none !important;
        transition: none !important;
    }

    .theme-toggle:hover,
    .cmd-btn:hover,
    .home-link-btn:hover,
    .suggestion-btn:hover,
    .saved-note-card:hover,
    .review-flashcard:hover,
    .source-remove-btn:hover,
    .remove-btn:hover {
        transform: none !important;
    }
}

/* ==========================================================================
   AI GENERATE BUTTONS
   ========================================================================== */
.ai-gen-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    margin-left: 12px;
    background: linear-gradient(45deg, #ff00cc, #3333ff);
    border: none;
    border-radius: 6px;
    color: white;
    font-size: 0.75rem;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 2px 8px rgba(255, 0, 204, 0.3);
}

#generate-all-btn,
.ai-gen-btn {
    color: #fff !important;
}

.ai-gen-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(255, 0, 204, 0.5);
}

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

.ai-gen-btn.loading {
    opacity: 0.6;
    pointer-events: none;
}

.editor-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
}

.editor-toolbar-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.note-section {
    margin-bottom: 2rem;
    overflow: hidden;
}

.note-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.note-section-title {
    color: var(--accent, #00ffcc);
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
}

#panel-outline {
    overflow-y: auto;
    flex: 1;
    max-height: calc(100vh - 150px);
}

.outline-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 1rem;
}

.outline-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.outline-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    border-radius: 10px;
}

.outline-item-copy {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    min-width: 0;
}

.outline-item-order {
    font-weight: 700;
    color: var(--text-muted);
}

.outline-item-text {
    color: var(--text);
    word-break: break-word;
}

.outline-item-actions {
    display: inline-flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    flex-shrink: 0;
}

.outline-rename-btn,
.outline-remove-btn {
    height: 30px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    font-size: 0.75rem;
}

.outline-rename-btn:hover {
    background: rgba(255, 255, 255, 0.12);
}

.outline-remove-btn {
    border: 1px solid rgba(255, 107, 107, 0.35);
    background: rgba(255, 107, 107, 0.12);
    color: #ff9d9d;
}

.outline-remove-btn:hover {
    background: rgba(255, 107, 107, 0.2);
}

.heading-suggestions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 1rem;
}

.heading-suggestion-btn {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
    text-align: left;
    font: inherit;
}

.heading-suggestion-btn:hover {
    background: rgba(255, 255, 255, 0.09);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 40;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.modal-backdrop.is-open {
    display: flex;
}

body.modal-open {
    overflow: hidden;
}

.modal-card {
    width: min(620px, 100%);
    padding: 24px;
    border-radius: 18px;
    background: rgba(6, 6, 6, 0.92);
    border: 1px solid var(--glass-border);
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

.auth-modal-card {
    width: min(620px, 100%);
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.auth-choice-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding: 16px;
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    text-align: left;
    font: inherit;
    transition: var(--transition);
}

.auth-choice-card:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.08);
}

.auth-choice-card.is-active {
    border-color: var(--accent-border);
    background:
        radial-gradient(circle at top left, rgba(77, 244, 213, 0.12), transparent 45%),
        rgba(255, 255, 255, 0.06);
    box-shadow: 0 12px 26px rgba(0, 0, 0, 0.18);
}

.auth-choice-card strong {
    font-size: 1rem;
}

.auth-choice-card span:last-child {
    color: var(--text-muted);
    line-height: 1.4;
}

.auth-choice-kicker {
    color: var(--accent);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.auth-cloud-panel {
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.auth-form {
    display: grid;
    gap: 12px;
}

.auth-status-copy {
    min-height: 24px;
}

.auth-status-copy[data-tone="success"] {
    color: var(--status-success);
}

.auth-status-copy[data-tone="error"] {
    color: var(--status-error);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 18px;
}

.modal-title {
    margin: 0;
    font-size: 1.15rem;
}

.modal-mode-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.selection-action-toolbar {
    position: fixed;
    z-index: 80;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(6, 6, 6, 0.9);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.32);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform: translateZ(0);
}

.selection-action-toolbar[hidden] {
    display: none !important;
}

.selection-action-btn {
    min-width: 80px;
}

.explain-modal-card {
    width: min(720px, 100%);
    max-height: min(78vh, 860px);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.explain-selection-preview-shell,
.explain-modal-state {
    padding: 16px 18px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
}

.explain-selection-label {
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.explain-selection-preview {
    margin: 0;
    padding-left: 14px;
    border-left: 3px solid var(--accent-border);
    color: var(--text);
    font-size: 0.98rem;
    line-height: 1.7;
    max-height: 130px;
    overflow: auto;
    white-space: pre-wrap;
}

.explain-modal-state {
    overflow: auto;
}

.explain-selection-result {
    margin-top: 12px;
    color: var(--text);
    line-height: 1.7;
}

.draw-selection-result {
    margin-top: 12px;
}

.draw-selection-figure {
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.draw-selection-image-shell {
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background:
        radial-gradient(circle at top, rgba(0, 255, 204, 0.08), transparent 55%),
        rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.draw-selection-image {
    display: block;
    width: 100%;
    height: auto;
    max-height: min(54vh, 640px);
    object-fit: contain;
}

.draw-selection-caption {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.explain-selection-result p,
.explain-selection-result ul,
.explain-selection-result ol,
.explain-selection-result h2,
.explain-selection-result h3,
.explain-selection-result h4 {
    margin: 0 0 0.9rem;
}

.explain-selection-result ul,
.explain-selection-result ol {
    padding-left: 1.25rem;
}

.explain-selection-result > *:last-child {
    margin-bottom: 0;
}

.explain-loading-pill,
.explain-error-copy {
    display: inline-flex;
    align-items: center;
    min-height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
}

.explain-error-copy {
    border-radius: 14px;
    align-items: flex-start;
    padding: 12px 14px;
    color: var(--status-error);
    background: rgba(255, 107, 107, 0.08);
    border-color: rgba(255, 107, 107, 0.18);
}

.explain-source-section {
    margin-top: 18px;
}

.explain-source-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.explain-source-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    text-decoration: none;
    transition: var(--transition);
}

.explain-source-link:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.08);
}

.explain-source-link span {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

html[data-theme="light"] .explain-selection-preview-shell,
html[data-theme="light"] .explain-modal-state,
html[data-theme="light"] .explain-source-link,
html[data-theme="light"] .auth-cloud-panel,
html[data-theme="light"] .auth-choice-card,
html[data-theme="light"] .auth-session-panel {
    background: rgba(255, 255, 255, 0.78);
    border-color: rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .selection-action-toolbar,
html[data-theme="light"] .draw-selection-image-shell {
    background: rgba(255, 255, 255, 0.86);
    border-color: rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .auth-choice-card.is-active {
    background:
        radial-gradient(circle at top left, rgba(15, 118, 110, 0.1), transparent 45%),
        rgba(255, 255, 255, 0.96);
}

html[data-theme="light"] .auth-session-chip[data-mode="guest"] {
    color: #b45309;
    background: rgba(245, 158, 11, 0.12);
    border-color: rgba(245, 158, 11, 0.22);
}

html[data-theme="light"] .auth-session-chip[data-mode="local"],
html[data-theme="light"] .auth-session-chip[data-mode="loading"] {
    color: #475569;
}

html[data-theme="light"] .explain-selection-preview {
    border-left-color: rgba(14, 165, 233, 0.28);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ==========================================================================
   NOTE TEXTAREA
   ========================================================================== */
.note-textarea {
    width: 100%;
    min-height: 150px;
    padding: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.95rem;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    transition: var(--transition);
    margin-bottom: 2rem;
}

.note-textarea:focus {
    border-color: rgba(0, 255, 204, 0.4);
    box-shadow: 0 0 0 3px rgba(0, 255, 204, 0.1);
}

.note-textarea::placeholder {
    color: var(--text-dim);
    font-style: italic;
}

/* ==========================================================================
   HOMEPAGE + ACCOUNT CENTER REFRESH
   ========================================================================== */
body.home-page {
    background:
        radial-gradient(circle at top left, rgba(77, 244, 213, 0.08), transparent 26%),
        radial-gradient(circle at top right, rgba(56, 189, 248, 0.08), transparent 24%),
        var(--bg);
}

.home-header {
    padding: 22px 24px 0;
}

.home-header-bar.home-hero-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
    gap: 18px;
    align-items: center;
    padding: 24px 26px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at top left, rgba(77, 244, 213, 0.12), transparent 26%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    box-shadow: var(--shadow-card);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
}

.home-brand-lockup {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 8px;
    text-align: left;
    max-width: 560px;
}

.home-brand-lockup .home-hero-title {
    font-size: clamp(3rem, 6vw, 4.25rem);
}

.home-hero-slogan {
    max-width: 22ch;
    margin: 0;
    font-size: 1rem;
    line-height: 1.35;
}

.home-hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.home-hero-pill {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 14px;
    border-radius: var(--radius-pill);
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-muted);
    font-size: 0.82rem;
    letter-spacing: 0.02em;
}

.home-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 10px;
}

.home-session-panel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 100%;
    padding: 20px;
}

.home-session-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    width: min(100%, 240px);
    text-align: center;
}

.home-session-meta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: min(100%, 240px);
}

.home-session-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 188px;
}

.home-stat-card {
    display: grid;
    gap: 2px;
    padding: 14px;
    justify-items: center;
    text-align: center;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
}

.home-stat-value {
    font-size: 1.8rem;
    font-weight: 700;
    line-height: 1;
    color: var(--text);
}

.home-stat-label {
    color: var(--text-dim);
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

.home-session-actions {
    width: auto;
    justify-content: center;
}

.home-session-panel .auth-session-chip,
.home-session-panel .cmd-btn {
    align-self: center;
}

.home-page .terminal-container {
    max-width: 1120px;
    padding: 16px 24px 56px;
}

.home-page .terminal-container.home-dashboard {
    display: grid;
    grid-template-columns: minmax(320px, 0.86fr) minmax(0, 1.14fr);
    gap: 18px;
    align-items: start;
}

.home-primary-column,
.home-collections-panel {
    min-width: 0;
}

.home-primary-column {
    display: grid;
}

.home-primary-column .creation-hub {
    height: 100%;
}

.creation-hub {
    padding: 22px;
}

.saved-notes-panel.home-collections-panel {
    padding: 22px;
    background:
        radial-gradient(circle at top right, rgba(77, 244, 213, 0.12), transparent 28%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
}

.home-collections-head {
    align-items: center;
    margin-bottom: 14px;
}

.home-collections-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.home-collections-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.home-collection-tabs {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 0;
}

.home-collection-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    transition: var(--transition);
}

.home-collection-tab:hover {
    background: rgba(255, 255, 255, 0.1);
}

.home-collection-tab.is-active {
    background: var(--accent-surface);
    border-color: var(--accent-border);
    color: var(--accent-strong);
}

.home-collection-panel {
    margin-top: 14px;
}

.home-review-tip {
    display: none;
}

.saved-notes-list {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 14px;
}

.saved-note-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 100%;
    padding: 16px;
}

.saved-note-card-top {
    margin-bottom: 0;
}

.saved-note-card-title {
    margin: 0;
    font-size: 1.18rem;
}

.saved-note-body {
    display: grid;
    gap: 10px;
}

.saved-note-card-preview {
    margin: 0;
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    color: var(--text-muted);
    line-height: 1.55;
}

.saved-note-bottom {
    display: grid;
    gap: 10px;
    margin-top: auto;
}

.saved-note-inline-meta {
    color: var(--text-dim);
    font-size: 0.8rem;
}

.saved-note-inline-meta time {
    color: var(--text-muted);
}

.home-session-head .saved-notes-copy,
.creation-hub .persona-description {
    max-width: 28ch;
    margin-top: 0;
}

.home-session-head .saved-notes-copy {
    line-height: 1.35;
}

.creation-hub-header {
    margin-bottom: 16px;
}

.creation-flow {
    gap: 14px;
}

.field-group {
    gap: 6px;
}

.persona-selector-card {
    padding: 14px 16px;
}

.persona-selector-header {
    margin-bottom: 8px;
}

.persona-selector-title,
.persona-selector-copy {
    display: none;
}

.persona-description {
    margin-top: 8px;
    color: var(--text-dim);
    font-size: 0.84rem;
    line-height: 1.4;
}

.creation-actions .cmd-btn {
    width: 100%;
    justify-content: center;
}

.saved-notes-empty-state {
    gap: 6px;
    min-height: 180px;
    padding: 24px 18px;
}

.saved-notes-empty {
    padding: 0;
}

.saved-note-actions {
    margin-top: 0;
}

.review-note-builder {
    display: grid;
    gap: 12px;
}

.review-note-options {
    gap: 8px;
}

.review-note-action-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.review-note-status {
    flex: 1 1 auto;
    margin: 0;
    text-align: left;
}

.review-create-btn {
    flex-shrink: 0;
}

.account-shell {
    max-width: 1180px;
    display: grid;
    gap: 24px;
    padding: 110px 24px 80px;
}

.account-overview-panel {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: 24px;
    padding: 30px;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(circle at top left, rgba(77, 244, 213, 0.14), transparent 32%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.03));
    box-shadow: var(--shadow-card);
    backdrop-filter: var(--blur-glass);
    -webkit-backdrop-filter: var(--blur-glass);
}

.account-overview-copy {
    max-width: 64ch;
}

.account-hero-title {
    margin: 0;
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    line-height: 0.98;
    letter-spacing: -0.04em;
}

.account-overview-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 22px;
}

.account-overview-status {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 22px;
    border-radius: 20px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 22px;
}

.account-card {
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-height: 100%;
    padding: 26px;
}

.account-card-head {
    margin-bottom: 0;
}

.account-identity-block {
    min-width: 220px;
    padding: 14px 16px;
    border-radius: 18px;
    border: 1px solid var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
}

.account-identity-label {
    margin: 0 0 4px;
    color: var(--text-dim);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.account-identity-value {
    margin: 0;
    color: var(--text);
    font-weight: 600;
    word-break: break-word;
}

.account-form {
    gap: 14px;
}

.account-setting-stack {
    display: grid;
    gap: 16px;
}

.account-setting-copy {
    max-width: 32ch;
}

.account-status-copy {
    margin-top: auto;
}

html[data-theme="light"] .home-hero-pill,
html[data-theme="light"] .home-stat-card,
html[data-theme="light"] .account-overview-status,
html[data-theme="light"] .account-identity-block {
    background: rgba(255, 255, 255, 0.7);
    border-color: rgba(15, 23, 42, 0.1);
}

html[data-theme="light"] .home-session-panel,
html[data-theme="light"] .saved-notes-panel.home-collections-panel,
html[data-theme="light"] .account-overview-panel {
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 28%),
        rgba(255, 255, 255, 0.88);
    border-color: rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .home-header-bar.home-hero-grid {
    background:
        radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 28%),
        rgba(255, 255, 255, 0.86);
    border-color: rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .home-collection-tab {
    background: rgba(15, 23, 42, 0.04);
    border-color: rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .home-collection-tab:hover {
    background: rgba(15, 23, 42, 0.08);
}

html[data-theme="light"] .saved-note-card {
    background: rgba(255, 255, 255, 0.94);
}

@media (max-width: 1080px) {
    .home-header-bar.home-hero-grid,
    .home-dashboard,
    .account-overview-panel,
    .account-grid {
        grid-template-columns: 1fr;
    }

    .home-session-panel,
    .account-overview-status {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .home-header {
        padding: 88px 16px 0;
    }

    .home-brand-lockup {
        align-items: center;
        text-align: center;
    }

    .home-hero-slogan {
        margin-right: auto;
        margin-left: auto;
    }

    .home-hero-pills,
    .home-hero-actions,
    .home-collection-tabs,
    .account-overview-pills {
        justify-content: center;
    }

    .home-page .terminal-container,
    .account-shell {
        padding-right: 16px;
        padding-left: 16px;
    }

    .home-header-bar.home-hero-grid,
    .creation-hub,
    .saved-notes-panel.home-collections-panel,
    .account-overview-panel,
    .account-card {
        padding: 18px;
    }

    .home-session-stats {
        grid-template-columns: 1fr 1fr;
    }

    .home-collections-controls,
    .review-note-action-row,
    .account-setting-row {
        align-items: stretch;
        justify-content: flex-start;
    }

    .home-collections-controls,
    .review-note-action-row {
        flex-direction: column;
    }

    .home-collections-controls .cmd-btn,
    .review-note-action-row .cmd-btn,
    .account-theme-toggle {
        width: 100%;
    }

    .home-page .terminal-container.home-dashboard {
        grid-template-columns: 1fr;
    }

    .saved-notes-list {
        grid-template-columns: 1fr;
    }
}
