/* ==========================================================================
   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;
}

/* ==========================================================================
   Base & Reset
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html,
body {
    width: 100%;
    height: 100%;
    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;
}

[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;
    overflow: hidden;
    background: var(--bg-app);
}

.main_container {
    display: flex;
    width: 100%;
    height: 100%;
    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: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 8px;
    border-radius: var(--radius-sm);
    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: 4px;
}

.ct_no .pgs {
    padding-left: 4px;
}

.ct_no .pgs:empty {
    min-height: 28px;
    border: 1px dashed var(--border-medium);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.01);
    margin-top: 4px;
}

/* 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;
    border: 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;
    z-index: 5;
}

.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;
    transition: all 0.15s ease;
}

.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;
}

.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;
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-popover);
    padding: 8px;
    z-index: 100;
    animation: menuFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

@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
   ========================================================================== */

.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;
}

.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;
    top: 39px;
    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: 50;
    max-height: 240px;
    overflow-y: auto;
}

.editor-header-picker {
    left: 148px;
}

.editor-font-picker {
    left: 178px;
    min-width: 145px;
}

.editor-size-picker {
    left: 210px;
    min-width: 140px;
}

.editor-header-picker button,
.editor-font-picker button,
.editor-size-picker button {
    height: 26px;
    padding: 0 10px;
    justify-content: flex-start;
    font-size: 12px;
    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;
    top: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-popover);
    padding: 12px;
    z-index: 60;
    min-width: 288px;
    width: max-content;
    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);
}

.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;
}

/* 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);
    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);
    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: 13px;
    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: 13px;
    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);
    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-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;
    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);
    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);
    color: var(--primary);
    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;
}

/* 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);
}

@media (max-width: 600px) {
    .settings-body {
        flex-direction: column;
    }

    .settings-sidebar {
        width: 100%;
        min-width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border-subtle);
        padding: 8px 12px;
    }

    .settings-sidebar-nav {
        flex-direction: row;
    }

    .settings-footer {
        flex-direction: column;
        gap: 10px;
        align-items: stretch;
    }
}

/* ==========================================================================
   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);
    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;
    }

    .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,
body.is-extension {
    width: 790px;
    height: 580px;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

@media (min-width: 801px),
(min-height: 601px) {

    html.is-extension,
    body.is-extension {
        width: 100vw;
        height: 100vh;
    }
}

.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;
    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;
        max-height: 90vh;
    }

    .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;
    }
}