:root {
    /* Premium Dark Palette - Improved Contrast */
    --bg-base: #0d0d0f;
    /* Slightly lighter for better contrast */
    --bg-surface: #1a1a1c;
    /* Zinc 900 - adjusted */
    --bg-glass: rgba(26, 26, 28, 0.8);
    --bg-glass-high: rgba(42, 42, 45, 0.5);

    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-active: rgba(255, 255, 255, 0.15);

    /* Text - Improved readability */
    --text-primary: #ffffff;
    /* Pure white for better contrast */
    --text-secondary: #b3b3b3;
    /* Lighter gray */
    --text-success: #22c55e;
    --text-danger: #ef4444;
    --text-warning: #f59e0b;
    --text-muted: #787878;

    /* Status Colors */
    --status-offline: #787878;
    --status-syncing: #f59e0b;
    --status-synced: #22c55e;
    --status-error: #ef4444;

    /* Brand */
    --brand-primary: #3b82f6;
    /* Blue 500 */
    --brand-glow: rgba(59, 130, 246, 0.4);
    --brand-secondary: #a855f7;
    --brand-secondary-glow: rgba(168, 85, 247, 0.35);
    --accent-cyan: #22d3ee;
    --accent-cyan-glow: rgba(34, 211, 238, 0.25);

    /* FX */
    --glass-blur: 14px;
    --glass-sat: 160%;
    --shadow-elev-1: 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-elev-2: 0 18px 44px rgba(0, 0, 0, 0.38);

    /* Typography - Improved hierarchy */
    --font-sans: 'Space Grotesk', 'Inter', system-ui, -apple-system, sans-serif;
    --font-mono: 'IBM Plex Mono', 'JetBrains Mono', 'Consolas', monospace;
    --font-size-base: clamp(12px, 0.75vw + 8px, 14px);
    --font-size-sm: clamp(11px, 0.65vw + 7px, 13px);
    --font-size-xs: clamp(10px, 0.55vw + 6px, 12px);

    /* Spacing - More generous */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --layout-max: 1480px;
    --layout-pad: clamp(1rem, 3vw, 2.5rem);
    --layout-gap: clamp(1rem, 2vw, 2rem);
    --sidebar-width: clamp(72px, 7vw, 80px);
    --list-width: clamp(280px, 26vw, 380px);
    --editor-max: 1000px;
    --floating-panel-width: clamp(300px, 45vw, 450px);
    --floating-panel-top: clamp(4rem, 14vh, 8rem);
    --floating-panel-margin: 16px;

    /* Background customization */
    --app-bg-image: none;
    --app-bg-opacity: 0.25;
    --app-bg-blur: 0px;
    --app-bg-fit: cover;
    --app-bg-position: center;
    --app-bg-gradient-opacity: 0.8;
}

/* Light Theme */
[data-theme="light"] {
    --bg-base: #f8fafc;
    --bg-surface: #ffffff;
    --bg-glass: rgba(255, 255, 255, 0.85);
    --bg-glass-high: rgba(255, 255, 255, 0.6);

    --border-subtle: #e2e8f0;
    --border-active: #cbd5e1;

    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --text-success: #16a34a;
    --text-muted: #94a3b8;
}

/* AMOLED Theme */
[data-theme="amoled"] {
    --bg-base: #000000;
    --bg-surface: #111111;
    --bg-glass: rgba(17, 17, 17, 0.65);
    --app-bg-gradient-opacity: 0.75;
}

/* Low Contrast Theme */
[data-theme="low-contrast"] {
    --bg-base: #1a1a1c;
    --text-primary: #c1c1c1;
    --text-secondary: #888888;
    --app-bg-gradient-opacity: 0.55;
    /* Spacing */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* Nord Theme */
[data-theme="nord"] {
    --bg-base: #0b1119;
    --bg-surface: #131c28;
    --bg-glass: rgba(19, 28, 40, 0.72);
    --bg-glass-high: rgba(19, 28, 40, 0.46);

    --border-subtle: rgba(236, 239, 244, 0.10);
    --border-active: rgba(236, 239, 244, 0.16);

    --text-primary: #eceff4;
    --text-secondary: #9aa6b2;
    --text-muted: #6b7a8b;

    --brand-primary: #88c0d0;
    --brand-glow: rgba(136, 192, 208, 0.45);
    --brand-secondary: #b48ead;
    --brand-secondary-glow: rgba(180, 142, 173, 0.38);
    --app-bg-gradient-opacity: 0.95;
}

/* Rose Theme */
[data-theme="rose"] {
    --bg-base: #0f0b10;
    --bg-surface: #19101b;
    --bg-glass: rgba(25, 16, 27, 0.72);
    --bg-glass-high: rgba(25, 16, 27, 0.48);

    --border-subtle: rgba(255, 255, 255, 0.10);
    --border-active: rgba(255, 255, 255, 0.16);

    --text-primary: #fdf2f8;
    --text-secondary: #f9a8d4;
    --text-muted: #a78bfa;

    --brand-primary: #fb7185;
    --brand-glow: rgba(251, 113, 133, 0.40);
    --brand-secondary: #a78bfa;
    --brand-secondary-glow: rgba(167, 139, 250, 0.38);
    --app-bg-gradient-opacity: 1;
}

* {
    box-sizing: border-box;
    outline: none;
}

/* Accessible focus styles (keyboard navigation) */
:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.9);
    outline-offset: 2px;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

body {
    margin: 0;
    background-color: var(--bg-base);
    color: var(--text-primary);
    font-family: var(--font-sans);
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-font-smoothing: antialiased;
    position: relative;
    background: var(--bg-base);
}

/* Layered app background (gradient + optional image) */
body::before,
body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

body::before {
    background-image: var(--app-bg-image);
    background-size: var(--app-bg-fit);
    background-position: var(--app-bg-position);
    background-repeat: no-repeat;
    filter: blur(var(--app-bg-blur));
    opacity: var(--app-bg-opacity);
    transform: translateZ(0);
}

body::after {
    opacity: var(--app-bg-gradient-opacity);
    background:
        radial-gradient(circle at 18% 18%, rgba(59, 130, 246, 0.18), transparent 45%),
        radial-gradient(circle at 82% 22%, rgba(168, 85, 247, 0.18), transparent 50%),
        radial-gradient(circle at 42% 88%, rgba(0, 255, 156, 0.12), transparent 55%),
        radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03), transparent 60%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 120px),
        repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.03) 1px, transparent 1px, transparent 120px),
        linear-gradient(180deg, #0b0b10, #09090b);
    animation: bg-drift 18s ease-in-out infinite;
    transform: translateZ(0);
}

@keyframes bg-drift {
    0% {
        transform: translate3d(0, 0, 0) scale(1);
        filter: hue-rotate(0deg);
    }

    50% {
        transform: translate3d(0, -10px, 0) scale(1.02);
        filter: hue-rotate(12deg);
    }

    100% {
        transform: translate3d(0, 0, 0) scale(1);
        filter: hue-rotate(0deg);
    }
}

/* Keep app layers above background */
.screen {
    z-index: 10;
}

@media (prefers-reduced-motion: reduce) {
    body::after {
        animation: none;
    }

    * {
        scroll-behavior: auto !important;
    }
}

/* Mobile touch adjustments */
html,
body {
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    font-size: var(--font-size-base, 16px);
}

/* Reduce tap highlight on mobile */
* {
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}

/* --- UTILS --- */
.hidden {
    display: none !important;
}

.admin-only.hidden {
    display: none !important;
}

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

.debug-panel {
    position: fixed;
    left: 0.75rem;
    bottom: calc(0.75rem + env(safe-area-inset-bottom));
    z-index: 9999;
    background: rgba(12, 12, 14, 0.92);
    color: #ffffff;
    font-size: 11px;
    line-height: 1.4;
    padding: 0.5rem 0.6rem;
    border-radius: 8px;
    max-width: 90vw;
    pointer-events: none;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.screen {
    position: absolute;
    inset: 0;
    display: flex;
    background: transparent;
    /* Changed from bg-base to allow body gradient */
    z-index: 10;
}

/* --- GLASSMORPHISM --- */
.glass-panel {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.02)),
        var(--bg-glass);
    backdrop-filter: blur(var(--glass-blur)) saturate(var(--glass-sat));
    border: 1px solid var(--border-subtle);
    box-shadow: var(--shadow-elev-1), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* --- LOADING SCREEN --- */
#loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2rem;
}

.logo-mark {
    font-size: 3rem;
    font-weight: 700;
    color: var(--brand-primary);
    letter-spacing: -0.05em;
    animation: fadeIn 0.5s ease;
}

.loader-pulse {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--brand-primary);
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

.btn-feedback {
    animation: scaleIn 0.2s ease;
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

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

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }

    100% {
        background-position: 1000px 0;
    }
}

@keyframes pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

@keyframes authFloat {
    0% {
        transform: translateY(0px) scale(0.995);
        box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    }

    50% {
        transform: translateY(-4px) scale(1);
        box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
    }

    100% {
        transform: translateY(0px) scale(0.995);
        box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
    }
}

@keyframes glowPulse {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.28);
    }

    70% {
        box-shadow: 0 0 0 12px rgba(59, 130, 246, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

@keyframes highlight {
    from {
        background-color: var(--brand-glow);
    }

    to {
        background-color: rgba(0, 0, 0, 0.3);
    }
}

.highlight {
    animation: highlight 0.5s ease-out;
}

/* --- AUTH SCREEN --- */
#auth-screen.auth-hero {
    justify-content: center;
    align-items: center;
    background: radial-gradient(circle at 30% 20%, rgba(0, 255, 156, 0.12), transparent 45%),
        radial-gradient(circle at 80% 10%, rgba(59, 130, 246, 0.15), transparent 50%),
        linear-gradient(135deg, #111827, #0f172a 55%, #0b1220 100%);
    padding: 1rem;
    padding-top: 3rem;
}

.auth-stack {
    width: min(420px, 92vw);
    width: clamp(320px, 92vw, 400px);
    text-align: center;
    padding: 2rem 2rem;
    border-radius: var(--radius-lg);
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    animation: fadeIn 0.5s ease;
}

.auth-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.logo-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(0, 255, 156, 0.25), rgba(59, 130, 246, 0.2));
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.logo-ring img {
    width: 40px;
    height: 40px;
}

.auth-card .brand-title,
.auth-stack .brand-title {
    font-size: 1.5rem;
    margin: 0;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.form-title {
    margin: 0 0 1.5rem;
    font-size: 1.25rem;
    font-weight: 500;
}

.auth-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-subtle);
}

.auth-footer .btn-icon {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
}

.auth-footer .btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.auth-footer .btn-text {
    font-size: 0.85rem;
    padding: 0.5rem 0.75rem;
    color: var(--text-secondary);
    transition: color 0.2s;
}

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



.auth-settings-mobile {
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.35rem;
    text-align: left;
    width: 100%;
}

.settings-mobile-label {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.settings-mobile-launcher {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    font-size: 0.95rem;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}




.modal-overlay {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    pointer-events: none;
}

.modal-overlay:not(.hidden) {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
}

.modal-content {
    background: var(--bg-surface);
    border-radius: 16px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    max-height: 80dvh;
    overflow-y: auto;
    transform: translateY(10px);
    transition: all 0.3s ease;
}

.modal-overlay:not(.hidden) .modal-content {
    animation: floatIn 0.45s ease forwards;
}

@keyframes floatIn {
    0% {
        transform: translateY(20px) scale(0.95);
        opacity: 0;
    }

    100% {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* --- SECURITY HEALTH WIDGET --- */
.security-health-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(16, 185, 129, 0.05));
    border: 1px solid rgba(59, 130, 246, 0.2);
}

.security-health-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.health-ring-container {
    position: relative;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.health-ring-chart {
    width: 100%;
    height: 100%;
    transform: rotate(0deg);
}

.health-ring-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 3;
}

.health-ring-value {
    fill: none;
    stroke: var(--text-success);
    stroke-width: 3;
    stroke-linecap: round;
    animation: progress 1s ease-out forwards;
}

.health-icon {
    position: absolute;
    width: 20px;
    height: 20px;
    color: var(--text-success);
}

.health-content {
    flex: 1;
}

.health-content h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
}

/* --- STEALTH MODE --- */
body.stealth-mode .brand-title {
    color: transparent !important;
    background: none !important;
    text-shadow: none !important;
    position: relative;
}

body.stealth-mode .brand-title::after {
    content: 'Notes';
    position: absolute;
    left: 0;
    top: 0;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.8em;
    letter-spacing: normal;
}

body.stealth-mode .note-preview,
body.stealth-mode .editor-input-body,
body.stealth-mode .attachment-name,
body.stealth-mode .dashboard-card h3 {
    filter: blur(6px);
    transition: filter 0.3s ease;
    user-select: none;
}

body.stealth-mode .editor-panel:hover .editor-input-body,
body.stealth-mode .note-item:hover .note-preview {
    filter: blur(0);
    user-select: auto;
}

/* --- TEMPLATES GRID --- */
.templates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    padding: 1.5rem;
}

.template-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-card:hover {
    background: rgba(59, 130, 246, 0.1);
    border-color: var(--brand-primary);
    transform: translateY(-2px);
}

.template-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    display: grid;
    place-items: center;
    color: var(--brand-primary);
}

.template-icon svg {
    width: 24px;
    height: 24px;
}

.template-title {
    font-weight: 600;
    font-size: 0.95rem;
}

/* Floating Password Panel */
.floating-panel {
    position: fixed;
    top: var(--floating-panel-top);
    left: 50%;
    transform: translateX(-50%);
    width: var(--floating-panel-width);
    z-index: 60;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.floating-panel.hidden {
    display: none;
}

.floating-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: rgba(15, 23, 42, 0.88);
    border: 1px solid var(--border-subtle);
    border-bottom: none;
    cursor: grab;
    user-select: none;
}

.floating-panel-header:active {
    cursor: grabbing;
}

.floating-panel-header h2 {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.floating-panel-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.floating-panel-body {
    padding: 1rem;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    border-top: none;
    background: var(--bg-surface);
}

.floating-panel-body .input-field {
    font-family: var(--font-mono);
    letter-spacing: 0.01em;
}

.settings-panel {
    width: min(520px, 95vw);
    max-height: 80vh;
    max-height: 80dvh;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
}

.settings-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.settings-panel-subtitle {
    margin: 0.35rem 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.4;
}

.settings-actions {
    display: grid;
    gap: 0.9rem;
    margin-top: 1rem;
}

.settings-action {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-radius: var(--radius-md);
    padding: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

.settings-action:hover {
    border-color: var(--border-active);
    background: rgba(59, 130, 246, 0.08);
}

.settings-action-icon {
    font-size: 1.6rem;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    display: grid;
    place-items: center;
}

.settings-action-content {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.settings-action-title {
    font-weight: 600;
}

.settings-action-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

.settings-action-danger {
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--text-danger);
}

.settings-action-danger:hover {
    background: rgba(248, 113, 113, 0.12);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary);
}

.modal-close {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    transition: all 0.2s;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-body {
    padding: 1.5rem;
}

.settings-section h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.settings-list li {
    margin-bottom: 0.5rem;
}

.settings-item {
    width: 100%;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-align: left;
}

.settings-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-active);
}

.settings-item.danger:hover {
    background: rgba(248, 113, 113, 0.1);
    border-color: var(--text-danger);
}

.settings-item-content {
    flex: 1;
}

.settings-item-title {
    display: block;
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.settings-item-desc {
    display: block;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.auth-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.lang-switcher {
    display: flex;
    align-items: center;
}

.lang-switcher label {
    display: none;
}

.lang-switcher select {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    color: var(--text-secondary);
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    min-width: 100px;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-switcher select:hover {
    border-color: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

/* --- Auth Form Transitions --- */
/* This targets all the swappable views inside the auth card */
#auth-choice,
#auth-setup,
#auth-login,
#auth-recovery {
    transition: opacity 0.3s ease-out, transform 0.3s ease-out;
}

/* When a form is not active, it's invisible and shifted down */
#auth-choice.hidden,
#auth-setup.hidden,
#auth-login.hidden,
#auth-recovery.hidden {
    opacity: 0;
    transform: translateY(10px);
    pointer-events: none;
    /* Prevent interaction with hidden forms */
}

#auth-login {
    animation: fadeSlideUp 0.4s ease;
}

#auth-choice {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: rgba(15, 23, 42, 0.48);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    text-align: left;
}

#auth-choice .auth-choice-actions .btn {
    text-align: left;
    padding: 0.75rem 0.95rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.2rem;
    width: min(240px, 100%);
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
}

#auth-choice .auth-choice-actions small {
    font-size: 0.78rem;
    color: var(--text-secondary);
    line-height: 1.3;
}

#username-recommendation-text {
    font-weight: 600;
    color: var(--brand-primary);
}


.auth-choice-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.65rem;
    position: relative;
    justify-content: center;
}

.auth-choice-actions .btn-primary {
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.3s ease;
}

.auth-choice-actions .btn-primary::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg, transparent 0%, rgba(255, 255, 255, 0.16) 35%, transparent 70%);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.auth-choice-actions .btn-primary:hover::after {
    transform: translateX(100%);
}

.auth-choice-actions .btn-primary:hover {
    transform: translateY(-1px) scale(1.01);
    box-shadow: 0 14px 30px rgba(59, 130, 246, 0.25);
}

.logo-ring {
    animation: glowPulse 3s ease-in-out infinite;
}

.auth-choice-meta {
    display: grid;
    gap: 0.35rem;
    text-align: left;
}


.brand-title {
    font-weight: 800;
    letter-spacing: -2px;
    font-size: 2.5rem;
    margin: 0 0 0.25rem 0;
    background: linear-gradient(90deg, #ffffff, #cbd5f5);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    margin-top: 0.5rem;
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.lede {
    margin: -2rem auto 2rem;
    max-width: 420px;
    color: #d4d4d8;
    font-size: 1rem;
    line-height: 1.6;
}

.eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin: 0 0 0.35rem 0;
}

.hint {
    margin: 0.5rem 0 0;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.center {
    text-align: center;
}

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

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.input-group {
    text-align: left;
    margin-bottom: 1rem;
}

.input-group:last-of-type {
    margin-bottom: 1.5rem;
}

.input-wrapper {
    position: relative;
}

.input-wrapper input {
    padding-right: 3rem;
    /* Make space for the icon */
}

.btn-toggle-visibility {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3rem;
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.btn-toggle-visibility:hover {
    color: var(--text-primary);
}

.input-group label {
    display: none;
}

/* Glossy Inputs */
input {
    width: 100%;
    padding: 0.875rem 1rem;
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    font-family: var(--font-sans);
    transition: all 0.2s ease;
    min-height: 44px; /* Better mobile touch target */
}

input::placeholder {
    color: var(--text-muted);
}

input:focus {
    outline: none;
    border-color: var(--brand-primary);
    background: var(--bg-glass-high);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.input-focus-hint {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.35);
}

button.btn {
    min-height: 44px; /* Better mobile touch target */
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: none;
    font-weight: 500;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    letter-spacing: 0.01em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.25), 0 0 22px var(--brand-glow), 0 0 18px var(--brand-secondary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
    box-shadow: var(--shadow-elev-2), 0 0 26px var(--brand-glow), 0 0 22px var(--brand-secondary-glow);
}

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

.btn-secondary:hover {
    background: var(--bg-glass-high);
    border-color: var(--border-active);
}

.btn-icon {
    min-width: 44px;
    min-height: 44px;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

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

.btn-icon.ghost {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.btn-icon.ghost:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.btn-primary.accent {
    background: linear-gradient(120deg, #26d97c, #34b7ff);
    box-shadow: 0 8px 24px rgba(38, 217, 124, 0.25), 0 10px 30px rgba(52, 183, 255, 0.25);
}

.info-text {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 1.5rem;
}

.mt-1 {
    margin-top: 1rem;
}

.flex-grow-1 {
    flex-grow: 1;
}

.flex-grow-2 {
    flex-grow: 2;
}

.flex-gap-05 {
    display: flex;
    gap: 0.5rem;
}

/* --- VAULT LAYOUT --- */
#vault-screen {
    flex-direction: row;
    gap: var(--layout-gap);
    padding: var(--layout-pad);
    align-items: stretch;
}

/* Coach-only mode: hide notes UI and make Coach full-width. */
body.coach-only #vault-screen {
    padding: 0;
    gap: 0;
}

body.coach-only #vault-screen .sidebar,
body.coach-only #mobile-topbar {
    display: none !important;
}

body.coach-only #vault-screen .list-panel,
body.coach-only #vault-screen .editor-panel,
body.coach-only #vault-screen .dashboard-panel,
body.coach-only #vault-screen .admin-panel {
    display: none !important;
}

/* Coach focus (desktop): keep sidebar, hide notes/editor panels. */
body.coach-focus #vault-screen .list-panel,
body.coach-focus #vault-screen .editor-panel,
body.coach-focus #vault-screen .dashboard-panel,
body.coach-focus #vault-screen .admin-panel {
    display: none !important;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: none;
    padding: clamp(1rem, 2vw, 1.5rem) 0;
    z-index: 20;
}

.sidebar.glass-panel {
    background: rgba(24, 24, 27, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow:
        0 16px 40px rgba(0, 0, 0, 0.22),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

[data-theme="light"] .sidebar.glass-panel {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow:
        0 18px 40px rgba(15, 23, 42, 0.10),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.logo-small {
    font-weight: 800;
    margin-bottom: 2rem;
    color: var(--brand-primary);
    display: flex;
    justify-content: center;
    align-items: center;
}

.logo-small img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 12px;
}

.sync-status-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    cursor: default;
    transition: background 0.3s;
}

.sync-status-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sync-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--status-offline);
    transition: background-color 0.3s, box-shadow 0.3s;
}

.sync-label {
    font-size: 0.55rem;
    margin-top: 4px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sync-dot.status-offline {
    background: var(--status-offline);
}

.sync-dot.status-syncing {
    background: var(--status-syncing);
    box-shadow: 0 0 8px var(--status-syncing);
    animation: pulseSync 1.5s infinite;
}

.sync-dot.status-synced {
    background: var(--status-synced);
}

.sync-dot.status-error {
    background: var(--status-error);
}

.sync-dot.status-local_saved {
    background: var(--brand-primary);
}

@keyframes pulseSync {
    0% {
        transform: scale(0.9);
        opacity: 0.7;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }

    100% {
        transform: scale(0.9);
        opacity: 0.7;
    }
}

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

.status-actions .btn {
    font-size: 0.85rem;
    padding: 0.15rem 0.6rem;
}

.sync-overlay,
.import-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 7, 10, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
}

.sync-card,
.import-card {
    width: min(480px, 90vw);
    padding: 1.5rem;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
    background: var(--bg-surface);
    backdrop-filter: blur(18px);
}

.sync-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.sync-subtitle {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin: 0.2rem 0 0;
}

.sync-status-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.sync-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.sync-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--brand-primary), #6a5efc);
    border-radius: 999px;
    transition: width 0.3s ease;
}

.sync-qr {
    width: 100%;
    min-height: 260px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    padding: 0.75rem;
}

.sync-qr canvas {
    width: 220px;
    height: 220px;
}

.sync-code {
    width: 100%;
    min-height: 80px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.75rem;
    font-family: monospace;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    resize: vertical;
}

.sync-actions,
.import-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.sync-scanner,
.sync-manual {
    margin-top: 0.75rem;
}

.sync-scanner.hidden,
.sync-manual.hidden {
    display: none;
}

.sync-scanner video {
    width: 100%;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
}

.sync-scanner-tip {
    color: var(--text-muted);
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.import-card textarea {
    width: 100%;
    min-height: 160px;
    border-radius: 12px;
    background: rgba(5, 5, 5, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 0.8rem;
    resize: vertical;
    font-family: 'JetBrains Mono', monospace;
}

.import-card h3 {
    margin-top: 0;
}



.nav-items {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    align-items: center;
}

.nav-item {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.nav-item:hover {
    background: var(--bg-glass-high);
    color: white;
}

.nav-item.active {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22), 0 0 18px var(--brand-glow), 0 0 14px var(--brand-secondary-glow);
}

.mobile-topbar {
    width: 100%;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.25rem;
}

.mobile-topbar img {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}

.topbar-logo {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1;
}

.topbar-actions {
    display: flex;
    gap: 0.35rem;
    flex: 1;
    justify-content: center;
}

.nav-pill {
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: 500;
    cursor: pointer;
    min-height: 44px;
    display: flex;
    align-items: center;
    transition: all 0.2s;
}

.nav-pill:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.nav-pill.active {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22), 0 0 18px var(--brand-glow), 0 0 14px var(--brand-secondary-glow);
}

.topbar-utilities {
    display: flex;
    gap: 0.35rem;
    align-items: center;
}

.icon {
    width: 24px;
    height: 24px;
}

/* Mobile bottom navigation (injected via UI) */
.mobile-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    align-items: center;
    justify-content: space-around;
    gap: 0.5rem;
    padding: 0.4rem 0.75rem calc(0.6rem + env(safe-area-inset-bottom));
    border-top: 1px solid var(--border-subtle);
    z-index: 18;
    transition: transform 0.25s ease, opacity 0.25s ease;
    font-size: var(--font-size-xs);
    line-height: 1.25;
    touch-action: manipulation;
}

#mobile-footer.glass-panel {
    background: rgba(12, 12, 16, 0.72);
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(var(--glass-blur)) saturate(180%);
    box-shadow: 0 -18px 44px rgba(0, 0, 0, 0.45);
}

.mobile-footer .label {
    font-size: var(--font-size-xs);
    letter-spacing: 0.01em;
}

.mobile-footer.footer-hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.mobile-nav-item {
    flex: 1;
    min-width: 0;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 12px;
    padding: 0.45rem 0.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    font-size: var(--font-size-xs);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.mobile-nav-item svg {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
}

.mobile-nav-item.active {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.14);
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.28), 0 0 16px var(--brand-glow);
}

.mobile-nav-item.primary {
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: #fff;
    border-color: rgba(255, 255, 255, 0.18);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.32), 0 0 18px var(--brand-glow), 0 0 16px var(--brand-secondary-glow);
}

.mobile-nav-item.primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

/* History Modal */
.note-history-modal {
    width: 600px;
    width: min(600px, 90vw);
    height: 80vh;
    display: flex;
    flex-direction: column;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 0 0.5rem;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 0.5rem;
    border-radius: 8px;
}

.history-item:last-child {
    border-bottom: none;
}

.history-meta {
    flex: 1;
    margin-right: 1rem;
}

.history-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.history-preview {
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

/* Dashboard Panel */
.dashboard-panel {
    flex: 1;
    background: var(--bg-surface);
    padding: 2rem;
    overflow-y: auto;
}

.dashboard-panel.hidden {
    display: none;
}

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

.dashboard-header h1 {
    font-size: clamp(1.6rem, 2.2vw, 2.4rem);
    margin: 0 0 0.5rem 0;
    background: linear-gradient(90deg, var(--text-primary), var(--brand-primary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.dashboard-header .subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.dashboard-card {
    position: relative;
    overflow: hidden;
    padding: 1.35rem 1.5rem;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.02), rgba(59, 130, 246, 0.06)), var(--bg-glass);
    border: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.dashboard-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 20% 20%, rgba(96, 165, 250, 0.15), transparent 35%), radial-gradient(circle at 80% 80%, rgba(59, 130, 246, 0.12), transparent 30%);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.dashboard-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.35);
    border-color: var(--border-active);
}

.dashboard-card:hover::after {
    opacity: 1;
}

.dashboard-card .card-icon {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border-radius: var(--radius-md);
    background: var(--bg-glass-high);
    color: var(--brand-primary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.08);
}

.dashboard-card .card-icon svg {
    width: 18px;
    height: 18px;
}

.dashboard-card .card-content h3 {
    font-size: clamp(1.4rem, 2vw, 1.9rem);
    margin: 0;
    color: var(--brand-primary);
}

.dashboard-card .card-content p {
    margin: 0.25rem 0 0 0;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.dashboard-hero {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 0 1.5rem;
}

.dashboard-hero .chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.chip-btn {
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
    padding: 0.55rem 0.95rem;
    border-radius: var(--radius-pill);
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chip-btn:hover,
.chip-btn.active {
    border-color: rgba(59, 130, 246, 0.55);
    background: rgba(59, 130, 246, 0.12);
    color: var(--brand-primary);
    transform: translateY(-1px);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.hero-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 140px;
}

.dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.dashboard-actions .btn {
    min-width: 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-weight: 600;
}

.dashboard-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
    margin-top: 2rem;
}

.dashboard-section {
    grid-column: span 2;
    padding: 1.5rem;
    border-radius: var(--radius-md);
}

.dashboard-section h2 {
    margin: 0 0 0.75rem 0;
    font-size: 1.05rem;
    color: var(--text-primary);
}

.dashboard-section .section-subtitle {
    margin: 0 0 1rem 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.dashboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.dashboard-note-item {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}

.dashboard-note-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

.dashboard-note-item .note-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-note-item .note-date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-badge {
    padding: 0.5rem 1rem;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 999px;
    font-size: 0.85rem;
    color: var(--brand-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag-badge:hover {
    background: rgba(59, 130, 246, 0.25);
    transform: scale(1.05);
}

.quick-actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
}

.quick-action-btn {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 1rem 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--brand-primary);
    transform: translateY(-2px);
}

.quick-action-btn .quick-action-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.06);
    color: var(--brand-primary);
}

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

.quick-action-btn span:last-child {
    font-size: 0.8rem;
    font-weight: 600;
}

@media (max-width: 1024px) {
    .dashboard-hero {
        flex-direction: column;
        align-items: flex-start;
    }
    .hero-actions {
        width: 100%;
    }
    .hero-actions .btn {
        flex: 1;
    }
}

@media (max-width: 768px) {
    .dashboard-panel {
        padding: 1.25rem 1rem 2rem;
    }
    .dashboard-header h1 {
        font-size: 2rem;
    }
    .dashboard-header .subtitle {
        font-size: 0.95rem;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-row {
        grid-template-columns: 1fr;
    }
    .dashboard-actions .btn {
        flex: 1 1 calc(50% - 0.75rem);
    }
    .quick-actions-grid {
        grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    }
}

/* Secure Share */
.share-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.share-panel.share-external {
    padding: 0;
}

.share-panel.share-external[open] .share-summary {
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.share-summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.5rem;
    cursor: pointer;
}

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

.share-panel-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.share-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.share-header h2 {
    margin-bottom: 0.4rem;
}

.share-badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.share-badge {
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    background: rgba(59, 130, 246, 0.18);
    color: var(--brand-primary);
    border: 1px solid rgba(59, 130, 246, 0.3);
}

.share-badge.neutral {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    border-color: var(--border-subtle);
}

.share-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.share-column h3 {
    margin: 0 0 0.35rem 0;
    font-size: 1rem;
}

.share-field {
    margin-top: 0.75rem;
    display: grid;
    gap: 0.5rem;
}

.share-field textarea {
    min-height: 90px;
    resize: vertical;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: 0.75rem;
    font-family: var(--font-mono);
    font-size: 0.8rem;
}

.share-transfer {
    display: grid;
    gap: 1.25rem;
}

.share-drop {
    border: 2px dashed rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.2);
    transition: all 0.2s ease;
}

.share-drop:hover,
.share-drop.drag-over {
    border-color: var(--brand-primary);
    background: rgba(59, 130, 246, 0.08);
}

.share-drop input {
    display: none;
}

.share-options {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.share-option {
    display: grid;
    gap: 0.35rem;
    font-size: 0.85rem;
}

.share-option.inline {
    align-items: end;
}

.share-option input[type="number"] {
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-primary);
}

.share-option.toggle-row {
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.5rem;
}

.share-status {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
    padding: 1rem;
    display: grid;
    gap: 0.75rem;
}

.share-state {
    font-weight: 600;
    color: var(--text-primary);
}

.share-state[data-tone="success"] {
    color: var(--text-success);
}

.share-state[data-tone="error"] {
    color: var(--text-danger);
}

.share-state[data-tone="info"] {
    color: var(--text-secondary);
}

.share-progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    overflow: hidden;
}

.share-progress-bar span {
    display: block;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #00ff9c, #3b82f6);
    transition: width 0.2s ease;
}

.share-progress-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.share-receiver {
    border: 1px solid var(--border-subtle);
    border-radius: 14px;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    display: grid;
    gap: 0.75rem;
}

.share-receiver-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: flex-start;
}

.share-file-name {
    font-weight: 600;
}

.share-file-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.share-permission-badges {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.share-preview {
    min-height: 140px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
    display: grid;
    place-items: center;
    padding: 0.5rem;
    overflow: hidden;
}

.share-preview img {
    max-width: 100%;
    border-radius: 10px;
}

.share-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.share-actions .btn {
    flex: 1;
}

.share-lifetime {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.diagnostics-panel {
    align-items: center;
}

.diagnostics-output {
    margin-top: 0.75rem;
    padding: 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border-subtle);
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.85rem;
    display: grid;
    gap: 0.4rem;
}

.diagnostics-output .ok {
    color: var(--text-success);
}

.diagnostics-output .fail {
    color: var(--text-danger);
}


/* List Panel */
.count-badge {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: var(--font-mono);
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    min-width: 40px;
    text-align: center;
}

.list-panel {
    width: var(--list-width);
    flex: 0 0 auto;
    min-width: 240px;
    max-width: 420px;
    background: transparent;
    border-right: 1px solid rgba(255, 255, 255, 0.06);
    display: flex;
    flex-direction: column;
    min-height: 40vh;
    animation: slideInLeft 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.list-header {
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    position: relative;
}

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

.search-wrapper {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 0.75rem;
    width: 16px;
    height: 16px;
    color: rgba(255, 255, 255, 0.55);
    pointer-events: none;
    z-index: 1;
}

.search-input-minimal {
    flex: 1;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
    padding: 0.6rem 1rem 0.6rem 2.5rem;
    font-size: 0.9rem;
    color: var(--text-primary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input-minimal::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.search-input-minimal:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
    transform: scale(1.02);
}

.search-input-minimal:focus+.search-hint {
    opacity: 0;
}

.search-hint {
    position: absolute;
    right: 0.75rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    padding: 0.2rem 0.4rem;
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.2s;
}

.btn-icon-minimal {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

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

.btn-icon-minimal svg {
    width: 16px;
    height: 16px;
}

.btn-new-minimal {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--brand-primary);
    color: white;
    font-size: 1.2rem;
    font-weight: 300;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-new-minimal:hover {
    background: var(--brand-primary);
    opacity: 0.9;
    transform: scale(1.05) rotate(90deg);
}

.btn-new-minimal:active {
    transform: scale(0.95) rotate(90deg);
}

.notes-settings-menu {
    background: rgba(15, 23, 42, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 0.75rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    backdrop-filter: blur(20px);
    animation: fadeInUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top;
}

.notes-settings-menu.hidden {
    display: none;
}

.settings-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.settings-menu-item label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    cursor: pointer;
}

.settings-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    width: 100%;
}

.toggle-input {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    position: relative;
    cursor: pointer;
    appearance: none;
    transition: all 0.2s;
}

.toggle-input::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: white;
    top: 2px;
    left: 2px;
    transition: all 0.2s;
}

.toggle-input:checked {
    background: var(--brand-primary);
    border-color: var(--brand-primary);
}

.toggle-input:checked::before {
    left: 18px;
}

.toggle-label {
    font-size: 0.85rem;
    color: var(--text-primary);
    user-select: none;
}

.settings-select-minimal {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    cursor: pointer;
    min-width: 120px;
}

.settings-select-minimal:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
}

.list-header-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.compact-toggle {
    font-size: 0.75rem;
    padding: 0.25rem 0.65rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.list-header h2 {
    font-size: 1.1rem;
    font-weight: 600;
}

.btn-icon-primary {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, var(--brand-primary), var(--brand-secondary));
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22), 0 0 14px var(--brand-glow);
    transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-icon-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
    box-shadow: var(--shadow-elev-2), 0 0 18px var(--brand-glow), 0 0 14px var(--brand-secondary-glow);
}

/* Quick Drop */
.quick-drop {
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    transition: background 220ms ease, border-color 220ms ease, padding 220ms ease;
}

.sidebar-bottom {
    margin-top: auto;
    padding-top: 0.75rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.sidebar-bottom-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
}

.sidebar-bottom-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem;
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.02);
}

.sidebar .nav-item .icon,
.sidebar .nav-item svg.icon {
    width: 18px;
    height: 18px;
}

.sidebar .nav-item:hover .icon,
.sidebar .nav-item:focus-visible .icon {
    color: var(--text-primary);
}

.sidebar .nav-item#btn-signout:hover {
    color: var(--text-danger);
}

.sidebar .nav-item#btn-signout:hover .icon {
    color: var(--text-danger);
}

/* Profile dropdown (replaces notes settings button/menu) */
.profile-menu {
    position: relative;
    display: inline-flex;
    align-items: center;
}

#btn-profile {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: auto;
    padding: 0 10px;
}

.profile-avatar {
    width: 22px;
    height: 22px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: rgba(255, 255, 255, 0.92);
    background:
        radial-gradient(circle at 30% 30%, rgba(59, 130, 246, 0.95), rgba(168, 85, 247, 0.85));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    flex-shrink: 0;
}

.profile-name {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 13px;
    font-weight: 600;
    opacity: 0.95;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 160px;
    padding: 8px;
    border-radius: 12px;
    background: rgba(20, 20, 20, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
    z-index: 50;
}

.profile-dropdown.hidden {
    display: none;
}

.profile-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 10px;
    border-radius: 10px;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.profile-item:hover,
.profile-item:focus-visible {
    background: rgba(255, 255, 255, 0.08);
    outline: none;
}

.dashboard-card[role="button"] {
    cursor: pointer;
}

.dashboard-card[role="button"]:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.35);
    outline-offset: 3px;
}

.mobile-user-display {
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 10ch;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-right: 0.25rem;
}

.quick-drop.collapsed input {
    height: 40px;
    opacity: 0.92;
}

#quick-drop-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px dashed var(--border-subtle);
    font-size: 0.9rem;
    border-radius: 12px;
    transition: height 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
        opacity 220ms ease,
        transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
        border-color 220ms ease,
        background 220ms ease;
    will-change: height, transform, opacity;
}

.quick-drop.collapsed #quick-drop-input {
    transform: translateY(-1px);
}

#quick-drop-input:focus {
    border-style: solid;
    border-color: var(--brand-primary);
}

/* Settings: background preview */
.bg-preview {
    width: 100%;
    height: 92px;
    border-radius: 12px;
    border: 1px solid var(--border-subtle);
    background:
        radial-gradient(circle at 20% 25%, rgba(59, 130, 246, 0.20), transparent 55%),
        radial-gradient(circle at 80% 35%, rgba(168, 85, 247, 0.20), transparent 55%),
        rgba(255, 255, 255, 0.03);
    overflow: hidden;
    position: relative;
}

.bg-preview::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--preview-bg-image, none);
    background-size: var(--preview-bg-fit, cover);
    background-position: center;
    background-repeat: no-repeat;
    opacity: var(--preview-bg-opacity, 0.35);
    filter: blur(var(--preview-bg-blur, 0px));
}

.bg-preview .bg-preview-label {
    position: absolute;
    left: 10px;
    bottom: 8px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.35);
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    border: 1px solid var(--border-subtle);
    backdrop-filter: blur(8px);
}

.search-container {
    padding: 1rem;
}

#search-input {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 100px;
    font-size: 0.9rem;
}

.scroll-container {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    scroll-behavior: smooth;
}

/* Smooth scrollbar styling */
.scroll-container::-webkit-scrollbar {
    width: 6px;
}

.scroll-container::-webkit-scrollbar-track {
    background: transparent;
}

.scroll-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    transition: background 0.2s;
}

.scroll-container::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

.note-item {
    background: rgba(255, 255, 255, 0.02);
    padding: 1rem 1.25rem;
    border-radius: 12px;
    margin-bottom: 0.75rem;
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    animation: fadeInUp 0.3s ease both;
    opacity: 0;
    box-shadow: none;
    position: relative;
    touch-action: pan-y;
    will-change: transform, opacity, max-height, margin;
}

.note-item:nth-child(1) {
    animation-delay: 0.05s;
}

.note-item:nth-child(2) {
    animation-delay: 0.1s;
}

.note-item:nth-child(3) {
    animation-delay: 0.15s;
}

.note-item:nth-child(4) {
    animation-delay: 0.2s;
}

.note-item:nth-child(5) {
    animation-delay: 0.25s;
}

.note-item:nth-child(n+6) {
    animation-delay: 0.3s;
}

.note-item:hover {
    background: var(--bg-glass-high);
    border-color: var(--border-active);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.note-item.active {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 1px var(--brand-primary), 0 4px 12px rgba(59, 130, 246, 0.15);
    transform: translateY(-1px);
}

/* Swipe to delete animation */
@keyframes slideOutAndCollapse {
    0% {
        transform: translateX(0);
        opacity: 1;
        max-height: 240px;
        margin-bottom: 0.75rem;
        padding-top: 1rem;
        padding-bottom: 1rem;
        border-width: 1px;
    }

    40% {
        transform: translateX(-100%);
        opacity: 0;
        max-height: 240px;
        margin-bottom: 0.75rem;
        padding-top: 1rem;
        padding-bottom: 1rem;
        border-width: 1px;
    }

    100% {
        transform: translateX(-100%);
        opacity: 0;
        max-height: 0;
        margin-bottom: 0;
        padding-top: 0;
        padding-bottom: 0;
        border-width: 0;
    }
}

.note-item.deleting {
    animation: slideOutAndCollapse 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards;
    pointer-events: none;
    overflow: hidden;
}

.note-item h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.3;
}

.note-top-minimal {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.note-top-minimal h4 {
    flex: 1;
    margin: 0;
}

.note-actions-minimal {
    display: flex;
    gap: 0.25rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: auto;
}

.note-item:hover .note-actions-minimal {
    opacity: 1;
}

.note-action-icon {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    touch-action: manipulation;
}

.note-action-icon::before {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 4px;
    background: currentColor;
    opacity: 0;
    transform: scale(0);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.note-action-icon:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    transform: scale(1.1);
}

.note-action-icon:active {
    transform: scale(0.95);
}

.note-action-icon.active {
    color: var(--brand-primary);
}

.note-action-icon.active::before {
    opacity: 0.1;
    transform: scale(1);
}

.note-action-icon svg {
    width: 14px;
    height: 14px;
    stroke-width: 2;
}

.note-action-icon.active svg {
    fill: currentColor;
}

/* Empty state */
.empty-list-placeholder {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    animation: fadeIn 0.5s ease;
}

/* Skeleton Loader */
.skeleton-loader {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.05) 0%,
            rgba(255, 255, 255, 0.1) 50%,
            rgba(255, 255, 255, 0.05) 100%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
    height: 60px;
    margin-bottom: 0.5rem;
}

.skeleton-loader:nth-child(1) {
    animation-delay: 0s;
}

.skeleton-loader:nth-child(2) {
    animation-delay: 0.1s;
}

.skeleton-loader:nth-child(3) {
    animation-delay: 0.2s;
}

.skeleton-loader:nth-child(4) {
    animation-delay: 0.3s;
}

.skeleton-loader:nth-child(5) {
    animation-delay: 0.4s;
}

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

.note-actions {
    display: flex;
    gap: 0.3rem;
}

.note-action {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    border-radius: 8px;
    padding: 4px 6px;
    cursor: pointer;
    font-size: 0.85rem;
}

.note-action:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.note-action.active {
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    background-color: rgba(59, 130, 246, 0.15);
}

.note-action[data-action="history"]:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.note-action[data-action="archive-note"]:hover {
    background-color: rgba(251, 191, 36, 0.12);
    /* --text-warning */
}

.note-action[data-action="delete-note"]:hover {
    background: rgba(248, 113, 113, 0.15);
    /* --text-danger */
    color: var(--text-danger);
}

.note-action .icon-small {
    display: block;
    width: 14px;
    height: 14px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.note-badge {
    color: var(--brand-primary);
    font-size: 0.9rem;
    margin-left: 6px;
}

.note-item p {
    margin: 0;
}

body.compact-notes .note-item {
    padding: 0.55rem;
    margin-bottom: 0.4rem;
}

body.compact-notes .note-item h4 {
    font-size: 0.92rem;
    margin-bottom: 0.25rem;
}

body.compact-notes .note-item p {
    font-size: 0.72rem;
    white-space: normal;
}

/* Editor Panel */
.editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: transparent;
    position: relative;
    min-height: 50vh;
    min-width: 0;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.editor-toolbar-minimal {
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    gap: 1rem;
}

.editor-meta-minimal {
    display: flex;
    gap: 0.75rem;
    flex: 1;
}

.note-meta-info {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.35rem 0.6rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    font-size: 0.8rem;
    white-space: nowrap;
    min-width: 0;
}

.note-meta-info>span {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.note-meta-info svg {
    width: 14px;
    height: 14px;
    opacity: 0.9;
}

.note-meta-text {
    max-width: 11ch;
    overflow: hidden;
    text-overflow: ellipsis;
}

.meta-input-minimal {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    flex: 1;
    max-width: 200px;
}

.meta-input-minimal:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
    transform: scale(1.02);
}

.editor-actions-minimal {
    display: flex;
    gap: 0.5rem;
}

.btn-tool-minimal {
    min-width: 40px;
    min-height: 40px;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.btn-tool-minimal:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.btn-tool-minimal svg {
    width: 16px;
    height: 16px;
}

.status-badge {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
}

.status-badge.saved {
    color: var(--text-success);
    background: rgba(74, 222, 128, 0.1);
}

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

.btn-tool {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 600;
}

.btn-tool:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.btn-tool.danger:hover {
    background: rgba(248, 113, 113, 0.2);
    color: var(--text-danger);
}

.divider-v {
    width: 1px;
    height: 20px;
    background: var(--border-subtle);
    margin: 0 0.5rem;
}

.meta-inputs {
    display: flex;
    gap: 0.5rem;
    margin-right: 1rem;
}

.meta-input {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: 4px;
    padding: 4px 8px;
    color: var(--text-secondary);
    font-size: 0.8rem;
    width: 100px;
}

.meta-input:focus {
    border-color: var(--brand-primary);
    color: white;
    width: 140px;
}

.sidebar-divider {
    height: 1px;
    background: var(--border-subtle);
    width: 40px;
    margin: 1rem 0;
}

.nav-folders {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    align-items: center;
    overflow-y: auto;
    max-height: 300px;
}

.folder-item {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    font-weight: 600;
    text-transform: uppercase;
}

.folder-item:hover {
    background: var(--bg-glass-high);
    color: white;
}

.folder-item.active {
    background: var(--brand-primary);
    color: white;
}

.editor-canvas {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: clamp(1.5rem, 2.5vw, 3rem) clamp(1.25rem, 4vw, 4rem);
    overflow-y: auto;
    max-width: var(--editor-max);
    margin: 0 auto;
    width: 100%;
}

.editor-input-title {
    background: transparent;
    border: none;
    box-shadow: none;
    font-size: 2.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    padding: 0;
    margin-bottom: 1.5rem;
    font-family: var(--font-sans);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.editor-input-title:focus {
    outline: none;
    box-shadow: none;
    border: none;
    transform: translateY(-2px);
}

.editor-input-title::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
    transition: opacity 0.2s;
}

.editor-input-title:focus::placeholder {
    opacity: 0.3;
}

.editor-input-body {
    flex: 1;
    background: transparent;
    border: none;
    resize: none;
    font-family: var(--font-sans);
    font-size: 1.125rem;
    line-height: 1.75;
    color: #e4e4e7;
    padding: 0;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.editor-input-body:focus {
    outline: none;
}

.editor-input-body::placeholder {
    color: var(--text-secondary);
    opacity: 0.5;
    transition: opacity 0.2s;
}

.editor-input-body:focus::placeholder {
    opacity: 0.3;
}

/* Attachments */
.note-attachments {
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: grid;
    gap: 1rem;
}

.attachments-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.attachments-header h3 {
    margin: 0;
    font-size: 1rem;
}

.btn-attach-secondary {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0.9rem;
}

.attachments-list {
    display: grid;
    gap: 0.75rem;
}

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

.attachment-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: center;
    padding: 0.85rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.02);
}

.attachment-meta {
    display: grid;
    gap: 0.3rem;
}

.attachment-name {
    font-weight: 600;
    font-size: 0.95rem;
}

/* --- SECURE SCANNER --- */
.scanner-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.scanner-viewport {
    position: relative;
    width: 100%;
    height: 300px;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

#doc-scanner-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scanner-overlay {
    position: absolute;
    inset: 20px;
    border: 2px dashed rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    pointer-events: none;
    box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.5);
}

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

#scanner-processing {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--brand-primary);
    font-weight: 600;
}

.loader-pulse.small {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

.attachment-subtitle {
    color: var(--text-secondary);
    font-size: 0.8rem;
}

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

.btn-delete-attachment {
    color: var(--text-secondary);
    transition: all 0.2s ease;
}

.btn-delete-attachment:hover {
    color: var(--text-danger);
    background: rgba(248, 113, 113, 0.1);
    transform: scale(1.05);
}

.btn-delete-attachment i {
    pointer-events: none;
}

.attachment-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.attachment-progress-bar {
    width: 80px;
    height: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.attachment-progress-bar span {
    display: block;
    height: 100%;
    background: var(--brand-primary);
    width: 0%;
    transition: width 0.2s ease;
}

/* Command Palette */
#command-palette {
    position: fixed;
    inset: 0;
    backdrop-filter: blur(5px);
    background: rgba(0, 0, 0, 0.6);
    z-index: 100;
    display: flex;
    justify-content: center;
    padding-top: 15vh;
}

.palette-container {
    width: 600px;
    max-height: 50vh;
    background: #18181b;
    /* solid zinc 900 */
    border: 1px solid var(--border-active);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.palette-input {
    background: transparent;
    border: none;
    padding: 1.5rem;
    font-size: 1.25rem;
    color: white;
    border-bottom: 1px solid var(--border-subtle);
}

.palette-results {
    overflow-y: auto;
    padding: 0.5rem;
}

.palette-item {
    padding: 1rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    justify-content: space-between;
}

.palette-item:hover,
.palette-item.selected {
    background: var(--brand-primary);
    color: white;
}

/* Toasts */
#toast-container {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 300;
}

.toast {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-left: 3px solid var(--brand-primary);
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    opacity: 0;
    transform: translateX(100px) scale(0.9);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1) backwards;
}

.toast.visible {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.toast-success {
    border-left-color: var(--text-success);
}

.toast-error {
    border-left-color: var(--text-danger);
}

.toast-info {
    border-left-color: var(--brand-primary);
}

/* --- FOCUS MODE --- */
body.focus-mode-active #vault-screen .sidebar,
body.focus-mode-active #vault-screen .list-panel,
body.focus-mode-active #vault-screen .editor-toolbar,
body.focus-mode-active #vault-screen .editor-toolbar-minimal,
body.focus-mode-active #mobile-topbar {
    display: none !important;
}

body.focus-mode-active #vault-screen .editor-panel {
    width: 100%;
    max-width: 800px;
    /* Keep it readable on large screens */
    margin: 0 auto;
    border-left: none;
    border-right: none;
    height: 100vh;
    height: 100dvh;
}

body.focus-mode-active #vault-screen {
    background: var(--bg-base);
    /* Solid background for focus */
}

body.focus-mode-active .editor-canvas {
    padding-top: 10vh;
}

#btn-exit-focus-mode {
    position: fixed;
    top: 1.5rem;
    right: 1.5rem;
    z-index: 1000;
    display: none;
    /* Hidden by default */
}

body.focus-mode-active #btn-exit-focus-mode {
    display: flex;
}

/* App Blur Security */
body.app-blurred #vault-screen {
    filter: blur(12px);
    opacity: 0.6;
    pointer-events: none;
    transition: all 0.3s ease;
}

/* SAFE VIEW */
body.safe-view-mode {
    filter: blur(15px) grayscale(100%);
    filter: blur(15px) grayscale(80%);
    pointer-events: none;
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-active);
    border-radius: 34px;
    transition: .4s;
}

.toggle-label:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    transition: .4s;
}

.toggle-input:checked+.toggle-label {
    background-color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.toggle-input:checked+.toggle-label:before {
    transform: translateX(22px);
    background-color: white;
}

.logo-badge {
    width: 96px;
    height: 96px;
    margin: 0 auto 12px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, rgba(0, 255, 156, 0.3), rgba(59, 130, 246, 0.15));
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.05);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}

.app-logo {
    width: 72px;
    height: 72px;
    display: block;
    filter: drop-shadow(0 0 14px rgba(0, 255, 156, 0.65));
}

/* --- RECOVERY KEY MODAL --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    z-index: 200;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: none;
}

.modal-content {
    width: 100%;
    max-width: 480px;
    padding: 2rem;
    border-radius: var(--radius-lg);
}

.modal-overlay:not(.hidden) {
    pointer-events: all;
}

.modal-overlay#generated-password-modal,
.modal-overlay#password-history-delete-modal {
    z-index: 1200;
}

.modal-content h2 {
    margin-top: 0;
    font-size: 1.5rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin: 1rem 0 0.5rem;
}

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

.danger-zone {
    background: rgba(248, 113, 113, 0.06);
    border: 1px solid rgba(248, 113, 113, 0.2);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.warning-text {
    color: var(--text-danger);
    background: rgba(248, 113, 113, 0.1);
    border-left: 3px solid var(--text-danger);
    padding: 1rem;
    font-size: 0.9rem;
    margin: 1.5rem 0;
    border-radius: var(--radius-sm);
}

.recovery-key-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin-bottom: 2rem;
}

#recovery-key-display {
    transition: filter 0.2s ease;
    flex: 1;
    font-family: var(--font-mono);
    font-size: 1rem;
    color: var(--text-primary);
    word-break: break-all;
    margin: 0;
}

.blurred-text {
    filter: blur(8px);
    user-select: none;
    pointer-events: none;
}

.recovery-display-wrapper {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: var(--radius-sm);
    padding-right: 2.5rem;
}

.recovery-display-wrapper #toggle-recovery-visibility {
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
}

.recovery-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.border-subtle {
    border: 1px solid var(--border-subtle);
}

.rounded {
    border-radius: var(--radius-sm);
}

/* Settings Modal */
.settings-modal {
    width: min(980px, 96vw);
    max-width: 96vw;
    height: 92vh;
    height: 92dvh;
    display: flex;
    flex-direction: column;
}

/* Checklist panel (auto-detected from "- [ ]" lines) */
.checklist-panel {
    margin-top: 12px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.10);
    backdrop-filter: blur(10px);
}

.checklist-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}

.checklist-title {
    display: flex;
    align-items: baseline;
    gap: 10px;
}

.checklist-title h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.checklist-progress {
    font-size: 12px;
    opacity: 0.8;
}

.checklist-actions {
    display: flex;
    gap: 8px;
}

.btn-checklist {
    padding: 6px 10px;
    font-size: 12px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: inherit;
    cursor: pointer;
}

.btn-checklist:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.checklist-items {
    display: grid;
    gap: 8px;
}

.checklist-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.12);
}

.checklist-item input[type="checkbox"] {
    margin-top: 2px;
    width: 16px;
    height: 16px;
    accent-color: var(--brand-primary);
}

.checklist-text {
    flex: 1;
    font-size: 13px;
    line-height: 1.35;
    word-break: break-word;
}

.checklist-item.is-done .checklist-text {
    opacity: 0.65;
    text-decoration: line-through;
}

.checklist-hint {
    margin-top: 10px;
    font-size: 12px;
    opacity: 0.7;
}

.settings-modal .modal-header {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(24, 24, 27, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-subtle);
}

#close-settings-modal {
    width: 40px;
    height: 40px;
    border-radius: 999px;
}

.settings-admin-entry {
    padding: 0 2rem 1rem;
}

.settings-admin-entry .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.admin-panel {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.admin-card {
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: rgba(255, 255, 255, 0.02);
}

.admin-invite .admin-actions-grid {
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.admin-card h3 {
    margin: 0 0 1rem 0;
    font-size: 1.1rem;
}

.admin-metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.95rem;
}

.admin-metric:last-child {
    border-bottom: none;
}

.admin-users-list {
    display: grid;
    gap: 0.75rem;
}

.admin-user-row {
    display: grid;
    gap: 0.35rem;
    padding: 0.75rem 1rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
}

.admin-user-row strong {
    font-size: 1rem;
}

.admin-actions-grid {
    display: grid;
    gap: 0.75rem;
}

.admin-tags-list {
    display: grid;
    gap: 0.6rem;
}

.admin-tag-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0.9rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.9rem;
}

.admin-activity-list {
    display: grid;
    gap: 0.5rem;
}

.admin-activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.85rem;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    font-size: 0.85rem;
}

@media (max-width: 900px) {
    .settings-admin-entry {
        padding: 0 1rem 1rem;
    }

    .admin-panel {
        padding: 1.25rem;
    }

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

.settings-tabs {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    flex-wrap: wrap;
}

.settings-tab {
    padding: 0.65rem 0.95rem;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.95rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.settings-tab svg {
    width: 16px;
    height: 16px;
}

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

.settings-tab.active {
    background: rgba(59, 130, 246, 0.22);
    color: var(--text-primary);
    border: 1px solid rgba(59, 130, 246, 0.35);
}

.settings-tab.active svg {
    color: var(--brand-primary);
}

.settings-tab:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.settings-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.settings-content.hidden {
    display: none;
}

.settings-content h3 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
}

.settings-content h4 {
    margin: 1.5rem 0 1rem 0;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

/* Recovery Methods */
.recovery-methods-list {
    margin-bottom: 2rem;
}

.recovery-method-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
}

.recovery-method-item .method-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.recovery-method-item .method-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-primary);
    flex-shrink: 0;
}

.recovery-method-item .method-icon svg {
    width: 18px;
    height: 18px;
}

.recovery-method-item strong {
    display: block;
    margin-bottom: 0.25rem;
}

.recovery-method-item p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge.success {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.badge.warning {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

/* Recovery Actions */
.recovery-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.recovery-action-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all 0.2s;
}

.recovery-action-card:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--brand-primary);
}

.recovery-action-card .action-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.recovery-action-card .action-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.recovery-action-card .action-icon svg {
    width: 18px;
    height: 18px;
}

.recovery-action-card strong {
    display: block;
    margin-bottom: 0.25rem;
}

.recovery-action-card p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.recovery-test {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
}

/* Backup Codes */
.backup-codes-container {
    margin: 1.5rem 0;
}

.backup-codes-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 1.5rem;
    background: rgba(0, 0, 0, 0.3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}

.backup-code-item {
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.95rem;
    text-align: center;
    letter-spacing: 0.5px;
    color: var(--brand-primary);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border-subtle);
}

/* Form Groups */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.input-field {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.2s;
}

.input-field:focus {
    outline: none;
    border-color: var(--brand-primary);
    background: rgba(255, 255, 255, 0.08);
}

.input-field::placeholder {
    color: var(--text-muted);
}

/* Account Recovery */
.recovery-method-selector {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin: 2rem 0;
}

.recovery-method-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 2px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

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

.recovery-method-btn.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.recovery-method-btn .method-icon {
    font-size: 2rem;
}

.recovery-method-form {
    margin-top: 1rem;
}

.recovery-method-form.hidden {
    display: none;
}

#auth-recovery {
    animation: fadeSlideUp 0.45s ease;
}

.recovery-method-btn {
    position: relative;
    overflow: hidden;
    border-color: transparent;
}

.recovery-method-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 0%, rgba(59, 130, 246, 0.35), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.recovery-method-btn:hover::after,
.recovery-method-btn.active::after {
    opacity: 1;
}

.recovery-method-btn.active {
    color: var(--brand-primary);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.25);
}

.recovery-method-btn .method-icon {
    font-size: 2.25rem;
    animation: iconFloat 1.2s ease-in-out infinite alternate;
}

@keyframes fadeSlideUp {
    0% {
        opacity: 0;
        transform: translateY(16px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes iconFloat {
    from {
        transform: translateY(0);
    }

    to {
        transform: translateY(-4px);
    }
}

input[type="file"] {
    width: 100%;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
}

input[type="file"]::file-selector-button {
    padding: 0.5rem 1rem;
    background: var(--brand-primary);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    margin-right: 1rem;
}

input[type="file"]::file-selector-button {
    padding: 0.5rem 1rem;
    background: var(--brand-primary);
    border: none;
    border-radius: 6px;
    color: white;
    cursor: pointer;
    margin-right: 1rem;
}

/* Colored Tag Badges */
.note-tag {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-right: 0.5rem;
    margin-bottom: 0.25rem;
}

.note-tag.color-red {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.note-tag.color-orange {
    background: rgba(249, 115, 22, 0.2);
    color: #f97316;
}

.note-tag.color-yellow {
    background: rgba(234, 179, 8, 0.2);
    color: #eab308;
}

.note-tag.color-green {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.note-tag.color-blue {
    background: rgba(59, 130, 246, 0.2);
    color: #3b82f6;
}

.note-tag.color-purple {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

.note-tag.color-pink {
    background: rgba(236, 72, 153, 0.2);
    color: #ec4899;
}

.note-tag.color-gray {
    background: rgba(107, 114, 128, 0.2);
    color: #6b7280;
}

/* Added for Revoke Device Access button */
.recovery-action-card .btn-secondary.danger {
    background: rgba(248, 113, 113, 0.15);
    border-color: rgba(248, 113, 113, 0.4);
    color: var(--text-danger);
}

.recovery-action-card .btn-secondary.danger:hover {
    background: rgba(248, 113, 113, 0.25);
    border-color: var(--text-danger);
    transform: translateY(-2px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2);
}



/* Password Generator Styles */
.generated-password-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.generated-password-container input {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 1.1rem;
    background: rgba(0, 0, 0, 0.3);
    border-color: var(--border-active);
}

.generated-password-container .btn {
    padding: 0.75rem 1rem;
    width: auto;
}

.password-options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 1rem;
    border-radius: var(--radius-md);
}

.password-options-grid label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
}

.radio-group,
.checkbox-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.radio-group label,
.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.9rem;
}

.toggle-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.toggle-option input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* QR Scanner Modal Styles */
.qr-scanner-container {
    position: relative;
    width: 100%;
    max-width: 320px;
    margin: 0 auto 1rem;
    border-radius: var(--radius-md);
    overflow: hidden;
    border: 2px solid var(--border-subtle);
}

#qr-video {
    width: 100%;
    height: auto;
    display: block;
}

.qr-scanner-overlay {
    position: absolute;
    inset: 0;
    box-shadow: inset 0 0 0 4px var(--brand-primary);
    border-radius: var(--radius-md);
    opacity: 0.6;
}

/* Add a simple animation for the scanner line */
.qr-scanner-overlay::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, transparent, var(--brand-primary), transparent);
    animation: scan-line 3s infinite ease-in-out;
}

@keyframes scan-line {

    0%,
    100% {
        top: 10%;
    }

    50% {
        top: 90%;
    }
}

.ocr-preview {
    min-height: 50px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 0.5rem;
    margin: 1rem 0;
    font-family: var(--font-mono);
    font-size: var(--font-size-sm);
    white-space: pre-wrap;
    word-wrap: break-word;
}

.ocr-modal-content .ocr-scanner-frame {
    width: min(520px, 100%);
    margin: 0 auto;
    aspect-ratio: 4 / 3;
    border-radius: 16px;
    overflow: hidden;
}

.ocr-modal-content #ocr-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Responsive tweaks */
@media (max-width: 900px) {
    :root {
        --mobile-topbar-height: 56px;
        --mobile-footer-height: 72px;
    }

    body {
        height: auto;
        overflow: hidden;
    }

    .floating-panel {
        left: 50%;
        top: auto;
        bottom: calc(1rem + env(safe-area-inset-bottom));
        width: min(92vw, 480px);
        transform: translateX(-50%);
    }

    /* Allow screens to flow naturally on mobile (avoid absolute inset) */
    .screen {
        position: relative;
        inset: auto;
        display: block;
        min-height: 100vh;
        min-height: 100dvh;
    }

    /* Ensure auth screen content is centered on mobile */
    #auth-screen.auth-hero {
        display: flex;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        min-height: 100dvh;
        padding: 1rem;
    }

    .input-row {
        grid-template-columns: 1fr;
    }

    .auth-card,
    .auth-stack {
        padding: 1.5rem;
        padding: 2rem 1.5rem;
        width: 100%;
        max-height: 100%;
        /* Asegura que no exceda la altura del viewport */
        overflow-y: auto;
        /* Permite el desplazamiento si el contenido es demasiado alto */
    }

    .auth-stack {
        border-radius: 16px;
    }

    #vault-screen {
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 100vh;
        min-height: 100dvh;
        left: auto;
        right: auto;
        width: 100%;
        transform: none;
    }

    #mobile-topbar {
        display: flex;
        position: sticky;
        top: 0;
        padding-top: env(safe-area-inset-top);
        min-height: var(--mobile-topbar-height);
        z-index: 15;
        padding-left: 0.75rem;
        padding-right: 0.75rem;
        border-bottom: none;
    }

    /* Hide topbar nav pills in favor of footer */
    .mobile-topbar .nav-pill {
        display: none;
    }

    /* Show Footer */
    .mobile-footer {
        display: flex;
        border-top: none;
    }

    /* Add padding to prevent content overlap with footer */
    .list-panel,
    .editor-panel,
    .dashboard-panel {
        padding-bottom: calc(var(--mobile-footer-height) + env(safe-area-inset-bottom));
    }

    .sidebar {
        display: none;
    }

    .sidebar {
        flex-direction: row;
        width: 100%;
        height: 64px;
        padding: 0.5rem 0.75rem;
        justify-content: space-between;
        gap: 0.75rem;
    }

    .nav-items {
        flex-direction: row;
        gap: 0.5rem;
        justify-content: center;
        width: auto;
    }

    .nav-item {
        width: 44px;
        height: 44px;
    }

    .note-actions-minimal {
        opacity: 1;
    }

    .sidebar-bottom {
        display: none;
    }

    .list-panel {
        width: 100%;
        border-right: none;
        text-align: left;
        /* Ensure content is left-aligned */
        flex: 1;
        min-height: 0;
        overflow: auto;
    }

    .dashboard-panel {
        width: 100%;
        min-height: 0;
        overflow: auto;
    }

    .list-header {
        padding: 0.85rem 1rem;
        text-align: left;
        position: sticky;
        top: 0;
        z-index: 10;
        background: rgba(9, 9, 11, 0.85);
        backdrop-filter: blur(16px);
    }

    .list-header h2 {
        font-size: 1.05rem;
    }

    .search-input-minimal {
        padding: 0.8rem 1rem 0.8rem 2.75rem;
        font-size: 0.95rem;
        border-radius: 12px;
    }

    .search-icon {
        width: 18px;
        height: 18px;
        left: 0.9rem;
    }

    .list-header-actions .btn-icon-minimal,
    .list-header-actions .btn-new-minimal {
        width: 40px;
        height: 40px;
        border-radius: 12px;
    }

    .editor-panel {
        width: 100%;
        min-height: 70vh;
        text-align: left;
    }

    /* Mobile-first writing focus: toolbar becomes sticky, editor gets full-width rhythm */
    .editor-toolbar-minimal {
        position: sticky;
        top: calc(var(--mobile-topbar-height) + env(safe-area-inset-top));
        z-index: 12;
        padding: 0.65rem 1rem;
        gap: 0.75rem;
        flex-direction: column;
        align-items: stretch;
        background: rgba(9, 9, 11, 0.85);
        backdrop-filter: blur(16px);
        transition: transform 0.3s ease, background-color 0.3s ease;
    }

    .editor-meta-minimal {
        flex-direction: column;
        width: 100%;
    }

    .meta-input-minimal {
        max-width: none;
        padding: 0.75rem 0.9rem;
        font-size: 0.95rem;
    }

    .editor-actions-minimal {
        justify-content: flex-start;
        width: 100%;
        overflow-x: auto;
        gap: 0.75rem;
        padding-bottom: 2px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .btn-tool-minimal {
        width: 42px;
        height: 42px;
        border-radius: 10px;
    }

    /* Hide scrollbar in horizontal toolbars for cleaner look */
    .editor-actions-minimal::-webkit-scrollbar {
        display: none;
    }

    .editor-actions-minimal {
        scrollbar-width: none;
    }

    .editor-canvas {
        padding: 1.5rem 1.25rem 6rem;
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }

    .editor-input-title {
        font-size: clamp(1.75rem, 7vw, 2.25rem);
        font-weight: 700;
        line-height: 1.2;
        margin-bottom: 0.75rem;
    }

    .editor-input-body {
        min-height: 40vh;
        font-size: 1.05rem;
        line-height: 1.65;
        color: var(--text-secondary);
    }

    .editor-input-body:focus {
        color: var(--text-primary);
    }

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

    .btn-attach-secondary {
        width: 100%;
        justify-content: center;
    }

    .attachment-item {
        grid-template-columns: 1fr auto;
        align-items: center;
        padding: 0.85rem 1rem;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.05);
        gap: 1rem;
    }

    .attachment-actions {
        width: 100%;
        justify-content: space-between;
        position: static;
        width: auto;
        transform: none;
    }

    .btn-delete-attachment,
    .btn-delete-attachment.ghost {
        width: 44px;
        height: 44px;
        background: rgba(248, 113, 113, 0.15);
        color: var(--text-danger);
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        pointer-events: auto;
        cursor: pointer;
        border: 1px solid rgba(248, 113, 113, 0.2);
        position: relative;
        z-index: 5;
    }

    .scroll-container {
        -webkit-overflow-scrolling: touch;
        min-height: 0;
    }

    .note-item {
        padding: 1rem 1.1rem;
        border-radius: 14px;
        border: none;
        background: rgba(255, 255, 255, 0.04);
    }

    .note-item h4 {
        font-size: 1.05rem;
    }

    .note-preview {
        font-size: 0.85rem;
    }

    /* Increase touch targets and readable sizes */
    button.btn {
        padding: 0.95rem 1rem;
        font-size: 1.05rem;
        border-radius: 10px;
    }

    .btn-icon-primary,
    .btn-icon {
        width: 44px;
        height: 44px;
        font-size: 1.2rem;
    }

    button,
    .btn-icon,
    .btn-icon-minimal,
    .btn-tool-minimal,
    .mobile-nav-item {
        touch-action: manipulation;
    }

    input,
    textarea {
        padding: 0.9rem 1rem;
        font-size: 1rem;
    }

    .nav-item {
        min-width: 48px;
        min-height: 48px;
    }

    /* Allow note previews to wrap on small screens */
    .note-item p {
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
    }

    /* Ensure quick-drop input is thumb-reachable */
    #quick-drop-input {
        height: 50px;
    }

    /* Mobile list + editor state control (JS toggles) */
    body.mobile-editor-active .list-panel {
        display: none;
    }

    body.mobile-editor-active .editor-panel {
        display: flex;
        animation: slideInRightMobile 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    }

    body.mobile-list-active .editor-panel {
        display: none;
    }

    body.mobile-list-active .list-panel {
        display: flex;
        animation: slideInLeftMobile 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    }

    /* Mobile Password Generator Rework */
    #generated-password-modal .modal-content {
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        border: none;
    }

    .generated-password-container {
        flex-direction: column;
        margin-bottom: 2rem;
    }

    .generated-password-container input {
        font-size: 1.75rem;
        text-align: center;
        padding: 1.5rem 1rem;
        height: auto;
        margin-bottom: 1rem;
        width: 100%;
        border-radius: 16px;
        background: rgba(0, 0, 0, 0.2);
    }

    .generated-password-container .btn {
        width: 100%;
        padding: 1rem;
        font-size: 1.1rem;
    }

    .password-options-grid {
        grid-template-columns: 1fr;
        gap: 1.25rem;
        padding: 1.5rem;
        background: rgba(255, 255, 255, 0.02);
    }

    input[type=range] {
        height: 32px;
        width: 100%;
    }

    /* Mobile Topbar State Changes */
    body.mobile-editor-active #mobile-topbar .topbar-actions,
    body.mobile-editor-active #btn-mobile-menu {
        display: none;
    }

    .mobile-back-btn {
        display: none;
    }

    body.mobile-editor-active .mobile-back-btn {
        display: flex;
        margin-right: 0.5rem;
    }
}

.editor-undo-redo {
    opacity: 0;
    pointer-events: none;
    transform: translateY(-2px);
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.editor-panel:hover .editor-undo-redo,
.editor-panel:focus-within .editor-undo-redo {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.btn-tool-minimal:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Tablet and medium screens (768px to 1024px) */
@media (max-width: 1024px) and (min-width: 768px) {
    .sidebar {
        width: 60px;
    }

    .list-panel {
        width: 280px;
    }

    .editor-toolbar {
        padding: 1rem 1.5rem;
    }

    .editor-canvas {
        padding: 1.5rem;
    }

    .auth-stack {
        width: min(480px, 90vw);
        padding: 2rem;
    }

    .logo-ring {
        width: 88px;
        height: 88px;
    }

    .auth-card .brand-title,
    .auth-stack .brand-title {
        font-size: 1.8rem;
    }

    /* Adjust auth choice actions for tablets */
    .auth-choice-actions {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .auth-choice-actions .btn {
        min-height: 48px;
    }

    /* Adjust button sizes for tablets */
    .btn-icon-primary,
    .btn-icon {
        width: 36px;
        height: 36px;
        font-size: 1.1rem;
    }

    /* Better touch targets for tablets */
    .nav-pill {
        padding: 0.6rem 1rem;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .btn-tool {
        min-width: 44px;
        min-height: 44px;
    }

    /* Improve readability on tablets */
    .note-item h4 {
        font-size: 1.1rem;
    }

    .note-item p {
        font-size: 0.9rem;
    }

    /* Dashboard adjustments for tablets */
    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
        gap: 1.25rem;
    }

    .dashboard-panel {
        padding: 1.5rem;
    }

    .dashboard-header h1 {
        font-size: 2rem;
    }
}

/* Large tablets and small laptops (1024px to 1200px) */
@media (max-width: 1200px) and (min-width: 1024px) {
    .sidebar {
        width: 65px;
    }

    .list-panel {
        width: 300px;
    }

    .editor-toolbar {
        padding: 1rem 1.75rem;
    }

    .editor-canvas {
        padding: 1.75rem;
    }
}

/* Center the main workspace on larger screens */
@media (min-width: 1280px) {
    #vault-screen {
        left: 50%;
        right: auto;
        width: min(100%, var(--layout-max));
        transform: translateX(-50%);
    }
}

/* Extra large screens (1440px+) */
@media (min-width: 1440px) {
    :root {
        --editor-max: 1100px;
        --layout-pad: clamp(1.5rem, 3vw, 3rem);
    }

    .sidebar {
        width: 80px;
    }

    .list-panel {
        width: 360px;
    }

    .editor-toolbar {
        padding: 1.25rem 2.5rem;
    }

    .editor-canvas {
        padding: 2.5rem;
    }

    .auth-stack {
        width: min(560px, 85vw);
        padding: 2.5rem 3rem;
    }

    .logo-ring {
        width: 104px;
        height: 104px;
    }

    .auth-card .brand-title,
    .auth-stack .brand-title {
        font-size: 2.2rem;
    }

    .dashboard-panel {
        padding: 2.5rem;
    }

    .dashboard-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 2rem;
    }

    .dashboard-card {
        padding: 2rem;
    }

    .dashboard-section {
        padding: 2rem;
    }
}

/* Ultra-wide screens (1920px+) */
@media (min-width: 1920px) {
    :root {
        --editor-max: 1200px;
        --layout-max: 1680px;
    }

    .sidebar {
        width: 90px;
    }

    .list-panel {
        width: 400px;
    }

    .editor-panel {
        max-width: 1200px;
        margin: 0 auto;
    }

    .auth-stack {
        width: min(600px, 80vw);
        padding: 3rem 3.5rem;
    }

    .dashboard-panel {
        max-width: 1400px;
        margin: 0 auto;
    }
}

/* Mobile sidebar overlay behavior */
@media (max-width: 900px) {
    .sidebar {
        display: flex;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 270px;
        padding: 1rem 0.75rem;
        transform: translateX(calc(-100% - 12px));
        opacity: 0;
        pointer-events: none;
        transition: transform 0.22s ease, box-shadow 0.22s ease, opacity 0.18s ease;
        z-index: 25;
        flex-direction: column;
        justify-content: flex-start;
        box-shadow: none;
    }

    body.mobile-sidebar-open .sidebar {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
        box-shadow: 8px 0 30px rgba(0, 0, 0, 0.6);
    }

    .mobile-nav-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        z-index: 24;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.2s ease;
    }

    .mobile-nav-backdrop.visible {
        opacity: 1;
        pointer-events: auto;
    }

    .nav-items {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
        gap: 0.5rem;
    }

    .nav-item {
        width: 100%;
        min-height: 56px;
        padding: 0.75rem 1rem;
        justify-content: flex-start;
        gap: 1rem;
        font-size: 1rem;
    }
}

@media (min-width: 901px) {
    .mobile-footer {
        display: none !important;
    }
}

/* --- MOBILE CONTEXT MENU --- */
.mobile-context-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    backdrop-filter: blur(4px);
}

.mobile-context-menu-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.mobile-context-menu {
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    border-radius: 20px 20px 0 0;
    padding: 1.5rem;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: 70vh;
    overflow-y: auto;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
}

.mobile-context-menu-overlay.visible .mobile-context-menu {
    transform: translateY(0);
}

.ctx-header {
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1.1rem;
}

.ctx-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 0.5rem;
    color: var(--text-primary);
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-size: 1rem;
    border-radius: 12px;
    transition: background 0.2s;
}

.ctx-item:active {
    background: var(--bg-glass-high);
}

.ctx-item svg {
    width: 20px;
    height: 20px;
    color: var(--text-secondary);
}

.ctx-item.danger {
    color: var(--text-danger);
}

.ctx-item.danger svg {
    color: var(--text-danger);
}

/* Extra small devices (phones, 480px and down) */
@media (max-width: 480px) {

    /* Smaller Logo */
    .logo-ring {
        width: 80px;
        height: 80px;
    }

    .logo-ring .app-logo {
        width: 48px;
        height: 48px;
    }

    .auth-brand .brand-title {
        font-size: 1.75rem;
    }

    .auth-brand .subtitle {
        font-size: 0.9rem;
        margin-bottom: 2rem;
    }

    /* Smaller Textboxes/Inputs */
    input,
    textarea {
        padding: 0.75rem;
        font-size: 0.9rem;
    }

    /* Smaller Buttons */
    button.btn {
        padding: 0.8rem;
        font-size: 0.95rem;
    }

    /* Auth Stack Compactness */
    .auth-stack {
        padding: 1.5rem 1rem;
        gap: 1rem;
    }

    .auth-actions {
        flex-direction: column;
        gap: 0.25rem;
        align-items: center;
        width: 100%;
    }

    .form-title {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }

    /* Adjust list header for small screens */
    .list-header h2 {
        font-size: 1rem;
    }

    /* Editor title smaller */
    .editor-input-title {
        font-size: 1.5rem;
    }

    /* Mobile topbar adjustments */
    .mobile-topbar {
        padding: calc(0.35rem + env(safe-area-inset-top)) 0.75rem 0.5rem;
        justify-content: space-between;
        align-items: center;
    }

    .topbar-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        z-index: 1;
    }

    .topbar-logo img {
        width: 32px;
        height: 32px;
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    }

    .topbar-actions {
        flex: 1;
        justify-content: center;
        gap: 0.25rem;
    }

    .nav-pill {
        padding: 0.5rem 0.75rem;
        font-size: 0.9rem;
        min-width: 60px;
        text-align: center;
    }

    /* Dashboard adjustments for small screens */
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .dashboard-card {
        padding: 1rem;
    }

    .dashboard-section {
        grid-column: span 1;
        padding: 1rem;
    }

    /* Bottom nav: keep tap targets clean on very small widths */
    .mobile-footer .label {
        display: none;
    }

    .mobile-nav-item svg {
        margin-bottom: 0;
    }
}

/* Landscape phones and small tablets */
@media (max-width: 767px) and (orientation: landscape) {
    .auth-stack {
        padding: 1.25rem;
        width: min(450px, 95vw);
    }

    .logo-ring {
        width: 72px;
        height: 72px;
    }

    .logo-ring .app-logo {
        width: 40px;
        height: 40px;
    }

    .auth-card .brand-title,
    .auth-stack .brand-title {
        font-size: 1.5rem;
    }

    .editor-input-title {
        font-size: 1.4rem;
    }

    .editor-input-body {
        min-height: 150px;
    }
}

/* Recording Pulse Animation */
.recording-pulse {
    color: var(--text-danger) !important;
    animation: pulse-red 1.5s infinite;
    background: rgba(248, 113, 113, 0.1) !important;
    border-color: var(--text-danger) !important;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(248, 113, 113, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(248, 113, 113, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(248, 113, 113, 0);
    }
}

/* Markdown Toolbar */
.markdown-toolbar {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.btn-md-tool {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-md-tool:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

.btn-md-tool.active,
.btn-md-tool[aria-pressed="true"] {
    background: rgba(59, 130, 246, 0.16);
    color: var(--text-primary);
    box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.28);
}

.btn-md-tool:focus-visible {
    outline: none;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}

.btn-md-tool svg {
    width: 18px;
    height: 18px;
}

.unsaved-guard {
    margin-left: auto;
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.35rem 0.5rem;
    border-radius: 12px;
    border: 1px solid rgba(248, 113, 113, 0.24);
    background: rgba(248, 113, 113, 0.08);
    color: var(--text-primary);
}

.unsaved-guard.visible {
    display: inline-flex;
}

.unsaved-guard-text {
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
}

.unsaved-guard-actions {
    display: inline-flex;
    gap: 0.35rem;
}

/* Session Timeout Indicator */
.session-timeout-indicator {
    margin-top: auto;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-warning);
    background: rgba(251, 191, 36, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(251, 191, 36, 0.3);
    opacity: 0;
    transform: translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.session-timeout-indicator.visible {
    opacity: 1;
    transform: translateY(0);
}

.session-timeout-indicator.critical {
    color: var(--text-danger);
    background: rgba(248, 113, 113, 0.1);
    border-color: rgba(248, 113, 113, 0.3);
    animation: pulse 1s infinite;
}

/* Shake Animation */
.shake-animation {
    animation: shake 0.5s cubic-bezier(.36, .07, .19, .97) both;
}

@keyframes shake {

    10%,
    90% {
        transform: translate3d(-1px, 0, 0);
    }

    20%,
    80% {
        transform: translate3d(2px, 0, 0);
    }

    30%,
    50%,
    70% {
        transform: translate3d(-4px, 0, 0);
    }

    40%,
    60% {
        transform: translate3d(4px, 0, 0);
    }
}

/* --- MOBILE SETTINGS SHEET --- */
@media (max-width: 900px) {

    /* Ensure <dialog> defaults don't constrain the settings sheet */
    #settings-modal.modal-overlay {
        padding: 0;
        margin: 0;
        border: none;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        justify-content: stretch;
        align-items: stretch;
    }

    #settings-modal.modal-overlay::backdrop {
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: blur(10px);
    }

    .modal-content.settings-modal {
        position: relative;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        margin: 0;
        transform: translateY(100%);
        display: flex;
        flex-direction: column;
        border-bottom: none;
        overflow: hidden;
        transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .modal-overlay:not(.hidden) .modal-content.settings-modal {
        transform: translateY(0);
        animation: none;
        /* Override default floatIn */
    }

    .settings-modal .modal-header {
        flex-shrink: 0;
        cursor: grab;
        /* Hint for swipe */
        padding-top: calc(1rem + env(safe-area-inset-top));
    }

    .settings-modal .settings-content-container {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
        /* Safe area */
    }

    .settings-tabs {
        display: none;
    }

    .settings-accordion {
        display: grid;
        gap: 0.75rem;
        padding: 0 1rem 1rem;
    }

    .settings-accordion-item {
        border: 1px solid var(--border-subtle);
        border-radius: 14px;
        background: rgba(255, 255, 255, 0.02);
        overflow: hidden;
    }

    .settings-accordion-toggle {
        width: 100%;
        padding: 0.9rem 1rem;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.75rem;
        background: transparent;
        border: none;
        color: var(--text-primary);
        font-size: 1rem;
        font-weight: 600;
        cursor: pointer;
    }

    .settings-accordion-toggle span {
        display: inline-flex;
        align-items: center;
        gap: 0.5rem;
    }

    .settings-accordion-toggle i {
        transition: transform 0.2s ease;
    }

    .settings-accordion-item.open .settings-accordion-toggle i {
        transform: rotate(180deg);
    }

    .settings-accordion-content {
        padding: 0 1rem 1rem;
    }

    .settings-accordion-content.hidden {
        display: none;
    }

    /* --- MOBILE QUICK MENU (FULLSCREEN) --- */
    /* Ensure <dialog> defaults don't constrain the fullscreen sheet */
    #mobile-footer-menu-modal.modal-overlay {
        padding: 0;
        margin: 0;
        border: none;
        width: 100%;
        max-width: 100%;
        height: 100vh;
        height: 100dvh;
        max-height: 100vh;
        max-height: 100dvh;
        justify-content: stretch;
        align-items: stretch;
    }

    #mobile-footer-menu-modal.modal-overlay::backdrop {
        background: rgba(0, 0, 0, 0.6);
        backdrop-filter: none;
    }

    .modal-content.mobile-footer-menu-sheet {
        position: relative;
        inset: auto;
        width: 100%;
        max-width: 100%;
        height: 100%;
        max-height: 100%;
        border-radius: 0;
        margin: 0;
        display: flex;
        flex-direction: column;
        padding: 0;
        overflow: hidden;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    }

    .modal-overlay:not(.hidden) .modal-content.mobile-footer-menu-sheet {
        transform: translateY(0);
        animation: none;
    }

    .mobile-footer-menu-sheet .modal-header {
        position: sticky;
        top: 0;
        z-index: 2;
        background: rgba(24, 24, 27, 0.95);
        backdrop-filter: none;
        border-bottom: 1px solid var(--border-subtle);
        padding-top: calc(0.75rem + env(safe-area-inset-top));
    }

    .mobile-footer-menu-sheet .mobile-footer-menu-content {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.75rem 1rem calc(1.25rem + env(safe-area-inset-bottom));
        display: grid;
        gap: 0.75rem;
    }

    /* Make actions easier to read/tap on small screens */
    .mobile-footer-menu-sheet .settings-action {
        padding: 1rem;
        border-radius: 14px;
    }

    .mobile-footer-menu-sheet .settings-action-title {
        font-size: 1rem;
    }

    .mobile-footer-menu-sheet .settings-action-desc {
        font-size: 0.9rem;
        line-height: 1.25rem;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2),
(min-resolution: 192dpi) {
    .logo-ring {
        border-width: 0.5px;
    }

    .glass-panel {
        border-width: 0.5px;
    }
}

/* Print styles */
@media print {

    .sidebar,
    .mobile-topbar,
    .editor-toolbar {
        display: none !important;
    }

    .list-panel,
    .editor-panel {
        width: 50% !important;
        border: none !important;
    }

    .note-item {
        break-inside: avoid;
        border: 1px solid #ccc !important;
        background: white !important;
        color: black !important;
    }

    .editor-input-title {
        color: black !important;
        border-bottom: 1px solid #ccc;
        padding-bottom: 0.5rem;
        margin-bottom: 1rem;
    }

    .editor-input-body {
        color: black !important;
        white-space: pre-wrap;
    }
}

/* ADDITIVE SETTINGS STYLES */
.mt-1 {
    margin-top: 1rem !important;
}

.settings-section {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-subtle);
    border-radius: 12px;
}

.status-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
}

.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
}

.status-indicator.status-online {
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}

.status-indicator.status-offline {
    background: #f87171;
}

.status-indicator.status-ok {
    background: #3b82f6;
}

.status-indicator.status-warning {
    background: #fbbf24;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.status-indicator.status-secure {
    background: #a855f7;
    box-shadow: 0 0 8px rgba(168, 85, 247, 0.5);
}

.activity-logs {
    max-height: 200px;
    overflow-y: auto;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin: 0.5rem 0;
}

.log-item {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.log-item:last-child {
    border-bottom: none;
}

.log-item.empty {
    justify-content: center;
    color: var(--text-muted);
    font-style: italic;
    padding: 2rem;
}

.log-time {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.log-action {
    color: var(--text-primary);
    font-weight: 500;
}

@keyframes slideInRightMobile {
    from {
        transform: translateX(100%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Confirmation Modal */
.modal-content.confirmation {
    max-width: 380px;
    text-align: center;
}

.confirmation-body {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.confirmation-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(248, 113, 113, 0.15);
    color: var(--text-danger);
    display: grid;
    place-items: center;
    margin-bottom: 0.5rem;
}

.confirmation-icon svg {
    width: 28px;
    height: 28px;
}

.confirmation-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.confirmation-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.confirmation-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}

/* Cache Settings */
.settings-cache-control {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.cache-stats-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}

.cache-stats-row strong {
    color: var(--text-primary);
    font-family: var(--font-mono);
}

/* Bulk Selection Mode */
.note-select-checkbox {
    display: none;
    /* Hidden by default */
    width: 20px;
    height: 20px;
    margin-right: 1rem;
    accent-color: var(--brand-primary);
    cursor: pointer;
}

body.selection-mode .note-select-checkbox {
    display: block;
}

body.selection-mode .note-item {
    display: flex;
    align-items: center;
    padding-left: 1rem;
}

/* Ensure content doesn't overlap checkbox */
body.selection-mode .note-item-content {
    flex: 1;
    min-width: 0;
}

/* Bulk Action Bar (Overlays List Header) */
.bulk-action-bar {
    position: absolute;
    inset: 0;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    z-index: 15;
    /* Lower than header actions to keep Select button clickable if needed */
    border-bottom: 1px solid var(--border-subtle);
    animation: fadeIn 0.2s ease forwards;
}

.bulk-action-bar.hidden {
    display: none;
}

.bulk-selection-info {
    font-weight: 600;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bulk-actions {
    display: flex;
    gap: 0.5rem;
}

.bulk-actions .btn-icon-minimal {
    color: var(--text-primary);
}

/* Selection Badge on Toggle Button */
#btn-toggle-select {
    position: relative;
    overflow: visible;
    z-index: 20;
    /* Keep above bulk bar */
}

#btn-toggle-select[data-count]::after {
    content: attr(data-count);
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--brand-primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    height: 18px;
    min-width: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 2px solid var(--bg-surface);
    padding: 0 4px;
    animation: scaleIn 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

#btn-toggle-select[data-count="0"]::after {
    display: none;
}

/* Note Color Coding */
.note-item[data-color] {
    border-left-width: 3px;
}

.note-item[data-color="red"] { border-left-color: #ef4444; background: linear-gradient(90deg, rgba(239, 68, 68, 0.05), rgba(255, 255, 255, 0.02)); }
.note-item[data-color="orange"] { border-left-color: #f97316; background: linear-gradient(90deg, rgba(249, 115, 22, 0.05), rgba(255, 255, 255, 0.02)); }
.note-item[data-color="yellow"] { border-left-color: #eab308; background: linear-gradient(90deg, rgba(234, 179, 8, 0.05), rgba(255, 255, 255, 0.02)); }
.note-item[data-color="green"] { border-left-color: #22c55e; background: linear-gradient(90deg, rgba(34, 197, 94, 0.05), rgba(255, 255, 255, 0.02)); }
.note-item[data-color="blue"] { border-left-color: #3b82f6; background: linear-gradient(90deg, rgba(59, 130, 246, 0.05), rgba(255, 255, 255, 0.02)); }
.note-item[data-color="purple"] { border-left-color: #a855f7; background: linear-gradient(90deg, rgba(168, 85, 247, 0.05), rgba(255, 255, 255, 0.02)); }
.note-item[data-color="pink"] { border-left-color: #ec4899; background: linear-gradient(90deg, rgba(236, 72, 153, 0.05), rgba(255, 255, 255, 0.02)); }
.note-item[data-color="gray"] { border-left-color: #71717a; background: linear-gradient(90deg, rgba(113, 113, 122, 0.05), rgba(255, 255, 255, 0.02)); }

/* Color Picker in Prompt (Optional enhancement for prompt modal if we had custom HTML, 
   but for now we rely on text input/datalist which is functional) */

/* Tag Badges in Note Item (if not already present) */
.note-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.5rem;
}

.note-item-tag {
    font-size: 0.7rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
    font-family: var(--font-mono);
}

@keyframes slideInLeftMobile {
    from {
        transform: translateX(-20%);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Mobile performance safety: strip expensive filters and keep touch scrolling fluid */
@media (max-width: 900px) {
    .note-item {
        touch-action: pan-y;
    }

    .glass-panel,
    .modal-overlay::backdrop,
    .mobile-nav-backdrop,
    #settings-modal.modal-overlay::backdrop,
    #mobile-footer-menu-modal.modal-overlay::backdrop,
    #mobile-footer-menu-modal .modal-content,
    #auth-settings-modal.modal-overlay::backdrop,
    .modal-content {
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
    }

    body.app-blurred #vault-screen {
        filter: none !important;
    }

    .modal-overlay {
        background-color: rgba(0, 0, 0, 0.48);
    }
}
