/* Zyrin Notes - v1.2.36 - Admin Stats Fix */

/* ============================================
   NATIVE APP FEEL - Remove Web-like Behaviors
   ============================================ */

/* Prevent text selection on UI elements */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
}

/* Allow text selection only in editor content */
.note-body,
.note-body *,
.note-title-input,
input[type="text"],
input[type="email"],
input[type="password"],
textarea {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

/* Remove tap highlight on all elements */
* {
    -webkit-tap-highlight-color: transparent;
}

/* Remove focus outlines (use custom focus states instead) */
*:focus {
    outline: none;
}

/* Prevent overscroll bounce/glow */
html, body {
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
}

/* Prevent pull-to-refresh on the whole page */
body {
    overflow: hidden;
}

/* Disable context menu on non-text elements */
.note-row,
.sidebar-item,
.folder-item,
.icon-btn,
.text-btn,
.modal-btn,
button {
    -webkit-touch-callout: none;
}

/* Prevent image dragging */
img {
    -webkit-user-drag: none;
    user-drag: none;
    pointer-events: none;
}

/* Allow pointer events on clickable images */
.attachment-item img,
.image-lightbox img {
    pointer-events: auto;
}

/* Remove default button styling */
button {
    -webkit-appearance: none;
    appearance: none;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

/* Smooth momentum scrolling */
.notes-list,
.notes-section,
.modal-body,
.settings-content,
.sidebar-nav {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

/* Hide scrollbars on mobile (native feel) */
@media (max-width: 767px) {
    ::-webkit-scrollbar {
        display: none;
    }
    
    * {
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
}

/* Disable text cursor on non-editable elements */
.note-row,
.note-row *,
.sidebar-item,
.folder-item,
.header-title,
.selection-count,
label,
span:not([contenteditable]),
p:not([contenteditable]),
h1, h2, h3, h4, h5, h6 {
    cursor: default;
}

/* ============================================ */

:root {
    --bg: #ffffff;
    --bg-secondary: #f2f2f7;
    --text: #000000;
    --text-secondary: #3c3c43;
    --muted: #8e8e93;
    --accent: #007aff;
    --accent-light: rgba(0, 122, 255, 0.1);
    --line: #c6c6c8;
    --line-light: rgba(60, 60, 67, 0.1);
    --danger: #ff3b30;
    --success: #34c759;
    --warning: #ff9500;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-out: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Pull to Refresh */
.pull-to-refresh {
    position: absolute;
    top: -60px;
    left: 0;
    right: 0;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 13px;
    transition: transform 0.2s;
}

.pull-to-refresh svg {
    width: 24px;
    height: 24px;
    margin-right: 8px;
    transition: transform 0.2s;
}

.pull-to-refresh.pulling svg {
    transform: rotate(180deg);
}

.pull-to-refresh.refreshing svg {
    animation: spin 1s linear infinite;
}

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

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: calc(var(--safe-top) + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: var(--warning);
    color: #000;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    z-index: 9999;
    transition: transform 0.3s var(--spring);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.offline-indicator.visible {
    transform: translateX(-50%) translateY(0);
}

.offline-indicator svg {
    width: 16px;
    height: 16px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #000000;
        --bg-secondary: #1c1c1e;
        --text: #ffffff;
        --text-secondary: #ebebf5;
        --muted: #8e8e93;
        --line: #38383a;
        --line-light: rgba(84, 84, 88, 0.35);
        --shadow: 0 1px 3px rgba(0,0,0,0.3);
        --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    }
}

:root[data-theme="dark"] {
    --bg: #000000;
    --bg-secondary: #1c1c1e;
    --text: #ffffff;
    --text-secondary: #ebebf5;
    --muted: #8e8e93;
    --line: #38383a;
    --line-light: rgba(84, 84, 88, 0.35);
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
    font-size: 17px;
    line-height: 1.47;
    background: var(--bg);
    color: var(--text);
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
    -webkit-overflow-scrolling: touch;
    position: fixed;
    width: 100%;
    top: 0;
    left: 0;
    -webkit-touch-callout: none;
}

/* Prevent iOS context menu on non-editable content */
.note-row,
.folder-card,
.tab-item,
.settings-item,
.user-item,
.recording-item,
.attachment-item,
button,
a {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Allow selection only in editable areas */
.note-body,
.note-title-input,
input[type="text"],
input[type="password"],
textarea {
    -webkit-touch-callout: default;
    -webkit-user-select: text;
    user-select: text;
}

#app { 
    height: 100%; 
    position: relative; 
    overflow: hidden;
}

/* Screen Transitions */
.screen {
    position: absolute;
    inset: 0;
    display: none;
    flex-direction: column;
    background: var(--bg);
    z-index: 1;
    will-change: transform, opacity;
    overflow: hidden;
}

.screen.active {
    display: flex;
    z-index: 10;
    animation: screenFadeIn 0.3s var(--ease-out);
}

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

.screen.slide-out {
    animation: none;
    transform: translateX(-30%);
    opacity: 0.3;
    transition: transform 0.35s var(--ease-out), opacity 0.35s var(--ease-out);
    pointer-events: none;
}

#editor-screen.active { animation: slideInRight 0.35s var(--ease-out); }

@keyframes slideInRight {
    from { transform: translateX(100%); }
    to { transform: translateX(0); }
}

.status-bar-spacer { height: var(--safe-top); min-height: 12px; flex-shrink: 0; }

/* Auth */
.auth-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 32px 24px;
    max-width: 340px;
    margin: 0 auto;
    animation: authFadeIn 0.5s var(--ease-out);
}

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

.auth-header { margin-bottom: 40px; text-align: center; }
.auth-icon { display: none; }
.auth-title { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; }
.auth-subtitle { font-size: 17px; color: var(--muted); margin-top: 8px; }
.auth-form { display: flex; flex-direction: column; gap: 0; }
.form-group { position: relative; }

.form-group input {
    width: 100%;
    padding: 16px 0;
    font-size: 17px;
    font-family: inherit;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--line-light);
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus { border-color: var(--accent); }
.form-group input::placeholder { color: var(--muted); }

.auth-error { font-size: 14px; color: var(--danger); min-height: 20px; margin: 16px 0 8px; text-align: center; }

.auth-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    margin-top: 16px;
    font-size: 17px;
    font-weight: 600;
    font-family: inherit;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.15s var(--spring), opacity 0.15s;
}

.auth-submit:active { transform: scale(0.97); opacity: 0.9; }
.auth-submit:disabled { opacity: 0.4; cursor: not-allowed; }

.passkey-icon { flex-shrink: 0; }

.auth-hint {
    margin-top: 24px;
    font-size: 14px;
    color: var(--muted);
    text-align: center;
    line-height: 1.5;
}

.auth-toggle { margin-top: 28px; font-size: 15px; color: var(--muted); text-align: center; }

.text-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: inherit;
    font-family: inherit;
    cursor: pointer;
    padding: 4px;
    margin: -4px;
    transition: opacity 0.15s;
}

.text-btn:active { opacity: 0.6; }
.text-btn.danger { color: var(--danger); }

/* Header */
.glass-header { padding: 12px 20px 16px; background: var(--bg); position: relative; z-index: 50; }
.header-content { display: flex; justify-content: space-between; align-items: center; }
.header-title { font-size: 34px; font-weight: 700; letter-spacing: -0.5px; transition: all 0.2s var(--ease-out); }
.header-actions { display: flex; gap: 8px; align-items: center; }

.icon-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s var(--spring);
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.icon-btn:active { background: var(--accent-light); transform: scale(0.92); }
.icon-btn svg { width: 24px; height: 24px; }

/* Search */
.search-container { max-height: 0; overflow: hidden; padding: 0 20px; transition: max-height 0.3s var(--ease-out), margin 0.3s; }
.search-container.active { max-height: 52px; margin-bottom: 12px; }

.search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-radius: 12px;
    transition: box-shadow 0.2s;
}

.search-bar:focus-within { box-shadow: 0 0 0 3px var(--accent-light); }
.search-bar svg { width: 18px; height: 18px; color: var(--muted); flex-shrink: 0; }

.search-bar input {
    flex: 1;
    font-size: 17px;
    font-family: inherit;
    background: none;
    border: none;
    color: var(--text);
    outline: none;
    min-width: 0;
}

.search-bar input::placeholder { color: var(--muted); }

.search-clear {
    width: 20px;
    height: 20px;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--muted);
    border: none;
    border-radius: 50%;
    color: var(--bg);
    font-size: 12px;
    cursor: pointer;
    transition: transform 0.15s var(--spring);
}

.search-clear.visible { display: flex; }
.search-clear:active { transform: scale(0.85); }

/* Folders */
.folders-section { padding: 0 20px 20px; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.section-header h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.folders-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }

.folder-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--bg);
    border: 1.5px solid var(--line-light);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.2s var(--ease-out);
    -webkit-user-select: none;
    user-select: none;
}

.folder-card:active { transform: scale(0.97); background: var(--bg-secondary); }
.folder-card.active { border-color: var(--accent); background: var(--accent-light); }
.folder-icon { width: 26px; height: 22px; flex-shrink: 0; }
.folder-icon svg { width: 100%; height: 100%; }
.folder-info { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 6px; }
.folder-name { font-size: 15px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.folder-count { font-size: 15px; color: var(--muted); flex-shrink: 0; }

/* Folder edit button */
.folder-edit-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s, background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.folder-card:hover .folder-edit-btn {
    opacity: 1;
}

.folder-edit-btn:hover {
    background: var(--line-light);
    color: var(--text);
}

.folder-edit-btn:active {
    background: var(--bg-tertiary);
}

/* Always show edit button on touch devices */
@media (hover: none) {
    .folder-edit-btn {
        opacity: 0.6;
    }
}

/* Notes Section */
.notes-section {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    padding-bottom: calc(80px + var(--safe-bottom));
    position: relative;
}

.section-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px 10px;
    position: sticky;
    top: 0;
    background: var(--bg);
    z-index: 20;
}

.section-title-row h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.note-count { font-size: 15px; color: var(--muted); }
.notes-list { position: relative; }

.notes-date-group { animation: noteGroupFadeIn 0.3s var(--ease-out); }

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

.notes-date-header { padding: 20px 20px 10px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.notes-date-group:first-child .notes-date-header { padding-top: 8px; }

/* Note Cards */
.note-row {
    position: relative;
    padding: 14px 16px;
    margin: 0 16px 8px;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: background 0.15s, opacity 0.2s, transform 0.2s;
    -webkit-user-select: none;
    user-select: none;
    touch-action: pan-y pinch-zoom;
    border-radius: 12px;
}

.note-row:active {
    background: var(--bg-tertiary);
    transform: scale(0.98);
}

.note-row::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-light);
    opacity: 0;
    transition: opacity 0.15s;
    pointer-events: none;
}

.note-row:active:not(.swiping)::before { opacity: 1; }
.note-row.pinned { background: linear-gradient(90deg, var(--accent) 3px, var(--bg) 3px); }
.note-row-title { font-size: 17px; font-weight: 600; margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-row-meta { display: flex; gap: 10px; font-size: 15px; color: var(--muted); }
.note-row-preview { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.note-row-folder { display: none; }

.note-row.deleting { animation: noteSlideOut 0.3s var(--ease-out) forwards; }

/* Trash Notes */
.trash-folder {
    margin-top: 16px;
    border-top: 1px solid var(--line-light);
    padding-top: 16px;
}

.trash-actions {
    padding: 12px 20px;
    border-bottom: 1px solid var(--line-light);
}

.trash-empty-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--danger);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.trash-empty-btn:active {
    opacity: 0.8;
}

.trash-note {
    position: relative;
}

.trash-note-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.trash-restore-btn,
.trash-delete-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.15s;
}

.trash-restore-btn {
    background: var(--accent);
    color: #fff;
}

.trash-delete-btn {
    background: var(--bg-secondary);
    color: var(--danger);
}

.trash-restore-btn:active,
.trash-delete-btn:active {
    opacity: 0.7;
}

@keyframes noteSlideOut {
    to { transform: translateX(-100%); opacity: 0; height: 0; padding: 0; }
}

/* Empty & Loading */
.empty-state, .loading-state { display: none; flex-direction: column; align-items: center; justify-content: center; padding: 80px 32px; text-align: center; }
.empty-state.visible, .loading-state.visible { display: flex; animation: fadeInUp 0.4s var(--ease-out); }

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

.empty-icon { width: 64px; height: 64px; margin-bottom: 20px; color: var(--muted); opacity: 0.5; }
.empty-state h3 { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.empty-state p { font-size: 16px; color: var(--muted); max-width: 260px; }

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--line-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

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

/* FAB */
/* Old FAB - hidden, replaced by bottom bar compose button */
.fab {
    display: none !important;
}

/* Tab Bar - hidden, replaced by bottom bar */
.tab-bar {
    display: none !important;
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.15s, transform 0.15s var(--spring);
}

.tab-item:active { transform: scale(0.9); }
.tab-item svg { width: 26px; height: 26px; transition: transform 0.2s var(--spring); }
.tab-item span { font-size: 10px; font-weight: 500; }
.tab-item.active { color: var(--accent); }
.tab-item.active svg { transform: scale(1.1); }

/* Editor */
.editor-header { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; min-height: 52px; }
.editor-header-right { display: flex; align-items: center; gap: 4px; margin-left: auto; }

.back-btn {
    display: flex;
    align-items: center;
    gap: 2px;
    font-size: 17px;
    font-family: inherit;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: -8px;
    border-radius: 8px;
    transition: background 0.15s;
}

.back-btn:active { background: var(--accent-light); }
.back-btn svg { width: 24px; height: 24px; }

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

/* Action Menu (dropdown) */
.action-menu {
    position: fixed;
    top: calc(var(--safe-top) + 52px);
    right: 12px;
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 6px;
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    z-index: 150;
    opacity: 0;
    transform: translateY(-8px) scale(0.95);
    pointer-events: none;
    transition: opacity 0.2s, transform 0.2s var(--spring);
}

.action-menu.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.action-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    color: var(--text);
    background: none;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.action-menu-item:active { background: var(--line-light); }
.action-menu-item.danger { color: var(--danger); }
.action-menu-item svg { flex-shrink: 0; }

.action-menu-divider {
    height: 1px;
    background: var(--line-light);
    margin: 6px 0;
}

/* Collaboration - Active Users */
.collab-users {
    display: flex;
    align-items: center;
    margin-right: 8px;
}

/* Editor Sync Status */
.sync-status {
    display: flex;
    align-items: center;
    margin-right: 12px;
    opacity: 0;
    transition: opacity 0.3s;
}

.sync-status.visible {
    opacity: 1;
}

.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
}

.sync-status.syncing .sync-dot {
    background: var(--warning);
    animation: sync-pulse 1s ease-in-out infinite;
}

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

@keyframes sync-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.collab-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
    border: 2px solid var(--bg);
    margin-left: -8px;
    transition: transform 0.2s var(--spring);
}

.collab-avatar:first-child { margin-left: 0; }
.collab-avatar:hover { transform: scale(1.1); z-index: 1; }
.collab-avatar.typing { 
    animation: typing-pulse 1s ease-in-out infinite;
}

@keyframes typing-pulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.4); }
    50% { box-shadow: 0 0 0 4px rgba(255, 255, 255, 0); }
}

.collab-count {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-secondary);
    color: var(--muted);
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: -8px;
    border: 2px solid var(--bg);
}

/* Collaboration - Remote Cursors */
.remote-cursor {
    position: absolute;
    pointer-events: none;
    z-index: 100;
}

.remote-cursor-caret {
    position: absolute;
    width: 2px;
    height: 1.2em;
    animation: cursorBlink 1s ease-in-out infinite;
}

@keyframes cursorBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.remote-cursor-name {
    position: absolute;
    top: -18px;
    left: 0;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.2s, transform 0.2s;
}

.remote-cursor:hover .remote-cursor-name {
    opacity: 1;
    transform: translateY(0);
}

/* Connection status */
.collab-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    margin-right: 8px;
}

.collab-status.connected {
    background: rgba(52, 199, 89, 0.15);
    color: var(--success);
}

.collab-status.connecting {
    background: rgba(255, 149, 0, 0.15);
    color: var(--warning);
}

.collab-status.disconnected {
    background: rgba(255, 59, 48, 0.15);
    color: var(--danger);
}

.collab-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.collab-status.connecting .collab-status-dot {
    animation: pulse 1.5s ease-in-out infinite;
}

.editor-content {
    flex: 1;
    padding: 0 20px;
    padding-top: 0;
    padding-bottom: calc(20px + var(--safe-bottom));
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
}

.note-title-input {
    width: 100%;
    font-size: 28px;
    font-weight: 700;
    font-family: inherit;
    letter-spacing: -0.5px;
    background: none;
    border: none;
    color: var(--text);
    outline: none;
    margin-bottom: 8px;
}

.note-title-input::placeholder { color: var(--muted); }
.note-meta { display: flex; gap: 16px; margin-bottom: 24px; }
.note-date { font-size: 14px; color: var(--muted); }

.note-folder-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 14px;
    font-family: inherit;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: 6px;
    transition: background 0.15s;
}

.note-folder-btn:active { background: var(--line-light); }
.note-folder-btn svg { width: 12px; height: 12px; }
.note-body-container { flex: 1; overflow-y: auto; }
.note-body { font-size: 17px; line-height: 1.6; color: var(--text); outline: none; min-height: 200px; }
.note-body:empty::before { content: attr(placeholder); color: var(--muted); }

/* Images in Notes */
.note-body img.note-image {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 12px 0;
    display: block;
    cursor: pointer;
    transition: opacity 0.15s;
}

.note-body img.note-image:hover {
    opacity: 0.9;
}

.image-loading {
    display: inline-block;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    color: var(--muted);
    font-size: 14px;
    margin: 8px 0;
}

.image-error {
    display: inline-block;
    padding: 8px 16px;
    background: rgba(255, 59, 48, 0.1);
    border-radius: 8px;
    color: var(--danger);
    font-size: 14px;
    margin: 8px 0;
}

/* Search in Note Bar */
.note-search-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--line-light);
}

.note-search-bar.active {
    display: flex;
}

.note-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
}

.note-search-input-wrap svg {
    color: var(--muted);
    flex-shrink: 0;
}

#note-search-input {
    flex: 1;
    border: none;
    background: none;
    font-size: 15px;
    color: var(--text);
    outline: none;
}

#note-search-input::placeholder {
    color: var(--muted);
}

.note-search-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

#note-search-count {
    font-size: 13px;
    color: var(--muted);
    min-width: 40px;
    text-align: center;
}

.note-search-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s;
}

.note-search-btn:active {
    background: var(--line-light);
}

.note-search-highlight {
    background: rgba(255, 204, 0, 0.4);
    border-radius: 2px;
}

.note-search-highlight.current {
    background: rgba(255, 149, 0, 0.6);
}

/* Formatting Toolbar */
.formatting-toolbar {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: 2px;
    height: 48px;
    padding: 0 12px;
    margin: 0 -20px 16px -20px;
    background: var(--bg);
    border-bottom: 0.5px solid var(--line-light);
    overflow-x: auto;
    scrollbar-width: none;
    z-index: 40;
}

.formatting-toolbar::-webkit-scrollbar { display: none; }

.format-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s var(--spring);
}

.format-btn:active { background: var(--line-light); transform: scale(0.92); }
.format-btn.active { color: var(--accent); }
.format-btn svg { width: 20px; height: 20px; }
.format-divider { width: 1px; height: 24px; background: var(--line-light); margin: 0 8px; flex-shrink: 0; }

/* Settings */
.settings-content { flex: 1; padding: 8px 20px; padding-bottom: calc(80px + var(--safe-bottom)); overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch; overscroll-behavior-y: contain; }
.settings-section { margin-bottom: 32px; }
.settings-section h3 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin-bottom: 12px; padding-left: 4px; }
.settings-item { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 0.5px solid var(--line-light); }
.settings-label { font-size: 17px; }
.settings-value { font-size: 17px; color: var(--muted); }

/* Theme Selector */
.settings-item.appearance-selector {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
}

.theme-options {
    display: flex;
    gap: 8px;
    width: 100%;
}

.theme-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--line-light);
    border-radius: 12px;
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s ease;
}

.theme-option:active {
    transform: scale(0.98);
}

.theme-option.active {
    border-color: var(--primary);
    background: rgba(0, 122, 255, 0.1);
}

.theme-option svg {
    opacity: 0.7;
}

.theme-option.active svg {
    opacity: 1;
    color: var(--primary);
}

/* Impersonation Banner */
.impersonation-banner {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: rgba(255, 149, 0, 0.15);
    border: 1px solid rgba(255, 149, 0, 0.3);
    border-radius: 12px;
    margin-bottom: 16px;
}

.impersonation-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    color: var(--warning);
}

.impersonation-info strong {
    color: var(--text);
}

.impersonation-exit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--warning);
    color: #000;
    border: none;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s;
}

.impersonation-exit-btn:active {
    opacity: 0.8;
}

.settings-btn {
    width: 100%;
    padding: 16px;
    font-size: 17px;
    font-family: inherit;
    color: var(--accent);
    background: var(--bg-secondary);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, transform 0.15s var(--spring);
}

.settings-btn:active { background: var(--line-light); transform: scale(0.98); }
.settings-btn.danger { color: var(--danger); }
.settings-btn.primary { color: #fff; background: var(--accent); }
.settings-btn.primary:active { background: #0066d6; }

.settings-btn svg {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: -2px;
}

.settings-description {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 16px;
    line-height: 1.4;
}

.settings-buttons-row {
    display: flex;
    gap: 12px;
}

.settings-buttons-row .settings-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sync Status Card */
.sync-status-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
}

.sync-status-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.sync-status-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--success);
    border-radius: 50%;
    color: #fff;
}

.sync-status-icon.syncing {
    background: var(--accent);
}

.sync-status-icon.syncing svg {
    animation: spin 1s linear infinite;
}

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

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

.sync-status-text {
    flex: 1;
}

.sync-status-label {
    display: block;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 2px;
}

.sync-status-time {
    font-size: 13px;
    color: var(--muted);
}

.sync-status-counts {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.sync-count-item {
    background: var(--bg);
    padding: 10px 12px;
    border-radius: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sync-count-label {
    font-size: 14px;
    color: var(--muted);
}

.sync-count-value {
    font-size: 16px;
    font-weight: 600;
}

/* Export Modal */
.export-description {
    font-size: 15px;
    color: var(--muted);
    margin-bottom: 16px;
}

.export-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.export-option {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--line-light);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    text-align: left;
    font-family: inherit;
}

.export-option:hover { background: var(--line-light); }
.export-option:active { transform: scale(0.98); }

.export-option-icon {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent-light);
    border-radius: 10px;
    color: var(--accent);
    flex-shrink: 0;
}

.export-option-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.export-option-title {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.export-option-desc {
    font-size: 13px;
    color: var(--muted);
}

/* Import Progress */
.import-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 32px 20px;
    text-align: center;
}

.import-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--line-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

.import-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--line-light);
    border-radius: 3px;
    margin-top: 16px;
    overflow: hidden;
}

.import-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    width: 0%;
    transition: width 0.3s;
}

/* User List */
.user-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.user-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s var(--spring);
}

.user-item:active {
    background: var(--line-light);
    transform: scale(0.98);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--accent);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    font-weight: 600;
    flex-shrink: 0;
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 2px;
}

.user-username {
    font-size: 14px;
    color: var(--muted);
}

.user-badge {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    border-radius: 6px;
    background: var(--accent-light);
    color: var(--accent);
}

.user-badge.admin {
    background: rgba(255, 149, 0, 0.15);
    color: var(--warning);
}

/* Admin Backup Section */
.backup-info {
    margin-bottom: 16px;
}

.backup-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

.backup-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 8px;
    background: var(--bg-secondary);
    border-radius: 10px;
}

.backup-stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}

.backup-stat-label {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

.backup-sizes {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    color: var(--muted);
    padding: 8px 4px;
}

.backup-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
}

.backup-hint {
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    margin: 0;
}

/* Form Styles */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 8px;
}

.form-input,
.form-select {
    width: 100%;
    padding: 14px 16px;
    font-size: 17px;
    font-family: inherit;
    color: var(--text);
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: 12px;
    outline: none;
    transition: border-color 0.15s, background 0.15s;
    -webkit-appearance: none;
    appearance: none;
}

.form-input:focus,
.form-select:focus {
    border-color: var(--accent);
    background: var(--bg);
}

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

.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 44px;
}

.form-error {
    font-size: 14px;
    color: var(--danger);
    margin-top: 8px;
    min-height: 20px;
}

.form-hint {
    font-size: 13px;
    color: var(--muted);
    margin-top: 12px;
    line-height: 1.4;
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 24px;
}

.modal-overlay.active { display: flex; background: rgba(0, 0, 0, 0.4); }

.glass-modal {
    background: var(--bg);
    border-radius: 16px;
    width: 100%;
    max-width: 340px;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.3s var(--spring);
}

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

.modal-header { padding: 20px 20px 12px; }
.modal-header h3 { font-size: 18px; font-weight: 600; text-align: center; }
.modal-close { display: none; }
.modal-body { padding: 0 20px 20px; max-height: 50vh; overflow-y: auto; }
.modal-body p { font-size: 15px; color: var(--muted); text-align: center; line-height: 1.5; }
.modal-actions { display: flex; border-top: 0.5px solid var(--line-light); }

.modal-btn {
    flex: 1;
    padding: 16px;
    font-size: 17px;
    font-family: inherit;
    color: var(--accent);
    background: none;
    border: none;
    cursor: pointer;
    transition: background 0.15s;
}

.modal-btn:not(:last-child) { border-right: 0.5px solid var(--line-light); }
.modal-btn:active { background: var(--line-light); }
.modal-btn.danger { color: var(--danger); font-weight: 600; }
.modal-btn.warning { color: var(--warning); font-weight: 600; }
.modal-btn.primary { color: var(--accent); font-weight: 600; }
.modal-btn:disabled { opacity: 0.4; pointer-events: none; }

/* Folder Edit Modal */
.folder-edit-form {
    padding: 16px 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    font-size: 17px;
    border: none;
    border-radius: 10px;
    background: var(--bg-tertiary, var(--line-light));
    color: var(--text);
    outline: none;
    transition: box-shadow 0.15s;
}

.form-input:focus {
    box-shadow: 0 0 0 3px var(--accent-light);
}

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

.folder-color-picker {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.color-option {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
    position: relative;
}

.color-option:hover {
    transform: scale(1.1);
}

.color-option:active {
    transform: scale(0.95);
}

.color-option.selected {
    border-color: var(--text);
}

.color-option.selected::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 16px;
    height: 16px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* History Modal */
.history-modal { max-width: 600px; }
.history-modal .modal-body { 
    display: flex; 
    gap: 16px; 
    padding: 16px 20px 20px;
    max-height: 60vh;
}
.history-list {
    flex: 0 0 180px;
    overflow-y: auto;
    border-right: 0.5px solid var(--line-light);
    padding-right: 16px;
}
.history-item {
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
    margin-bottom: 4px;
}
.history-item:hover { background: var(--line-light); }
.history-item.selected { background: var(--accent-light); }
.history-item-date { font-size: 13px; font-weight: 500; color: var(--text); }
.history-item-time { font-size: 12px; color: var(--muted); margin-top: 2px; }
.history-item-user { font-size: 11px; color: var(--muted); margin-top: 4px; }
.history-preview {
    flex: 1;
    overflow-y: auto;
    min-height: 200px;
}
.history-preview-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--muted);
    font-size: 14px;
}
.history-preview-content { padding: 8px 0; }
.history-preview-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}
.history-preview-body {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
}
.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}
.history-empty svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

@media (max-width: 500px) {
    .history-modal .modal-body { flex-direction: column; }
    .history-list { 
        flex: none; 
        border-right: none; 
        border-bottom: 0.5px solid var(--line-light);
        padding-right: 0;
        padding-bottom: 12px;
        max-height: 150px;
    }
    .history-preview { min-height: 150px; }
}

/* Share Modal */
.share-modal { max-width: 400px; }
.share-modal .modal-body { padding: 16px 20px 20px; }

.share-current { margin-bottom: 16px; }
.share-current-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}
.share-user-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 0.5px solid var(--line-light);
}
.share-user-item:last-child { border-bottom: none; }
.share-user-info { display: flex; align-items: center; gap: 10px; }
.share-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
}
.share-user-name { font-size: 15px; color: var(--text); }
.share-remove-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
}
.share-remove-btn:active { background: var(--line-light); }

.share-empty {
    text-align: center;
    padding: 20px;
    color: var(--muted);
    font-size: 14px;
}

.share-add { margin-top: 12px; }

/* Shared note indicator in list */
.note-shared-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--accent);
    margin-left: 8px;
}
.note-shared-badge svg {
    width: 12px;
    height: 12px;
}

/* Shared indicator in editor */
.note-shared-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--accent);
    margin-left: 12px;
}
.note-shared-indicator svg {
    width: 14px;
    height: 14px;
}

.modal-header { position: relative; }
.modal-header .modal-close {
    display: block;
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
}

.folder-picker-item { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 0.5px solid var(--line-light); cursor: pointer; }
.folder-picker-item:last-child { border: none; }
.folder-picker-item:active { opacity: 0.6; }
.folder-picker-item.selected .folder-picker-name { color: var(--accent); }
.folder-picker-icon { width: 10px; height: 10px; border-radius: 50%; }
.folder-picker-name { font-size: 17px; }

/* Move to Folder Modal */
.move-folder-info {
    font-size: 14px !important;
    color: var(--muted) !important;
    text-align: left !important;
    margin-bottom: 12px !important;
}

.move-folder-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.move-folder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-secondary);
    border-radius: 10px;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    color: var(--text);
    text-align: left;
    width: 100%;
    transition: background 0.15s, transform 0.1s;
}

.move-folder-item:hover {
    background: var(--line-light);
}

.move-folder-item:active {
    transform: scale(0.98);
}

.move-folder-item .folder-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.move-folder-item .folder-icon svg {
    width: 18px;
    height: 18px;
    color: white;
}

.move-folder-item .folder-name {
    flex: 1;
    font-weight: 500;
}

.move-folder-item .folder-count {
    font-size: 14px;
    color: var(--muted);
}

.move-folder-item.no-folder {
    color: var(--muted);
}

.move-folder-item.no-folder .folder-icon {
    background: var(--line);
}

/* Selection Action Bar (Desktop) */
.selection-action-bar {
    display: none;
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg);
    border-top: 1px solid var(--line-light);
    padding: 0 16px;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    z-index: 100;
}

.selection-action-bar.active {
    display: flex;
}

.selection-count {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.selection-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.selection-action-btn {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
}

.selection-action-btn:hover {
    background: var(--line-light);
}

.selection-action-btn:active {
    transform: scale(0.95);
}

.selection-action-btn.danger {
    color: var(--danger);
}

.selection-action-btn.danger:hover {
    background: rgba(255, 59, 48, 0.15);
}

.selection-action-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.selection-action-btn:disabled:hover {
    background: var(--bg-secondary);
    transform: none;
}

.selection-done-btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    background: var(--accent);
    color: white;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}

.selection-done-btn:hover {
    opacity: 0.9;
}

.selection-done-btn:active {
    transform: scale(0.97);
}

/* Toggle Switch */
.toggle-switch { position: relative; width: 51px; height: 31px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--line);
    border-radius: 31px;
    cursor: pointer;
    transition: background 0.3s var(--ease-out);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    left: 2px;
    bottom: 2px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s var(--spring);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-switch input:checked + .toggle-slider { background: var(--success); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* Select Mode */
.note-row.selectable { padding-left: 52px; }

.note-row .select-checkbox {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: 2px solid var(--line);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    transition: all 0.2s var(--spring);
}

.note-row.selectable .select-checkbox { display: flex; }
.note-row.selected .select-checkbox { background: var(--accent); border-color: var(--accent); transform: translateY(-50%) scale(1.05); }
.note-row.selected .select-checkbox::after { content: ''; width: 10px; height: 5px; border-left: 2.5px solid #fff; border-bottom: 2.5px solid #fff; transform: rotate(-45deg) translateY(-1px); }

/* Attachments */
.attachments-section { margin-top: 32px; padding-top: 20px; border-top: 0.5px solid var(--line-light); display: none; }
.attachments-section.has-attachments { display: block; animation: fadeInUp 0.3s var(--ease-out); }
.attachments-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.attachments-title { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); }
.attachments-count { font-size: 13px; color: var(--muted); background: var(--line-light); padding: 3px 10px; border-radius: 12px; }
.attachments-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 12px; }

.attachment-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: 12px;
    overflow: hidden;
    background: var(--bg-secondary);
    cursor: pointer;
    transition: transform 0.2s var(--spring);
}

.attachment-item:active { transform: scale(0.95); }
.attachment-item img { width: 100%; height: 100%; object-fit: cover; }
.attachment-item.file { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; }
.attachment-item.file svg { width: 36px; height: 36px; color: var(--muted); }
.attachment-item.file span { font-size: 11px; color: var(--muted); text-align: center; word-break: break-all; line-height: 1.3; max-height: 30px; overflow: hidden; }

.attachment-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.2s var(--spring);
}

.attachment-item:hover .attachment-delete { opacity: 1; transform: scale(1); }
.attachment-delete svg { width: 16px; height: 16px; }
.attachment-item.uploading::after { content: ''; position: absolute; inset: 0; background: rgba(255, 255, 255, 0.85); }
.attachment-item.uploading::before { content: ''; position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.7s linear infinite; z-index: 1; }

/* Pull to Refresh */
.pull-to-refresh {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    transform: translateY(-100%);
    transition: transform 0.3s var(--ease-out);
    z-index: 10;
}

.pull-to-refresh.visible { transform: translateY(0); }
.pull-indicator { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; font-weight: 500; }
.pull-indicator svg { width: 22px; height: 22px; transition: transform 0.3s var(--spring); }
.pull-to-refresh.ready .pull-indicator svg { transform: rotate(180deg); }
.pull-to-refresh.refreshing .pull-indicator svg { animation: spin 0.8s linear infinite; }
.notes-section.pulling { transform: translateY(var(--pull-distance, 0)); transition: none; }
.notes-section.releasing { transition: transform 0.4s var(--spring); }

/* Toast */
.toast-container {
    position: fixed;
    bottom: calc(72px + var(--safe-bottom));
    left: 16px;
    right: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: #2c2c2e;
    color: #fff;
    border-radius: 14px;
    font-size: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    pointer-events: auto;
    animation: toastSlideUp 0.4s var(--spring);
}

@keyframes toastSlideUp {
    from { transform: translateY(100%) scale(0.9); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}

.toast.hiding { animation: toastSlideDown 0.3s var(--ease-out) forwards; }

@keyframes toastSlideDown {
    from { transform: translateY(0) scale(1); opacity: 1; }
    to { transform: translateY(100%) scale(0.9); opacity: 0; }
}

.toast-message { flex: 1; }

.toast-action {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    padding: 6px 10px;
    margin: -6px -10px;
    border-radius: 8px;
}

.toast-action:active { background: rgba(255, 255, 255, 0.1); }

.toast.update-toast { 
    background: var(--accent); 
    position: fixed;
    top: calc(var(--safe-top) + 60px);
    left: 16px;
    right: 16px;
    bottom: auto;
    z-index: 9999;
    animation: toastSlideFromTop 0.4s var(--spring);
}
.toast.update-toast .toast-action { color: #fff; background: rgba(255, 255, 255, 0.25); padding: 10px 20px; border-radius: 10px; font-weight: 600; }
.toast.update-toast .toast-action:active { background: rgba(255, 255, 255, 0.4); }

@keyframes toastSlideFromTop {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Toast Types */
.toast.toast-success { background: #34c759; }
.toast.toast-error { background: #ff3b30; }
.toast.toast-warning { background: #ff9500; color: #000; }
.toast.toast-warning .toast-action { color: #000; }
.toast.toast-info { background: #2c2c2e; }

/* Offline & Sync */
.offline-banner { display: none; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; background: var(--warning); color: #000; font-size: 14px; font-weight: 500; }
.offline-banner.visible { display: flex; }
.offline-banner svg { width: 18px; height: 18px; }

.sync-indicator {
    position: fixed;
    top: calc(var(--safe-top) + 12px);
    right: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--accent);
    color: #fff;
    border-radius: 24px;
    font-size: 13px;
    font-weight: 600;
    opacity: 0;
    transform: translateY(-20px) scale(0.9);
    transition: all 0.3s var(--spring);
    z-index: 200;
    box-shadow: 0 4px 16px rgba(0, 122, 255, 0.3);
}

.sync-indicator.visible { opacity: 1; transform: translateY(0) scale(1); }
.sync-indicator svg { width: 16px; height: 16px; animation: spin 1s linear infinite; }

/* Search Highlight */
.search-highlight { background: var(--warning); color: #000; border-radius: 3px; padding: 1px 3px; margin: 0 -1px; }

/* Utilities */
.hidden { display: none !important; }
::selection { background: var(--accent); color: #fff; }

/* Recording Bar (compact, allows editing while recording) */
.recording-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 20px;
    padding-top: calc(12px + var(--safe-top));
    background: var(--danger);
    color: #fff;
    z-index: 250;
    animation: slideDown 0.3s var(--ease-out);
}

.recording-bar.active { display: flex; }

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

.recording-bar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.recording-pulse {
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

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

.recording-timer {
    font-size: 17px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.recording-note-title {
    font-size: 14px;
    opacity: 0.85;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.recording-bar.paused .recording-pulse {
    animation: none;
    opacity: 0.5;
}

.recording-bar.paused .recording-timer::after {
    content: ' (Paused)';
    font-weight: 400;
    font-size: 14px;
}

.recording-stop-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    color: var(--danger);
    background: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: transform 0.15s var(--spring), opacity 0.15s;
}

.recording-stop-btn:active {
    transform: scale(0.95);
    opacity: 0.9;
}

.recording-stop-btn svg {
    width: 16px;
    height: 16px;
}

/* Recording Control Screen */
.recording-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, #1a0000 0%, #330000 50%, #1a0000 100%);
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 300;
    animation: fadeIn 0.3s ease-out;
}

.recording-screen.active {
    display: flex;
}

.recording-screen-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

.recording-screen-timer {
    font-size: 72px;
    font-weight: 200;
    color: #fff;
    font-variant-numeric: tabular-nums;
    letter-spacing: 2px;
}

.recording-screen-status {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    text-transform: uppercase;
    letter-spacing: 3px;
}

.recording-screen-wave {
    display: flex;
    align-items: center;
    gap: 6px;
    height: 60px;
    margin: 20px 0;
}

.wave-bar {
    width: 4px;
    height: 20px;
    background: #ff3b30;
    border-radius: 2px;
    animation: wave 1s ease-in-out infinite;
}

.wave-bar:nth-child(1) { animation-delay: 0s; }
.wave-bar:nth-child(2) { animation-delay: 0.1s; }
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
.wave-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes wave {
    0%, 100% { height: 20px; }
    50% { height: 50px; }
}

.recording-screen.paused .wave-bar {
    animation: none;
    height: 20px;
    opacity: 0.5;
}

.recording-screen-controls {
    display: flex;
    gap: 40px;
    margin-top: 30px;
}

.recording-control-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
}

.recording-control-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.25);
}

.recording-control-btn.stop {
    background: #ff3b30;
}

.recording-control-btn.stop:active {
    background: #d63029;
}

.recording-dim-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 50px;
    padding: 14px 24px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.2s;
}

.recording-dim-btn:active {
    background: rgba(255, 255, 255, 0.2);
}

.recording-screen-close {
    position: absolute;
    bottom: calc(40px + var(--safe-bottom));
    left: 50%;
    transform: translateX(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    padding: 16px;
}

/* Dimmed Recording Screen */
.recording-dimmed {
    position: fixed;
    inset: 0;
    background: #000;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 350;
    cursor: pointer;
}

.recording-dimmed.active {
    display: flex;
}

/* Hide recording bar when dimmed mode is active */
.recording-bar.dimmed {
    display: none !important;
}

.recording-dimmed-content {
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.recording-dimmed:active .recording-dimmed-content {
    opacity: 0.2;
}

.recording-dimmed-timer {
    font-size: 48px;
    font-weight: 200;
    color: #ff3b30;
    font-variant-numeric: tabular-nums;
}

.recording-dimmed-hint {
    font-size: 14px;
    color: #666;
    margin-top: 20px;
}

/* Adjust header and toolbar when recording */
.screen.recording .screen-header {
    top: calc(52px + var(--safe-top));
}

.screen.recording .formatting-toolbar {
    top: calc(172px + var(--safe-top));
}

.screen.recording .editor-content {
    padding-top: calc(56px + var(--safe-top));
}

/* Recordings Section */
.recordings-section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 0.5px solid var(--line-light);
    display: none;
}

.recordings-section.has-recordings { display: block; }

.recordings-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}

.recordings-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
}

.recordings-count {
    font-size: 13px;
    color: var(--muted);
    background: var(--line-light);
    padding: 3px 10px;
    border-radius: 12px;
}

.recordings-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.recording-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    transition: transform 0.15s var(--spring);
}

.recording-item:active { transform: scale(0.98); }

.recording-play-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.15s var(--spring);
}

.recording-play-btn:active { transform: scale(0.9); }
.recording-play-btn svg { width: 18px; height: 18px; margin-left: 2px; }
.recording-play-btn.playing svg { margin-left: 0; }

.recording-info {
    flex: 1;
    min-width: 0;
}

.recording-duration {
    font-size: 17px;
    font-weight: 500;
    margin-bottom: 2px;
}

.recording-date {
    font-size: 14px;
    color: var(--muted);
}

.recording-progress {
    flex: 1;
    height: 4px;
    background: var(--line-light);
    border-radius: 2px;
    overflow: hidden;
    display: none;
}

.recording-item.playing .recording-progress { display: block; }
.recording-item.playing .recording-info { display: none; }

.recording-progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.1s linear;
}

.recording-delete-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--muted);
    border-radius: 50%;
    cursor: pointer;
    transition: color 0.15s, background 0.15s;
}

.recording-delete-btn:active {
    background: var(--line-light);
    color: var(--danger);
}

.recording-delete-btn svg { width: 18px; height: 18px; }

/* Recording syncing state */
.recording-item.syncing .recording-play-btn {
    background: var(--muted);
    pointer-events: none;
}

.recording-item.syncing .recording-play-btn svg {
    animation: spin 1s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Tablet (iPad) */
@media (min-width: 600px) {
    .notes-list, .folders-section, .editor-content, .settings-content, .auth-container { 
        max-width: 600px; 
        margin-left: auto; 
        margin-right: auto; 
    }
    .toast-container { left: 50%; right: auto; transform: translateX(-50%); width: 360px; }
    
    .glass-modal { max-width: 400px; }
    
    .recording-bar {
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        max-width: 500px;
        border-radius: 0 0 16px 16px;
        padding-left: 24px;
        padding-right: 24px;
    }
}

/* Large tablet / Small desktop */
@media (min-width: 768px) {
    body {
        position: relative;
        overflow: auto;
        height: auto;
    }
    
    #app {
        display: flex;
        height: 100vh;
        overflow: hidden;
    }
    
    /* Hide sidebar during auth/login */
    body.auth-mode .tab-bar {
        display: none !important;
    }
    
    /* Auth screen should be full width and centered */
    body.auth-mode #auth-screen {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* Sidebar navigation */
    .tab-bar {
        display: flex !important;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 80px;
        flex-direction: column;
        justify-content: flex-start;
        padding: 20px 0;
        padding-top: calc(20px + var(--safe-top));
        border-radius: 0;
        border-right: 0.5px solid var(--line-light);
        border-top: none;
        gap: 8px;
        z-index: 100;
        background: var(--bg);
    }
    
    .tab-item {
        flex-direction: column;
        padding: 12px 8px;
        width: 64px;
        border-radius: 12px;
        margin: 0 8px;
    }
    
    .tab-item span { font-size: 11px; margin-top: 4px; }
    
    /* Main content area */
    .screen {
        position: relative;
        margin-left: 80px;
        width: calc(100% - 80px);
        height: 100vh;
    }
    
    /* Auth screen needs special handling */
    #auth-screen {
        position: absolute;
        inset: 0;
        margin-left: 0;
        width: 100%;
        z-index: 200;
    }
    
    .screen-header {
        position: sticky;
        top: 0;
    }
    
    .notes-section, .settings-content {
        padding-bottom: 40px;
    }
    
    /* Editor takes full width on tablet */
    .editor-content {
        max-width: 700px;
        padding-bottom: 100px;
    }
    
    .formatting-toolbar {
        position: fixed;
        bottom: 20px;
        left: calc(80px + 50%);
        right: auto;
        transform: translateX(-50%);
        max-width: 500px;
        border-radius: 16px;
        box-shadow: var(--shadow-lg);
    }
    
    /* Show FAB on tablet */
    .fab, .new-note-btn {
        display: flex !important;
        position: fixed;
        bottom: 24px;
        right: 24px;
        left: auto;
        width: 56px;
        height: 56px;
        border-radius: 16px;
        background: var(--accent);
        color: white;
        border: none;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
        z-index: 100;
    }
    
    .fab svg, .new-note-btn svg {
        width: 24px;
        height: 24px;
    }
}

/* ============================================
   iPad & Desktop - Apple Notes Style 3-Column Layout
   ============================================ */

/* Tablet - 2 column (Notes + Editor) */
@media (min-width: 768px) {
    /* Hide mobile bottom bar */
    .bottom-bar {
        display: none !important;
    }
    
    /* Show sidebar */
    .tab-bar {
        display: flex !important;
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: 260px;
        flex-direction: column;
        padding: 0;
        background: var(--bg-secondary);
        border-right: 0.5px solid var(--line-light);
        z-index: 100;
    }
    
    /* Sidebar header */
    .tab-bar::before {
        content: '';
        display: block;
        height: calc(20px + var(--safe-top));
    }
    
    .tab-item {
        flex-direction: row;
        width: 100%;
        padding: 12px 20px;
        justify-content: flex-start;
        gap: 12px;
        border-radius: 0;
        margin: 0;
    }
    
    .tab-item span {
        font-size: 15px;
        margin-top: 0;
    }
    
    .tab-item svg {
        width: 20px;
        height: 20px;
    }
    
    .tab-item.active {
        background: var(--accent-light);
    }
    
    .tab-spacer {
        flex: 1;
    }
    
    /* Main content - shifted right of sidebar */
    #app {
        margin-left: 260px;
        width: calc(100% - 260px);
        display: flex;
        flex-direction: row;
        height: 100vh;
    }
    
    .screen {
        position: relative;
        margin-left: 0;
        width: auto;
        height: 100vh;
    }
    
    /* Home screen becomes notes list */
    #home-screen {
        display: flex !important;
        flex-direction: column;
        width: 320px;
        min-width: 320px;
        max-width: 320px;
        border-right: 0.5px solid var(--line-light);
        height: 100vh;
        background: var(--bg);
    }
    
    #home-screen .screen-header {
        display: flex;
        padding: 12px 16px;
        padding-top: calc(12px + var(--safe-top));
        border-bottom: 0.5px solid var(--line-light);
        background: var(--bg);
    }
    
    #home-screen .screen-header .back-btn {
        display: none;
    }
    
    .notes-section {
        flex: 1;
        overflow-y: auto;
        padding: 0;
        border-right: none;
        width: 100%;
        min-width: 0;
        height: auto;
    }
    
    .notes-section .section-title-row {
        padding: 16px;
        padding-top: 16px;
    }
    
    /* Editor takes remaining space */
    #editor-screen {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
        flex: 1;
        display: flex !important;
        flex-direction: column;
        background: var(--bg);
        margin-left: 0;
        width: auto;
        height: 100vh;
    }
    
    #editor-screen:not(.active) {
        display: flex !important;
    }
    
    #editor-screen:not(.active) .editor-header,
    #editor-screen:not(.active) .editor-content,
    #editor-screen:not(.active) .formatting-toolbar {
        visibility: hidden;
    }
    
    #editor-screen:not(.active)::after {
        content: 'Select a note or create a new one';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: var(--label-tertiary);
        font-size: 17px;
    }
    
    .editor-header {
        padding: 12px 20px;
        padding-top: calc(12px + var(--safe-top));
        border-bottom: 0.5px solid var(--line-light);
    }
    
    .editor-header .back-btn {
        display: none;
    }
    
    .editor-content {
        flex: 1;
        overflow-y: auto;
        padding: 24px 32px;
        padding-bottom: 100px;
        max-width: none;
    }
    
    #note-title {
        font-size: 28px;
    }
    
    /* Formatting toolbar - top right of editor */
    .formatting-toolbar {
        position: absolute;
        top: calc(12px + var(--safe-top));
        right: 20px;
        left: auto;
        bottom: auto;
        transform: none;
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
        gap: 4px;
    }
    
    .formatting-toolbar .toolbar-btn {
        background: var(--bg-tertiary);
        border-radius: 8px;
    }
    
    /* New note button in header area */
    .fab, #new-note-btn {
        display: none !important;
    }
    
    #new-note-btn-bottom {
        display: flex !important;
        position: fixed;
        top: calc(16px + var(--safe-top));
        left: calc(260px + 320px - 60px);
        width: 40px;
        height: 40px;
        background: var(--accent);
        color: white;
        border: none;
        border-radius: 10px;
        align-items: center;
        justify-content: center;
        z-index: 101;
        cursor: pointer;
    }
    
    #new-note-btn-bottom svg {
        width: 20px;
        height: 20px;
    }
    
    /* Settings and other screens */
    #settings-screen,
    #search-screen {
        position: fixed;
        left: 260px;
        top: 0;
        right: 0;
        bottom: 0;
        width: auto;
        z-index: 60;
    }
    
    #settings-screen .settings-content {
        max-width: 600px;
        margin: 0 auto;
        padding: 24px;
    }
    
    /* Hide screens that shouldn't show */
    #home-screen:not(.active),
    #editor-screen:not(.active) {
        /* Keep visible for split view */
    }
    
    /* Auth screen full width */
    body.auth-mode .tab-bar {
        display: none !important;
    }
    
    body.auth-mode #app {
        margin-left: 0;
        width: 100%;
    }
    
    body.auth-mode #auth-screen {
        width: 100%;
    }
}

/* Large desktop - wider columns */
@media (min-width: 1200px) {
    .tab-bar {
        width: 280px;
    }
    
    #app {
        margin-left: 280px;
        width: calc(100% - 280px);
    }
    
    #home-screen {
        width: 380px;
        min-width: 380px;
        max-width: 380px;
    }
    
    #new-note-btn-bottom {
        left: calc(280px + 380px - 60px);
    }
    
    #settings-screen,
    #search-screen {
        left: 280px;
    }
    
    .editor-content {
        max-width: 800px;
        margin: 0 auto;
        padding: 32px 48px;
    }
    
    #note-title {
        font-size: 32px;
    }
}

/* Extra large desktop */
@media (min-width: 1600px) {
    #home-screen {
        width: 420px;
        min-width: 420px;
        max-width: 420px;
    }
    
    #new-note-btn-bottom {
        left: calc(280px + 420px - 60px);
    }
    
    .editor-content {
        max-width: 900px;
    }
}

/* Keyboard visible - keep toolbar above keyboard */
@media (max-height: 500px) and (max-width: 767px) {
    .formatting-toolbar {
        bottom: 0;
        border-radius: 0;
        padding-bottom: 8px;
    }
}

/* ============================================
   Drawing & Annotation Styles
   ============================================ */

/* Drawing Modal */
.drawing-modal,
.annotation-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.drawing-modal.active,
.annotation-modal.active {
    opacity: 1;
    visibility: visible;
}

.drawing-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    padding-top: calc(12px + var(--safe-top));
    background: var(--bg-secondary);
    border-bottom: 0.5px solid var(--line-light);
}

.drawing-header-btn {
    font-size: 17px;
    font-family: inherit;
    background: none;
    border: none;
    color: var(--primary);
    padding: 8px 12px;
    cursor: pointer;
}

.drawing-header-btn.primary {
    font-weight: 600;
}

.drawing-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.drawing-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-bottom: 0.5px solid var(--line-light);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.drawing-tools {
    display: flex;
    gap: 4px;
    padding-right: 12px;
    border-right: 1px solid var(--line-light);
}

.drawing-tool {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 10px;
    color: var(--text);
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.drawing-tool:active {
    background: var(--line-light);
}

.drawing-tool.active {
    background: var(--primary);
    color: #fff;
}

.drawing-colors {
    display: flex;
    gap: 8px;
    padding: 0 12px;
    border-right: 1px solid var(--line-light);
}

.drawing-color {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s;
}

.drawing-color:active {
    transform: scale(0.9);
}

.drawing-color.active {
    border-color: var(--primary);
    transform: scale(1.1);
}

.drawing-sizes {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-right: 12px;
    border-right: 1px solid var(--line-light);
}

.drawing-size {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 2px solid transparent;
    border-radius: 50%;
    cursor: pointer;
    transition: border-color 0.15s;
}

.drawing-size span {
    display: block;
    background: var(--text);
    border-radius: 50%;
}

.drawing-size.active {
    border-color: var(--primary);
}

.drawing-canvas-container,
.annotation-canvas-container {
    flex: 1;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

#drawing-canvas,
#annotation-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

/* Handwriting Overlay */
.handwriting-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 280px;
    background: var(--bg);
    border-top: 1px solid var(--line-light);
    border-radius: 16px 16px 0 0;
    z-index: 500;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.3s var(--spring);
}

.handwriting-overlay.active {
    transform: translateY(0);
}

.handwriting-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 0.5px solid var(--line-light);
}

.handwriting-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--muted);
}

.handwriting-canvas-container {
    flex: 1;
    position: relative;
    background: #fff;
}

.dark-mode .handwriting-canvas-container {
    background: #2c2c2e;
}

#handwriting-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.handwriting-preview {
    padding: 12px 16px;
    min-height: 44px;
    background: var(--bg-secondary);
    border-top: 0.5px solid var(--line-light);
}

.handwriting-text {
    font-size: 17px;
    color: var(--text);
}

/* Annotation on images */
.note-image-container {
    position: relative;
    display: inline-block;
}

.note-image-container .annotate-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 36px;
    height: 36px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    border-radius: 50%;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.note-image-container:hover .annotate-btn,
.note-image-container:focus-within .annotate-btn {
    opacity: 1;
}

/* iPad-specific styles */
@media (min-width: 768px) and (pointer: coarse) {
    .drawing-toolbar {
        padding: 16px 24px;
        gap: 16px;
    }
    
    .drawing-tool {
        width: 52px;
        height: 52px;
    }
    
    .drawing-color {
        width: 36px;
        height: 36px;
    }
    
    .drawing-size {
        width: 44px;
        height: 44px;
    }
}

/* ============================================
   Note Info Modal Styles
   ============================================ */

.note-info-body {
    padding: 0 !important;
}

.note-info-section {
    padding: 16px 20px;
    border-bottom: 0.5px solid var(--line-light);
}

.note-info-section:last-child {
    border-bottom: none;
}

.note-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.note-info-label {
    font-size: 15px;
    color: var(--muted);
}

.note-info-value {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
}

.note-info-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.note-info-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    background: var(--primary);
    color: #fff;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

/* ============================================
   Templates Modal Styles
   ============================================ */

.templates-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 4px;
}

.template-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--line-light);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.template-item:active {
    transform: scale(0.98);
    background: var(--line-light);
}

.template-icon {
    font-size: 32px;
}

.template-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text);
    text-align: center;
}

/* ============================================
   Share Link Modal Styles
   ============================================ */

.modal-description {
    font-size: 14px;
    color: var(--muted);
    margin-bottom: 16px;
}

.share-link-container {
    display: flex;
    gap: 8px;
}

.share-link-input {
    flex: 1;
    padding: 12px;
    background: var(--bg-secondary);
    border: 1px solid var(--line-light);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    font-family: monospace;
}

.share-link-copy {
    padding: 12px;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-link-copy:active {
    opacity: 0.8;
}

/* ============================================
   Backlinks Panel Styles
   ============================================ */

.backlinks-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 100%;
    background: var(--bg);
    border-left: 1px solid var(--line-light);
    z-index: 200;
    transform: translateX(100%);
    transition: transform 0.3s var(--spring);
    display: flex;
    flex-direction: column;
}

.backlinks-panel.active {
    transform: translateX(0);
}

.backlinks-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    padding-top: calc(16px + var(--safe-top));
    border-bottom: 0.5px solid var(--line-light);
}

.backlinks-header h3 {
    font-size: 17px;
    font-weight: 600;
}

.backlinks-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px 20px;
}

.backlinks-section {
    margin-bottom: 24px;
}

.backlinks-section h4 {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 4px;
}

.backlinks-hint {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 12px;
}

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

.backlink-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.15s;
}

.backlink-item:active {
    background: var(--line-light);
}

.backlink-title {
    flex: 1;
    font-size: 15px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.backlinks-empty {
    font-size: 14px;
    color: var(--muted);
    font-style: italic;
}

/* ============================================
   Note Search Bar Styles
   ============================================ */

.note-search-bar {
    display: none;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 0.5px solid var(--line-light);
}

.note-search-bar.active {
    display: flex;
}

.note-search-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 8px;
}

.note-search-input-wrap svg {
    color: var(--muted);
    flex-shrink: 0;
}

#note-search-input {
    flex: 1;
    background: none;
    border: none;
    font-size: 16px;
    color: var(--text);
    outline: none;
}

.note-search-nav {
    display: flex;
    align-items: center;
    gap: 4px;
}

#note-search-count {
    font-size: 13px;
    color: var(--muted);
    min-width: 40px;
    text-align: center;
}

.note-search-btn {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--text);
    border-radius: 6px;
    cursor: pointer;
}

.note-search-btn:active {
    background: var(--line-light);
}

/* Search highlight */
.search-highlight {
    background: rgba(255, 204, 0, 0.4);
    border-radius: 2px;
}

.search-highlight.current {
    background: rgba(255, 149, 0, 0.6);
}

/* ============================================
   Pin Indicator Styles
   ============================================ */

.note-row.pinned::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: var(--primary);
    border-radius: 0 2px 2px 0;
}

.pin-indicator {
    color: var(--primary);
    margin-left: 4px;
}

/* ============================================
   Sort Options
   ============================================ */

.sort-options {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-secondary);
    border-bottom: 0.5px solid var(--line-light);
}

.sort-label {
    font-size: 13px;
    color: var(--muted);
}

.sort-select {
    padding: 6px 10px;
    background: var(--bg);
    border: 1px solid var(--line-light);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text);
    font-family: inherit;
}

/* ============================================
   Note Link Autocomplete
   ============================================ */

.link-autocomplete {
    position: absolute;
    background: var(--bg);
    border: 1px solid var(--line-light);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.link-autocomplete.active {
    display: block;
}

.link-autocomplete-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text);
    border-bottom: 0.5px solid var(--line-light);
}

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

.link-autocomplete-item:hover,
.link-autocomplete-item.selected {
    background: var(--primary);
    color: #fff;
}

/* Note links in body */
.note-link {
    color: var(--primary);
    text-decoration: none;
    background: rgba(0, 122, 255, 0.1);
    padding: 1px 4px;
    border-radius: 4px;
    cursor: pointer;
}

.note-link:hover {
    background: rgba(0, 122, 255, 0.2);
}

/* ============================================
   iOS 26 Style Updates
   ============================================ */

/* Bottom Bar - iOS 26 Style */
.bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    padding-bottom: calc(8px + var(--safe-bottom));
    background: var(--bg);
    border-top: 0.5px solid var(--line-light);
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.search-bar-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 8px 12px;
}

.search-bar-container svg {
    color: var(--label-secondary);
    flex-shrink: 0;
}

.search-bar-container input {
    flex: 1;
    background: none;
    border: none;
    font-size: 16px;
    color: var(--label);
    outline: none;
}

.search-bar-container input::placeholder {
    color: var(--label-tertiary);
}

.voice-search-btn {
    background: none;
    border: none;
    padding: 4px;
    color: var(--label-secondary);
    cursor: pointer;
    border-radius: 6px;
}

.voice-search-btn:active {
    background: var(--bg-quaternary);
}

.compose-btn {
    width: 44px;
    height: 44px;
    border-radius: 22px;
    background: var(--accent);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 122, 255, 0.3);
}

.compose-btn:active {
    transform: scale(0.95);
}

/* iOS 26 Header Style */
.ios26-header .header-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ios26-header .header-title {
    flex: 1;
    font-size: 34px;
    font-weight: 700;
}

.back-btn-home {
    margin-right: 4px;
}

/* More Menu Dropdown */
.more-menu-dropdown {
    position: absolute;
    top: calc(var(--safe-top) + 56px);
    right: 16px;
    background: var(--bg);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    min-width: 220px;
    z-index: 1000;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.95) translateY(-8px);
    transform-origin: top right;
    transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
    pointer-events: none;
    border: 0.5px solid var(--line-light);
}

.more-menu-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

.more-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    font-size: 16px;
    color: var(--label);
    cursor: pointer;
    text-align: left;
}

.more-menu-item:active {
    background: var(--bg-tertiary);
}

.more-menu-item svg {
    color: var(--accent);
}

.more-menu-divider {
    height: 0.5px;
    background: var(--line-light);
    margin: 4px 16px;
}

/* Note count styling - iOS style */
.section-title-row {
    padding: 8px 20px 4px;
}

.section-title-row h2 {
    display: none;
}

.note-count {
    font-size: 13px;
    color: var(--label-secondary);
}

/* Hide old tab bar in favor of bottom bar */
.tab-bar {
    display: none !important;
}

/* Dark mode adjustments for iOS 26 */
[data-theme="dark"] .more-menu-dropdown {
    background: #2c2c2e;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .search-bar-container {
    background: #1c1c1e;
}

[data-theme="dark"] .compose-btn {
    box-shadow: 0 2px 12px rgba(0, 122, 255, 0.4);
}

/* Note row iOS 26 style refinements */
.note-row {
    background: var(--bg-secondary);
    border-radius: 12px;
    margin: 0 16px 8px;
    padding: 14px 16px;
}

.notes-date-header {
    font-size: 20px;
    font-weight: 600;
    color: var(--label);
    padding: 20px 20px 8px;
    margin: 0;
}

/* Folders grid update for iOS 26 */
.folders-grid {
    display: none;
}

/* Auth mode - hide bottom bar */
body.auth-mode .bottom-bar {
    display: none;
}

/* ============================================
   iOS 26 Settings Styles
   ============================================ */

.settings-group {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 8px;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 0.5px solid var(--line-light);
}

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

.settings-item.clickable {
    cursor: pointer;
}

.settings-item.clickable:active {
    background: var(--bg-tertiary);
}

.settings-item-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.settings-icon.accent { background: var(--accent); color: #fff; }
.settings-icon.danger { background: #ff3b30; color: #fff; }
.settings-icon.blue { background: #007AFF; color: #fff; }
.settings-icon.green { background: #34c759; color: #fff; }
.settings-icon.purple { background: #af52de; color: #fff; }
.settings-icon.orange { background: #ff9500; color: #fff; }
.settings-icon.warning { background: #ff9500; color: #fff; }

/* Admin Stats Card */
.admin-stats-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}

.admin-stats-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    color: var(--label);
    font-weight: 600;
    font-size: 15px;
}

.admin-stats-header svg {
    color: var(--accent);
}

.admin-stats-refresh {
    margin-left: auto;
    background: none;
    border: none;
    color: var(--accent);
    padding: 4px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-stats-refresh:active {
    background: var(--bg-tertiary);
}

.admin-stats-refresh.spinning svg {
    animation: spin 1s linear infinite;
}

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

.admin-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.admin-stat-item {
    text-align: center;
    padding: 12px 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
}

.admin-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--label);
    font-variant-numeric: tabular-nums;
}

.admin-stat-label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-top: 2px;
}

.admin-stats-details {
    border-top: 0.5px solid var(--line-light);
    padding-top: 12px;
}

.admin-stats-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
}

.admin-stats-row span:first-child {
    color: var(--muted);
}

.admin-stats-row span:last-child {
    color: var(--label);
    font-weight: 500;
}

/* Activity Log Modal */
.modal-large .modal-content {
    max-width: 600px;
    max-height: 80vh;
}

.modal-large .modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

.activity-log-filters {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.activity-log-filters select {
    flex: 1;
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--bg-secondary);
    color: var(--label);
    font-size: 14px;
}

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

.activity-log-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.activity-log-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-secondary);
    border-radius: 10px;
}

.activity-log-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.activity-log-icon.create { background: #34c75920; color: #34c759; }
.activity-log-icon.edit { background: #007AFF20; color: #007AFF; }
.activity-log-icon.delete { background: #ff3b3020; color: #ff3b30; }
.activity-log-icon.auth { background: #af52de20; color: #af52de; }
.activity-log-icon.user { background: #ff950020; color: #ff9500; }

.activity-log-content {
    flex: 1;
    min-width: 0;
}

.activity-log-message {
    font-size: 14px;
    color: var(--label);
    margin-bottom: 4px;
}

.activity-log-message strong {
    font-weight: 600;
}

.activity-log-meta {
    font-size: 12px;
    color: var(--muted);
    display: flex;
    gap: 8px;
}

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

.settings-label.danger {
    color: #ff3b30;
}

.settings-value {
    color: var(--label-secondary);
    font-size: 15px;
}

.chevron {
    color: var(--label-tertiary);
    flex-shrink: 0;
}

/* Folder list items */
.folder-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
}

.folder-icon-small {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.folder-list-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.folder-list-name {
    font-size: 16px;
    color: var(--label);
}

.folder-list-count {
    font-size: 13px;
    color: var(--label-secondary);
}

/* Settings back button */
#settings-back-btn {
    margin-right: 8px;
}

/* Theme options update */
.theme-options {
    display: flex;
    gap: 8px;
}

.theme-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    background: var(--bg-tertiary);
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.theme-option.active {
    border-color: var(--accent);
    background: var(--accent-light, rgba(0, 122, 255, 0.1));
}

.theme-option span {
    font-size: 12px;
    color: var(--label-secondary);
}

.theme-option.active span {
    color: var(--accent);
    font-weight: 500;
}

/* ============================================
   Search Screen Styles
   ============================================ */

#search-screen {
    background: var(--bg);
    z-index: 200;
}

#search-screen.active {
    display: flex;
    flex-direction: column;
}

/* Search screen top header */
.search-screen-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 12px;
    background: var(--bg);
}

.search-screen-title {
    font-size: 34px;
    font-weight: 700;
    color: var(--text);
    margin: 0;
}

.search-screen-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px 12px;
    background: var(--bg);
}

.search-input-container {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border-radius: 10px;
    padding: 10px 12px;
}

.search-input-container svg {
    color: var(--label-secondary);
    flex-shrink: 0;
}

.search-input-container input {
    flex: 1;
    background: none;
    border: none;
    font-size: 17px;
    color: var(--label);
    outline: none;
}

.search-input-container input::placeholder {
    color: var(--label-tertiary);
}

.search-clear-btn {
    background: none;
    border: none;
    padding: 0;
    color: var(--label-tertiary);
    cursor: pointer;
    display: none;
}

.search-clear-btn.visible {
    display: block;
}

.search-cancel-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 17px;
    font-weight: 400;
    cursor: pointer;
    padding: 8px;
    white-space: nowrap;
}

/* Bottom search bar (iOS style) */
.search-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 16px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    background: var(--bg-secondary);
    border-top: 0.5px solid var(--line-light);
    z-index: 100;
}

.search-bottom-bar .search-input-container {
    flex: 1;
}

.search-bottom-bar .voice-search-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--muted);
    border-radius: 50%;
    cursor: pointer;
}

.search-bottom-bar .voice-search-btn:active {
    background: var(--line-light);
}

.search-suggestions {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
    padding-bottom: 100px; /* Space for bottom bar */
}

.search-results {
    padding-bottom: 100px; /* Space for bottom bar */
}

.search-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--label-secondary);
    margin: 16px 0 8px;
}

.search-filters-list {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
}

.search-filter-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    border-bottom: 0.5px solid var(--line-light);
    font-size: 17px;
    color: var(--label);
    cursor: pointer;
    text-align: left;
}

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

.search-filter-item:active {
    background: var(--bg-tertiary);
}

.filter-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.search-results {
    flex: 1;
    overflow-y: auto;
    padding: 0 16px;
    display: none;
}

.search-results.active {
    display: block;
}

.search-results .note-row {
    margin: 0 0 8px;
}

.search-results-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--label-secondary);
}

.search-results-count {
    font-size: 13px;
    color: var(--label-secondary);
    padding: 12px 4px;
}

/* ============================================
   Mobile Folders Sidebar
   ============================================ */

.folders-btn {
    display: flex;
}

.mobile-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
    z-index: 998;
}

.mobile-sidebar-overlay.active {
    opacity: 1;
    visibility: visible;
}

.mobile-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: var(--bg);
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
    z-index: 999;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top, 0px);
}

.mobile-sidebar.active {
    transform: translateX(0);
}

.mobile-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 0.5px solid var(--line-light);
}

.mobile-sidebar-header h2 {
    font-size: 34px;
    font-weight: 700;
    margin: 0;
    color: var(--text);
}

.mobile-sidebar-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.mobile-folder-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: background 0.15s, transform 0.15s;
    position: relative;
}

.mobile-folder-item:active {
    transform: scale(0.98);
    background: var(--bg-tertiary);
}

.mobile-folder-item.active {
    background: var(--accent-light);
}

.mobile-folder-icon {
    width: 32px;
    height: 28px;
    flex-shrink: 0;
}

.mobile-folder-icon svg {
    width: 100%;
    height: 100%;
}

.mobile-folder-info {
    flex: 1;
    min-width: 0;
}

.mobile-folder-name {
    font-size: 17px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-folder-count {
    font-size: 15px;
    color: var(--muted);
    margin-top: 2px;
}

.mobile-folder-edit {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--muted);
    cursor: pointer;
    opacity: 0.6;
}

.mobile-folder-edit:active {
    background: var(--line-light);
}

.mobile-sidebar-footer {
    padding: 16px;
    border-top: 0.5px solid var(--line-light);
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

.mobile-sidebar-add-folder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 17px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}

.mobile-sidebar-add-folder:active {
    opacity: 0.8;
}

.mobile-sidebar-divider {
    height: 1px;
    background: var(--line-light);
    margin: 16px 0;
}

.mobile-sidebar-section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--muted);
    margin-bottom: 8px;
    padding-left: 4px;
}

/* ============================================
   iPad & Desktop Optimizations - v1.2.22
   ============================================ */

/* iPad Portrait (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1023px) {
    /* Better touch targets for iPad */
    .note-row {
        padding: 16px 20px;
        min-height: 80px;
    }
    
    .note-row-title {
        font-size: 17px;
    }
    
    .note-row-preview {
        font-size: 15px;
    }
    
    /* Larger folder cards */
    .folder-card {
        padding: 16px 20px;
        min-height: 60px;
    }
    
    /* Better toolbar for iPad */
    .formatting-toolbar {
        padding: 12px 16px;
        gap: 8px;
    }
    
    .toolbar-btn {
        width: 44px;
        height: 44px;
    }
    
    /* Modal sizing */
    .glass-modal {
        max-width: 500px;
        margin: 20px;
    }
    
    /* Search screen optimization */
    #search-screen {
        padding-top: calc(20px + var(--safe-top));
    }
    
    .search-screen-header {
        padding: 0 24px;
    }
    
    .search-input-container input {
        font-size: 17px;
        padding: 14px 44px 14px 16px;
    }
    
    /* Settings sections */
    .settings-section {
        padding: 20px 24px;
        margin: 12px 0;
    }
    
    .settings-item {
        padding: 16px 0;
    }
}

/* iPad Landscape & Desktop Split View Improvements */
@media (min-width: 1024px) {
    /* Smoother transitions */
    .screen {
        transition: none;
    }
    
    /* Note list hover states for mouse */
    .note-row {
        transition: background-color 0.15s ease;
        cursor: pointer;
    }
    
    .note-row:hover {
        background: var(--hover);
    }
    
    .note-row.selected {
        background: var(--accent-bg);
    }
    
    /* Folder hover */
    .folder-card {
        transition: background-color 0.15s ease, transform 0.15s ease;
        cursor: pointer;
    }
    
    .folder-card:hover {
        background: var(--hover);
        transform: translateY(-1px);
    }
    
    /* Better scrollbars for desktop */
    ::-webkit-scrollbar {
        width: 8px;
        height: 8px;
    }
    
    ::-webkit-scrollbar-track {
        background: transparent;
    }
    
    ::-webkit-scrollbar-thumb {
        background: var(--scroll-thumb);
        border-radius: 4px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: var(--scroll-thumb-hover);
    }
    
    /* Notes list scrollable with header visible */
    .notes-section {
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }
    
    .notes-section .section-title-row {
        flex-shrink: 0;
    }
    
    .notes-list {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 100px;
    }
    
    /* Editor improvements */
    .editor-content {
        overflow-y: auto;
        flex: 1;
    }
    
    #note-body {
        min-height: calc(100vh - 300px);
    }
    
    /* Keyboard shortcut hints */
    .toolbar-btn {
        position: relative;
    }
    
    .toolbar-btn:hover::after {
        content: attr(data-shortcut);
        position: absolute;
        bottom: -24px;
        left: 50%;
        transform: translateX(-50%);
        font-size: 11px;
        color: var(--label-secondary);
        white-space: nowrap;
        background: var(--bg-elevated);
        padding: 2px 6px;
        border-radius: 4px;
        opacity: 0;
        animation: fadeIn 0.2s ease 0.5s forwards;
    }
    
    /* More menu as dropdown on desktop */
    #more-menu-dropdown {
        min-width: 200px;
    }
    
    .more-menu-item {
        padding: 12px 16px;
        transition: background 0.15s ease;
    }
    
    .more-menu-item:hover {
        background: var(--hover);
    }
}

/* Large Desktop (1400px+) */
@media (min-width: 1400px) {
    /* Wider note list */
    .notes-section {
        width: 450px;
        min-width: 450px;
    }
    
    /* More spacious editor */
    .editor-content {
        max-width: 960px;
        padding: 0 80px;
    }
    
    #note-title {
        font-size: 32px;
    }
    
    #note-body {
        font-size: 17px;
        line-height: 1.7;
    }
    
    /* Larger modals */
    .glass-modal {
        max-width: 600px;
    }
    
    .history-modal {
        max-width: 800px;
    }
}

/* Ultra-wide displays (1800px+) */
@media (min-width: 1800px) {
    .notes-section {
        width: 500px;
        min-width: 500px;
    }
    
    .editor-content {
        max-width: 1100px;
    }
    
    .tab-bar {
        width: 260px;
    }
    
    .screen {
        margin-left: 260px;
        width: calc(100% - 260px);
    }
    
    .formatting-toolbar {
        left: calc(260px + 500px + (100% - 260px - 500px) / 2);
        max-width: 700px;
    }
    
    .new-note-btn {
        left: calc(260px + 500px - 80px);
    }
}

/* Touch device on large screen (iPad Pro, Surface) */
@media (min-width: 1024px) and (pointer: coarse) {
    /* Larger touch targets */
    .note-row {
        padding: 18px 20px;
    }
    
    .toolbar-btn {
        width: 48px;
        height: 48px;
    }
    
    .formatting-toolbar {
        gap: 6px;
        padding: 10px 14px;
    }
    
    /* No hover effects on touch */
    .note-row:hover,
    .folder-card:hover {
        background: transparent;
        transform: none;
    }
    
    .note-row:active,
    .folder-card:active {
        background: var(--hover);
    }
    
    /* Hide shortcut hints on touch */
    .toolbar-btn:hover::after {
        display: none;
    }
}

/* Print styles */
@media print {
    .tab-bar,
    .screen-header,
    .editor-header,
    .formatting-toolbar,
    .new-note-btn,
    .recording-bar {
        display: none !important;
    }
    
    .screen {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    #editor-screen {
        display: block !important;
        position: static !important;
    }
    
    .editor-content {
        max-width: none;
        padding: 0;
    }
    
    #note-body {
        font-size: 12pt;
        line-height: 1.5;
    }
}

/* Dark mode scrollbar */
[data-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* CSS Variables for scrollbar */
:root {
    --scroll-thumb: rgba(0, 0, 0, 0.2);
    --scroll-thumb-hover: rgba(0, 0, 0, 0.35);
    --hover: rgba(0, 0, 0, 0.04);
}

[data-theme="dark"] {
    --scroll-thumb: rgba(255, 255, 255, 0.2);
    --scroll-thumb-hover: rgba(255, 255, 255, 0.3);
    --hover: rgba(255, 255, 255, 0.06);
}

/* ============================================
   Storage Management UI
   ============================================ */

.storage-overview {
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 12px;
}

.storage-bar-container {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.storage-bar {
    flex: 1;
    height: 8px;
    background: var(--line-light);
    border-radius: 4px;
    overflow: hidden;
}

.storage-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.storage-bar-fill.warning {
    background: #ff9500;
}

.storage-bar-fill.danger {
    background: #ff3b30;
}

.storage-text {
    font-size: 13px;
    color: var(--label-secondary);
    min-width: 80px;
    text-align: right;
}

.storage-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.storage-detail-item {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    padding: 4px 0;
}

.storage-detail-item .label {
    color: var(--label-secondary);
}

.storage-detail-item .value {
    color: var(--label);
    font-weight: 500;
}

.settings-sublabel {
    display: block;
    font-size: 12px;
    color: var(--label-tertiary);
    margin-top: 2px;
}

.settings-label-group {
    display: flex;
    flex-direction: column;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
    background: var(--accent);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-small:active {
    opacity: 0.8;
}

/* Pending upload badge on attachments */
.attachment-item.pending-upload {
    position: relative;
    opacity: 0.8;
}

.attachment-item .pending-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 14px;
    background: rgba(0,0,0,0.5);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Sync badge */
#sync-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--accent);
    color: white;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

#sync-badge.visible {
    display: flex;
}

/* Offline indicator improvements */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #ff9500;
    color: white;
    text-align: center;
    padding: 8px;
    font-size: 13px;
    font-weight: 500;
    z-index: 9999;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

.offline-banner.visible {
    transform: translateY(0);
}

body:has(.offline-banner.visible) .screen-header,
body:has(.offline-banner.visible) .tab-bar {
    margin-top: 36px;
}

/* Cache download progress */
.cache-progress {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: 8px;
    margin-top: 8px;
}

.cache-progress-bar {
    flex: 1;
    height: 4px;
    background: var(--line-light);
    border-radius: 2px;
    overflow: hidden;
}

.cache-progress-fill {
    height: 100%;
    background: var(--accent);
    transition: width 0.2s ease;
}

.cache-progress-text {
    font-size: 12px;
    color: var(--label-secondary);
}

/* Tab spacer to push settings to bottom */
.tab-spacer {
    flex: 1;
}

/* ============================================
   PIN LOCK SCREEN
   ============================================ */

.pin-lock-screen {
    position: fixed;
    inset: 0;
    background: var(--bg);
    z-index: 10000;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pin-lock-screen.active {
    display: flex;
}

.pin-lock-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 320px;
    width: 100%;
}

.pin-lock-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--accent-light);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.pin-lock-icon svg {
    color: var(--accent);
}

.pin-lock-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.pin-lock-subtitle {
    font-size: 15px;
    color: var(--muted);
    margin-bottom: 32px;
    text-align: center;
}

.pin-dots {
    display: flex;
    gap: 16px;
    margin-bottom: 16px;
}

.pin-dot {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--line);
    transition: background 0.15s, transform 0.15s;
}

.pin-dot.filled {
    background: var(--accent);
    transform: scale(1.1);
}

.pin-dot.error {
    background: var(--danger);
    animation: pin-shake 0.4s ease;
}

@keyframes pin-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

.pin-error {
    font-size: 14px;
    color: var(--danger);
    min-height: 20px;
    margin-bottom: 24px;
    text-align: center;
}

.pin-keypad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    max-width: 280px;
}

.pin-key {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: none;
    font-size: 28px;
    font-weight: 500;
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s, transform 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.pin-key:active {
    background: var(--line-light);
    transform: scale(0.95);
}

.pin-key.empty {
    background: transparent;
    pointer-events: none;
}

.pin-key.delete {
    background: transparent;
}

.pin-key.delete svg {
    color: var(--text);
}

.pin-key.delete:active {
    background: var(--line-light);
}

/* PIN Setup Modal */
.pin-modal {
    max-width: 360px;
    padding-bottom: 24px;
}

.pin-setup-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 24px;
}

.pin-setup-instruction {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 24px;
    text-align: center;
}

.pin-setup-content .pin-dots {
    margin-bottom: 12px;
}

.pin-setup-content .pin-error {
    margin-bottom: 20px;
}

.pin-setup-content .pin-keypad {
    gap: 12px;
}

.pin-setup-content .pin-key {
    width: 64px;
    height: 64px;
    font-size: 24px;
}

/* Settings hint text */
.settings-hint {
    font-size: 13px;
    color: var(--muted);
    padding: 8px 4px 0;
    line-height: 1.4;
}

/* Settings icon colors */
.settings-icon.orange {
    background: rgba(255, 149, 0, 0.15);
    color: #ff9500;
}

/* ============================================
   APPLE NOTES STYLE - CLEAN OVERRIDE
   iPad & Desktop 3-Column Layout
   ============================================ */

@media (min-width: 768px) {
    /* Hide mobile elements */
    .bottom-bar,
    .fab:not(#new-note-btn-bottom) {
        display: none !important;
    }
    
    /* Sidebar - Folders panel (like Apple Notes left sidebar) */
    .tab-bar {
        display: flex !important;
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: 260px !important;
        flex-direction: column !important;
        padding: 0 8px !important;
        padding-top: calc(env(safe-area-inset-top, 8px) + 8px) !important;
        padding-bottom: env(safe-area-inset-bottom, 8px) !important;
        background: var(--bg-secondary) !important;
        border-right: 0.5px solid var(--line-light) !important;
        border-radius: 0 !important;
        z-index: 200 !important;
        gap: 1px !important;
        overflow-y: auto !important;
    }
    
    /* Hide old tab-item on iPad, use sidebar-item instead */
    .tab-item {
        display: none !important;
    }
    
    /* New Note button at top of sidebar */
    .sidebar-new-note {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        width: 100% !important;
        margin: 0 0 8px 0 !important;
        padding: 8px 12px !important;
        gap: 6px !important;
        border-radius: 6px !important;
        background: var(--accent) !important;
        border: none !important;
        cursor: pointer !important;
        color: #fff !important;
        font-family: inherit !important;
        font-size: 14px !important;
        font-weight: 500 !important;
        transition: opacity 0.15s ease !important;
    }
    
    .sidebar-new-note:hover {
        opacity: 0.9 !important;
    }
    
    .sidebar-new-note:active {
        opacity: 0.8 !important;
    }
    
    .sidebar-new-note svg {
        width: 100% !important;
        height: 100% !important;
        flex-shrink: 0 !important;
    }
    
    .sidebar-new-note .sidebar-icon {
        width: 16px !important;
        height: 16px !important;
        min-width: 16px !important;
        min-height: 16px !important;
    }
    
    /* New sidebar item styles */
    .sidebar-item {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 7px 10px !important;
        gap: 8px !important;
        border-radius: 6px !important;
        background: transparent !important;
        border: none !important;
        cursor: pointer !important;
        color: var(--text) !important;
        font-family: inherit !important;
        text-align: left !important;
        transition: background 0.15s ease !important;
    }
    
    .sidebar-item:hover {
        background: rgba(128, 128, 128, 0.1) !important;
    }
    
    .sidebar-item.active {
        background: var(--accent-light, rgba(0, 122, 255, 0.15)) !important;
    }
    
    .sidebar-item svg {
        width: 18px !important;
        height: 18px !important;
        min-width: 18px !important;
        min-height: 18px !important;
        flex-shrink: 0 !important;
        color: var(--muted) !important;
    }
    
    .sidebar-item.active svg {
        color: var(--accent) !important;
    }
    
    /* Wrap icons in a fixed-size container */
    .sidebar-icon {
        width: 18px !important;
        height: 18px !important;
        min-width: 18px !important;
        min-height: 18px !important;
        flex-shrink: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .sidebar-icon svg {
        width: 100% !important;
        height: 100% !important;
    }
    
    .sidebar-item-name {
        flex: 1 !important;
        font-size: 14px !important;
        font-weight: 400 !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }
    
    .sidebar-item.active .sidebar-item-name {
        font-weight: 500 !important;
        color: var(--accent) !important;
    }
    
    .sidebar-item-count {
        font-size: 13px !important;
        color: var(--muted) !important;
        flex-shrink: 0 !important;
    }
    
    /* Settings item - never highlighted blue */
    .sidebar-item.sidebar-settings {
        background: transparent !important;
    }
    
    .sidebar-item.sidebar-settings:hover {
        background: rgba(128, 128, 128, 0.1) !important;
    }
    
    .sidebar-item.sidebar-settings svg,
    .sidebar-item.sidebar-settings .sidebar-item-name {
        color: var(--muted) !important;
        font-weight: 400 !important;
    }
    
    /* Sidebar folders container */
    .sidebar-folders {
        display: flex !important;
        flex-direction: column !important;
        gap: 2px !important;
        padding: 0 !important;
    }
    
    /* Tab spacer - minimal */
    .tab-spacer {
        flex: 1 !important;
        min-height: 8px !important;
    }
    
    body.auth-mode .tab-bar {
        display: none !important;
    }
    
    /* App container - 3 column flex layout */
    #app {
        display: flex !important;
        flex-direction: row !important;
        margin-left: 260px !important;
        width: calc(100% - 260px) !important;
        height: 100vh !important;
        overflow: hidden !important;
    }
    
    body.auth-mode #app {
        margin-left: 0 !important;
        width: 100% !important;
    }
    
    /* All screens reset */
    .screen {
        position: relative !important;
        margin-left: 0 !important;
        height: 100vh !important;
        transform: none !important;
        transition: none !important;
    }
    
    /* Auth screen - full width centered */
    #auth-screen {
        position: absolute !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        z-index: 300 !important;
    }
    
    body.auth-mode #auth-screen {
        margin-left: 0 !important;
    }
    
    /* Home screen - Notes list column */
    #home-screen {
        display: flex !important;
        flex-direction: column !important;
        width: 320px !important;
        min-width: 320px !important;
        max-width: 320px !important;
        height: 100vh !important;
        border-right: 0.5px solid var(--line-light) !important;
        background: var(--bg) !important;
        flex-shrink: 0 !important;
    }
    
    #home-screen.active {
        display: flex !important;
    }
    
    #home-screen .glass-header {
        display: flex !important;
        flex-direction: column !important;
        padding: 12px 16px !important;
        padding-top: calc(12px + env(safe-area-inset-top, 0px)) !important;
        border-bottom: 0.5px solid var(--line-light) !important;
        min-height: auto !important;
    }
    
    #home-screen .glass-header .back-btn-home {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Hide folders button on iPad/desktop - sidebar is always visible */
    #home-screen .glass-header .folders-btn {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Hide mobile sidebar on iPad/desktop - use permanent tab-bar instead */
    .mobile-sidebar,
    .mobile-sidebar-overlay {
        display: none !important;
    }
    
    .notes-section {
        display: block !important;
        flex: 1 !important;
        overflow-y: auto !important;
        width: 100% !important;
        min-width: 0 !important;
        max-width: none !important;
        padding: 0 !important;
        border-right: none !important;
    }
    
    /* Hide folders-section on iPad - folders are in sidebar */
    .folders-section {
        display: none !important;
    }
    
    .notes-section .section-title-row {
        padding: 12px 16px !important;
        padding-top: 8px !important;
    }
    
    /* Cleaner, wider note cards */
    .note-row {
        margin: 2px 8px !important;
        padding: 12px 14px !important;
        border-radius: 10px !important;
        border: none !important;
        background: transparent !important;
    }
    
    .note-row:hover {
        background: rgba(128, 128, 128, 0.08) !important;
    }
    
    .note-row.selected,
    .note-row.active {
        background: var(--accent-light, rgba(0, 122, 255, 0.12)) !important;
    }
    
    .note-row .note-title {
        font-size: 15px !important;
        font-weight: 500 !important;
        margin-bottom: 2px !important;
    }
    
    .note-row .note-preview {
        font-size: 13px !important;
        color: var(--muted) !important;
        line-height: 1.3 !important;
    }
    
    .note-row .note-date {
        font-size: 12px !important;
        color: var(--muted) !important;
    }
    
    /* Editor screen - takes remaining space */
    #editor-screen {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        width: auto !important;
        min-width: 0 !important;
        height: 100vh !important;
        background: var(--bg) !important;
        margin-left: 0 !important;
        z-index: auto !important;
    }
    
    /* Show empty state when no note selected */
    #editor-screen:not(.active) {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    #editor-screen:not(.active) .editor-header,
    #editor-screen:not(.active) .editor-content,
    #editor-screen:not(.active) .formatting-toolbar,
    #editor-screen:not(.active) .attachments-section,
    #editor-screen:not(.active) .recording-indicator {
        display: none !important;
    }
    
    #editor-screen:not(.active)::after {
        content: 'Select a note';
        color: var(--label-tertiary);
        font-size: 17px;
    }
    
    #editor-screen.active::after {
        display: none;
    }
    
    .editor-header {
        display: flex !important;
        padding: 8px 16px !important;
        padding-top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        border-bottom: 0.5px solid var(--line-light) !important;
        min-height: auto !important;
    }
    
    .editor-header .back-btn {
        display: none !important;
    }
    
    .editor-content {
        flex: 1 !important;
        overflow-y: auto !important;
        padding: 24px 32px !important;
        padding-bottom: 120px !important;
        max-width: none !important;
    }
    
    #note-title {
        font-size: 28px !important;
    }
    
    /* Formatting toolbar - in editor header area */
    .formatting-toolbar {
        position: fixed !important;
        top: calc(8px + env(safe-area-inset-top, 0px)) !important;
        left: auto !important;
        right: 16px !important;
        bottom: auto !important;
        transform: none !important;
        background: var(--bg-elevated) !important;
        border-radius: 8px !important;
        padding: 4px 8px !important;
        box-shadow: var(--shadow-sm) !important;
        max-width: none !important;
        width: auto !important;
        z-index: 150 !important;
        gap: 4px !important;
        height: auto !important;
        border: none !important;
    }
    
    .formatting-toolbar .format-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        flex-shrink: 0 !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .formatting-toolbar .format-btn svg {
        width: 18px !important;
        height: 18px !important;
        min-width: 18px !important;
        min-height: 18px !important;
    }
    
    .formatting-toolbar .format-divider {
        width: 1px !important;
        height: 20px !important;
        margin: 0 4px !important;
        flex-shrink: 0 !important;
    }
    
    /* Hide editor-actions on iPad - overlaps with formatting toolbar */
    .editor-actions {
        display: none !important;
    }
    
    /* New note button - bottom of notes list */
    #new-note-btn-bottom,
    .new-note-btn,
    .compose-btn {
        display: flex !important;
        position: fixed !important;
        bottom: 24px !important;
        left: calc(260px + 160px) !important;
        right: auto !important;
        transform: translateX(-50%) !important;
        width: 48px !important;
        height: 48px !important;
        border-radius: 50% !important;
        background: var(--accent) !important;
        color: white !important;
        border: none !important;
        align-items: center !important;
        justify-content: center !important;
        box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3) !important;
        z-index: 100 !important;
        cursor: pointer !important;
    }
    
    #new-note-btn-bottom svg,
    .new-note-btn svg,
    .compose-btn svg {
        width: 22px !important;
        height: 22px !important;
    }
    
    /* Settings screen - overlay on right */
    #settings-screen {
        position: fixed !important;
        left: 260px !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: auto !important;
        background: var(--bg) !important;
        z-index: 100 !important;
    }
    
    #settings-screen:not(.active) {
        display: none !important;
    }
    
    #settings-screen .settings-content {
        max-width: 600px !important;
        margin: 0 auto !important;
        padding: 24px !important;
    }
    
    /* Search screen - overlay */
    #search-screen {
        position: fixed !important;
        left: 260px !important;
        right: 0 !important;
        top: 0 !important;
        bottom: 0 !important;
        width: auto !important;
        z-index: 100 !important;
    }
    
    /* More menu dropdown on iPad/desktop - position relative to home screen */
    .more-menu-dropdown {
        position: absolute !important;
        top: calc(env(safe-area-inset-top, 0px) + 50px) !important;
        right: 8px !important;
        left: auto !important;
        z-index: 1000 !important;
    }
}

/* Larger tablets and small desktops */
@media (min-width: 1024px) {
    .tab-bar {
        width: 280px !important;
    }
    
    #app {
        margin-left: 280px !important;
        width: calc(100% - 280px) !important;
    }
    
    /* Force hide all navigation buttons in notes list header on desktop */
    #home-screen .glass-header .folders-btn,
    #home-screen .glass-header .back-btn-home,
    #home-screen .glass-header .icon-btn:first-child:not(#more-menu-btn) {
        display: none !important;
        visibility: hidden !important;
        width: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
        position: absolute !important;
        pointer-events: none !important;
    }
    
    #home-screen {
        width: 320px !important;
        min-width: 320px !important;
        max-width: 320px !important;
    }
    
    #new-note-btn-bottom,
    .new-note-btn,
    .compose-btn {
        left: calc(280px + 160px) !important;
    }
    
    #settings-screen,
    #search-screen {
        left: 280px !important;
    }
    
    .editor-content {
        padding: 32px 48px !important;
    }
    
    #note-title {
        font-size: 32px !important;
    }
}

/* Large desktops */
@media (min-width: 1400px) {
    #home-screen {
        width: 360px !important;
        min-width: 360px !important;
        max-width: 360px !important;
    }
    
    #new-note-btn-bottom,
    .new-note-btn,
    .compose-btn {
        left: calc(280px + 180px) !important;
    }
    
    .editor-content {
        padding: 40px 80px !important;
        max-width: none !important;
    }
}

/* ============================================
   DESKTOP UI POLISH - v1.2.28
   Clean Apple Notes-style refinements
   ============================================ */

@media (min-width: 768px) {
    /* ===== SIDEBAR REFINEMENTS ===== */
    
    /* More compact new note button */
    .sidebar-new-note {
        padding: 10px 14px !important;
        margin-bottom: 12px !important;
        font-size: 15px !important;
        font-weight: 600 !important;
        border-radius: 8px !important;
    }
    
    /* Tighter folder list spacing */
    .sidebar-folders {
        gap: 1px !important;
    }
    
    .sidebar-item {
        padding: 6px 10px !important;
        border-radius: 6px !important;
        font-size: 13px !important;
    }
    
    .sidebar-item-name {
        font-size: 13px !important;
    }
    
    .sidebar-item-count {
        font-size: 12px !important;
        opacity: 0.7 !important;
    }
    
    /* Subtle divider above settings */
    .tab-spacer {
        border-top: 1px solid var(--line-light) !important;
        margin-top: 8px !important;
        padding-top: 8px !important;
    }
    
    /* ===== NOTES LIST COLUMN ===== */
    
    /* Clean header - just title and menu */
    #home-screen .glass-header {
        padding: 16px 16px 12px !important;
        border-bottom: none !important;
        background: var(--bg) !important;
    }
    
    #home-screen .glass-header .header-content {
        align-items: center !important;
    }
    
    #home-screen .glass-header .header-title {
        font-size: 22px !important;
        font-weight: 700 !important;
        letter-spacing: -0.3px !important;
    }
    
    /* Hide redundant section title row on desktop */
    .notes-section .section-title-row {
        display: none !important;
    }
    
    /* Clean notes list */
    .notes-list {
        padding: 0 !important;
    }
    
    /* Apple Notes style note rows */
    .note-row {
        margin: 0 8px 1px !important;
        padding: 10px 12px !important;
        border-radius: 8px !important;
        border: none !important;
        background: transparent !important;
        transition: background 0.1s ease !important;
        position: relative !important;
    }
    
    .note-row:hover {
        background: var(--line-light) !important;
    }
    
    .note-row.selected,
    .note-row.active {
        background: var(--accent-light) !important;
    }
    
    /* Selection mode on desktop */
    .note-row.selectable {
        padding-left: 44px !important;
    }
    
    .note-row .select-checkbox {
        left: 12px !important;
        width: 22px !important;
        height: 22px !important;
    }
    
    .note-row.selected .select-checkbox::after {
        width: 8px !important;
        height: 4px !important;
        border-width: 2px !important;
    }
    
    .note-row .note-title {
        font-size: 14px !important;
        font-weight: 500 !important;
        margin-bottom: 2px !important;
        color: var(--text) !important;
    }
    
    .note-row .note-meta {
        display: flex !important;
        align-items: center !important;
        gap: 8px !important;
    }
    
    .note-row .note-date {
        font-size: 12px !important;
        color: var(--muted) !important;
        font-weight: 400 !important;
    }
    
    .note-row .note-preview {
        font-size: 12px !important;
        color: var(--muted) !important;
        line-height: 1.35 !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 1 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }
    
    /* DESKTOP: Hide old header selection buttons, use floating bar instead */
    #header-actions-select {
        display: none !important;
    }
    
    /* Notes section needs relative positioning for the floating bar */
    .notes-section {
        position: relative !important;
    }
    
    /* When in selection mode, add padding at bottom for action bar */
    .notes-section.select-mode {
        padding-bottom: 56px !important;
    }
    
    /* Selection action bar positioning */
    .selection-action-bar {
        position: absolute !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        background: var(--bg) !important;
        border-top: 1px solid var(--line-light) !important;
    }
    
    /* When in selection mode, keep the normal header title (not "X Selected") */
    #home-screen .glass-header .header-title {
        flex-shrink: 0 !important;
        min-width: 0 !important;
    }
    
    /* Date group headers */
    .date-group-header {
        font-size: 12px !important;
        font-weight: 600 !important;
        color: var(--muted) !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        padding: 16px 16px 6px !important;
        margin: 0 !important;
    }
    
    /* Hide scroll indicator line in notes list */
    .notes-section::-webkit-scrollbar {
        width: 6px !important;
    }
    
    .notes-section::-webkit-scrollbar-track {
        background: transparent !important;
    }
    
    .notes-section::-webkit-scrollbar-thumb {
        background: var(--line-light) !important;
        border-radius: 3px !important;
    }
    
    .notes-list::-webkit-scrollbar {
        width: 6px !important;
    }
    
    .notes-list::-webkit-scrollbar-track {
        background: transparent !important;
    }
    
    .notes-list::-webkit-scrollbar-thumb {
        background: var(--line-light) !important;
        border-radius: 3px !important;
    }
    
    /* Hide the floating FAB - new note is in sidebar */
    #new-note-btn-bottom,
    .compose-btn,
    .fab {
        display: none !important;
    }
    
    /* ===== EDITOR COLUMN - COMPLETE REDESIGN ===== */
    
    /* Clean editor area with subtle left border */
    #editor-screen {
        border-left: 0.5px solid var(--line-light) !important;
        background: var(--bg) !important;
    }
    
    /* Hide the mobile-style back button header on desktop */
    #editor-screen .editor-header {
        display: none !important;
    }
    
    /* Editor content - the main writing area */
    .editor-content {
        flex: 1 !important;
        display: flex !important;
        flex-direction: column !important;
        padding: 24px 48px 100px !important;
        overflow-y: auto !important;
        max-width: 800px !important;
        margin: 0 auto !important;
        width: 100% !important;
    }
    
    /* Title input - large and prominent */
    #note-title,
    .note-title-input {
        font-size: 32px !important;
        font-weight: 700 !important;
        letter-spacing: -0.5px !important;
        border: none !important;
        background: transparent !important;
        padding: 0 !important;
        margin-bottom: 8px !important;
        color: var(--text) !important;
        width: 100% !important;
    }
    
    #note-title::placeholder,
    .note-title-input::placeholder {
        color: var(--muted) !important;
        opacity: 0.6 !important;
    }
    
    /* Note metadata line - date and folder */
    .note-meta {
        display: flex !important;
        align-items: center !important;
        gap: 16px !important;
        font-size: 13px !important;
        color: var(--muted) !important;
        margin-bottom: 16px !important;
        padding-bottom: 0 !important;
        border-bottom: none !important;
    }
    
    .note-date {
        font-size: 13px !important;
        color: var(--muted) !important;
    }
    
    .note-folder-btn {
        font-size: 13px !important;
        color: var(--muted) !important;
        padding: 2px 6px !important;
        margin: -2px -6px !important;
    }
    
    .note-folder-btn:hover {
        background: var(--line-light) !important;
    }
    
    /* Formatting toolbar - horizontal bar below metadata */
    .formatting-toolbar {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        left: auto !important;
        bottom: auto !important;
        transform: none !important;
        display: flex !important;
        align-items: center !important;
        gap: 2px !important;
        height: 44px !important;
        padding: 0 !important;
        margin: 0 0 20px 0 !important;
        background: transparent !important;
        border: none !important;
        border-bottom: 1px solid var(--line-light) !important;
        box-shadow: none !important;
        overflow-x: auto !important;
        flex-wrap: nowrap !important;
        width: 100% !important;
        max-width: none !important;
        z-index: 1 !important;
    }
    
    .formatting-toolbar .format-btn {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        border-radius: 6px !important;
        background: transparent !important;
        border: none !important;
        color: var(--text-secondary, var(--muted)) !important;
        transition: background 0.1s, color 0.1s !important;
        flex-shrink: 0 !important;
    }
    
    .formatting-toolbar .format-btn:hover {
        background: var(--line-light) !important;
        color: var(--text) !important;
    }
    
    .formatting-toolbar .format-btn.active {
        background: var(--accent-light) !important;
        color: var(--accent) !important;
    }
    
    .formatting-toolbar .format-btn svg {
        width: 18px !important;
        height: 18px !important;
    }
    
    .formatting-toolbar .format-divider {
        width: 1px !important;
        height: 20px !important;
        background: var(--line-light) !important;
        margin: 0 8px !important;
        flex-shrink: 0 !important;
    }
    
    /* Note body container */
    .note-body-container {
        flex: 1 !important;
        overflow-y: visible !important;
    }
    
    /* Note body - the actual editable area */
    .note-body,
    #note-body {
        font-size: 16px !important;
        line-height: 1.7 !important;
        color: var(--text) !important;
        min-height: 300px !important;
        outline: none !important;
    }
    
    .note-body:empty::before,
    #note-body:empty::before {
        content: attr(placeholder) !important;
        color: var(--muted) !important;
        opacity: 0.6 !important;
    }
    
    /* Empty editor state */
    #editor-screen:not(.active)::after {
        content: 'Select a note or create a new one' !important;
        color: var(--muted) !important;
        font-size: 15px !important;
    }
    
    /* Attachments and recordings sections */
    .attachments-section,
    .recordings-section {
        margin-top: 32px !important;
        padding-top: 24px !important;
        border-top: 1px solid var(--line-light) !important;
    }
    
    .attachments-header,
    .recordings-header {
        font-size: 13px !important;
        font-weight: 600 !important;
        color: var(--muted) !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        margin-bottom: 12px !important;
    }
}

/* Desktop 1024px+ refinements */
@media (min-width: 1024px) {
    .tab-bar {
        width: 240px !important;
    }
    
    #app {
        margin-left: 240px !important;
        width: calc(100% - 240px) !important;
    }
    
    #home-screen {
        width: 300px !important;
        min-width: 300px !important;
        max-width: 300px !important;
    }
    
    .editor-content {
        padding: 32px 64px 100px !important;
        max-width: 860px !important;
    }
    
    #note-title,
    .note-title-input {
        font-size: 34px !important;
    }
}

/* Large desktop 1400px+ */
@media (min-width: 1400px) {
    .tab-bar {
        width: 260px !important;
    }
    
    #app {
        margin-left: 260px !important;
        width: calc(100% - 260px) !important;
    }
    
    #home-screen {
        width: 340px !important;
        min-width: 340px !important;
        max-width: 340px !important;
    }
    
    .editor-content {
        padding: 40px 80px 120px !important;
        max-width: 920px !important;
    }
}

/* Extra large desktop 1800px+ */
@media (min-width: 1800px) {
    .tab-bar {
        width: 280px !important;
    }
    
    #app {
        margin-left: 280px !important;
        width: calc(100% - 280px) !important;
    }
    
    #home-screen {
        width: 380px !important;
        min-width: 380px !important;
        max-width: 380px !important;
    }
    
    .editor-content {
        max-width: 1000px !important;
    }
}
