/* ==========================================================================
   AfterNote - Modern Compact Design System
   Color Scheme: Blue / Emerald Green with Amber Gold Accent
   ========================================================================== */

@import url('fonts.css');

:root {
    /* Primary Colors (Blue / Emerald) */
    --primary: #2563eb;
    --primary-hover: #1d4ed8;
    --primary-light: #eff6ff;
    --primary-border: #bfdbfe;

    --emerald: #10b981;
    --emerald-hover: #059669;
    --emerald-light: #ecfdf5;
    --emerald-border: #a7f3d0;

    /* Accent Color (Amber Gold / Coral) */
    --accent: #f59e0b;
    --accent-hover: #d97706;
    --accent-light: #fef3c7;
    --accent-border: #fde68a;
    --accent-bg: #fef08a;

    /* Neutral & Backgrounds */
    --bg-app: #f8fafc;
    --bg-sidebar: #f1f5f9;
    --bg-editor: #ffffff;
    --bg-card: #ffffff;
    --bg-hover: #e2e8f0;
    --bg-active: #dbeafe;

    /* Borders & Dividers */
    --border-subtle: #e2e8f0;
    --border-medium: #cbd5e1;
    --border-strong: #94a3b8;

    /* Typography Colors */
    --text-main: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --text-inverse: #ffffff;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --danger-border: #fecaca;

    /* Radii & Shadows */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 9999px;

    --shadow-xs: 0 1px 2px 0 rgba(15, 23, 42, 0.05);
    --shadow-sm: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 1px 2px -1px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -2px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.08);
    --shadow-popover: 0 20px 25px -5px rgba(15, 23, 42, 0.12), 0 8px 10px -6px rgba(15, 23, 42, 0.08);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

    --sidebar-width: 190px;
    --sidebar-min-width: 160px;
    --sidebar-max-width: 700px;
    --header-height: 52px;
    --app-height: 100dvh;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html,
body {
    width: 100%;
    height: 100%;
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
    overflow: hidden;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-main);
    background-color: var(--bg-app);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

button {
    outline: none;
}

[v-cloak] {
    display: none !important;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--border-strong);
}

/* ==========================================================================
   Main Application Layout
   ========================================================================== */

#app {
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
    overflow: hidden;
    background: var(--bg-app);
}

.main_container {
    display: flex;
    width: 100%;
    height: 100%;
    height: var(--app-height, 100dvh);
    max-height: var(--app-height, 100dvh);
    overflow: hidden;
}

/* ==========================================================================
   Left Sidebar
   ========================================================================== */

.panel_sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    height: 100%;
    background-color: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    user-select: none;
    z-index: 10;
}

/* Sidebar Resizer Divider */
.sidebar-resizer {
    width: 8px;
    margin-left: -4px;
    margin-right: -4px;
    height: 100%;
    cursor: col-resize;
    position: relative;
    z-index: 25;
    flex-shrink: 0;
    user-select: none;
    touch-action: none;
    background: transparent;
}

.sidebar-resizer::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 3px;
    width: 2px;
    background: transparent;
    transition: background-color 0.15s ease, box-shadow 0.15s ease;
    pointer-events: none;
}

.sidebar-resizer:hover::after,
.sidebar-resizer.is-resizing::after,
body.is-resizing-sidebar .sidebar-resizer::after {
    background: var(--primary);
    box-shadow: 0 0 4px rgba(37, 99, 235, 0.4);
}

body.is-resizing-sidebar,
body.is-resizing-sidebar * {
    cursor: col-resize !important;
    user-select: none !important;
}

body.is-resizing-sidebar iframe {
    pointer-events: none !important;
}

/* Sidebar Top Brand Header */
.sidebar-header {
    display: flex;
    height: var(--header-height);
    align-items: center;
    justify-content: space-between;
    padding: 5px 15px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    cursor: default;
}

.brand-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    /*background: linear-gradient(135deg, var(--primary) 0%, #3b82f6 100%);*/
    /*color: white;*/
    /*border-radius: var(--radius-md);*/
    /*box-shadow: 0 2px 5px rgba(37, 99, 235, 0.3);*/
}

.brand-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Square Buttons Toolbar */
.sidebar-toolbar {
    display: flex;
    height: 41px;
    padding: 5px 8px;
    gap: 5px;
    border-bottom: 1px solid var(--border-subtle);
    justify-content: flex-start;
    background: var(--bg-sidebar);
    align-items: stretch;
    box-sizing: border-box;
}

.btn-square {
    position: relative;
    display: inline-flex;
    min-width: 30px;
    max-width: 44px;
    border: 1px solid var(--border-medium);
    font-size: 14px;
    font-weight: 600;
    flex: 1;
    border-radius: var(--radius-md);
    color: var(--text-main);
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all 0.15s ease-in-out;
}

.btn-square:hover:not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-square:hover:not(:disabled):after {
    color: var(--primary);
}

.btn-square:active:not(:disabled) {
    transform: translateY(0) scale(0.96);
    box-shadow: none;
}

.btn-square:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    background: transparent;
    border-color: var(--border-subtle);
}

.btn-square.btn-delete:hover:not(:disabled) {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-square.btn-trash-full {
    color: var(--danger);
    border-color: var(--danger-border);
}

.btn-square.btn-trash-full:hover:not(:disabled) {
    background: var(--danger-light);
    border-color: var(--danger);
    color: var(--danger);
}

.btn-square.active {
    position: relative;
    background: var(--primary);
    border-color: var(--primary-hover);
    color: white;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.35);
}

.btn-square.active svg {
    display: none;
}

.btn-square.active:after {
    position: absolute;
    display: flex;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    content: "✕";
    font-size: 15px;
    line-height: 1;
    color: var(--text-inverse);
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease-in-out;
}

/* Expandable Search Bar Drawer */
.sidebar-search-drawer {
    padding: 8px 12px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
    animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-input-wrapper {
    display: flex;
    align-items: center;
    position: relative;
}

.search-input {
    width: 100%;
    height: 32px;
    padding: 0 28px 0 10px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-app);
    outline: none;
    transition: all 0.15s ease;
}

.search-input:focus {
    border-color: var(--primary);
    background: var(--bg-card);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.search-btn-clear {
    position: absolute;
    right: 6px;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 15px;
    cursor: pointer;
    border-radius: 50%;
}

.search-btn-clear:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.search-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
}

.search-matches-count {
    font-weight: 500;
    font-size: 11px;
    padding: 1px 6px;
    background: var(--bg-hover);
    border-radius: var(--radius-xs);
}

.search-nav-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
}

.search-nav-btn {
    height: 24px;
    width: 24px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xs);
    color: var(--text-main);
    cursor: pointer;
    transition: background 0.1s;
}

.search-nav-btn svg {
    width: 75%;
    height: 75px;
    opacity: 0.8;
}
.search-nav-btn path {
    stroke: var(--text-main);
}

.search-nav-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-border);
    color: var(--primary);
}

/* ==========================================================================
   Sidebar Tree (Categories & Pages List)
   ========================================================================== */

.panel_list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 10px 10px 10px 8px;
    display: flex;
    flex-direction: column;
}

/* Sidebar Bottom Trash Button */
.sidebar-trash-wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    height: 42px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
    cursor: pointer;
    user-select: none;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.sidebar-trash-wrap:hover {
    background: var(--bg-hover);
}

.sidebar-trash-wrap.trash-is-full {
    background: var(--danger-light, #fee2e2);
}

.sidebar-trash-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.sidebar-trash-icon {
    font-size: 15px;
    line-height: 1;
    flex-shrink: 0;
}

.sidebar-trash-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.2px;
}

.sidebar-trash-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 7px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius-full);
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    color: var(--text-muted);
}

.sidebar-trash-badge.sidebar-trash-empty {
    opacity: 0.6;
}

.sidebar-trash-badge.badge-full {
    background: var(--danger, #ef4444);
    color: #ffffff;
    border-color: var(--danger, #ef4444);
    font-weight: 700;
    box-shadow: 0 1px 3px rgba(239, 68, 68, 0.3);
}

.list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

/* Category item */
.ct {
    display: flex;
    flex-direction: column;
    margin-bottom: 4px;
    border-radius: var(--radius-md);
    transition: background-color 0.15s ease;
}

.ct_line {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    font-size: 13px;
    color: var(--text-main);
    gap: 6px;
    transition: background 0.12s ease;
}

.ct_line:hover {
    background-color: var(--bg-hover);
}

.ct.active>.ct_line {
    position: relative;
    background-color: var(--primary-light);
    color: var(--primary);
}

.ct.active>.ct_line:before {
    position: absolute;
    content: "";
    display: block;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    margin-left: 0px;
    background-color: var(--primary);
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
}

.ct-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    font-size: 10px;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
    transition: transform 0.15s ease;
}

.ct-arrow.collapsed {
    transform: rotate(-90deg);
}

.ct_badge {
    background-color: var(--accent);
    color: var(--bg-app);
    border: 1px solid var(--border-subtle);
    font-size: 11px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 6px;
    min-width: 21px;
    text-align: center;
    line-height: 1.3;
    box-shadow: 2px -1px 0px var(--accent-border);
    font-family: monospace;
}

/*.ct.active .ct_badge {
    background-color: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}*/

.ct-title-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ct-title-text:empty::after,
.ct-title-text.is-empty::after {
    content: attr(data-placeholder);
    color: var(--text-light);
    opacity: 0.7;
    font-style: normal;
    pointer-events: none;
}

.ct.active .ct-title-text:empty::after,
.ct.active .ct-title-text.is-empty::after {
    color: inherit;
    opacity: 0.65;
}

/* Pages list inside category */
.pgs {
    list-style: none;
    padding-left: 20px;
    display: flex;
    flex-direction: column;
    /*gap: 2px;*/
    overflow: hidden;
    transition: max-height 0.2s ease-in-out;
}

.pgs>li {
    margin-bottom: 2px;
}

.pgs>li:last-child {
    margin-bottom: 0px;
}

.pgs>li:first-child {
    margin-bottom: 2px !important;
}

.pgs_collapsed {
    max-height: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin: 0;
    display: none;
}

.ct_no {
    margin-top: 6px;
}

.ct_no .pgs {
    padding-left: 4px;
    min-height: 14px;
}

.ct_no_line {
    display: flex;
    display: none;
    align-items: center;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    cursor: default;
    font-weight: 600;
    font-size: 12px;
    color: var(--text-muted);
    gap: 6px;
    margin-bottom: 2px;
    border-top: 1px solid var(--border-subtle);
    padding-top: 8px;
    user-select: none;
    transition: all 0.15s ease;
}

.ct_no_line .ct-title-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ct_no_line.drop-active,
.ct_no.drag-over-ct .ct_no_line {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px dashed var(--primary);
}

.ct-no-icon {
    font-size: 13px;
    opacity: 0.75;
}

.ct_no_empty_dropzone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-sm);
    background: rgba(37, 99, 235, 0.03);
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 4px;
    list-style: none;
    user-select: none;
    transition: all 0.15s ease;
}

.ct_no_empty_dropzone.drop-target,
.ct_no.drag-over-ct .ct_no_empty_dropzone {
    border-color: var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

/* Page item */
.pg {
    display: flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text-main);
    gap: 7px;
    /*transition: all 0.12s ease;*/
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border: 1px solid transparent;
}

.pg:hover {
    background-color: var(--bg-hover);
    color: var(--text-main);
}

.pg.active {
    position: relative;
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
    border-color: var(--primary-border);
    /*box-shadow: 0 1px 2px rgba(37, 99, 235, 0.08);*/
    /*border-left: 3px solid var(--primary);*/
}

.pg.active:before {
    position: absolute;
    content: "";
    display: block;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    margin-left: 0px;
    background-color: var(--primary);
    border-top-left-radius: var(--radius-sm);
    border-bottom-left-radius: var(--radius-sm);
}

.pg-icon {
    font-size: 13px;
    opacity: 0.75;
    flex-shrink: 0;
}

.pg-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pg-title:empty::after,
.pg-title.is-empty::after {
    content: attr(data-placeholder);
    color: var(--text-light);
    opacity: 0.7;
    font-style: normal;
    pointer-events: none;
}

.pg.active .pg-title:empty::after,
.pg.active .pg-title.is-empty::after {
    color: inherit;
    opacity: 0.65;
}

/* Drag and Drop states */
.is-dragging {
    opacity: 0.45;
    outline: 1px dashed var(--primary) !important;
    background-color: var(--primary-light) !important;
}

.drag-over-ct {
    background-color: var(--emerald-light) !important;
}

.drag-over-ct>.ct_line {
    outline: 1px dashed var(--emerald) !important;
}

.pg-drop-target {
    /*margin-bottom: 1px;*/
    /*outline: 1px dashed var(--emerald);*/
    /*border-radius: var(--radius-sm);*/
    /*background-color: var(--emerald-light);*/
}

/* ==========================================================================
   Main Right Editor Panel
   ========================================================================== */

.panel_editor {
    flex: 1;
    height: 100%;
    background-color: var(--bg-editor);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* Контейнер кнопки ссылки */
.link-tool-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.link-tool-btn .link-icon {
    font-size: 13px;
    line-height: 1;
    display: inline-block;
}

/* Editor Header Bar (Top Area) */
.editor-topbar {
    height: var(--header-height);
    min-height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
    gap: 16px;
    position: relative;
    z-index: 100;
}

.editor-title-container {
    flex: 1;
    display: flex;
    align-items: center;
    min-width: 0;
}

.editor-title {
    width: 100%;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    color: var(--text-main);
    background: transparent;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
    transition: all 0.15s ease;
}

.editor-title::-webkit-search-cancel-button,
.editor-title::-webkit-search-decoration,
.editor-title::-webkit-search-results-button,
.editor-title::-webkit-search-results-decoration {
    -webkit-appearance: none;
    display: none;
}

.editor-title:hover {
    background: var(--bg-app);
}

.editor-title:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.editor-title::placeholder {
    color: var(--text-light);
    opacity: 0.65;
    font-weight: 500;
}

/* Right Topbar Actions: Save & Menu */
.editor-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Save Button with Dynamic Sync State Indicator */
.btn-save {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border-medium);
    background: var(--bg-card);
    color: var(--text-main);
    box-shadow: var(--shadow-xs);
    transition: all 0.15s ease-in-out;
    user-select: none;
}

.btn-save:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    box-shadow: var(--shadow-sm);
}

.btn-save:active {
    transform: translateY(1px);
}

/* Sync State Indicators inside Save Button */
.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.sync-clean .sync-dot {
    background-color: var(--emerald);
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.sync-syncing .sync-dot {
    background-color: var(--primary);
    animation: pulseSync 1s infinite alternate;
}

.sync-dirty .sync-dot {
    background-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2);
}

.sync-break .sync-dot {
    background-color: var(--danger);
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.2);
}

@keyframes pulseSync {
    0% {
        transform: scale(0.85);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.15);
        opacity: 1;
    }
}

/* Menu Dropdown Container */
.user-menu-container {
    position: relative;
    display: inline-block;
    z-index: 100;
}

.user-menu-container svg {
    opacity: 0.8;
}

.user-menu-container svg circle,
.user-menu-container svg path {
    stroke: var(--text-main);
}

.btn-menu {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 17px;
    color: var(--text-main);
    cursor: pointer;
    box-shadow: var(--shadow-xs);
    transition: all 0.15s ease;
}

.btn-menu:hover,
.btn-menu.active {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 250px;
    max-height: calc(100vh - 72px);
    max-height: calc(100dvh - 72px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-popover);
    padding: 8px;
    z-index: 1000 !important;
    animation: menuFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-dropdown::-webkit-scrollbar {
    width: 5px;
}

.menu-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.menu-dropdown::-webkit-scrollbar-thumb {
    background: var(--border-medium, rgba(0, 0, 0, 0.15));
    border-radius: 4px;
}

.menu-dropdown::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted, rgba(0, 0, 0, 0.3));
}

@keyframes menuFadeIn {
    from {
        opacity: 0;
        transform: translateY(-6px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.menu-user-header {
    padding: 8px 10px;
    background: var(--bg-app);
    border-radius: var(--radius-sm);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-user-email {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.menu-stats-row {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
    flex-direction: column;
}

.menu-stats-row > span {
    margin-top: 3px;
}

.menu-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 4px 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 10px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    color: var(--text-main);
    cursor: pointer;
    text-align: left;
    transition: background 0.1s ease;
}

.menu-item:hover {
    background: var(--bg-hover);
}

.menu-item.menu-danger {
    color: var(--danger);
}

.menu-item.menu-danger:hover {
    background: var(--danger-light);
}

/* ==========================================================================
   Quill Formatting Toolbar
   ========================================================================== */

.editor-tools-wrap {
    position: relative;
    width: 100%;
}

.panel_editor-tools {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    padding: 6px 6px 6px 10px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    user-select: none;
    position: relative;
    z-index: 20;
}

.panel_editor-tools button {
    height: 28px;
    min-width: 28px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.1s ease;
}

.panel_editor-tools button:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.panel_editor-tools button.active {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary-border);
}

.toolbar-separator {
    width: 1px;
    height: 18px;
    background: var(--border-medium);
    margin: 0 4px;
}

.toolbar-color-bg {
    background-color: var(--accent-bg);
}

/* Color Picker Popover */
.editor-color-picker {
    position: absolute;
    top: 42px;
    left: 180px;
    display: grid;
    grid-template-columns: repeat(7, 18px);
    gap: 4px;
    padding: 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-popover);
    z-index: 50;
}

.editor-color-picker button {
    width: 18px;
    height: 18px;
    border-radius: 3px;
    border: 1px solid rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.editor-header-picker,
.editor-font-picker,
.editor-size-picker {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-popover);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 500 !important;
    /*max-height: 240px;*/
    max-height: calc(100vh - 150px);
    max-height: calc(100dvh - 150px);
    overflow-y: auto;
}

.editor-header-picker {
    min-width: 72px;
}

.editor-font-picker {
    min-width: 145px;
}

.editor-size-picker {
    min-width: 140px;
}

.editor-header-picker button,
.editor-font-picker button,
.editor-size-picker button {
    height: 40px;
    min-height: 24px;
    padding: 0 10px;
    justify-content: flex-start;
    font-size: 12px;
    background-color: var(--bg-card);
    border-radius: var(--radius-xs);
    color: var(--text-main);
    width: 100%;
}

.editor-header-picker button:hover,
.editor-font-picker button:hover,
.editor-size-picker button:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.editor-header-picker button.active,
.editor-font-picker button.active,
.editor-size-picker button.active {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 600;
}

.editor-size-picker button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.editor-size-picker .size-opt-label {
    flex: 1;
    text-align: left;
    white-space: nowrap;
}

.editor-size-picker .size-opt-preview {
    font-weight: 700;
    opacity: 0.5;
    line-height: 1;
    display: inline-flex;
    align-items: center;
}

.editor-size-picker button:hover .size-opt-preview,
.editor-size-picker button.active .size-opt-preview {
    opacity: 0.95;
}

.size-btn-icon {
    display: inline-flex;
    align-items: baseline;
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: -0.5px;
}

.size-btn-icon span {
    font-size: 9.5px;
    font-weight: 600;
    line-height: 1;
    margin-left: 0.5px;
}

.editor-color-input {
    position: fixed;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Кнопка "Очистить форматирование" со значком */
.btn-clear-format svg {
    pointer-events: none;
    display: block;
}

/* ==========================================================================
   Table Picker Popover
   ========================================================================== */

.table-tool-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.table-tool-wrap button svg {
    pointer-events: none;
    display: block;
}

.editor-table-picker {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-popover);
    padding: 12px;
    z-index: 500 !important;
    min-width: 288px;
    width: max-content;
    max-width: calc(100vw - 20px);
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 10px;
    animation: menuFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
}

.table-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

.table-picker-badge {
    padding: 2px 7px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 700;
}

/* Сетка для интерактивного выбора размера таблицы */
.table-picker-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 6px;
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
}

.table-grid-row {
    display: flex;
    gap: 3px;
}

.table-grid-cell {
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-medium);
    border-radius: 2px;
    background: var(--bg-card);
    transition: all 0.08s ease;
}

.table-grid-cell.highlighted {
    background: var(--primary-light);
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary-border);
}

/* Ручной ввод строк и столбцов */
.table-picker-inputs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
}

.table-input-group {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: var(--text-muted);
}

.table-input-group input {
    width: 38px;
    height: 24px;
    padding: 0 4px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    background: var(--bg-app);
    color: var(--text-main);
    font-size: 12px;
    text-align: center;
}

.table-input-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-create-table {
    padding: 4px 10px !important;
    height: 24px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    background: var(--primary) !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: var(--radius-sm) !important;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
}

.btn-create-table:hover {
    background: var(--primary-hover) !important;
}

/* Панель управления существующей таблицей */
.table-picker-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding-top: 8px;
    border-top: 1px solid var(--border-subtle);
}

.table-actions-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.table-actions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
}

.table-actions-grid button {
    height: 26px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    font-weight: 500 !important;
    background: var(--bg-app) !important;
    border: 1px solid var(--border-subtle) !important;
    border-radius: var(--radius-sm) !important;
    color: var(--text-main) !important;
    cursor: pointer;
    justify-content: center !important;
    transition: all 0.12s ease;
}

.table-actions-grid button:hover {
    background: var(--bg-hover) !important;
    border-color: var(--border-medium) !important;
}

.table-actions-grid button.btn-danger-action {
    color: var(--danger) !important;
}

.table-actions-grid button.btn-danger-action:hover {
    background: var(--danger-light) !important;
    border-color: var(--danger-border) !important;
}

.table-actions-grid button.table-btn-delete-full {
    grid-column: span 2;
    font-weight: 600 !important;
}

/* ==========================================================================
   Editor Iframe Wrapper & Counter
   ========================================================================== */

.panel_editor-iframe {
    flex: 1;
    width: 100%;
    min-height: 0;
    position: relative;
    background: var(--bg-editor);
    z-index: 1;
}

.panel_editor-iframe iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: none;
}

/* Character Counter Badge */
.panel_editor-counter {
    position: absolute;
    bottom: 12px;
    right: 18px;
    padding: 3px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-family: var(--font-mono);
    color: var(--text-muted);
    backdrop-filter: blur(4px);
    box-shadow: var(--shadow-xs);
    pointer-events: none;
    user-select: none;
    z-index: 10;
}

/* Bottom Toolbar Mode */
.panel_editor.toolbar-bottom .panel_editor-tools {
    border-bottom: none;
    border-top: 1px solid var(--border-subtle);
    order: 10;
}

.panel_editor.toolbar-bottom .panel_editor-iframe {
    order: 5;
}

.panel_editor.toolbar-bottom .panel_editor-counter {
    bottom: 54px;
}

.panel_editor.toolbar-bottom .editor-header-picker,
.panel_editor.toolbar-bottom .editor-font-picker,
.panel_editor.toolbar-bottom .editor-size-picker,
.panel_editor.toolbar-bottom .editor-table-picker {
    max-height: calc(100% - 60px);
}

.panel_editor.toolbar-bottom .editor-color-picker {
    top: auto;
    bottom: 46px;
}

/* Empty State / Welcome Screen */
.editor-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.6;
}

.empty-state-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

.empty-state-desc {
    font-size: 13px;
    max-width: 320px;
    line-height: 1.5;
    margin-bottom: 18px;
}

.btn-primary-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
    transition: all 0.15s ease;
}

.btn-primary-action:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.35);
}


/* ==========================================================================
   Export Modal Dialog
   ========================================================================== */

.export-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    animation: overlayFade 0.18s ease-out;
    padding: 16px;
}

.export-popup {
    position: relative;
    width: 520px;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-popover);
    border: 1px solid var(--border-medium);
    animation: popupSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.export-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.export-header-brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.export-header-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--radius-md);
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
}

.export-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

.export-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.export-close {
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--text-light);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s ease;
}

.export-close:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.export-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.export-section-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 6px;
}

/* Карточки форматов */
.export-format-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.export-format-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-app);
    border: 1.5px solid var(--border-subtle);
    border-radius: var(--radius-md);
    cursor: pointer;
    user-select: none;
    transition: all 0.15s ease;
}

.export-format-card:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
}

.export-format-card.active {
    background: var(--primary-light);
    border-color: var(--primary);
    box-shadow: 0 0 0 1px var(--primary);
}

.export-radio-hidden {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.export-format-icon {
    font-size: 20px;
    line-height: 1;
}

.export-format-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.export-format-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
}

.export-format-desc {
    font-size: 11px;
    color: var(--text-muted);
}

.export-format-check {
    font-size: 12px;
    font-weight: 700;
    color: var(--primary);
}

/* Тулбар списка */
.export-list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.export-select-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.export-action-link {
    background: transparent;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    padding: 2px 4px;
    border-radius: var(--radius-xs);
    transition: background 0.12s ease;
}

.export-action-link:hover {
    background: var(--primary-light);
    text-decoration: underline;
}

.export-action-dot {
    color: var(--border-medium);
    font-size: 10px;
}

/* Контейнер дерева заметок */
.export-tree-container {
    max-height: calc(100vh - 530px);
    max-height: calc(100dvh - 530px);
    min-height: 320px;
    overflow-y: auto;
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.export-category-block {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.export-category-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 3px 6px;
}

.export-category-icon {
    font-size: 13px;
    line-height: 1;
}

.export-category-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.export-category-count {
    font-size: 10px;
    font-weight: 700;
    background: var(--bg-hover);
    color: var(--text-light);
    padding: 1px 5px;
    border-radius: var(--radius-full);
}

.export-pages-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 14px;
}

.export-page-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    user-select: none;
    transition: background 0.1s ease;
}

.export-page-item:hover {
    background: var(--bg-hover);
}

.export-page-item.selected {
    background: rgba(37, 99, 235, 0.05);
}

.export-page-checkbox {
    width: 15px;
    height: 15px;
    cursor: pointer;
    accent-color: var(--primary);
}

.export-page-icon {
    font-size: 12px;
    opacity: 0.8;
    line-height: 1;
}

.export-page-name {
    font-size: 13px;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.export-empty-category {
    padding-left: 20px;
    font-size: 11px;
    color: var(--text-light);
    font-style: italic;
}

/* Футер */
.export-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--bg-app);
    border-top: 1px solid var(--border-subtle);
}

.export-footer-info {
    font-size: 11px;
    color: var(--text-muted);
}

.export-footer-info strong {
    color: var(--text-main);
}

.export-footer-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-export-cancel {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 600;
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.12s ease;
}

.btn-export-cancel:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

.btn-export-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 34px;
    padding: 0 16px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-md);
    background: var(--primary);
    border: 1px solid var(--primary);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
    transition: all 0.15s ease;
}

.btn-export-confirm:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.btn-export-confirm:disabled {
    background: var(--border-subtle);
    border-color: var(--border-subtle);
    color: var(--text-light);
    box-shadow: none;
    cursor: not-allowed;
}

@media (max-width: 580px) {
    .export-format-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   Settings Modal (Настройки)
   ========================================================================== */

.settings-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    animation: overlayFade 0.18s ease-out;
    padding: 16px;
}

.settings-popup {
    position: relative;
    width: 680px;
    max-width: 100%;
    height: 100%;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-medium);
    animation: popupSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.settings-header-brand {
    display: flex;
    height: 45px;
    gap: 12px;
    align-items: center;
}

.settings-header-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-lg);
    background: var(--primary-light);
    border: 1px solid var(--primary-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    line-height: 1;
}
.settings-header-text {
    height: 47px;
}

.settings-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.3px;
}

.settings-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.settings-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--text-light);
    cursor: pointer;
    width: 32px;
    min-width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, color 0.15s ease;
}

.settings-close:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.settings-body {
    display: flex;
    flex: 1;
    min-height: 250px;
    max-height: calc(100vh - 124px);
    max-height: calc(100dvh - 124px);
    overflow: hidden;
}

/* Sidebar with tabs inside Settings */
.settings-sidebar {
    width: 190px;
    min-width: 190px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border-subtle);
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-nav-item {
    display: flex;
    height: 55px;
    gap: 10px;
    padding: 10px 12px;
    border: none;
    align-items: center;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
    transition: background 0.15s ease, color 0.15s ease;
    width: 100%;
}

.settings-nav-item:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.settings-nav-item.active {
    background: var(--accent-bg) !important;
    color: var(--primary) !important;
    font-weight: 600;
}

.settings-nav-icon {
    font-size: 16px;
    flex-shrink: 0;
    line-height: 1;
}

.settings-nav-text {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.settings-nav-title-row {
    display: flex;
    align-items: center;
    gap: 6px;
}

.settings-nav-title {
    font-size: 13px;
    line-height: 1.2;
}

.settings-nav-pro-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 1px 5px;
    font-size: 9px;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: 0.5px;
    border-radius: var(--radius-xs);
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    box-shadow: 0 1px 3px rgba(217, 119, 6, 0.3);
    text-transform: uppercase;
}

.settings-nav-desc {
    font-size: 10px;
    opacity: 0.75;
    margin-top: 2px;
}

/* Content Area */
.settings-content {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    background: var(--bg-card);
}

.settings-section-header {
    margin-bottom: 20px;
}

.settings-section-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0 0 4px 0;
}

.settings-section-desc {
    display: block;
    font-size: 12px;
    height: 3em;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.4;
}

.settings-cards-list {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.settings-card {
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.settings-card:hover {
    border-color: var(--border-medium);
}

.settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
}

.settings-card-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.settings-card-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.settings-size-badge-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 3px 8px;
}

.settings-number-input {
    width: 44px;
    border: none;
    background: transparent;
    color: var(--text-main);
    font-size: 14px;
    font-weight: 700;
    text-align: right;
    outline: none;
    font-family: inherit;
    -moz-appearance: textfield;
}

.settings-number-input::-webkit-outer-spin-button,
.settings-number-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.settings-unit {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.settings-slider-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-slider-bound {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-light);
    width: 32px;
    flex-shrink: 0;
}

.settings-slider-bound:last-child {
    text-align: right;
    width: 38px;
}

.settings-slider {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    border-radius: 3px;
    background: var(--border-medium);
    outline: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    border: 2px solid #ffffff;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.settings-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
}

.settings-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
    border: 2px solid #ffffff;
}

/* Preset Chips */
.settings-presets-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
}

.settings-presets-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.settings-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.settings-chip {
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.12s ease;
}

.settings-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

.settings-chip.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    font-weight: 600;
}

.chip-sub {
    font-size: 9px;
    opacity: 0.8;
}

.settings-chip-reset,
.settings-btn-reset-link {
    background: transparent;
    border: none;
    font-size: 11px;
    color: var(--primary);
    cursor: pointer;
    text-decoration: underline;
    padding: 2px 4px;
    border-radius: var(--radius-xs);
    transition: opacity 0.15s ease;
}

.settings-chip-reset:hover,
.settings-btn-reset-link:hover {
    opacity: 0.8;
}

/* Font Selector */
.settings-select-wrapper {
    position: relative;
    width: 100%;
}

.settings-select {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    color: var(--text-main);
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.settings-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.settings-font-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.settings-font-pill {
    padding: 4px 10px;
    font-size: 11px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.12s ease;
}

.settings-font-pill:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.settings-font-pill.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

/* Segmented Control (Toolbar Position, etc.) */
.settings-segmented-control {
    display: flex;
    gap: 8px;
    width: 100%;
}

.settings-segment-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-main);
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
}

.settings-segment-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-subtle);
}

.settings-segment-btn.active {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    font-weight: 600;
}

.settings-segment-btn svg {
    flex-shrink: 0;
}

/* Preview Box */
.settings-card-preview {
    background: var(--bg-card);
    border: 1px dashed var(--border-medium);
}

.settings-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-preview-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--primary);
}

.settings-preview-meta {
    font-size: 11px;
    color: var(--text-muted);
}

.settings-preview-box {
    padding: 14px 16px;
    background: var(--bg-app);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    line-height: 1.45;
    word-break: break-word;
    height: 120px;
    overflow-y: auto;
    transition: font-size 0.1s ease;
}

/* Footer */
.settings-footer {
    display: none;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
}

.settings-footer-info {
    font-size: 11px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-settings-close {
    padding: 8px 20px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.05s ease;
}

.btn-settings-close:hover {
    background: var(--primary-hover);
}

.btn-settings-close:active {
    transform: scale(0.98);
}

.settings-footer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-settings-support {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-card);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-settings-support:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.settings-sidebar-divider {
    height: 1px;
    background: var(--border-subtle);
    margin: 6px 4px;
}

.settings-nav-ext-arrow {
    font-size: 11px;
    color: var(--text-muted);
    transition: transform 0.15s ease, color 0.15s ease;
}

.settings-nav-support:hover .settings-nav-ext-arrow {
    color: var(--primary);
    transform: translate(1px, -1px);
}

/* Settings Export Tab & PRO Teaser */
.settings-section-export {
    display: flex;
    flex-direction: column;
}

.settings-export-header-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.settings-export-header-top .settings-section-title {
    margin: 0;
}

/* Settings PRO Teaser Card */
.settings-pro-teaser-card {
    background: var(--bg-app);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 22px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.2s ease;
}

.settings-pro-teaser-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #f59e0b, #ef4444, #8b5cf6, #3b82f6);
}

.settings-pro-teaser-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.settings-pro-teaser-icon-wrap {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: var(--radius-md);
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(234, 179, 8, 0.25));
    border: 1px solid rgba(245, 158, 11, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.settings-pro-teaser-star {
    position: absolute;
    bottom: -4px;
    right: -4px;
    font-size: 13px;
    line-height: 1;
}

.settings-pro-teaser-title {
    margin: 0 0 4px 0;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-main);
}

.settings-pro-teaser-desc {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.settings-pro-features-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.settings-pro-feature-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

.settings-pro-feat-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
}

.settings-pro-feat-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-pro-feat-text strong {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

.settings-pro-feat-text span {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.35;
}

.settings-pro-teaser-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 2px;
}

.btn-settings-pro-upgrade {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(217, 119, 6, 0.35);
    transition: all 0.15s ease;
}

.btn-settings-pro-upgrade:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(217, 119, 6, 0.45);
}

/* Settings Export Panel */
.settings-export-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.2s ease;
}

.settings-export-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
}

/* Settings Themes Tab */
.settings-section-themes {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.2s ease;
}

.settings-active-theme-pill {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-full);
    border: 1px solid var(--primary-border);
    white-space: nowrap;
}

.settings-theme-hint {
    margin-top: 4px;
}

/* ==========================================================================
   Settings: Language & Region Tab
   ========================================================================== */
.settings-section-language {
    display: flex;
    flex-direction: column;
    gap: 18px;
    animation: fadeIn 0.2s ease;
}

.settings-lang-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.settings-lang-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    gap: 4px;
    position: relative;
    user-select: none;
}

.settings-lang-card:hover:not(.disabled) {
    border-color: var(--border-medium);
    background: var(--bg-hover);
    transform: translateY(-1px);
}

.settings-lang-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 1px var(--primary);
}

.settings-lang-card.disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: var(--bg-app);
}

.settings-lang-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-lang-flag {
    font-size: 22px;
    line-height: 1;
}

.settings-lang-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(56, 189, 248, 0.18);
    color: var(--primary);
}

.settings-lang-badge.soon {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.settings-lang-name {
    font-size: 13.5px;
    font-weight: 700;
    color: var(--text-main);
}

.settings-lang-sub {
    font-size: 11px;
    color: var(--text-muted);
}

/* Regional formats cards */
.settings-regional-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.settings-regional-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-regional-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-main);
}

.settings-regional-select {
    width: 100%;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-main);
    font-size: 13px;
    outline: none;
    cursor: pointer;
}

.settings-regional-select:focus {
    border-color: var(--primary);
}

/* Live Regional Preview */
.settings-lang-preview-card {
    background: var(--bg-app);
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-lang-preview-info {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.settings-lang-preview-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
}

.settings-lang-preview-text {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text-main);
}

/* Help translate callout */
.settings-lang-community-box {
    background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(139, 92, 246, 0.06));
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.settings-lang-community-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.settings-lang-community-text {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.45;
}

.settings-lang-community-text strong {
    color: var(--text-main);
}

/* Button & status for checking translation updates */
.btn-check-translations {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--primary);
    background: var(--primary-light);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-check-translations:hover:not(:disabled) {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

.btn-check-translations:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.settings-translation-status {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1.4;
}

.settings-translation-status.success {
    background: rgba(34, 197, 94, 0.12);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.25);
}

.settings-translation-status.info {
    background: rgba(59, 130, 246, 0.12);
    color: #60a5fa;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

.settings-translation-status.error {
    background: rgba(239, 68, 68, 0.12);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.25);
}


/* ==========================================================================
   Settings: Account & Sessions Tabs
   ========================================================================== */

.settings-section-account,
.settings-section-sessions {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.2s ease;
}

/* General Button Utilities */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    padding: 8px 14px;
    cursor: pointer;
    transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    white-space: nowrap;
    text-decoration: none;
    box-sizing: border-box;
}

.btn:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    height: 32px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #1d4ed8 100%);
    color: #ffffff !important;
    border-color: rgba(37, 99, 235, 0.3);
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-hover) 0%, #1e40af 100%);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(37, 99, 235, 0.2);
}

.btn-outline {
    background: var(--bg-card);
    color: var(--text-main);
    border-color: var(--border-medium);
    box-shadow: var(--shadow-xs);
}

.btn-outline:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
    color: var(--text-main);
    transform: translateY(-1px);
}

.btn-outline:active {
    transform: translateY(0);
}

.btn-spinner {
    width: 13px;
    height: 13px;
    border: 2px solid rgba(255, 255, 255, 0.35);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: btnSpin 0.7s linear infinite;
    display: inline-block;
}

@keyframes btnSpin {
    to { transform: rotate(360deg); }
}

/* ==========================================================================
   Account Section Styling
   ========================================================================== */

/* Hero Profile Card */
.settings-card-account-hero {
    background: linear-gradient(135deg, var(--bg-card) 0%, rgba(37, 99, 235, 0.04) 50%, var(--bg-card) 100%);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    position: relative;
    overflow: hidden;
}

.settings-card-account-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6 0%, #6366f1 50%, #10b981 100%);
}

.account-hero-header {
    display: flex;
    align-items: center;
    gap: 16px;
}

.account-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3b82f6 0%, #6366f1 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.02em;
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.3);
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
}

.account-avatar-guest {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
}

.account-hero-info {
    display: flex;
    width: 100%;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 0;
}

.account-hero-primary {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.account-user-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
    word-break: break-all;
    letter-spacing: -0.01em;
}

.account-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    letter-spacing: 0.02em;
}

.account-status-badge.badge-cloud {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.account-status-badge.badge-guest {
    background: rgba(245, 158, 11, 0.12);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.account-hero-meta {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    flex-direction: column;
    font-size: 12px;
    color: var(--text-muted);
}

.account-meta-item {
    display: inline-flex;
    align-items: flex-start;
    gap: 5px;
    flex-direction: column;
}

.account-meta-label {
    color: var(--text-muted);
    font-weight: 500;
}

.account-meta-value {
    color: var(--text-main);
    font-weight: 600;
}

.account-meta-divider {
    color: var(--border-medium);
}

.account-guest-banner {
    padding: 14px 16px;
    background: rgba(245, 158, 11, 0.05);
    border: 1px solid rgba(245, 158, 11, 0.25);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.account-guest-banner p {
    margin: 0;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-main);
    flex: 1;
    min-width: 220px;
}

.account-guest-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.account-auth-actions {
    display: flex;
    justify-content: flex-end;
}

.account-btn-logout {
    color: #ef4444 !important;
    border-color: rgba(239, 68, 68, 0.3) !important;
    background: rgba(239, 68, 68, 0.04) !important;
    transition: all 0.15s ease;
}

.account-btn-logout:hover {
    background: #ef4444 !important;
    color: #ffffff !important;
    border-color: #ef4444 !important;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.25);
}

/* Subscription Card */
.settings-card-subscription {
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all 0.15s ease;
}

.settings-card-subscription:hover {
    border-color: var(--border-medium);
}

.settings-card-subscription .settings-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.subscription-plan-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

.subscription-plan-pill.plan-pro {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.18) 0%, rgba(251, 191, 36, 0.28) 100%);
    color: #d97706;
    border: 1px solid rgba(245, 158, 11, 0.4);
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
}

.subscription-plan-pill.plan-free {
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 1px solid var(--border-medium);
}

.subscription-details-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    flex-wrap: wrap;
}

.subscription-meta-box {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sub-meta-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 700;
    color: var(--text-muted);
}

.sub-meta-val {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.sub-days-tag {
    background: rgba(16, 185, 129, 0.12);
    color: #059669;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-weight: 700;
    font-size: 11px;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

.subscription-actions-wrap {
    display: flex;
    align-items: center;
}

/* Key Activation Row */
.account-key-activate-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px dashed var(--border-subtle);
}

.account-key-input-wrap {
    display: flex;
    gap: 8px;
    align-items: center;
}

.account-key-input {
    flex: 1;
    min-width: 0;
    height: 36px;
    padding: 0 14px;
    font-size: 13px;
    font-family: var(--font-mono, monospace);
    letter-spacing: 0.05em;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-medium);
    background: var(--bg-card);
    color: var(--text-main);
    outline: none;
    transition: all 0.15s ease;
    box-sizing: border-box;
}

.account-key-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.account-btn-activate {
    height: 36px;
    padding: 0 16px;
    font-weight: 700;
    white-space: nowrap;
}

.account-key-msg {
    font-size: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 6px;
}

.key-msg-error {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.25);
}

.key-msg-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.25);
}

/* Statistics Grid */
.settings-card-stats {
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all 0.15s ease;
}

.settings-card-stats:hover {
    border-color: var(--border-medium);
}

.settings-card-stats .settings-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.btn-stat-refresh {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 14px;
    cursor: pointer;
    color: var(--text-muted);
    box-shadow: var(--shadow-xs);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-stat-refresh:hover {
    color: var(--primary);
    border-color: var(--primary);
    background: var(--bg-hover);
    transform: rotate(180deg);
}

.btn-stat-refresh:active {
    transform: rotate(180deg) scale(0.95);
}

.account-stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

@media (max-width: 600px) {
    .account-meta-divider {
        display: none;
    }
    .account-hero-header {
        flex-direction: column;
    }
    .account-hero-primary {
        flex-direction: column;
    }
    .offId {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
    }
    .offId .account-meta-value {
        font-size: 11px;
    }
    .account-stats-grid {
        grid-template-columns: repeat(1, 1fr);
        gap: 8px;
    }
    .account-key-input-wrap {
        flex-direction: column;
    }
    .account-key-input {
        padding: 11px 14px;
        font-size: 14px;
    }
    .btn-stat-refresh {
        display: none;
    }
}

.account-stat-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    box-shadow: var(--shadow-xs);
}

.account-stat-tile:hover {
    border-color: var(--border-medium);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.stat-tile-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.account-stat-tile:hover .stat-tile-icon {
    transform: scale(1.08);
}

/* Tile color accents */
.stat-tile-ct .stat-tile-icon {
    background: rgba(37, 99, 235, 0.1);
}

.stat-tile-pg .stat-tile-icon {
    background: rgba(16, 185, 129, 0.1);
}

.stat-tile-trash .stat-tile-icon {
    background: rgba(245, 158, 11, 0.1);
}

.stat-tile-chars .stat-tile-icon {
    background: rgba(99, 102, 241, 0.1);
}

.stat-tile-words .stat-tile-icon {
    background: rgba(168, 85, 247, 0.1);
}

.stat-tile-storage .stat-tile-icon {
    background: rgba(14, 165, 233, 0.1);
}

.stat-tile-body {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.stat-tile-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
    line-height: 1.2;
    letter-spacing: -0.01em;
}

.stat-tile-max {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
}

.stat-tile-label {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Guest State for Sessions Tab */
.settings-guest-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 36px 20px;
    background: var(--bg-app);
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-lg);
    gap: 12px;
}

.settings-guest-icon {
    font-size: 40px;
    line-height: 1;
}

.settings-guest-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-main);
}

.settings-guest-desc {
    font-size: 13px;
    color: var(--text-muted);
    max-width: 420px;
    line-height: 1.5;
}

.settings-guest-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

/* Header with action */
.settings-header-with-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.settings-sidebar-nav .settings-nav-count-badge {
    background: var(--primary);
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 9999px;
    margin-left: auto;
}

.sessions-toolbar-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
}


/* ==========================================================================
   Auth Modal Dialog
   ========================================================================== */

.auth-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(4px);
    animation: overlayFade 0.15s ease-out;
}

@keyframes overlayFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.auth-popup {
    position: relative;
    width: 380px;
    max-width: calc(100% - 32px);
    padding: 32px;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-popover);
    border: 1px solid var(--border-medium);
    animation: popupSlide 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes popupSlide {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.auth-popup h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 20px;
    letter-spacing: -0.4px;
}

.auth-popup input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    margin-bottom: 14px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    color: var(--text-main);
    background: var(--bg-app);
    outline: none;
    transition: all 0.15s ease;
}

.auth-popup input:focus {
    background: var(--bg-card);
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.auth-close {
    position: absolute;
    top: 14px;
    right: 16px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    font-size: 20px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 0.1s ease;
}

.auth-close:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.auth-submit {
    width: 100%;
    height: 42px;
    margin-top: 4px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--primary);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.25);
    transition: all 0.15s ease;
}

.auth-submit:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.35);
}

.auth-switch {
    display: block;
    width: 100%;
    margin-top: 14px;
    border: none;
    background: transparent;
    color: var(--primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    padding: 6px;
}

.auth-switch:hover {
    text-decoration: underline;
}

.auth-error {
    margin-bottom: 14px;
    padding: 8px 12px;
    background: var(--danger-light);
    border: 1px solid var(--danger-border);
    border-radius: var(--radius-sm);
    color: var(--danger);
    font-size: 13px;
    font-weight: 500;
}

.auth-desc {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: -10px 0 16px 0;
}

.auth-aux-row {
    display: flex;
    justify-content: flex-end;
    margin: -4px 0 14px 0;
}

.auth-link-btn {
    background: none;
    border: none;
    padding: 0;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s ease;
}

.auth-link-btn:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

.auth-popup input.auth-code-input {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: 6px;
    text-align: center;
    font-family: monospace, inherit;
    color: var(--primary);
    border-color: var(--border-medium);
    background: var(--bg-app);
}

.auth-popup input.auth-code-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.auth-success {
    margin-bottom: 14px;
    padding: 8px 12px;
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: var(--radius-sm);
    color: #10b981;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
}

.auth-mode-tabs {
    display: flex;
    gap: 6px;
    background: var(--bg-hover);
    padding: 4px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.auth-tab-btn {
    flex: 1;
    height: 34px;
    border: none;
    background: transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.auth-tab-btn:hover {
    color: var(--text-main);
}

.auth-tab-btn.is-active {
    background: var(--bg-card);
    color: var(--primary);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.auth-sent-card {
    text-align: center;
}

.auth-sent-icon {
    font-size: 46px;
    margin-bottom: 12px;
    line-height: 1;
}


/* ==========================================================================
   Sessions Modal Dialog
   ========================================================================== */

.sessions-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(6px);
    animation: overlayFade 0.18s ease-out;
    padding: 16px;
}

.sessions-popup {
    position: relative;
    width: 640px;
    max-width: 100%;
    max-height: calc(100vh - 40px);
    max-height: calc(100dvh - 40px);
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-popover);
    border: 1px solid var(--border-medium);
    animation: popupSlide 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}

.sessions-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 24px 28px 18px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

.sessions-header-info {
    flex: 1;
    min-width: 0;
}

.sessions-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.sessions-title-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-md);
    font-size: 16px;
    flex-shrink: 0;
}

.sessions-header h2 {
    font-size: 19px;
    font-weight: 700;
    color: var(--text-main);
    margin: 0;
    letter-spacing: -0.3px;
}

.sessions-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    font-size: 12px;
    font-weight: 600;
    background: var(--bg-hover);
    color: var(--text-muted);
    border-radius: var(--radius-full);
}

.sessions-subtitle {
    margin-top: 6px;
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.4;
}

.sessions-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-md);
    transition: all 0.15s ease;
    margin-left: 12px;
    margin-top: -4px;
}

.sessions-close:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.sessions-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 16px 28px 0;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
}

.sessions-alert-danger {
    background: var(--danger-light);
    border: 1px solid var(--danger-border);
    color: var(--danger);
}

.sessions-alert-retry {
    padding: 4px 10px;
    background: var(--bg-card);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.sessions-alert-retry:hover {
    background: var(--danger);
    color: #ffffff;
}

.sessions-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px 28px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 180px;
}

.sessions-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 40px 0;
    color: var(--text-muted);
    font-size: 14px;
}

.sessions-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.sessions-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 8px;
    margin-bottom: 4px;
    border-bottom: 1px dashed var(--border-subtle);
}

.sessions-select-all-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}

.sessions-select-all-label input[type="checkbox"],
.session-checkbox {
    width: 17px;
    height: 17px;
    cursor: pointer;
    accent-color: var(--primary);
}

.sessions-btn-refresh {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
}

.sessions-btn-refresh:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-main);
    border-color: var(--border-strong);
}

.sessions-btn-refresh:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.session-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.session-card:hover {
    border-color: var(--border-medium);
    box-shadow: var(--shadow-sm);
}

.session-card-current {
    background: linear-gradient(135deg, var(--emerald-light) 0%, var(--bg-card) 100%);
    border-color: var(--emerald-border);
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.08);
}

.session-card-current:hover {
    border-color: var(--emerald);
}

.session-card-selected {
    background: var(--primary-light);
    border-color: var(--primary-border);
}

.session-check-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    flex-shrink: 0;
}

.session-current-lock {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    opacity: 0.7;
    cursor: not-allowed;
}

.session-device-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: var(--radius-md);
    background: var(--bg-sidebar);
    color: var(--text-main);
    font-size: 18px;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.session-card-current .session-device-icon {
    background: var(--emerald-light);
    color: var(--emerald);
}

.session-card:hover .session-device-icon {
    transform: scale(1.05);
}

.session-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.session-primary-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.session-device-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    letter-spacing: -0.2px;
}

.session-badge-current {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 2px 8px;
    background: var(--emerald-light);
    border: 1px solid var(--emerald-border);
    color: var(--emerald);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.badge-pulse-dot {
    width: 6px;
    height: 6px;
    background-color: var(--emerald);
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
    0% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

.session-details-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
}

.session-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.session-meta-label {
    color: var(--text-light);
}

.session-meta-val {
    color: var(--text-muted);
    font-weight: 500;
}

.session-meta-divider {
    color: var(--border-medium);
    font-size: 10px;
}

.session-actions {
    display: flex;
    align-items: center;
    margin-left: 6px;
    flex-shrink: 0;
}

.session-btn-close-one {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid transparent;
    background: transparent;
    color: var(--text-light);
    border-radius: var(--radius-sm);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.session-btn-close-one:hover:not(:disabled) {
    background: var(--danger-light);
    border-color: var(--danger-border);
    color: var(--danger);
}

.session-btn-close-one:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.sessions-only-current-note {
    padding: 16px;
    background: var(--bg-app);
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-muted);
    text-align: center;
}

.sessions-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 28px;
    background: var(--bg-app);
    border-top: 1px solid var(--border-subtle);
}

.sessions-footer-left {
    font-size: 13px;
    color: var(--text-muted);
}

.sessions-selected-info strong {
    color: var(--text-main);
}

.sessions-footer-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-sessions-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 42px;
    margin-top: 4px;
    border: none;
    gap: 6px;
    padding: 0 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-sessions-selected {
    background: var(--primary);
    border: 1px solid var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.btn-sessions-selected:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.btn-sessions-selected:disabled {
    background: var(--border-subtle);
    border-color: var(--border-subtle);
    color: var(--text-light);
    box-shadow: none;
    cursor: not-allowed;
}

.btn-sessions-all {
    background: var(--bg-card);
    border: 1px solid var(--danger-border);
    color: var(--danger);
}

.btn-sessions-all:hover:not(:disabled) {
    background: var(--danger);
    border-color: var(--danger);
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(239, 68, 68, 0.25);
    transform: translateY(-1px);
}

.btn-sessions-all:disabled {
    background: transparent;
    border-color: var(--border-subtle);
    color: var(--text-light);
    cursor: not-allowed;
}

.btn-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@media (max-width: 580px) {
    .sessions-popup {
        width: 100%;
        max-height: 94vh;
        max-height: 94dvh;
    }

    .sessions-header,
    .sessions-body,
    .sessions-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .sessions-footer {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .sessions-footer-actions {
        flex-direction: column;
        width: 100%;
    }

    .btn-sessions-action {
        width: 100%;
    }
}

/* ============================================================
 * РЕЖИМ РАСШИРЕНИЯ CHROME (POPUP)
 * ============================================================ */
html.is-extension,
html.is-extension body,
body.is-extension {
    width: 790px;
    height: 580px;
    min-width: 790px;
    max-width: 790px;
    min-height: 580px;
    max-height: 580px;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

html.is-extension #app,
html.is-extension .main_container,
body.is-extension #app,
body.is-extension .main_container {
    width: 790px;
    height: 580px;
    min-height: 580px;
    max-height: 580px;
    overflow: hidden;
}

/* Режим расширения в отдельной вкладке браузера */
html.is-extension-tab,
html.is-extension-tab body,
html.is-extension-tab #app,
html.is-extension-tab .main_container {
    width: 100vw !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 0 !important;
    max-height: none !important;
}

@media (min-width: 801px) {
    html.is-extension:not(.is-extension-popup),
    html.is-extension:not(.is-extension-popup) body,
    html.is-extension:not(.is-extension-popup) #app,
    html.is-extension:not(.is-extension-popup) .main_container,
    body.is-extension:not(.is-extension-popup),
    body.is-extension:not(.is-extension-popup) #app,
    body.is-extension:not(.is-extension-popup) .main_container {
        width: 100vw;
        min-width: 0;
        max-width: none;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        max-height: none;
    }
}

.btn-expand-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: transparent;
    border: none;
    color: var(--text-light, #64748b);
    cursor: pointer;
    transition: all 0.15s ease;
    /*margin-left: auto;*/
}

.btn-expand-tab:hover {
    background: var(--bg-hover, rgba(0, 0, 0, 0.05));
    color: var(--accent, #3b82f6);
}

/* ============================================================
 * МЕНЮ: СЧЁТЧИК КОРЗИНЫ
 * ============================================================ */
.menu-trash-count {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 6px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1;
    border-radius: var(--radius-full);
    background: var(--bg-hover);
    color: var(--text-muted);
    border: 1px solid var(--border-medium);
}

.menu-trash-count.trash-count-full {
    background: var(--danger-light, #fee2e2);
    color: var(--danger, #ef4444);
    border-color: var(--danger-border, #fca5a5);
    font-weight: 700;
}

/* ============================================================
 * ВСПЛЫВАЮЩИЕ УВЕДОМЛЕНИЯ (APP TOAST)
 * ============================================================ */
.app-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 18px;
    background: #1e293b;
    color: #ffffff;
    border-radius: var(--radius-lg);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.12);
    backdrop-filter: blur(8px);
    max-width: 480px;
}

.toast-fade-enter-active,
.toast-fade-leave-active {
    transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.toast-fade-enter-from,
.toast-fade-leave-to {
    opacity: 0;
    transform: translateY(16px) scale(0.96);
}

.app-toast-content {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    line-height: 1.4;
    color: #f1f5f9;
}

.app-toast-text {
    white-space: pre-wrap;
}

.app-toast-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.app-toast-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: auto;
}

.btn-toast-action {
    background: var(--primary);
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.btn-toast-action:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-toast-close {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    border-radius: var(--radius-xs);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease;
}

.btn-toast-close:hover {
    color: #ffffff;
}

/* ============================================================
 * МОДАЛЬНОЕ ОКНО КОРЗИНЫ (TRASH MODAL)
 * ============================================================ */
.trash-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 16px;
    animation: fadeIn 0.15s ease;
}

.trash-popup {
    background: var(--bg-card);
    width: 700px;
    max-width: 100%;
    height: 560px;
    max-height: 85vh;
    max-height: 85dvh;
    border-radius: var(--radius-xl);
    box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border-subtle);
    animation: slideUp 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    transition: height 0.25s ease;
}

.trash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
}

.trash-header-title-box {
    display: flex;
    align-items: center;
    gap: 12px;
}

.trash-header-icon {
    font-size: 24px;
}

.trash-title {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
    color: var(--text-main);
}

.trash-subtitle {
    margin: 2px 0 0 0;
    font-size: 12px;
    color: var(--text-muted);
}

.trash-btn-close {
    background: transparent;
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}

.trash-btn-close:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

/* Toolbar */
.trash-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid var(--border-subtle);
    background: var(--bg-card);
}

/* Баннер переполненной корзины */
.trash-full-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    background: var(--danger-light, #fee2e2);
    border-bottom: 1px solid var(--danger-border, #fca5a5);
    color: var(--danger, #b91c1c);
    font-size: 13px;
    line-height: 1.45;
}

.trash-full-icon {
    font-size: 20px;
    flex-shrink: 0;
}

.trash-full-text {
    flex: 1;
}

.trash-full-text strong {
    color: var(--danger, #b91c1c);
    display: block;
    margin-bottom: 2px;
}

.trash-search-wrap {
    position: relative;
    flex: 1;
    display: flex;
    align-items: center;
}

.trash-search-icon {
    position: absolute;
    left: 10px;
    font-size: 13px;
    opacity: 0.6;
    pointer-events: none;
}

.trash-search-input {
    width: 100%;
    padding: 7px 30px 7px 32px;
    font-size: 13px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-app);
    color: var(--text-main);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.trash-search-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-border);
}

.trash-search-clear {
    position: absolute;
    right: 8px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 4px;
}

.trash-actions-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-trash-restore-all {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: var(--emerald-light);
    color: var(--emerald-hover);
    border: 1px solid var(--emerald-border);
    transition: all 0.15s ease;
}

.btn-trash-restore-all:hover {
    background: var(--emerald);
    color: #ffffff;
}

.btn-trash-empty {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 12px;
    border-radius: var(--radius-md);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger-border);
    transition: all 0.15s ease;
}

.btn-trash-empty:hover {
    background: var(--danger);
    color: #ffffff;
}

.btn-trash-empty:disabled,
.btn-trash-restore-all:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Body */
.trash-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 24px;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.trash-loading-state,
.trash-empty-state {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 16px;
    color: var(--text-muted);
    animation: fadeIn 0.25s ease;
}

.trash-empty-illustration {
    font-size: 44px;
    margin-bottom: 12px;
    opacity: 0.8;
}

.trash-empty-title {
    margin: 0 0 6px 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.trash-empty-desc {
    margin: 0;
    font-size: 13px;
    max-width: 360px;
    line-height: 1.45;
}

.trash-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: fadeIn 0.2s ease;
}

.trash-item-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg-app);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.trash-item-card:hover {
    background: var(--bg-active);
    border-color: var(--border-medium);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.trash-item-main {
    flex: 1;
    min-width: 0;
}

.trash-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}

.trash-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 340px;
}

.trash-item-category {
    font-size: 11px;
    color: var(--text-muted);
    background: var(--bg-sidebar);
    padding: 2px 7px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    white-space: nowrap;
}

.trash-item-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.trash-days-pill {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 1px 7px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 600;
}

.trash-days-pill.days-normal {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--primary-border);
}

.trash-days-pill.days-warning {
    background: var(--accent-light);
    color: var(--accent-hover);
    border: 1px solid var(--accent-border);
}

.trash-days-pill.days-danger {
    background: var(--danger-light);
    color: var(--danger);
    border: 1px solid var(--danger-border);
    animation: pulseDanger 2s infinite ease-in-out;
}

@keyframes pulseDanger {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

.trash-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.btn-trash-restore {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: var(--emerald-light);
    color: var(--emerald-hover);
    border: 1px solid var(--emerald-border);
    transition: all 0.15s ease;
}

.btn-trash-restore:hover {
    background: var(--emerald);
    color: #ffffff;
    border-color: var(--emerald);
}

.btn-trash-delete {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 500;
    border-radius: var(--radius-md);
    cursor: pointer;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

.btn-trash-delete:hover {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger-border);
}

/* Footer */
.trash-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    border-top: 1px solid var(--border-subtle);
    background: var(--bg-sidebar);
}

.trash-footer-info {
    font-size: 11px;
    color: var(--text-muted);
}

.btn-trash-close-footer {
    padding: 8px 20px;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    background: var(--bg-app);
    color: var(--text-main);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-trash-close-footer:hover {
    background: var(--bg-hover);
}

@media (max-width: 600px) {
    .trash-popup {
        height: 90vh;
        height: 90dvh;
        max-height: 90vh;
        max-height: 90dvh;
    }

    .trash-item-card {
        flex-direction: column;
        align-items: stretch;
    }

    .trash-item-actions {
        justify-content: flex-end;
        border-top: 1px solid var(--border-subtle);
        padding-top: 8px;
    }

    .trash-toolbar {
        flex-direction: column;
        align-items: stretch;
    }

    .trash-actions-bar {
        justify-content: space-between;
    }

    .app-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
    }
}

/* ==========================================================================
   МОБИЛЬНАЯ АДАПТАЦИЯ (RESPONSIVE MOBILE FIRST) ДЛЯ ОСНОВНОГО БЛОКНОТА
   ========================================================================== */
.btn-mobile-back,
.btn-mobile-to-editor,
.btn-save-icon,
.ct-drag-handle,
.pg-drag-handle {
    display: none !important;
}

@media (max-width: 768px) {
    /* Контейнер приложения */
    .main_container {
        position: relative !important;
        width: 100vw !important;
        height: 100vh !important;
        height: 100dvh !important;
        height: var(--app-height, 100dvh) !important;
        max-height: var(--app-height, 100dvh) !important;
        overflow: hidden !important;
        display: block !important;
    }

    /* Скрываем ресайзер на телефонах и планшетах */
    .sidebar-resizer {
        display: none !important;
    }

    /* Сайдбар на мобильном занимает 100% ширины */
    .panel_sidebar {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        height: var(--app-height, 100dvh) !important;
        max-height: var(--app-height, 100dvh) !important;
        z-index: 10 !important;
        transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.26s !important;
    }

    /* Редактор на мобильном занимает 100% ширины */
    .panel_editor {
        position: absolute !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        width: 100% !important;
        min-width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
        height: var(--app-height, 100dvh) !important;
        max-height: var(--app-height, 100dvh) !important;
        z-index: 15 !important;
        transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.26s !important;
    }

    /* Вид 1: Просмотр списка заметок (Сайдбар активен) */
    .main_container.mobile-view-sidebar .panel_sidebar {
        transform: translateX(0) !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    .main_container.mobile-view-sidebar .panel_editor {
        transform: translateX(100%) !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    /* Вид 2: Просмотр и редактирование заметки (Редактор активен) */
    .main_container.mobile-view-editor .panel_sidebar {
        transform: translateX(-100%) !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

    .main_container.mobile-view-editor .panel_editor {
        transform: translateX(0) !important;
        visibility: visible !important;
        pointer-events: auto !important;
    }

    /* Кнопка «←» в шапке редактора (только стрелка без текста на мобильных) */
    .btn-mobile-back {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        background: rgba(37, 99, 235, 0.08);
        border: 1px solid var(--primary-border);
        border-radius: var(--radius-sm);
        padding: 0 !important;
        width: 34px !important;
        height: 34px !important;
        min-width: 34px !important;
        color: var(--primary);
        cursor: pointer;
        flex-shrink: 0;
        transition: all 0.15s ease;
    }

    .btn-mobile-back .btn-mobile-back-text {
        display: none !important;
    }

    .btn-mobile-back:hover {
        background: var(--primary-light);
    }

    /* Кнопка перехода к редактору в шапке сайдбара */
    .btn-mobile-to-editor {
        display: inline-flex !important;
        align-items: center;
        gap: 5px;
        background: var(--primary-light);
        border: 1px solid var(--primary-border);
        border-radius: var(--radius-sm);
        padding: 4px 8px;
        margin-left: auto;
        font-size: 12px;
        font-weight: 600;
        color: var(--primary);
        cursor: pointer;
        transition: all 0.15s ease;
    }

    .btn-mobile-to-editor:hover {
        background: var(--primary);
        color: #fff;
    }

    /* Шапка редактора на мобильных */
    .editor-topbar {
        padding: 0 10px !important;
        gap: 8px !important;
        position: relative !important;
        z-index: 100 !important;
    }

    .editor-title {
        height: 33px;
        font-size: 13px !important;
    }

    /* Кнопка «Сохранить» с иконкой дискеты на мобильных */
    .btn-save {
        padding: 0 8px !important;
        min-width: 34px !important;
        height: 34px !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        gap: 5px !important;
    }

    .btn-save:hover {
        background: none;
        border-color: none;
        box-shadow: none;
    }

    .btn-save .btn-save-text {
        display: none !important;
    }

    .btn-save .btn-save-icon {
        display: inline-block !important;
        width: 17px !important;
        height: 17px !important;
        flex-shrink: 0;
    }

    .empty-state-desc {
        line-height: 1.4;
    }

    /* Иконки перетаскивания (бургер) для папок и заметок в сайдбаре */
    .ct-drag-handle,
    .pg-drag-handle {
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
        width: 30px;
        height: 30px;
        margin-left: auto;
        color: var(--text-muted);
        opacity: 0.6;
        cursor: grab;
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
        flex-shrink: 0;
        border-radius: var(--radius-sm);
        transition: opacity 0.12s ease, background 0.12s ease, color 0.12s ease;
    }

    .ct-drag-handle:active,
    .pg-drag-handle:active {
        opacity: 1;
        color: var(--primary);
        background: var(--primary-light);
    }

    body.is-touch-sorting {
        user-select: none !important;
        -webkit-user-select: none !important;
    }

    /* Панель инструментов Quill — горизонтальный свайп в одну строчку */
    .editor-tools-wrap {
        position: relative !important;
        width: 100% !important;
        overflow: hidden !important;
        flex-shrink: 0 !important;
    }

    .editor-tools-wrap::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 1px;
        width: 26px;
        background: linear-gradient(to right, transparent, var(--bg-card));
        pointer-events: none;
        z-index: 25;
    }

    .panel_editor.toolbar-bottom .editor-tools-wrap::after {
        top: 1px;
        bottom: 0;
    }

    .panel_editor-tools {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        padding: 4px 8px !important;
        gap: 2px !important;
    }

    .panel_editor-tools::-webkit-scrollbar {
        display: none !important;
    }

    .panel_editor-tools button {
        flex-shrink: 0 !important;
        min-width: 32px !important;
        height: 32px !important;
    }

    .panel_editor-tools button:hover {
        color: var(--text-muted);
        background: transparent;
    }
    .panel_editor-tools button:hover.active {
        background: var(--primary-light);
        color: var(--primary);
        border-color: var(--primary-border);
    }

    .panel_editor.toolbar-bottom .panel_editor-counter {
        bottom: 50px !important;
    }

    /* Панель поиска */
    .sidebar-search-drawer {
        padding: 8px 10px !important;
    }

    /* Модальные окна */
    .modal-content,
    .modal-box,
    .theme-modal,
    .premium-modal-dialog,
    .sessions-modal,
    .link-modal {
        width: 95vw !important;
        max-width: 440px !important;
        padding: 16px 14px !important;
        margin: 12px auto !important;
    }

    .sessions-toolbar {
        flex-direction: column;
        gap: 15px;
    }

    /* Адаптация модального окна настроек (Settings Modal) на мобильных */
    .settings-overlay {
        padding: 8px !important;
    }

    .settings-popup {
        width: 100% !important;
        max-width: 540px !important;
        height: 94vh !important;
        height: 94dvh !important;
        max-height: 94vh !important;
        max-height: 94dvh !important;
        border-radius: var(--radius-lg) !important;
    }

    .settings-header {
        padding: 10px 14px !important;
    }

    .settings-header-brand {
        height: auto !important;
        gap: 8px !important;
    }

    .settings-header-icon {
        width: 32px !important;
        height: 32px !important;
        font-size: 16px !important;
    }

    .settings-title {
        font-size: 15px !important;
    }

    .settings-subtitle {
        font-size: 11px !important;
    }

    .settings-body {
        flex-direction: column !important;
        max-height: none !important;
        overflow: hidden !important;
        flex: 1 !important;
    }

    .settings-sidebar {
        width: 100% !important;
        min-width: 100% !important;
        padding: 6px 0px !important;
        border-right: none !important;
        border-bottom: 1px solid var(--border-subtle) !important;
        background: var(--bg-sidebar) !important;
        flex-shrink: 0 !important;
        position: relative !important;
    }

    .settings-sidebar::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 26px;
        background: linear-gradient(to right, transparent, var(--bg-sidebar));
        pointer-events: none;
        z-index: 5;
    }

    .settings-sidebar-nav {
        flex-direction: row !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        gap: 6px !important;
        padding-bottom: 2px !important;
        padding: 0px 10px 2px 10px !important;
    }

    .settings-nav-item:hover {
        background: transparent;
        color: var(--text-muted);
    }

    .settings-sidebar-nav::-webkit-scrollbar {
        display: none !important;
    }

    .settings-nav-item {
        flex: 0 0 auto !important;
        width: auto !important;
        height: auto !important;
        min-height: 36px !important;
        padding: 6px 10px !important;
        gap: 6px !important;
        border-radius: var(--radius-md) !important;
        white-space: nowrap !important;
    }
    .settings-nav-item.active {
        font-weight: 500;
    }

    .settings-nav-item .settings-nav-desc {
        display: none !important;
    }

    .settings-nav-item .settings-nav-title {
        font-size: 12px !important;
    }

    .settings-nav-item .settings-nav-icon {
        font-size: 14px !important;
    }

    .settings-sidebar-divider {
        width: 1px !important;
        height: 22px !important;
        margin: auto 4px !important;
        flex-shrink: 0 !important;
    }

    .settings-content {
        padding: 14px 12px !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        flex: 1 !important;
    }

    .settings-section-header {
        margin-bottom: 12px !important;
    }

    .settings-section-title {
        font-size: 14.5px !important;
    }

    .settings-section-desc {
        font-size: 11px !important;
        height: auto !important;
        margin-bottom: 10px !important;
    }

    .settings-card {
        padding: 24px 10px 12px 10px !important;
        gap: 10px !important;
    }

    .settings-cards-list {
        gap: 24px;
    }

    .settings-card-header {
        gap: 6px !important;
    }

    .settings-card-title {
        font-size: 13px !important;
    }

    .settings-card-desc {
        font-size: 11px !important;
    }

    .settings-slider-wrapper {
        gap: 8px !important;
    }

    .settings-presets-row {
        gap: 6px !important;
    }

    .settings-chips {
        gap: 4px !important;
    }

    .settings-chip {
        padding: 3px 7px !important;
        font-size: 10.5px !important;
    }

    .settings-regional-row {
        grid-template-columns: 1fr !important;
        gap: 10px !important;
    }

    .settings-lang-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .settings-pro-features-grid {
        grid-template-columns: 1fr !important;
        gap: 8px !important;
    }

    .settings-pro-teaser-card {
        padding: 14px 12px !important;
        gap: 12px !important;
    }

    .settings-pro-teaser-header {
        gap: 10px !important;
    }

    .settings-pro-teaser-icon-wrap {
        width: 36px !important;
        height: 36px !important;
        font-size: 18px !important;
    }

    .settings-pro-teaser-title {
        font-size: 13.5px !important;
    }

    .settings-pro-teaser-desc {
        font-size: 11px !important;
    }

    .settings-preview-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .settings-segment-btn {
        display: flex;
        padding: 8px 8px;
    }

    .settings-footer {
        padding: 10px 14px !important;
    }

    .export-list-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .trash-header {
        padding: 18px 13px;
    }

    .trash-footer {
        display: none;
    }

    .trash-footer-actions {
        display: none;
    }

    .trash-item-card {
        gap: 0;
    }

    .sync-dot {
        display: none;
    }

    .sync-dirty {
        background-color: var(--accent-light);
    }

    .sync-dirty svg {
        stroke: var(--accent-hover);
    }

    .sessions-header {
        position: relative;
        padding-top: 10px;
    }

    .sessions-header h2 {
        font-size: 16px;
    }

    .sessions-header-info {
        padding-right: 20px;
    }

    .sessions-subtitle {
        line-height: 1.2
    }

    .sessions-close {
        position: absolute;
        top: 16px;
        right: 10px;
        margin: 0;
        z-index: 1;
    }

    .session-card {
        position: relative;
        padding: 3px 14px 12px 14px;
        gap: 8px;
        flex-direction: row;
        justify-content: start;
        flex-wrap: wrap;
    }

    .session-check-wrap,
    .session-device-icon {
        width: 30px;
        height: 30px;
    }

    .session-device-name {
        font-size: 11px;
    }

    .session-badge-current,
    .session-btn-close-one {
        position: absolute;
        top: 8px;
        right: 8px;
    }

    .session-meta-divider {
        display: none;
    }

    .session-details-row {
        gap: 2px;
        align-items: flex-start;
        flex-wrap: nowrap;
        flex-direction: column;
    }

    .sessions-footer {
        padding: 10px 28px 12px 28px;
    }

    .sessions-footer-left span {
        font-size: 9px !important;
    }

    .sessions-footer-actions {
        gap: 6px;
    }

    .btn-sessions-action {
        height: 36px;
        margin-top: 0;
    }

    .session-info {
        width: 100%;
        min-width: 100%;
    }

    .app-toast {
        flex-direction: column;
        gap: 8px;
    }

    .app-toast-content {
        padding-right: 18px;
    }

    .btn-toast-close {
        position: absolute;
        top: 8px;
        right: 12px;
    }

    input, select, textarea {
        font-size: 16px; /* Защита от автозума на iOS при фокусе */
    }
}
