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

:root {
    --bg: #0f0f0f;
    --surface: #181818;
    --surface2: #1f1f1f;
    --border: #2a2a2a;
    --border-h: #3d3d3d;
    --text: #e8e4dc;
    --muted: #666;
    --accent: #c9f565;
    --accent-d: #a8d44a;
    --danger: #ff5a5a;
    --link: #00b9ff;
    --radius: 12px;
}

html,
body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 17px;
    line-height: 1.6;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 360px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 36px 0 0;
    z-index: 10;
}

.logo {
    padding: 0 30px 36px;
    font-family: 'Instrument Serif', serif;
    font-size: 30px;
    letter-spacing: -.5px;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
}

.logo span {
    color: var(--accent);
}

.nav-label {
    padding: 0 30px 10px;
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 30px;
    cursor: pointer;
    color: var(--muted);
    transition: color .15s, background .15s;
    font-size: 16px;
}

.nav-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .04);
}

.nav-item.active {
    color: var(--text);
}

.nav-item .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}

.sidebar-lists {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 8px;
}

.sidebar-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 24px;
    cursor: pointer;
    color: var(--muted);
    font-size: 14px;
    transition: color .15s, background .15s;
    white-space: nowrap;
    overflow: hidden;
}

.sidebar-list-item:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .04);
}

.sidebar-list-item.active {
    color: var(--text);
}

.sidebar-list-item .sl-emoji {
    font-size: 17px;
    flex-shrink: 0;
}

.sidebar-list-item .sl-name {
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-footer {
    padding: 12px 0 20px;
    border-top: 1px solid var(--border);
}

.list-count-label {
    padding: 0 30px 10px;
    color: var(--muted);
    font-size: 13px;
}

.profile-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background .15s;
    margin: 0 16px;
    border: none;
    background: none;
    width: calc(100% - 32px);
    text-align: left;
    font-family: 'JetBrains Mono', monospace;
}

.profile-btn:hover {
    background: rgba(255, 255, 255, .05);
}

.profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.profile-avatar-fallback {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(201, 245, 101, .15);
    color: var(--accent);
    font-size: 12px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: .02em;
}

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

.profile-name {
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.profile-email {
    font-size: 11px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.profile-popover {
    position: fixed;
    bottom: 84px;
    left: 12px;
    width: 296px;
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 14px;
    z-index: 500;
    box-shadow: 0 16px 48px rgba(0, 0, 0, .75);
    overflow: hidden;
    display: none;
    transform-origin: bottom left;
}

.profile-popover.open {
    display: block;
    animation: scaleIn .15s ease both;
}

.popover-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--border);
}

.popover-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.popover-avatar-fallback {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(201, 245, 101, .15);
    color: var(--accent);
    font-size: 15px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
}

.popover-name {
    font-size: 15px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.3;
}

.popover-email {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
    word-break: break-all;
}

.popover-menu {
    padding: 6px 0;
}

.popover-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 18px;
    cursor: pointer;
    font-size: 14px;
    color: var(--muted);
    transition: background .12s, color .12s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: 'JetBrains Mono', monospace;
}

.popover-item:hover {
    background: rgba(255, 255, 255, .04);
    color: var(--text);
}

.popover-item.danger:hover {
    color: var(--danger);
    background: rgba(255, 90, 90, .06);
}

.popover-sep {
    height: 1px;
    background: var(--border);
    margin: 4px 0;
}

#page-settings {
    display: none;
    padding: 68px 72px 150px;
    animation: fadeIn .2s ease;
    max-width: 700px;
}

#page-settings.visible {
    display: block;
}

.settings-title {
    font-family: 'Instrument Serif', serif;
    font-size: 48px;
    letter-spacing: -1.2px;
    line-height: 1;
    margin-bottom: 48px;
}

.settings-title em {
    color: var(--accent);
    font-style: italic;
}

.settings-section {
    margin-bottom: 28px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.settings-section-label {
    padding: 13px 22px;
    font-size: 11px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--border);
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
    gap: 20px;
}

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

.settings-row-label {
    font-size: 15px;
    color: var(--text);
    line-height: 1.3;
}

.settings-row-desc {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
    line-height: 1.5;
}

.settings-account-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 22px;
}

.settings-avatar {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: block;
}

.settings-avatar-fallback {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: rgba(201, 245, 101, .15);
    color: var(--accent);
    font-size: 18px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
}

.settings-account-name {
    font-size: 17px;
    color: var(--text);
    font-weight: 500;
    line-height: 1.3;
}

.settings-account-email {
    font-size: 13px;
    color: var(--muted);
    margin-top: 3px;
}

.settings-account-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    font-size: 11px;
    color: rgba(201, 245, 101, .7);
    background: rgba(201, 245, 101, .08);
    border: 1px solid rgba(201, 245, 101, .15);
    border-radius: 20px;
    padding: 3px 10px;
    letter-spacing: .04em;
}

.settings-danger-btn {
    background: none;
    border: 1px solid rgba(255, 90, 90, .3);
    color: var(--danger);
    border-radius: 8px;
    padding: 9px 18px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.settings-danger-btn:hover {
    background: rgba(255, 90, 90, .08);
    border-color: var(--danger);
}

.settings-export-btn {
    background: none;
    border: 1px solid var(--border-h);
    color: var(--text);
    border-radius: 8px;
    padding: 9px 18px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.settings-export-btn:hover {
    border-color: var(--accent);
    background: rgba(201, 245, 101, .04);
}

.page-wrap {
    margin-left: 360px;
    min-height: 100vh;
}

#page-home {
    padding: 68px 72px;
    animation: fadeIn .2s ease;
}

#page-home.hidden {
    display: none;
}

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    margin-bottom: 56px;
}

.page-title {
    font-family: 'Instrument Serif', serif;
    font-size: 57px;
    line-height: 1;
    letter-spacing: -1.2px;
}

.page-title em {
    font-style: italic;
    color: var(--accent);
}

.btn-new {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    background: var(--accent);
    color: #0f0f0f;
    border: none;
    border-radius: var(--radius);
    padding: 14px 28px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, transform .1s;
    flex-shrink: 0;
}

.btn-new:hover {
    background: var(--accent-d);
    transform: translateY(-1px);
}

.btn-new:active {
    transform: translateY(0);
}

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

.home-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 40px;
    flex-wrap: wrap;
}

.search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    flex: 1;
    min-width: 200px;
    max-width: 420px;
}

.search-icon {
    position: absolute;
    left: 14px;
    width: 15px;
    height: 15px;
    color: var(--muted);
    pointer-events: none;
    flex-shrink: 0;
}

.search-input {
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 11px 38px 11px 38px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
}

.search-input:focus {
    border-color: var(--border-h);
}

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

.search-clear {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 4px;
    display: none;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: color .15s;
}

.search-clear svg {
    width: 9px;
    height: 9px;
}

.search-clear:hover {
    color: var(--text);
}

.search-clear.visible {
    display: flex;
}

.filter-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.filter-label {
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.filter-pills {
    display: flex;
    gap: 6px;
}

.filter-pill {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 20px;
    padding: 6px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
    white-space: nowrap;
}

.filter-pill:hover {
    border-color: var(--border-h);
    color: var(--text);
}

.filter-pill.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(201, 245, 101, .06);
}

.no-results {
    grid-column: 1/-1;
    text-align: center;
    padding: 64px 0;
    color: var(--muted);
    font-size: 16px;
}

.lists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(420px, 1fr));
    gap: 20px;
}

.list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px 30px 24px;
    cursor: pointer;
    position: relative;
    transition: border-color .15s, transform .15s, box-shadow .15s;
    animation: fadeUp .3s ease both;
}

.list-card:hover {
    border-color: var(--border-h);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}

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

.card-title-row {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
    flex: 1;
}

.btn-delete {
    opacity: 0;
    background: none;
    border: none;
    color: var(--danger);
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    font-size: 14px;
    letter-spacing: .04em;
    font-family: 'JetBrains Mono', monospace;
    transition: opacity .15s, background .15s;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

.btn-delete svg {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

.list-card:hover .btn-delete {
    opacity: 1;
}

.btn-delete:hover {
    background: rgba(255, 90, 90, .12);
}

.card-name {
    font-family: 'Instrument Serif', serif;
    font-size: 22px;
    letter-spacing: -.2px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    min-width: 0;
}

.card-info {
    color: var(--muted);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-info .pill {
    background: rgba(201, 245, 101, .08);
    color: var(--accent);
    padding: 1px 8px;
    border-radius: 20px;
    font-size: 12px;
}

.empty-state {
    grid-column: 1/-1;
    text-align: center;
    padding: 84px 0;
    color: var(--muted);
}

.empty-state .big {
    font-family: 'Instrument Serif', serif;
    font-size: 38px;
    color: var(--text);
    margin-bottom: 10px;
}

.empty-state .sub {
    font-size: 16px;
}

#page-list {
    display: none;
    padding: 68px 72px 150px;
    animation: fadeIn .2s ease;
    min-height: 100vh;
}

#page-list.visible {
    display: block;
}

.list-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 48px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    padding: 5px 0;
    transition: color .15s;
    margin-right: auto;
}

.btn-back:hover {
    color: var(--text);
}

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

.btn-tag-filter {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 8px;
    padding: 7px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}

.btn-tag-filter:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(201,245,101,.05);
}

.btn-tag-filter.active {
    border-color: var(--accent);
    color: #0f0f0f;
    background: var(--accent);
}

.btn-tag-filter.active:hover {
    background: var(--accent-d);
    border-color: var(--accent-d);
    color: #0f0f0f;
}

.list-title-wrap {
    margin-bottom: 14px;
}

.list-title-input {
    font-family: 'Instrument Serif', serif;
    font-size: 38px;
    line-height: 1;
    letter-spacing: -0.8px;
    background: none;
    border: none;
    color: var(--text);
    outline: none;
    width: 100%;
    caret-color: var(--accent);
    min-height: 1.2em;
    word-break: break-word;
    white-space: pre-wrap;
    cursor: text;
    max-width: 880px;
}

.list-title-input:empty::before {
    content: attr(data-placeholder);
    color: var(--border-h);
    pointer-events: none;
}

.list-title-input b,
.list-title-input strong { font-weight: 700; }
.list-title-input i,
.list-title-input em { font-style: italic; }
.list-title-input u { text-decoration: underline; }
.list-title-input s,
.list-title-input strike { text-decoration: line-through; }
.list-title-input a {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.list-desc-wrap {
    margin-bottom: 14px;
    max-width: 880px;
}

.list-description {
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    color: #888;
    line-height: 1.7;
    background: none;
    border: none;
    outline: none;
    width: 100%;
    caret-color: var(--accent);
    min-height: 28px;
    word-break: break-word;
    white-space: pre-wrap;
    overflow: hidden;
}

.list-description:empty::before {
    content: attr(data-placeholder);
    color: #333;
    pointer-events: none;
}

.list-tags-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    margin-bottom: 20px;
    max-width: 880px;
    min-height: 26px;
    position: relative;
}

.list-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    border-radius: 20px;
    padding: 3px 11px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    cursor: pointer;
    transition: opacity .15s;
    border-width: 1px;
    border-style: solid;
    line-height: 1.4;
}

.list-tag:hover { opacity: .8; }

.list-tags-add-btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px dashed var(--border-h);
    background: none;
    color: var(--muted);
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color .15s, color .15s;
    line-height: 1;
    font-family: monospace;
    padding: 0;
}

.list-tags-add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.list-tags-wrap.has-tags .list-tags-add-btn {
    display: none;
}

.list-tags-wrap.has-tags:hover .list-tags-add-btn {
    display: inline-flex;
}

.items-container {
    max-width: 880px;
}

.item-row {
    display: flex;
    align-items: flex-start;
    position: relative;
    padding-left: 0;
    transition: padding-left .12s;
    flex-wrap: wrap;
}

.item-row[data-level="1"] { padding-left: 32px; }
.item-row[data-level="2"] { padding-left: 64px; }
.item-row[data-level="3"] { padding-left: 96px; }
.item-row[data-level="4"] { padding-left: 128px; }
.item-row[data-level="5"] { padding-left: 160px; }

.item-row.drag-over-above {
    border-top: 2px solid var(--accent);
}

.item-row.drag-over-below {
    border-bottom: 2px solid var(--accent);
}

.item-row.dragging {
    opacity: .4;
}

.item-row.tag-filter-hidden {
    display: none !important;
}

.item-gutter {
    width: 32px;
    flex-shrink: 0;
    display: flex;
    align-items: flex-start;
    padding-top: 5px;
    justify-content: flex-end;
    padding-right: 9px;
    opacity: 0;
    transition: opacity .12s;
}

.item-row:hover .item-gutter,
.item-row:focus-within .item-gutter {
    opacity: 1;
}

.item-gutter-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--muted);
    margin-top: 4px;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform .15s, opacity .15s;
}

.item-gutter-dot:hover {
    transform: scale(1.6);
    opacity: 0.9;
}

.item-content {
    flex: 1;
    min-height: 36px;
    outline: none;
    font-family: 'JetBrains Mono', monospace;
    font-size: 17px;
    color: var(--text);
    line-height: 1.8;
    word-break: break-word;
    padding: 0;
    caret-color: var(--accent);
}

.item-content:empty::before {
    content: attr(data-placeholder);
    color: #444;
    pointer-events: none;
}

.item-content b,
.item-content strong { font-weight: 600; }
.item-content i,
.item-content em { font-style: italic; }
.item-content u { text-decoration: underline; }
.item-content s,
.item-content strike { text-decoration: line-through; }

.item-content a,
.list-title-input a {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.item-content a:hover,
.list-title-input a:hover {
    opacity: .85;
}

.item-tag-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    padding: 0 0 4px 32px;
    width: 100%;
    flex-basis: 100%;
}

.item-tag-pill {
    font-size: 10px;
    padding: 1px 8px;
    cursor: default;
    pointer-events: none;
    opacity: .85;
}

.item-row.is-divider {
    align-items: center;
    margin: 10px 0 4px;
}

.item-row.is-divider .item-gutter {
    opacity: 1;
    padding-right: 6px;
    cursor: pointer;
}

.item-row.is-divider .item-gutter-dot {
    display: none;
}

.collapse-toggle {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    transition: transform .18s, color .15s;
    flex-shrink: 0;
}

.collapse-toggle svg {
    width: 10px;
    height: 10px;
}

.item-row.is-divider:hover .collapse-toggle {
    color: var(--text);
}

.item-row.is-divider.collapsed .collapse-toggle {
    transform: rotate(-90deg);
}

.item-row.is-divider .item-content {
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    min-height: 24px;
    line-height: 24px;
    flex: none;
    width: auto;
    min-width: 40px;
    padding-right: 12px;
}

.divider-line {
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-left: 4px;
    align-self: center;
}

.item-row.is-divider.collapsed .divider-line {
    background: var(--border-h);
}

.item-row.collapse-hidden {
    display: none;
}

.item-row.fr-highlighted .item-content {
    background: rgba(201, 245, 101, .07);
    border-radius: 4px;
    outline: 1px solid rgba(201, 245, 101, .25);
}

.add-item-hint {
    margin-top: 4px;
    padding: 6px 0 6px 32px;
    color: #3a3a3a;
    font-size: 16px;
    cursor: text;
    transition: color .15s;
    display: flex;
    align-items: center;
    gap: 9px;
    max-width: 880px;
}

.add-item-hint:hover {
    color: var(--muted);
}

.format-toolbar {
    position: fixed;
    z-index: 400;
    background: var(--surface2);
    border: 1px solid var(--border-h);
    border-radius: 9px;
    padding: 5px 8px;
    display: none;
    align-items: center;
    gap: 3px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .6);
    transform: translateY(-2px);
    transition: opacity .1s;
}

.format-toolbar.visible {
    display: flex;
    animation: scaleIn .12s ease both;
}

.fmt-btn {
    width: 38px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    border-radius: 5px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 16px;
    transition: background .1s, color .1s;
    font-weight: 500;
}

.fmt-btn:hover {
    background: rgba(255, 255, 255, .08);
    color: var(--text);
}

.fmt-btn.active {
    color: var(--accent);
}

#fmt-link.active {
    color: var(--link);
}

.fmt-sep {
    width: 1px;
    height: 18px;
    background: var(--border);
    margin: 0 3px;
    flex-shrink: 0;
}

.fmt-label {
    font-size: 12px;
    color: var(--muted);
    padding: 0 5px;
    letter-spacing: .06em;
}

.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    z-index: 100;
    align-items: center;
    justify-content: center;
}

.modal-overlay.open {
    display: flex;
}

.modal {
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 14px;
    padding: 32px;
    width: 420px;
    box-sizing: border-box;
    animation: scaleIn .2s ease both;
}

.modal h2 {
    font-family: 'Instrument Serif', serif;
    font-size: 22px;
    margin-bottom: 20px;
    letter-spacing: -.3px;
}

.input-name-wrap {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.input-name {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 17px 14px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    outline: none;
    transition: border-color .15s;
}

.input-name:focus {
    border-color: var(--accent);
}

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

.input-name-hint {
    font-size: 11px;
    color: var(--muted);
    text-align: right;
    letter-spacing: .02em;
    transition: color .15s;
}

.input-name-hint.near-limit { color: var(--accent); }
.input-name-hint.at-limit   { color: var(--danger); }

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 22px;
}

.btn-cancel {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 9px;
    padding: 10px 22px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
}

.btn-cancel:hover {
    border-color: var(--border-h);
    color: var(--text);
}

.btn-create {
    background: var(--accent);
    border: none;
    color: #0f0f0f;
    border-radius: 9px;
    padding: 10px 22px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}

.btn-create:hover {
    background: var(--accent-d);
}

.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    z-index: 200;
    align-items: center;
    justify-content: center;
}

.confirm-overlay.open {
    display: flex;
}

.confirm-box {
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 14px;
    padding: 40px;
    width: 460px;
    box-sizing: border-box;
    animation: scaleIn .15s ease both;
}

.confirm-box p {
    font-size: 16px;
    color: var(--muted);
    margin-top: 10px;
    line-height: 1.5;
    word-break: break-word;
}

.confirm-box h3 {
    font-family: 'JetBrains Mono', monospace;
    font-size: 24px;
}

.confirm-actions {
    display: flex;
    gap: 12px;
    margin-top: 30px;
    justify-content: flex-end;
}

.btn-danger {
    background: var(--danger);
    border: none;
    color: #fff;
    border-radius: 9px;
    padding: 10px 22px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    cursor: pointer;
    transition: opacity .15s;
}

.btn-danger:hover {
    opacity: .85;
}

.fmt-color-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.fmt-color-btn {
    flex-direction: column;
    gap: 2px;
    height: 36px;
    padding: 4px 6px;
    width: auto;
    min-width: 28px;
}

.fmt-color-bar {
    width: 18px;
    height: 3px;
    border-radius: 2px;
    flex-shrink: 0;
}

.fmt-color-popup {
    display: none;
    position: fixed;
    z-index: 9999;
    background: var(--surface2);
    border: 1px solid var(--border-h);
    border-radius: 12px;
    padding: 12px;
    width: 196px;
    box-sizing: border-box;
    box-shadow: 0 12px 36px rgba(0, 0, 0, .7);
    flex-direction: column;
    gap: 9px;
}

.fmt-color-popup.open {
    display: flex;
}

.fcp-label {
    font-size: 12px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.fcp-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.fcp-swatch {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid rgba(255, 255, 255, .08);
    transition: transform .1s;
    flex-shrink: 0;
}

.fcp-swatch:hover {
    transform: scale(1.2);
}

.fcp-swatch.transparent {
    background: linear-gradient(135deg, #fff 42%, #f00 42%, #f00 58%, #fff 58%) !important;
    border-color: rgba(255, 255, 255, .2);
}

.fcp-inputs {
    display: flex;
    gap: 6px;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.fcp-hex {
    flex: 1;
    min-width: 0;
    width: 0;
    background: rgba(255, 255, 255, .06);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 6px 8px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    outline: none;
    transition: border-color .15s;
}

.fcp-hex:focus {
    border-color: var(--accent);
}

.fcp-native {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 7px;
    cursor: pointer;
    padding: 0;
    background: none;
    outline: 1px solid var(--border);
}

.fcp-native::-webkit-color-swatch-wrapper { padding: 0; }
.fcp-native::-webkit-color-swatch { border: none; border-radius: 6px; }

.fcp-apply {
    background: var(--accent);
    border: none;
    color: #0f0f0f;
    border-radius: 7px;
    padding: 7px 0;
    width: 100%;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}

.fcp-apply:hover {
    background: var(--accent-d);
}

.link-popup-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(4px);
    z-index: 700;
    align-items: center;
    justify-content: center;
}

.link-popup-overlay.open {
    display: flex;
}

.link-popup {
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 14px;
    padding: 28px 28px 24px;
    width: 420px;
    box-sizing: border-box;
    animation: scaleIn .18s ease both;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.link-popup-title {
    font-family: 'Instrument Serif', serif;
    font-size: 22px;
    letter-spacing: -.3px;
    color: var(--text);
}

.link-popup-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.link-popup-label {
    font-size: 11px;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--muted);
}

.link-popup-input {
    background: rgba(255, 255, 255, .05);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 11px 14px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
    width: 100%;
    box-sizing: border-box;
}

.link-popup-input:focus {
    border-color: var(--link);
}

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

.link-popup-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
}

.item-img-wrap {
    display: inline-block;
    position: relative;
    cursor: default;
    line-height: 0;
    vertical-align: middle;
    max-width: 100%;
}

.item-img-wrap img {
    display: block;
    max-width: 100%;
    border-radius: 6px;
    user-select: none;
    -webkit-user-drag: none;
}

.item-img-wrap.selected img {
    outline: 2px solid var(--accent);
    border-radius: 6px;
}

.img-resize-handle {
    display: none;
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 3px;
    cursor: se-resize;
    z-index: 10;
}

.item-img-wrap.selected .img-resize-handle {
    display: block;
}

.img-size-label {
    display: none !important;
}

.fr-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .55);
    backdrop-filter: blur(5px);
    z-index: 600;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}

.fr-overlay.open {
    display: flex;
    animation: fadeIn .15s ease both;
}

.fr-modal {
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 16px;
    width: 520px;
    max-width: calc(100vw - 32px);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .8);
    animation: scaleIn .18s ease both;
    overflow: hidden;
}

.fr-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.fr-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text);
    font-weight: 500;
    flex: 1;
}

.fr-title svg {
    color: var(--accent);
    flex-shrink: 0;
}

.fr-hotkey-hint {
    font-size: 11px;
    color: var(--muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 2px 7px;
    letter-spacing: .04em;
}

.fr-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color .15s, background .15s;
}

.fr-close svg {
    width: 10px;
    height: 10px;
}

.fr-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, .07);
}

.fr-fields {
    padding: 18px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.fr-field-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.fr-label {
    font-size: 11px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
}

.fr-input {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 9px;
    padding: 11px 14px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
    width: 100%;
}

.fr-input:focus {
    border-color: var(--accent);
}

.fr-input::placeholder {
    color: #444;
}

.fr-status {
    padding: 10px 20px 0;
    min-height: 28px;
    display: flex;
    align-items: center;
}

.fr-match-count {
    font-size: 12px;
    color: var(--muted);
    letter-spacing: .04em;
}

.fr-results {
    margin: 0 20px;
    max-height: 210px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: 9px;
    background: var(--surface2);
}

.fr-results:empty {
    display: none;
}

.fr-result-item {
    padding: 9px 13px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--muted);
    line-height: 1.5;
    word-break: break-word;
}

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

.fr-preview {
    display: -webkit-box;
    overflow: hidden;
    line-clamp: 2;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    white-space: pre-wrap;
}

.fr-mark {
    background: rgba(201, 245, 101, .28);
    color: var(--accent);
    border-radius: 2px;
    padding: 0 1px;
    font-style: normal;
}

.fr-actions {
    display: flex;
    gap: 10px;
    padding: 14px 20px 18px;
}

.fr-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    border: none;
    border-radius: 9px;
    padding: 10px 18px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    flex: 1;
    justify-content: center;
}

.fr-btn:disabled {
    opacity: .35;
    cursor: not-allowed;
}

.fr-btn-replace {
    background: var(--accent);
    color: #0f0f0f;
}

.fr-btn-replace:hover:not(:disabled) {
    background: var(--accent-d);
}

.fr-btn-remove {
    background: rgba(255, 90, 90, .15);
    color: var(--danger);
    border: 1px solid rgba(255, 90, 90, .25);
}

.fr-btn-remove:hover:not(:disabled) {
    background: rgba(255, 90, 90, .25);
}

.btn-list-settings {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 8px;
    padding: 7px 10px;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
    font-size: 14px;
}

.btn-list-settings:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(201,245,101,.05);
}

.ls-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(5px);
    z-index: 800;
    align-items: flex-start;
    justify-content: center;
    padding-top: 72px;
}

.ls-overlay.open {
    display: flex;
    animation: fadeIn .15s ease both;
}

.ls-modal {
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 16px;
    width: 540px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,.8);
    animation: scaleIn .18s ease both;
}

.ls-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 22px 18px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
    border-radius: 16px 16px 0 0;
}

.ls-title {
    font-family: 'Instrument Serif', serif;
    font-size: 20px;
    letter-spacing: -.3px;
    flex: 1;
}

.ls-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color .15s, background .15s;
}

.ls-close svg { width: 10px; height: 10px; }

.ls-close:hover { color: var(--text); background: rgba(255,255,255,.07); }

.ls-body { padding: 0 0 8px; }

.ls-section { border-bottom: 1px solid var(--border); }
.ls-section:last-child { border-bottom: none; }

.ls-section-label {
    padding: 14px 22px 4px;
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--muted);
}

.ls-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 22px;
}

.ls-row-col { flex: 1; min-width: 0; }
.ls-row-label { font-size: 14px; color: var(--text); line-height: 1.3; }
.ls-row-desc { font-size: 12px; color: var(--muted); margin-top: 2px; line-height: 1.4; }

.ls-input {
    background: rgba(255,255,255,.05);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
    box-sizing: border-box;
    margin: 2px 22px 12px;
    width: calc(100% - 44px);
    display: block;
}

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

.ls-toggle {
    position: relative;
    width: 38px;
    height: 22px;
    flex-shrink: 0;
}

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

.ls-toggle-track {
    position: absolute;
    inset: 0;
    background: var(--border-h);
    border-radius: 20px;
    cursor: pointer;
    transition: background .2s;
}

.ls-toggle input:checked + .ls-toggle-track { background: var(--accent); }

.ls-toggle-track::after {
    content: '';
    position: absolute;
    left: 3px; top: 3px;
    width: 16px; height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}

.ls-toggle input:checked + .ls-toggle-track::after { transform: translateX(16px); }

.ls-visibility-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-family: 'JetBrains Mono', monospace;
    letter-spacing: .04em;
    margin-top: 2px;
}

.ls-visibility-badge.shared {
    background: rgba(201,245,101,.1);
    color: var(--accent);
    border: 1px solid rgba(201,245,101,.25);
}

.ls-visibility-badge.private {
    background: rgba(255,255,255,.04);
    color: var(--muted);
    border: 1px solid var(--border);
}

.ls-share-url {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 2px 22px 12px;
}

.ls-share-url-text {
    flex: 1;
    font-size: 12px;
    color: var(--muted);
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: 'JetBrains Mono', monospace;
    min-width: 0;
}

.ls-share-copy-btn {
    background: none;
    border: 1px solid var(--border-h);
    color: var(--text);
    border-radius: 7px;
    padding: 7px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s, background .15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.ls-share-copy-btn:hover { border-color: var(--accent); background: rgba(201,245,101,.05); }

.ls-generate-share-btn {
    background: none;
    border: 1px solid var(--border-h);
    color: var(--muted);
    border-radius: 8px;
    padding: 8px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
    margin: 2px 22px 12px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.ls-generate-share-btn:hover { border-color: var(--accent); color: var(--accent); background: rgba(201,245,101,.05); }
.ls-generate-share-btn:disabled { opacity: .5; cursor: not-allowed; }

.ls-shortcuts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
    padding: 6px 22px 14px;
}

.ls-shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255,255,255,.03);
}

.ls-shortcut-desc { font-size: 12px; color: var(--muted); line-height: 1.3; }
.ls-shortcut-keys { display: flex; gap: 3px; flex-shrink: 0; align-items: center; }

.ls-kbd {
    background: var(--surface2);
    border: 1px solid var(--border-h);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    color: var(--text);
    line-height: 1.6;
}

.tag-edit-popup {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 12px;
    padding: 14px;
    width: 230px;
    z-index: 900;
    box-shadow: 0 12px 36px rgba(0,0,0,.7);
    display: none;
    flex-direction: column;
    gap: 10px;
}

.tag-edit-popup.open { display: flex; animation: scaleIn .15s ease both; }
.tag-edit-title { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.tag-edit-field { display: flex; flex-direction: column; gap: 4px; }
.tag-edit-field-label { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.tag-edit-input {
    background: rgba(255,255,255,.05);
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 7px 10px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    outline: none;
    transition: border-color .15s;
    width: 100%;
    box-sizing: border-box;
}

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

.tag-color-row { display: flex; gap: 5px; align-items: center; }

.tag-color-hex {
    flex: 1;
    min-width: 0;
    width: 0;
    background: rgba(255,255,255,.05);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 5px 7px;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    outline: none;
    transition: border-color .15s;
}

.tag-color-hex:focus { border-color: var(--accent); }

.tag-color-native {
    width: 28px; height: 28px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    padding: 0;
    background: none;
    outline: 1px solid var(--border);
    flex-shrink: 0;
}

.tag-color-native::-webkit-color-swatch-wrapper { padding: 0; }
.tag-color-native::-webkit-color-swatch { border: none; border-radius: 4px; }

.tag-edit-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    background: var(--surface2);
    border-radius: 7px;
    min-height: 34px;
    font-size: 13px;
}

.tag-edit-actions { display: flex; gap: 7px; }

.tag-edit-save {
    flex: 1;
    background: var(--accent);
    border: none;
    color: #0f0f0f;
    border-radius: 7px;
    padding: 8px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s;
}

.tag-edit-save:hover { background: var(--accent-d); }

.tag-edit-delete {
    background: none;
    border: 1px solid rgba(255,90,90,.3);
    color: var(--danger);
    border-radius: 7px;
    padding: 8px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}

.tag-edit-delete:hover { background: rgba(255,90,90,.08); border-color: var(--danger); }

.item-props-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.6);
    backdrop-filter: blur(5px);
    z-index: 950;
    align-items: center;
    justify-content: center;
}

.item-props-overlay.open {
    display: flex;
    animation: fadeIn .15s ease both;
}

.item-props-modal {
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 16px;
    width: 400px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    box-shadow: 0 24px 60px rgba(0,0,0,.8);
    animation: scaleIn .18s ease both;
}

.item-props-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 1;
    border-radius: 16px 16px 0 0;
}

.item-props-title {
    font-family: 'Instrument Serif', serif;
    font-size: 19px;
    letter-spacing: -.3px;
    flex: 1;
}

.item-props-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color .15s, background .15s;
}

.item-props-close svg { width: 10px; height: 10px; }
.item-props-close:hover { color: var(--text); background: rgba(255,255,255,.07); }

.item-props-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.item-props-section { display: flex; flex-direction: column; gap: 10px; }

.item-props-section-label {
    font-size: 10px;
    letter-spacing: .14em;
    text-transform: uppercase;
    color: var(--muted);
}

.item-props-dot-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.item-props-dot-preview {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--muted);
    flex-shrink: 0;
    border: 2px solid rgba(255,255,255,.1);
    transition: background .15s;
}

.item-props-dot-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    flex: 1;
}

.item-props-swatch {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid transparent;
    transition: transform .12s, border-color .12s;
    flex-shrink: 0;
}

.item-props-swatch:hover {
    transform: scale(1.25);
}

.item-props-swatch.active {
    border-color: var(--accent);
    transform: scale(1.15);
}

.item-props-dot-custom {
    display: flex;
    gap: 5px;
    align-items: center;
    width: 100%;
    margin-top: 2px;
}

.item-props-tags-empty {
    font-size: 12px;
    color: var(--muted);
    font-style: italic;
    padding: 4px 0;
    line-height: 1.5;
}

.item-props-tags-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.item-props-tag-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: var(--surface2);
}

.item-props-tag-row:hover {
    border-color: var(--border-h);
    background: rgba(255,255,255,.04);
}

.item-props-tag-row.selected {
    border-color: var(--accent);
    background: rgba(201,245,101,.06);
}

.item-props-tag-check {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid var(--border-h);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color .15s, background .15s;
}

.item-props-tag-check svg {
    width: 10px;
    height: 8px;
    stroke: #0f0f0f;
    opacity: 0;
    transition: opacity .12s;
}

.item-props-tag-row.selected .item-props-tag-check {
    background: var(--accent);
    border-color: var(--accent);
}

.item-props-tag-row.selected .item-props-tag-check svg {
    opacity: 1;
}

.item-props-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--border);
}

.tag-filter-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(5px);
    z-index: 850;
    align-items: flex-start;
    justify-content: center;
    padding-top: 80px;
}

.tag-filter-overlay.open {
    display: flex;
    animation: fadeIn .15s ease both;
}

.tag-filter-modal {
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 16px;
    width: 400px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 140px);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 60px rgba(0,0,0,.8);
    animation: scaleIn .18s ease both;
}

.tag-filter-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 18px 14px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.tag-filter-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text);
    font-weight: 500;
    flex: 1;
}

.tag-filter-title svg {
    color: var(--accent);
}

.tag-filter-close {
    background: none;
    border: none;
    color: var(--muted);
    cursor: pointer;
    padding: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color .15s, background .15s;
}

.tag-filter-close svg { width: 10px; height: 10px; }
.tag-filter-close:hover { color: var(--text); background: rgba(255,255,255,.07); }

.tag-filter-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 18px;
}

.tag-filter-empty {
    font-size: 13px;
    color: var(--muted);
    font-style: italic;
    line-height: 1.5;
    padding: 8px 0;
}

.tag-filter-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tag-filter-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 12px;
    border-radius: 9px;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: border-color .15s, background .15s;
    background: var(--surface2);
}

.tag-filter-row:hover {
    border-color: var(--border-h);
    background: rgba(255,255,255,.04);
}

.tag-filter-row.selected {
    border-color: var(--accent);
    background: rgba(201,245,101,.06);
}

.tag-filter-check {
    width: 18px;
    height: 18px;
    border-radius: 4px;
    border: 1.5px solid var(--border-h);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color .15s, background .15s;
}

.tag-filter-check svg {
    width: 10px;
    height: 8px;
    stroke: #0f0f0f;
    opacity: 0;
    transition: opacity .12s;
}

.tag-filter-row.selected .tag-filter-check {
    background: var(--accent);
    border-color: var(--accent);
}

.tag-filter-row.selected .tag-filter-check svg {
    opacity: 1;
}

.tag-filter-footer {
    display: flex;
    gap: 10px;
    padding: 12px 18px 16px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}

.tag-filter-clear {
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 9px;
    padding: 10px 18px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, color .15s;
    flex: 1;
}

.tag-filter-clear:hover {
    border-color: var(--border-h);
    color: var(--text);
}

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

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

@keyframes fadeIn {
    from { opacity: 0 }
    to   { opacity: 1 }
}

::-webkit-scrollbar { width: 7px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px }

#page-login {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.login-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 48px;
    background: var(--surface);
    border: 1px solid var(--border-h);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(0,0,0,.6);
    animation: scaleIn .2s ease both;
}

.login-logo {
    font-family: 'Instrument Serif', serif;
    font-size: 42px;
    color: var(--accent);
    letter-spacing: -.5px;
}

.login-sub {
    font-size: 15px;
    color: var(--muted);
    margin-top: -12px;
}

.login-note {
    font-size: 12px;
    color: var(--muted);
    opacity: .5;
}

.hidden { display: none !important; }
#app.hidden { display: none !important; }
#app { opacity: 0; transition: opacity 0.15s; }
#app:not(.hidden) { opacity: 1; }

.app-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0 32px;
    margin-top: 32px;
    text-align: center;
    font-size: 13px;
    color: var(--muted);
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.footer-link {
    color: var(--muted);
    text-decoration: none;
    border-bottom: none;
    transition: color .15s;
}

.footer-link:hover { color: var(--text); }
.footer-link--active { color: var(--text); }

.btn-share {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    background: none;
    border: 1px solid var(--border);
    color: var(--muted);
    border-radius: 8px;
    padding: 7px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}

.btn-share:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(201,245,101,.05);
}

.btn-share:disabled { opacity:.5; cursor:not-allowed; }

.not-found-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 70vh;
    text-align: center;
    padding: 40px;
}

.not-found-code {
    font-family: 'Instrument Serif', serif;
    font-size: 120px;
    line-height: 1;
    letter-spacing: -4px;
    color: var(--border-h);
    margin-bottom: 16px;
}

.not-found-title {
    font-family: 'Instrument Serif', serif;
    font-size: 32px;
    color: var(--text);
    margin-bottom: 10px;
}

.not-found-sub {
    font-size: 15px;
    color: var(--muted);
    max-width: 380px;
    line-height: 1.6;
}
/* ── Recently deleted ───────────────────────────────────────── */

.nav-item .trash-dot {
    background: var(--muted);
}

.nav-item.active .trash-dot {
    background: var(--text);
}

#page-trash {
    display: none;
    padding: 68px 72px 150px;
    animation: fadeIn .2s ease;
    max-width: 760px;
}

#page-trash.visible {
    display: block;
}

.trash-title {
    font-family: 'Instrument Serif', serif;
    font-size: 48px;
    letter-spacing: -1.2px;
    line-height: 1;
    margin-bottom: 16px;
}

.trash-title em {
    color: var(--accent);
    font-style: italic;
}

.trash-sub {
    font-size: 14px;
    color: var(--muted);
    line-height: 1.6;
    max-width: 520px;
    margin-bottom: 36px;
}

.trash-list.has-items {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.trash-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 22px;
    border-bottom: 1px solid var(--border);
}

.trash-row:last-child {
    border-bottom: none;
}

.trash-row-main {
    min-width: 0;
}

.trash-row-name {
    font-size: 15px;
    color: var(--text);
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.trash-row-meta {
    font-size: 13px;
    color: var(--muted);
    margin-top: 4px;
}

.trash-row-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

.trash-row-actions button:disabled {
    opacity: .5;
    cursor: default;
}

.trash-message {
    color: var(--muted);
    font-size: 14px;
    padding: 40px 0;
    text-align: center;
}

/* ── Toast ──────────────────────────────────────────────────── */

.toast {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 12px);
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: min(560px, calc(100vw - 32px));
    padding: 12px 14px 12px 18px;
    background: var(--surface2);
    border: 1px solid var(--border-h);
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, .45);
    font-size: 14px;
    color: var(--text);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease, transform .18s ease;
    z-index: 1000;
}

.toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
    pointer-events: auto;
}

.toast-msg {
    overflow-wrap: anywhere;
}

.toast-action {
    background: none;
    border: none;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    padding: 4px 10px;
    border-radius: 6px;
    cursor: pointer;
    flex-shrink: 0;
}

.toast-action:hover {
    background: rgba(201, 245, 101, .1);
}
