/* ==========================================================================
   ENOTE APP CSS
   ==========================================================================
   1. Variables & Reset
   2. Typography & Fonts
   3. Layout & Containers
   4. Components (Buttons, Inputs)
   5. Feature: Editor
   6. Feature: Auth
   7. Feature: Lists & Note Items
   8. Feature: Stats & Navigation
   9. Feature: Lightbox & Overlays
   10. Utilities & Icons
   11. Responsive
   ========================================================================== */

/* ==========================================================================
   1. Variables & Reset
   ========================================================================== */
:root {
    --bg: #f5f7f9;
    --card-bg: #ffffff;
    --txt-main: #333333;
    --txt-sub: #555555;
    --txt-mut: #999999;
    --m-blu: #6a8caf;
    --m-blu-light: #eef2f6;
    --m-blu-hover: #5b7a9a;
    --border: #eaedf1;
    --rad: 12px;
    --danger: #ef4444;
    --success: #10b981;
    --fold-height: 380px;
    --note-title-size: clamp(1.45rem, 1.32rem + 0.35vw, 1.65rem);
    --content-h1-size: clamp(1.3rem, 1.2rem + 0.22vw, 1.45rem);
    --content-h2-size: clamp(1.14rem, 1.07rem + 0.14vw, 1.24rem);
}

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

html {
    overflow-y: scroll;
    scrollbar-gutter: stable;
}

body {
    font-family: "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: linear-gradient(180deg, rgba(101, 158, 185, 0.12) 0%, rgba(101, 158, 185, 0) 600px), var(--bg) fixed;
    color: var(--txt-main);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 20px 0;
}

/* ==========================================================================
   2. Typography & Fonts
   ========================================================================== */
@font-face {
    font-family: 'Montserrat';
    font-style: normal;
    font-weight: 100 900;
    font-display: block;
    src: url('/assets/fonts/montserrat-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Apply Montserrat to UI Elements */
.btn-save-mini,
.btn-new-mini,
.btn-backup,
.c-title,
.auth-card input,
.auth-err {
    font-family: 'Montserrat', sans-serif !important;
}

/* ==========================================================================
   3. Layout & Containers
   ========================================================================== */
.d-container {
    width: 100%;
    max-width: 720px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
}

.card {
    background: transparent;
    border-radius: 0;
    padding: 10px 0;
    box-shadow: none;
    border: none;
}

.c-head {
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: transparent;
    padding: 0 8px 12px;
    border-radius: 0;
    box-shadow: none;
    border: none;
    border-bottom: 1px solid #cbd5e1;
}

.c-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--txt-sub);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.breadcrumb-item {
    transition: color 0.2s ease;
}

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

.breadcrumb-item.clickable:hover {
    color: var(--m-blu);
}

.breadcrumb-divider {
    color: var(--txt-mut);
    margin: 0 8px;
    font-weight: 400;
}

.head-right {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.global-note-tools {
    display: none;
    width: 100%;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    margin: 0 0 12px;
}

.global-note-tools.active {
    display: flex;
}

.nav-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 12px;
    padding-bottom: 8px;
    padding-left: 8px;
    flex-wrap: wrap;
}

.view-container {
    display: none;
}

.view-container.active {
    display: block;
    animation: fade .4s ease-out;
}

.partial-view {
    display: none;
}

.view-container .partial-view {
    display: block;
}

body>.partial-view {
    display: none;
}

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

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

/* ==========================================================================
   4. Components
   ========================================================================== */
/* Buttons */
.btn-new-mini,
.btn-save-mini {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 15px;
    background: linear-gradient(135deg, var(--m-blu), #8baecf);
    color: white;
    border: none;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 6px rgba(106, 140, 175, 0.2);
    position: relative;
    overflow: hidden;
}

.btn-new-mini:hover,
.btn-save-mini:hover {
    filter: brightness(1.05);
    box-shadow: 0 4px 10px rgba(106, 140, 175, 0.3);
}

.btn-new-mini:active,
.btn-save-mini:active {
    transform: scale(0.96);
}

.btn-save-mini:disabled {
    background: #cbd5e1;
    box-shadow: none;
    cursor: not-allowed;
    filter: none;
}

.btn-save-mini i {
    font-size: 9px;
    display: inline-block;
}

.btn-save-mini.sending i {
    animation: plane-shuttle 0.8s infinite linear;
}

.btn-head-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.7);
    color: var(--txt-main);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-head-secondary:hover {
    border-color: rgba(106, 140, 175, 0.35);
    color: var(--m-blu);
    background: rgba(106, 140, 175, 0.08);
}

.btn-head-icon {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.72);
    color: var(--txt-main);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.btn-head-icon:hover,
.btn-head-icon.active {
    border-color: rgba(106, 140, 175, 0.35);
    background: rgba(106, 140, 175, 0.1);
    color: var(--m-blu);
}

.btn-head-icon .ri-icon {
    width: 1.05em;
    height: 1.05em;
}

@keyframes plane-shuttle {
    0% {
        transform: translate(0, 0);
        opacity: 1;
    }

    45% {
        transform: translate(15px, -15px);
        opacity: 0;
    }

    50% {
        transform: translate(-15px, 15px);
        opacity: 0;
    }

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

.btn-icon-s {
    cursor: pointer;
    color: #cbd5e1;
    font-size: 18px;
    transition: all 0.2s ease;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.btn-icon-s.edit:hover {
    color: var(--m-blu);
    background: var(--m-blu-light);
}

.btn-del {
    cursor: pointer;
    opacity: 0;
    color: #fca5a5;
    font-size: 18px;
    transition: all 0.2s ease;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
}

.btn-del:hover {
    color: var(--danger);
    background: #fee2e2;
    opacity: 1 !important;
}

/* Inputs */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    appearance: none;
    margin: 0;
}

input[type=number] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* ==========================================================================
   5. Feature: Editor
   ========================================================================== */
#editor-card {
    display: none;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

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

.editor-wrapper {
    background: var(--card-bg);
    border-radius: var(--rad);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    margin-bottom: 24px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border);
}

.editor-in-card {
    margin-top: 0;
    margin-bottom: 0;
    border: none;
    box-shadow: none;
    border-top: none;
    border-radius: var(--rad);
    background: var(--card-bg);
    margin-left: 0;
    margin-right: 0;
    width: 100%;
}

.editor-in-new {
    margin-bottom: 0;
}

.editor-wrapper:focus-within {
    border-color: var(--m-blu);
    box-shadow: 0 4px 20px rgba(106, 140, 175, 0.08);
}

.editor-in-card:focus-within {
    border-color: transparent;
    box-shadow: none;
}

/* Toolbar */
.toolbar {
    display: flex;
    padding: 8px 12px;
    background: #f8fafc;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
}

.tb-btn {
    min-width: 28px;
    height: 28px;
    padding: 0 6px;
    border: none;
    background: transparent;
    border-radius: 4px;
    cursor: pointer;
    color: var(--txt-sub);
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.tb-btn:hover {
    background: #e2e6ea;
    color: #000;
}

.tb-btn.active {
    background: var(--m-blu-light);
    color: var(--m-blu);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.tb-sep {
    width: 1px;
    height: 16px;
    background: #ddd;
    margin: 0 6px;
}

/* Color Picker */
.color-picker-wrapper {
    position: relative;
}

.color-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 100;
}

.color-dropdown.show {
    display: block;
}

.color-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.color-option {
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.color-option:hover {
    transform: scale(1.1);
    border-color: var(--m-blu);
}

/* Date Picker */
.date-wrapper {
    margin-left: auto;
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
}

.editor-actions {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

.editor-actions .date-wrapper {
    margin-left: 0;
}

.btn-meta-toggle {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid rgba(203, 213, 225, 0.8);
    background: rgba(248, 250, 252, 0.9);
    color: var(--txt-sub);
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.btn-meta-toggle:hover {
    color: var(--m-blu);
    background: rgba(106, 140, 175, 0.08);
    border-color: rgba(106, 140, 175, 0.18);
}

.btn-meta-toggle .ri-arrow-right-s-line {
    font-size: 16px;
    line-height: 1;
    transform: rotate(-90deg);
    transition: transform 0.22s ease;
}

.btn-meta-toggle[data-state="collapsed"] .ri-arrow-right-s-line {
    transform: rotate(90deg);
}

.date-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 15px;
    background: var(--m-blu-light);
    color: var(--m-blu);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: 0.2s;
    border: 1px solid transparent;
    user-select: none;
}

.date-pill:hover {
    background: #e2e8f0;
}

.inp-date {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    visibility: hidden;
}

.btn-close-editor {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: none;
    background: #f0f2f5;
    color: var(--txt-sub);
    cursor: pointer;
    transition: .2s;
    margin-left: 5px;
}

.btn-close-editor:hover {
    background: #fee2e2;
    color: var(--danger);
}

.note-meta-bar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(180deg, rgba(248, 250, 252, 0.9), rgba(255, 255, 255, 0.96));
}

.note-meta-bar.collapsed {
    display: none;
}

.meta-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
}

.meta-input {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 12px;
    outline: none;
    background: #fff;
    color: var(--txt-main);
    font-size: 13px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.meta-input:focus {
    border-color: rgba(106, 140, 175, 0.45);
    box-shadow: 0 0 0 4px rgba(106, 140, 175, 0.08);
}

.meta-title {
    font-size: var(--note-title-size);
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: -0.02em;
    padding: 10px 12px;
}

.note-date-editor {
    flex-shrink: 0;
}

/* Editor Content */
.editor-box,
.dc-text {
    width: 100%;
    outline: none;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.85;
    color: var(--txt-main);
    text-align: justify;
    word-break: normal;
    overflow-wrap: break-word;
}

.editor-box hr,
.dc-text hr {
    border: none;
    border-top: 2px solid #eee;
    width: 60px;
    margin: 1em auto;
    user-select: none;
    pointer-events: none;
}

.editor-box a,
.dc-text a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: var(--border);
    text-underline-offset: 3px;
    opacity: 0.8;
    transition: opacity 0.2s ease, text-decoration-color 0.2s ease;
}

.editor-box a:hover,
.dc-text a:hover {
    opacity: 1;
    text-decoration-color: var(--txt-sub);
}

.editor-box code,
.dc-text code {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 0.85em;
    padding: 0.2em 0.4em;
    background-color: var(--m-blu-light);
    color: var(--m-blu-hover);
    border-radius: 4px;
}

.editor-box {
    height: 450px;
    overflow-y: auto;
    padding: 20px;
    resize: vertical;
    position: relative;
}

/* Editor HTML & Image Styling */
.editor-box img,
.dc-text img {
    width: 50%;
    max-width: 100%;
    height: auto;
    display: inline-block;
    vertical-align: bottom;
    margin: 5px 0;
    border-radius: 6px;
}

.editor-box img {
    cursor: pointer;
    box-sizing: border-box;
    border: 3px solid transparent;
    transition: border-color .15s, width .3s cubic-bezier(.25, 1, .5, 1);
}

.editor-box img.img-selected {
    border-color: var(--m-blu);
}

.dc-text img {
    cursor: zoom-in;
}

.editor-box video,
.dc-text video {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    margin: 8px 0;
    border-radius: 6px;
    background: #000;
}

.dc-text video {
    cursor: pointer;
}

.editor-box blockquote,
.dc-text blockquote {
    border-left: 3px solid var(--m-blu);
    padding: 10px 18px;
    color: var(--txt-sub);
    background: #f8f9fa;
    border-radius: 0 6px 6px 0;
    margin: 1.5em 0;
}

.indent {
    text-indent: 2em;
}

.editor-box h1,
.dc-text h1 {
    font-family: 'Montserrat', "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: var(--content-h1-size);
    font-weight: 800;
    margin-bottom: 0.18em;
    border-bottom: none;
    color: var(--txt-main);
    letter-spacing: -0.02em;
    margin-top: 0.58em;
    line-height: 1.28;
}

/* Upload Widget */
.upload-widget {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.upload-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
}

.upload-title {
    font-weight: 700;
    color: var(--txt-main);
    display: flex;
    align-items: center;
    gap: 6px;
}

.upload-title i {
    color: var(--m-blu);
    font-size: 14px;
}

.upload-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--txt-mut);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.upload-percent {
    color: var(--m-blu);
    font-weight: 800;
    min-width: 35px;
    text-align: right;
}

.upload-bar-wrapper {
    width: 100%;
    height: 6px;
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
}

.upload-progress-bar-inner {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--m-blu), #8baecf);
    border-radius: 10px;
    transition: width 0.15s linear;
}

.upload-cancel {
    background: none;
    border: none;
    color: var(--txt-sub);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    padding: 2px;
    transition: all 0.2s;
}

.upload-cancel:hover {
    color: var(--danger);
    background: #fee2e2;
}

.editor-box h2,
.dc-text h2 {
    font-family: 'Montserrat', "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: var(--content-h2-size);
    font-weight: 700;
    margin-bottom: 0.2em;
    margin-top: 0.82em;
    color: var(--txt-main);
    line-height: 1.35;
}

.editor-box ul,
.dc-text ul {
    padding-left: 30px;
    margin: 10px 0;
}

.editor-box li,
.dc-text li {
    margin-bottom: 4px;
}


/* Image Toolbar */
.img-toolbar {
    position: absolute;
    display: none;
    gap: 6px;
    background: rgba(255, 255, 255, .95);
    border: 1px solid var(--border);
    padding: 6px 8px;
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, .15);
    z-index: 100;
    backdrop-filter: blur(5px);
    align-items: center;
    transform: translateX(-50%);
}

.img-toolbar.show {
    display: flex;
    animation: popIn .2s cubic-bezier(.175, .885, .32, 1.275);
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: translateX(-50%) scale(.9);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
}

.it-btn {
    border: none;
    background: #f1f5f9;
    color: var(--txt-sub);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s;
}

.it-btn:hover {
    background: #e2e8f0;
    color: #000;
}

.it-btn.active {
    background: var(--m-blu);
    color: #fff;
    box-shadow: 0 2px 5px rgba(106, 140, 175, .3);
}


/* ==========================================================================
   6. Feature: Auth
   ========================================================================== */
#auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(242, 244, 247, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, visibility 0s linear 0.15s;
}

#auth-overlay.active {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
    transition: opacity 0.15s ease;
}

.auth-card {
    width: 100%;
    max-width: 320px;
    text-align: center;
    padding: 40px 20px 30px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
    position: relative;
}

.auth-card .c-title {
    margin-bottom: 24px;
    color: var(--m-blu);
    letter-spacing: 2px;
}

.auth-card input {
    width: 100%;
    padding: 14px 25px;
    border-radius: 30px;
    border: 2px solid transparent;
    background: var(--m-blu-light);
    color: var(--m-blu);
    outline: none;
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 2px;
    transition: 0.3s;
}

.auth-card input:focus {
    border-color: var(--m-blu);
    background: #fff;
    box-shadow: 0 5px 15px rgba(106, 140, 175, 0.1);
}

.auth-card input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-btn {
    margin-top: 25px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    background: var(--m-blu);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    box-shadow: 0 4px 15px rgba(106, 140, 175, 0.3);
    margin-left: auto;
    margin-right: auto;
}

.auth-btn:hover {
    transform: scale(1.1);
    background: var(--m-blu-hover);
    box-shadow: 0 6px 20px rgba(106, 140, 175, 0.4);
}

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

.auth-btn svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

#auth-messages {
    min-height: 30px;
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-err {
    background: #fee2e2;
    color: var(--danger);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    font-weight: 700;
    animation: authShake 0.3s ease;
    display: inline-block;
}

@keyframes authShake {

    0%,
    100% {
        transform: translateX(0);
    }

    25% {
        transform: translateX(-5px);
    }

    75% {
        transform: translateX(5px);
    }
}

/* ==========================================================================
   7. Feature: Lists & Note Items
   ========================================================================== */
.d-item {
    display: flex;
    flex-direction: column;
    padding: 28px;
    margin-bottom: 24px;
    background: var(--card-bg);
    border-radius: var(--rad);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border);
    transition: all 0.3s ease;
}

.d-item.editing-inline {
    padding: 0;
    overflow: hidden;
}

.archive-row.editing-inline {
    display: block;
    min-height: 0;
    padding: 0;
    border-color: transparent;
    background: transparent;
}

.archive-row.editing-inline:hover,
.archive-row.editing-inline:focus-visible {
    background: transparent;
    border-color: transparent;
}

.d-item:first-child {
    margin-top: 12px;
}

.d-item:hover .item-actions {
    opacity: 1;
}

.d-item:hover .btn-del {
    opacity: 0.7;
}

.d-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 8px;
}

.note-title-block {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.note-title {
    font-family: 'Montserrat', "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: var(--note-title-size);
    font-weight: 800;
    line-height: 1.2;
    color: var(--txt-main);
    letter-spacing: -0.02em;
    word-break: break-word;
}

.note-meta-line {
    color: var(--txt-mut);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.2px;
}

.note-tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.note-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(106, 140, 175, 0.11);
    color: var(--m-blu);
    font-size: 11px;
    font-weight: 700;
}

.note-date-pill {
    width: fit-content;
    cursor: default;
}

.note-date-pill:hover {
    background: var(--m-blu-light);
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.2s;
}

.content-folded {
    max-height: var(--fold-height);
    overflow: hidden;
    position: relative;
    -webkit-mask-image: linear-gradient(180deg, black 90%, transparent 100%);
    mask-image: linear-gradient(180deg, black 90%, transparent 100%);
}

/* Read More */
.btn-read-more {
    display: flex;
    justify-content: center;
    margin-top: 10px;
    position: relative;
    z-index: 5;
    pointer-events: none;
    padding-bottom: 5px;
}

.btn-read-more-inner {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    background: #ffffff;
    color: var(--txt-sub);
    border: 1px solid var(--border);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.btn-read-more-inner:hover {
    border-color: var(--m-blu);
    color: var(--m-blu);
    box-shadow: 0 6px 15px rgba(106, 140, 175, 0.15);
}

.btn-read-more-inner i {
    font-size: 14px;
}

/* Pagination */
.pg-box {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    align-items: center;
    font-size: 13px;
    color: var(--txt-mut);
}

.pg-btn {
    cursor: pointer;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: 7px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, color 0.2s ease;
    color: #95a4b6;
}

.pg-btn:hover {
    background: rgba(106, 140, 175, 0.08);
    color: var(--m-blu);
}

.pg-status {
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
}

.pg-inp {
    width: 40px;
    border: 1px solid var(--m-blu);
    background: #fff;
    text-align: center;
    font-weight: 700;
    color: var(--m-blu);
    outline: none;
    border-radius: 3px;
    font-size: 13px;
    margin-right: 4px;
}

.sync-stat {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transition: all 0.3s;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 20px;
    color: var(--m-blu);
    white-space: nowrap;
    flex-shrink: 0;
}

.sync-stat.active {
    opacity: 1;
}

.sync-stat.success {
    color: var(--success);
}

.spin {
    animation: spin 0.8s linear infinite;
}

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

/* ==========================================================================
   9. Feature: Overlays
   ========================================================================== */
#swal-root {
    position: fixed;
    inset: 0;
    z-index: 2400;
    pointer-events: none;
}

#swal-root .swal2-container {
    position: fixed !important;
    inset: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 16px !important;
    box-sizing: border-box;
    z-index: 2400 !important;
    pointer-events: auto;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: rgba(15, 23, 42, 0.16);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}


/* Backup/Restore */
.btn-backup {
    display: block;
    width: 140px;
    margin: 12px auto;
    padding: 10px 0;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    text-decoration: none;
}

.btn-backup.primary {
    background: #ADAAA5;
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(173, 170, 165, 0.4);
}

.btn-backup.primary:hover {
    filter: brightness(1.05);
    box-shadow: 0 6px 20px rgba(173, 170, 165, 0.5);
}

.btn-backup.secondary {
    background: #B7B7BD;
    color: #fff;
    border: none;
    box-shadow: 0 4px 15px rgba(183, 183, 189, 0.4);
}

.btn-backup.secondary:hover {
    filter: brightness(1.05);
    box-shadow: 0 6px 20px rgba(183, 183, 189, 0.5);
}

/* ==========================================================================
   10. Utilities & Icons
   ========================================================================== */
.btn-back {
    cursor: pointer;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: transparent;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #95a4b6;
    transition: background-color 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
}

.btn-back:hover {
    background: rgba(106, 140, 175, 0.08);
    color: var(--m-blu);
}

.loading-hint {
    text-align: center;
    padding: 40px;
    color: #ccc;
    font-style: italic;
    letter-spacing: 1px;
    font-size: 14px;
}

.nav-header-stack {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
}

.nav-header-top {
    display: flex;
    align-items: center;
}

.note-tools {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.search-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    width: 100%;
}

.search-input {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    padding: 12px 14px;
    font-size: 14px;
    color: var(--txt-main);
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
    border-color: rgba(106, 140, 175, 0.45);
    box-shadow: 0 0 0 4px rgba(106, 140, 175, 0.08);
}

.search-actions .btn-filter {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
}

.btn-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 11px 16px;
    border-radius: 10px;
    border: none;
    background: var(--m-blu);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-filter:hover {
    filter: brightness(1.05);
}

.btn-filter.secondary {
    background: #e2e8f0;
    color: var(--txt-sub);
}

/* RemixIcon */
@font-face {
    font-family: "remixicon";
    src: url('/assets/fonts/remixicon.woff2') format('woff2');
    font-display: block;
}

[class^="ri-"],
[class*=" ri-"] {
    font-family: 'remixicon' !important;
    font-style: normal;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}


.ri-bold:before {
    content: "\ead1";
}

.ri-italic:before {
    content: "\ee6b";
}

.ri-align-center:before {
    content: "\ea25";
}

.ri-align-justify:before {
    content: "\ea26";
}

.ri-indent-increase:before {
    content: "\ee55";
}

.ri-palette-line:before {
    content: "\efc5";
}

.ri-double-quotes-l:before {
    content: "\ec51";
}

.ri-image-add-line:before {
    content: "\ee47";
}

.ri-separator:before {
    content: "\f0de";
}

.ri-calendar-line:before {
    content: "\eb27";
}

.ri-close-line:before {
    content: "\eb99";
}

.ri-send-plane-fill:before {
    content: "\f0d9";
}

.ri-edit-line:before {
    content: "\ec86";
}

.ri-delete-bin-line:before {
    content: "\ec2a";
}

.ri-arrow-left-s-line:before {
    content: "\ea64";
}

.ri-arrow-right-s-line:before {
    content: "\ea6e";
}


.ri-check-line:before {
    content: "\eb7b";
}

.ri-arrow-down-double-line:before {
    content: "\ea4e";
}

.ri-database-2-line:before {
    content: "\ec22";
}

.ri-film-line:before {
    content: "\ec9a";
}

.ri-icon {
    width: 1.2em;
    height: 1.2em;
    vertical-align: middle;
    fill: currentColor;
    stroke: currentColor;
    stroke-width: 1;
}

/* ==========================================================================
   11. Responsive
   ========================================================================== */
@media (max-width:600px) {
    body {
        padding: 4px 4px 0;
    }

    .card {
        padding: 12px;
    }

    .d-item {
        padding: 16px 14px;
        margin-bottom: 12px;
        border-radius: 10px;
    }

    .editor-wrapper {
        margin-bottom: 16px;
    }

    .editor-box {
        height: 320px;
        padding: 16px 14px;
    }

    .editor-actions {
        gap: 6px;
    }

    .btn-meta-toggle {
        width: 26px;
        height: 26px;
    }

    .note-meta-bar {
        gap: 7px;
        padding: 10px 12px;
    }

    .meta-grid {
        grid-template-columns: 1fr;
        gap: 7px;
    }

    .meta-title {
        font-size: clamp(1.32rem, 1.2rem + 0.45vw, 1.5rem);
    }

    .note-title {
        font-size: clamp(1.32rem, 1.2rem + 0.45vw, 1.5rem);
    }

    .note-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .search-input {
        min-width: 0;
        width: 100%;
    }

    .btn-filter,
    .btn-head-secondary {
        width: 100%;
    }

    .head-right {
        width: auto;
        margin-left: auto;
        justify-content: flex-end;
        flex-wrap: nowrap;
    }

    .global-note-tools {
        flex-direction: column;
        align-items: stretch;
    }

    .search-actions {
        width: 100%;
        flex-direction: row;
        align-items: center;
    }

    .editor-box img,
    .dc-text img {
        width: 100%;
    }

    .editor-fullscreen {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: var(--card-bg);
        flex-direction: column;
        border-radius: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden;
        border: none !important;
        box-shadow: none !important;
    }

    .editor-fullscreen .toolbar {
        flex-shrink: 0;
    }

    .editor-fullscreen .editor-box {
        height: auto !important;
        flex: 1;
        min-height: 0;
        border-radius: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
    }

    .editor-fullscreen .toolbar,
    .editor-fullscreen .editor-box,
    .editor-fullscreen .img-toolbar {
        transition: opacity 0.2s ease-out;
    }

    .editor-fullscreen.editor-loading .toolbar,
    .editor-fullscreen.editor-loading .editor-box,
    .editor-fullscreen.editor-loading .img-toolbar {
        opacity: 0;
        pointer-events: none;
    }
}

/* ==========================================================================
   12. Workspace Overrides
   ========================================================================== */
.d-container {
    width: 100%;
    max-width: 1184px;
    flex: 1;
}

.workspace-shell {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.workspace-side {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    align-self: start;
    position: sticky;
    top: 15px;
    max-height: calc(100vh - 30px);
    overflow: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.workspace-side::-webkit-scrollbar {
    width: 0;
    height: 0;
    display: none;
}

.workspace-panel {
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(203, 213, 225, 0.65);
    border-radius: 14px;
    box-shadow: 0 20px 45px rgba(148, 163, 184, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.sidebar-panel {
    display: flex;
    flex-direction: column;
    padding: 14px 12px 14px;
}

.tags-panel {
    align-self: start;
    width: 100%;
    padding: 14px 12px 14px;
    flex-shrink: 0;
}

.main-panel {
    min-width: 0;
    padding: 14px 16px 18px;
}

.card {
    padding: 0;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 2px 4px 10px;
    border-bottom: 1px solid rgba(203, 213, 225, 0.8);
    margin-bottom: 10px;
}

.folder-panel-head {
    gap: 12px;
    flex-wrap: wrap;
}

.folder-head-tools,
.folder-head-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.folder-head-actions {
    margin-left: auto;
}

.folder-panel-head .panel-tool-btn,
.folder-panel-head .btn-head-icon {
    width: 24px;
    height: 24px;
    padding: 0;
    border: none;
    border-radius: 7px;
    background: transparent;
    box-shadow: none;
    color: #95a4b6;
}

.folder-panel-head .panel-tool-btn>span {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    font-size: 0;
    line-height: 1;
}

.folder-panel-head .panel-tool-btn>span::before {
    font-family: 'remixicon' !important;
    font-size: 18px;
    font-weight: 400;
    line-height: 1;
    transition: transform 0.22s ease, opacity 0.2s ease;
}

#tree-toggle-label::before {
    content: "\ea6e";
    transform: rotate(0deg);
}

#btn-tree-toggle[data-state="expanded"] #tree-toggle-label::before {
    transform: rotate(90deg);
}

#folder-dom-toggle-label::before {
    content: "\ea6e";
    font-size: 18px;
    transform: rotate(-90deg);
}

#btn-folder-dom-toggle[data-state="expanded"] #folder-dom-toggle-label::before {
    content: "\ea6e";
    transform: rotate(90deg);
}

.folder-panel-head .panel-tool-btn:disabled>span::before {
    opacity: 0.45;
}

.folder-panel-head .btn-head-icon .ri-icon {
    width: 1.1em;
    height: 1.1em;
}

.folder-panel-head .panel-tool-btn:hover,
.folder-panel-head .btn-head-icon:hover,
.folder-panel-head .btn-head-icon.active {
    background: rgba(106, 140, 175, 0.08);
    color: var(--m-blu);
}

.folder-panel-head .panel-tool-btn:disabled,
.folder-panel-head .panel-tool-btn:disabled:hover {
    background: transparent;
    color: rgba(149, 164, 182, 0.42);
}

.panel-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 1px solid rgba(203, 213, 225, 0.8);
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.92);
    color: var(--txt-sub);
    font-family: "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 16px;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.panel-tool-btn>span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}

.panel-tool-btn:hover {
    background: rgba(106, 140, 175, 0.08);
    border-color: rgba(106, 140, 175, 0.16);
    color: var(--m-blu);
}

.panel-tool-btn:disabled {
    opacity: 0.45;
    cursor: default;
}

.panel-tool-btn:disabled:hover {
    background: rgba(248, 250, 252, 0.92);
    border-color: rgba(203, 213, 225, 0.8);
    color: var(--txt-sub);
}

.folder-tree-shell {
    display: block;
    padding-right: 4px;
}

.folder-tree-shell.collapsed {
    display: none;
}

.sidebar-panel:has(.folder-tree-shell.collapsed) .folder-panel-head {
    border-bottom-color: transparent;
    margin-bottom: 0;
    padding-bottom: 0;
}

.sidebar-new-note {
    padding-inline: 13px;
}

.sidebar-new-note .ri-icon {
    transition: transform 0.22s ease;
    transform-origin: center;
}

.sidebar-new-note:hover .ri-icon,
.sidebar-new-note:focus-visible .ri-icon {
    transform: rotate(90deg);
}

.panel-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 1.4px;
    color: var(--txt-sub);
    text-transform: uppercase;
}

.c-head {
    margin-bottom: 12px;
    padding: 2px 0 10px;
}

.head-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.btn-back-head {
    width: 0;
    height: 24px;
    padding: 0;
    border-width: 0;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-4px);
    overflow: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, background-color 0.2s ease, color 0.2s ease;
}

.btn-back-head.visible {
    width: 24px;
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.head-left .c-title {
    flex: 1;
    min-width: 0;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.global-note-tools {
    margin: 0 0 12px;
}

.nav-header {
    margin-bottom: 12px;
    padding: 0 0 4px;
}

.view-container.active {
    animation: fade 0.22s ease-out;
}

.workspace-empty {
    min-height: 380px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 14px;
    padding: 24px 10px;
}

.workspace-empty-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    color: var(--m-blu);
}

.workspace-empty h2 {
    font-family: 'Montserrat', "PingFang SC", "Microsoft YaHei", sans-serif;
    font-size: 32px;
    line-height: 1.15;
    letter-spacing: -0.03em;
    color: var(--txt-main);
}

.workspace-empty p {
    max-width: 620px;
    color: var(--txt-sub);
    font-size: 15px;
    line-height: 1.9;
}

.folder-tree {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-right: 0;
}

.tag-cloud {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 2px 2px;
}

.tag-cloud-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag-cloud-footer {
    display: flex;
    justify-content: flex-end;
}

.tag-cloud-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    border: none;
    background: transparent;
    padding: 0;
    border-radius: 6px;
    color: #95a4b6;
    font-size: 16px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s ease, background-color 0.2s ease;
}

.tag-cloud-more .ri-arrow-right-s-line {
    font-size: 16px;
    line-height: 1;
    transform: rotate(90deg);
    transition: transform 0.22s ease;
    pointer-events: none;
}

.tag-cloud-more.is-expanded .ri-arrow-right-s-line {
    transform: rotate(-90deg);
}

.tag-cloud-more:hover {
    color: var(--m-blu);
    background: rgba(106, 140, 175, 0.08);
}

.tag-cloud-empty {
    padding: 2px 4px 4px;
    color: var(--txt-mut);
    font-size: 12px;
    line-height: 1.7;
}

.tag-cloud-chip {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    appearance: none;
    border: 1px solid rgba(203, 213, 225, 0.7);
    border-radius: 999px;
    background: rgba(248, 250, 252, 0.92);
    color: var(--txt-sub);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.tag-cloud-chip:hover {
    background: rgba(106, 140, 175, 0.08);
    border-color: rgba(106, 140, 175, 0.16);
    color: var(--m-blu);
}

.tag-cloud-chip.active {
    background: rgba(106, 140, 175, 0.14);
    border-color: rgba(106, 140, 175, 0.22);
    color: var(--m-blu);
}

.tree-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.tree-node {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 36px;
    padding: 6px 10px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    position: relative;
    border: 1px solid transparent;
}

.tree-node:hover {
    background: rgba(106, 140, 175, 0.08);
    border-color: rgba(106, 140, 175, 0.12);
}

.tree-node.active {
    background: rgba(106, 140, 175, 0.15);
    border-color: rgba(106, 140, 175, 0.24);
    color: var(--m-blu);
    box-shadow: inset 3px 0 0 rgba(106, 140, 175, 0.85);
}

.tree-category.active-parent {
    background: rgba(106, 140, 175, 0.07);
    border-color: rgba(106, 140, 175, 0.16);
    color: var(--txt-main);
    box-shadow: inset 2px 0 0 rgba(106, 140, 175, 0.34);
}

.tree-category {
    font-weight: 750;
    letter-spacing: 0.01em;
    color: var(--txt-main);
}

.tree-subcategory {
    margin-left: 0;
    color: var(--txt-sub);
}

.tree-label {
    flex: 1;
    min-width: 0;
    font-size: 14px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tree-count {
    font-family: 'Montserrat', sans-serif;
    min-width: 24px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid rgba(203, 213, 225, 0.8);
    background: rgba(241, 245, 249, 0.92);
    font-size: 10px;
    font-weight: 700;
    color: #7c8a9d;
    line-height: 1.4;
    text-align: center;
    flex-shrink: 0;
}

.tree-node.active .tree-count {
    border-color: rgba(106, 140, 175, 0.2);
    background: rgba(106, 140, 175, 0.1);
    color: var(--m-blu);
}

.tree-category.active-parent .tree-count {
    color: #6b7c92;
}

.tree-toggle {
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    color: #9aa8ba;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border-radius: 7px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.tree-toggle .ri-icon {
    width: 1em;
    height: 1em;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    transition: transform 0.2s ease;
}

.tree-group.open .tree-toggle .ri-icon {
    transform: rotate(90deg);
}

.tree-node:hover .tree-toggle,
.tree-node.active .tree-toggle {
    background: rgba(106, 140, 175, 0.08);
    color: var(--m-blu);
}

.tree-children {
    display: none;
    position: relative;
    flex-direction: column;
    gap: 4px;
    margin-left: 14px;
    padding-left: 14px;
}

.tree-children::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 5px;
    bottom: 7px;
    width: 1px;
    background: linear-gradient(180deg,
            rgba(203, 213, 225, 0.12),
            rgba(203, 213, 225, 0.55) 12%,
            rgba(203, 213, 225, 0.55) 88%,
            rgba(203, 213, 225, 0.12));
}

.tree-group.open .tree-children {
    display: flex;
}

.tree-leaf {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    border: 2px solid rgba(106, 140, 175, 0.28);
    background: rgba(255, 255, 255, 0.98);
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.92);
}

.tree-subcategory.active .tree-leaf {
    border-color: var(--m-blu);
    background: var(--m-blu);
}

.tree-delete-slot {
    position: absolute;
    top: -6px;
    right: -6px;
    z-index: 2;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
}

.tree-delete-btn {
    position: relative;
    width: 14px;
    height: 14px;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: #c8a9a9;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.96);
    transition: opacity 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
    transform: translateY(-1px) scale(0.92);
}

.tree-delete-btn i {
    font-size: 10px;
    line-height: 1;
}

.tree-delete-slot:hover .tree-delete-btn,
.tree-delete-slot:focus-within .tree-delete-btn,
.tree-delete-btn:focus-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.tree-delete-btn:hover {
    background: #fff1f2;
    color: var(--danger);
}

.tree-empty {
    margin-left: 2px;
    padding: 4px 10px 2px 14px;
    color: var(--txt-mut);
    font-size: 12px;
    line-height: 1.5;
}

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

.archive-row {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 14px;
    position: relative;
}

.archive-row {
    min-height: 46px;
    border-radius: 10px;
    padding: 2px 0;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    border: 1px solid transparent;
}

.archive-row:hover,
.archive-row:focus-visible {
    background: rgba(106, 140, 175, 0.06);
    border-color: rgba(106, 140, 175, 0.12);
    outline: none;
}

.archive-meta {
    min-width: 0;
    justify-self: end;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding-right: 6px;
}

.archive-date {
    color: var(--txt-sub);
    font-size: 12px;
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
    flex-shrink: 0;
}

.archive-track {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
}

.archive-track::before {
    content: "";
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: 50%;
    border-left: 2px dashed rgba(148, 163, 184, 0.24);
    transform: translateX(-50%);
}

.archive-row:first-child .archive-track::before {
    top: 50%;
}

.archive-row:last-child .archive-track::before {
    bottom: 50%;
}

.archive-dot {
    position: relative;
    z-index: 1;
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: #94a3b8;
    box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.95);
}

.archive-row:hover .archive-dot {
    background: var(--m-blu);
}

.archive-title {
    font-family: 'Montserrat', "PingFang SC", "Microsoft YaHei", sans-serif;
    min-width: 0;
    font-size: 17px;
    font-weight: 800;
    line-height: 1.2;
    color: var(--txt-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s ease;
}

.archive-row:hover .archive-title {
    color: var(--m-blu);
}

.archive-tags {
    min-width: 0;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    overflow: hidden;
    max-width: 240px;
}

.archive-tag {
    max-width: 100%;
    appearance: none;
    border: none;
    background: transparent;
    font: inherit;
    color: rgba(107, 114, 128, 0.78);
    font-size: 12px;
    line-height: 1;
    padding: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    cursor: pointer;
    transition: color 0.2s ease;
}

.archive-tag:hover {
    color: var(--m-blu);
}

.note-detail-shell {
    position: relative;
    padding: 14px 12px 8px;
}

.note-detail-shell.editing-inline {
    padding: 0;
}

.note-detail-header {
    margin-bottom: 12px;
}

.note-title-block {
    width: 100%;
    min-width: 0;
}

.note-detail-title {
    font-size: var(--note-title-size);
    line-height: 1.2;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}

.note-detail-meta {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.note-detail-body {
    margin-top: 0;
    width: 100%;
}

.note-date-muted {
    color: var(--txt-mut);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    min-width: 96px;
    flex-shrink: 0;
}

.note-detail-meta .item-actions {
    margin-left: auto;
    padding-right: 6px;
}

.note-detail-footer {
    display: flex;
    justify-content: flex-start;
    margin-top: 28px;
    width: 100%;
}

.note-detail-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: 8px;
    max-width: 100%;
}

.note-detail-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    appearance: none;
    border: none;
    border-radius: 8px;
    background: rgba(106, 140, 175, 0.08);
    font: inherit;
    color: var(--txt-sub);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.note-detail-tag:hover {
    background: rgba(106, 140, 175, 0.14);
    color: var(--m-blu);
}

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

.tree-context-menu {
    position: fixed;
    z-index: 1200;
    display: none;
    flex-direction: column;
    min-width: 210px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(203, 213, 225, 0.9);
    border-radius: 12px;
    box-shadow: 0 16px 30px rgba(15, 23, 42, 0.14);
}

.tree-context-btn {
    width: 100%;
    border: none;
    background: transparent;
    border-radius: 8px;
    padding: 10px 12px;
    text-align: left;
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.7px;
    color: var(--txt-main);
    cursor: pointer;
    transition: background-color 0.18s ease, color 0.18s ease;
}

.tree-context-btn:hover {
    background: rgba(106, 140, 175, 0.1);
    color: var(--m-blu);
}

@media (max-width: 1260px) {
    .workspace-shell {
        grid-template-columns: 260px minmax(0, 1fr);
    }
}

@media (max-width: 900px) {
    .workspace-shell {
        grid-template-columns: 1fr;
        grid-template-areas:
            "sidebar"
            "main"
            "tags";
    }

    .workspace-side {
        display: contents;
        position: static;
        max-height: none;
        overflow: visible;
    }

    .sidebar-panel,
    .tags-panel {
        position: static;
        max-height: none;
    }

    .sidebar-panel {
        grid-area: sidebar;
    }

    .main-panel {
        grid-area: main;
        padding: 16px;
    }

    .tags-panel {
        grid-area: tags;
    }
}

@media (max-width: 720px) {
    .archive-row {
        grid-template-columns: 28px minmax(0, 1fr) auto;
    }

    .archive-tags {
        display: none;
    }

    .archive-title {
        font-size: 17px;
    }

    .note-detail-title {
        font-size: clamp(1.32rem, 1.2rem + 0.45vw, 1.5rem);
    }

    .workspace-empty h2 {
        font-size: 26px;
    }

    .note-detail-shell {
        padding: 10px 4px 6px;
    }

    .note-detail-tags {
        max-width: 100%;
    }
}

@media (max-width: 600px) {

    .main-panel,
    .sidebar-panel {
        padding: 14px;
    }

    .tree-children {
        margin-left: 10px;
        padding-left: 12px;
    }
}

@media (hover: none) {

    .note-detail-meta .item-actions,
    .note-detail-meta .btn-del {
        opacity: 1;
    }
}