* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
body {
    background: #0b0b0b;
    color: #f5e56b;
    display: flex;
    height: 100vh;
    overflow: hidden;
}
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: #1a1a1a; }
::-webkit-scrollbar-thumb { background: #f5e56b; border-radius: 12px; }

.sidebar {
    position: relative;
    width: 280px;
    min-width: 280px;
    background: #141414;
    border-right: 1px solid #3a3a2a;
    height: 100vh;
    overflow-y: auto;
    padding: 1.8rem 0.8rem 2rem 1.2rem;
    transition: transform 0.25s ease, margin 0.25s ease, opacity 0.2s ease;
    z-index: 10;
    box-shadow: 2px 0 10px rgba(0,0,0,0.6);
}
.sidebar.hidden {
    transform: translateX(-100%);
    margin-right: -280px;
    opacity: 0;
    pointer-events: none;
}
.sidebar-toggle-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 20;
    padding: 1.2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: transparent;
    pointer-events: none;
}
.sidebar-toggle-wrapper button {
    pointer-events: auto;
    background: #1a1a1a;
    border: 1px solid #f5e56b;
    border-radius: 40px;
    padding: 0.5rem 1rem;
    font-size: 1rem;
    cursor: pointer;
    transition: 0.2s;
    color: #f5e56b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 0 12px rgba(245,229,107,0.15);
}
.sidebar-toggle-wrapper button:hover {
    background: #2a2a1a;
    border-color: #ffe066;
    box-shadow: 0 0 20px rgba(245,229,107,0.25);
}
.sidebar-content { padding-top: 4.5rem; }

/* Sidebar close button */
.sidebar-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: #7a7a5a;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.3rem;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: 0.15s;
    z-index: 5;
}

.sidebar-close-btn:hover {
    color: #f5e56b;
    background: #1a1a12;
}

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

.save-indicator {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    background: #f5e56b;
    color: #0b0b0b;
    padding: 0.5rem 1rem;
    border-radius: 40px;
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 30;
    box-shadow: 0 4px 20px rgba(245,229,107,0.3);
    pointer-events: none;
}
.save-indicator.show { opacity: 1; }
.save-indicator.error { background: #e74c5e; color: #fff; }

.sync-status {
    font-size: 0.7rem;
    color: #b8a84a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sync-status i { font-size: 0.6rem; }
.sync-status .synced { color: #f5e56b; }
.sync-status .unsynced { color: #e74c5e; }
.sync-status .syncing { color: #f4a261; animation: spin 1s linear infinite; }
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.status-panel {
    background: #1a1a12;
    border: 1px solid #3a3a2a;
    border-radius: 12px;
    padding: 0.8rem 1.2rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.status-panel .status-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #d4c45a;
}
.status-panel .status-info i { color: #f5e56b; }
.status-panel .status-info .connected { color: #f5e56b; }
.status-panel .status-info .disconnected { color: #7a7a5a; }
.status-panel .status-actions button {
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    border: 1px solid #3a3a2a;
    background: #1a1a12;
    font-size: 0.7rem;
    cursor: pointer;
    transition: 0.15s;
    color: #d4c45a;
}
.status-panel .status-actions button:hover {
    background: #2a2a1a;
    border-color: #f5e56b;
}
.status-panel .status-actions button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
#pullBtn {
    border-color: #4a9eff;
    color: #4a9eff;
}
#pullBtn:hover:not(:disabled) {
    background: #1a2a3a;
    border-color: #6ab4ff;
    color: #6ab4ff;
}
#pushBtn {
    border-color: #f5e56b;
    color: #d4c45a;
}
#pushBtn:hover:not(:disabled) {
    background: #2a2a1a;
    border-color: #f5e56b;
    color: #f5e56b;
}

.section-group { margin-bottom: 1.8rem; }
.section-title {
    font-weight: 600;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #d4c45a;
    padding: 0.5rem 0.4rem 0.3rem 0.4rem;
    border-bottom: 1px solid #2a2a1a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: 0.15s;
}
.section-title:hover {
    color: #f5e56b;
    background: #1a1a12;
    border-radius: 4px;
}
.section-title .section-actions i {
    margin-left: 6px;
    color: #7a7a5a;
    font-size: 0.7rem;
    cursor: pointer;
    transition: 0.15s;
}
.section-title .section-actions i:hover { color: #f5e56b; }
.section-title.active {
    color: #f5e56b;
    border-left: 3px solid #f5e56b;
    padding-left: 0.8rem;
}
.subsection-list { list-style: none; margin-top: 0.25rem; }
.subsection-list li {
    padding: 0.35rem 0.4rem 0.35rem 1.2rem;
    font-size: 0.9rem;
    color: #d4c45a;
    border-radius: 6px;
    margin: 0.1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: 0.15s;
}
.subsection-list li:hover {
    background: #1a1a12;
    color: #f5e56b;
}
.subsection-list li i {
    color: #7a7a5a;
    font-size: 0.75rem;
    width: 1.1rem;
}
.subsection-list li.active {
    background: #2a2a1a;
    color: #f5e56b;
    border-left: 3px solid #f5e56b;
}
.delete-sub {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #7a7a5a;
    font-size: 0.65rem;
    cursor: pointer;
    transition: 0.15s;
    margin-left: auto;
    padding: 2px;
    min-width: 16px;
    min-height: 16px;
}
.delete-sub:hover { color: #e74c5e; }
.add-section-btn {
    background: transparent;
    border: none;
    color: #b8a84a;
    font-size: 0.8rem;
    padding: 0.3rem 0.2rem;
    margin-top: 2.5rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: 0.15s;
    border-radius: 20px;
    padding: 0.3rem 0.8rem;
}
.add-section-btn:hover {
    background: #1a1a12;
    color: #f5e56b;
}

.main {
    flex: 1;
    height: 100vh;
    overflow: hidden;
    padding: 0;
    background: #0b0b0b;
    position: relative;
    margin-left: 0;
}
.canvas {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: auto;
    background: #0b0b0b;
    transition: background 0.5s ease;
    padding: 2rem;
}
.canvas.has-selection { background: #111111; }

.canvas-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
    padding-bottom: 0.8rem;
    border-bottom: 2px solid #2a2a1a;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.canvas.has-selection .canvas-header {
    padding-top: 0.8rem;
    background: rgba(17, 17, 17, 0.94);
}

.canvas-header .title-section {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.canvas-header .title-section h1 {
    font-size: 1.8rem;
    font-weight: 600;
    color: #f5e56b;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.canvas-header .title-section h1 i { color: #f5e56b; }
.canvas-header .title-section .editable-title {
    background: transparent;
    border: none;
    color: #f5e56b;
    font-size: 1.8rem;
    font-weight: 600;
    outline: none;
    border-bottom: 2px solid transparent;
    transition: 0.15s;
    min-width: 100px;
}
.canvas-header .title-section .editable-title:focus {
    border-bottom-color: #f5e56b;
}
.canvas-header .badge {
    background: #1a1a12;
    padding: 0.3rem 1.2rem;
    border-radius: 40px;
    font-size: 0.8rem;
    color: #d4c45a;
    border: 1px solid #2a2a1a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.canvas-header .back-btn {
    background: #1a1a12;
    border: 1px solid #2a2a1a;
    padding: 0.3rem 1rem;
    border-radius: 40px;
    color: #d4c45a;
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: 0.15s;
}
.canvas-header .back-btn:hover {
    background: #2a2a1a;
    border-color: #f5e56b;
    color: #f5e56b;
}
.canvas-header .delete-subsection-btn {
    background: transparent;
    border: none;
    color: #ff6b6b;
    cursor: pointer;
    font-size: 0.9rem;
    padding: 0.3rem;
    transition: 0.15s;
    display: flex;
    align-items: center;
}
.canvas-header .delete-subsection-btn:hover {
    color: #e74c5e;
    transform: scale(1.1);
}

.box-grid {
    position: relative;
    min-height: 800px;
    padding: 0;
}

.shared-section-box .shared-by {
    position: absolute;
    right: 1.2rem;
    bottom: 1rem;
    color: #7a7a5a;
    font-size: 0.78rem;
}

/* ── Responsive grid used inside sections / subsections ── */
.box-grid--responsive {
    position: relative;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
    gap: 1.2rem;
    align-items: start;
    padding: 0.5rem 0 2rem 0;
    min-height: unset;
}

.note-box,
.list-box {
    position: absolute;
    background: #141414;
    border: 1px solid #2a2a1a;
    border-radius: 16px;
    padding: 1.2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: box-shadow 0.2s ease;
    min-width: 200px;
    min-height: 120px;
    cursor: default;
    overflow: hidden;
}

/* Inside the responsive grid: override absolute positioning */
.box-grid--responsive .note-box,
.box-grid--responsive .list-box {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: unset;
    min-width: unset;
    overflow: visible;
}
/* Hide drag/resize handles in responsive mode */
.box-grid--responsive .drag-handle,
.box-grid--responsive .resize-handle {
    display: none !important;
}
.note-box:hover,
.list-box:hover {
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
}

/* ── Top-right corner delete button ── */
.box-delete-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 10;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #1a1a12;
    border: 1px solid #3a3a2a;
    color: #7a7a5a;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    line-height: 1;
}
.note-box:hover .box-delete-btn,
.list-box:hover .box-delete-btn {
    opacity: 1;
}
.box-delete-btn:hover {
    background: #e74c5e;
    border-color: #e74c5e;
    color: #fff;
}

.note-box.dragging,
.list-box.dragging {
    opacity: 0.8;
    z-index: 100;
    box-shadow: 0 20px 60px rgba(0,0,0,0.9);
    cursor: grabbing;
}
.note-box .box-title,
.list-box .box-title {
    font-weight: 600;
    font-size: 0.9rem;
    color: #f5e56b;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.8rem;
    padding-bottom: 0.5rem;
    padding-right: 26px; /* leave room for the corner × delete button */
    border-bottom: 1px solid #2a2a1a;
}
.note-box .box-title .drag-handle,
.list-box .box-title .drag-handle {
    color: #3a3a2a;
    cursor: grab;
    font-size: 0.8rem;
    padding: 0 0.3rem;
    user-select: none;
}
.note-box .box-title .drag-handle:hover,
.list-box .box-title .drag-handle:hover {
    color: #7a7a5a;
}
.note-box .box-title .drag-handle:active,
.list-box .box-title .drag-handle:active {
    cursor: grabbing;
}
.note-box .box-title .editable-title,
.list-box .box-title .editable-title {
    background: transparent;
    border: none;
    color: #f5e56b;
    font-weight: 600;
    font-size: 0.9rem;
    outline: none;
    border-bottom: 2px solid transparent;
    transition: 0.15s;
    flex: 1;
}
.note-box .box-title .editable-title:focus,
.list-box .box-title .editable-title:focus {
    border-bottom-color: #f5e56b;
}
.note-box .box-title i,
.list-box .box-title i {
    color: #f5e56b;
    font-size: 0.8rem;
}
.note-box .box-title .box-actions,
.list-box .box-title .box-actions {
    margin-left: auto;
    display: flex;
    gap: 6px;
}
.note-box .box-title .box-actions i,
.list-box .box-title .box-actions i {
    color: #7a7a5a;
    font-size: 0.7rem;
    cursor: pointer;
    transition: 0.15s;
}
.note-box .box-title .box-actions i:hover,
.list-box .box-title .box-actions i:hover {
    color: #f5e56b;
}
.note-box .box-title .box-actions i.fa-trash-alt:hover,
.list-box .box-title .box-actions i.fa-trash-alt:hover {
    color: #e74c5e;
}

.note-box .note-content {
    color: #d4c45a;
    font-size: 0.95rem;
    line-height: 1.6;
    padding: 0.2rem 0;
}
.note-box .note-content .editable-content {
    background: transparent;
    border: none;
    color: #d4c45a;
    font-size: 0.95rem;
    line-height: 1.6;
    outline: none;
    width: 100%;
    min-height: 60px;
    font-family: inherit;
    resize: vertical;
    padding: 0.2rem;
    border-radius: 4px;
    transition: 0.15s;
    /* auto-height up to a sensible cap */
    max-height: min(60vh, 500px);
    field-sizing: content; /* Chrome 123+ native auto-resize */
}
/* Responsive mode: textarea grows with content freely */
.box-grid--responsive .note-box .note-content .editable-content {
    max-height: min(70vh, 600px);
}
.note-box .note-content .editable-content:focus {
    background: #1a1a12;
    border: 1px solid #2a2a1a;
}

.list-box .list-items {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: calc(100% - 60px);
    overflow-y: auto;
}
/* In responsive mode, list shows all items without scroll cap */
.box-grid--responsive .list-box .list-items {
    max-height: none;
    overflow-y: visible;
}
.list-box .sub-list-item {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    padding: 0.35rem 0.5rem;
    background: #1a1a12;
    border-radius: 6px;
    border: 1px solid #1a1a12;
    transition: 0.15s;
}
.list-box .sub-list-item:hover {
    border-color: #2a2a1a;
}
.list-box .sub-list-item.item-selected {
    border-color: #f5e56b;
    background: rgba(245, 229, 107, 0.1);
    box-shadow: inset 3px 0 0 #f5e56b;
}
.list-box .sub-list-item i {
    color: #7a7a5a;
    cursor: pointer;
    font-size: 0.7rem;
    flex-shrink: 0;
}
.list-box .sub-list-item i:hover {
    color: #f5e56b;
}
/* Text input: always on its own line so text is fully visible */
.list-box .sub-list-item .editable-item {
    flex: 1 1 100%;
    min-width: 0;
    background: transparent;
    border: none;
    color: #d4c45a;
    font-size: 0.9rem;
    font-family: inherit;
    line-height: 1.4;
    outline: none;
    padding: 0.1rem 0.2rem;
    border-radius: 4px;
    transition: background 0.15s, border 0.15s;
    order: 2;   /* always after the check icon */
    /* textarea-specific: grow with content, no scrollbar/handle */
    resize: none;
    overflow: hidden;
    field-sizing: content;  /* Chrome 123+ native auto-height */
    min-height: 1.4em;
}
.list-box .sub-list-item .editable-item:focus {
    background: #0b0b0b;
    border: 1px solid #2a2a1a;
}
/* Check/circle icon stays left on row 1 */
.list-box .sub-list-item > i:first-child {
    order: 1;
    flex-shrink: 0;
    font-size: 0.8rem;
}
/* Badges and controls go below the text on row 2 */
.list-box .sub-list-item .item-rating,
.list-box .sub-list-item .item-tag,
.list-box .sub-list-item .item-delete,
.list-box .sub-list-item .location-badge {
    order: 3;
    flex-shrink: 0;
}
/* map icon (not location-badge link) */
.list-box .sub-list-item i.fa-map-marker-alt {
    order: 3;
}
.list-box .sub-list-item .item-tag {
    font-size: 0.6rem;
    padding: 0.05rem 0.5rem;
    border-radius: 20px;
    background: #1a1a12;
    color: #b8a84a;
    border: 1px solid #2a2a1a;
}
.list-box .sub-list-item .item-rating {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    margin: 0 0.2rem;
}
.list-box .sub-list-item .item-rating .star-box {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.list-box .sub-list-item .item-rating .star-half {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 50%;
    z-index: 2;
    cursor: pointer;
}
.list-box .sub-list-item .item-rating .star-half.left {
    left: 0;
}
.list-box .sub-list-item .item-rating .star-half.right {
    right: 0;
}
.list-box .sub-list-item .item-rating i {
    font-size: 0.75rem;
    cursor: pointer;
    transition: transform 0.15s ease, color 0.15s ease;
}
.list-box .sub-list-item .item-rating i.active {
    color: #f5e56b;
    text-shadow: 0 0 6px rgba(245, 229, 107, 0.4);
}
.list-box .sub-list-item .item-rating i.inactive {
    color: #3a3a2a;
}
.list-box .sub-list-item .item-rating .star-box:hover i {
    transform: scale(1.25);
    color: #ffe066;
}
.list-box .list-rating-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 600;
    color: #f5e56b;
    background: rgba(245, 229, 107, 0.1);
    border: 1px solid rgba(245, 229, 107, 0.25);
    padding: 0.1rem 0.4rem;
    border-radius: 12px;
    margin-right: 0.4rem;
}
.location-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    color: #e74c5e;
    background: rgba(231, 76, 94, 0.12);
    border: 1px solid rgba(231, 76, 94, 0.3);
    padding: 0.1rem 0.45rem;
    border-radius: 12px;
    text-decoration: none;
    transition: 0.15s ease;
    max-width: 120px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex-shrink: 0;
}
.location-badge:hover {
    background: rgba(231, 76, 94, 0.25);
    border-color: #e74c5e;
    color: #ff6b7d;
    transform: translateY(-1px);
}
/* Compact badge = icon only — must never clip the glyph */
.location-badge.compact {
    padding: 0.15rem 0.4rem;
    max-width: none;
    overflow: visible;
    white-space: normal;
    line-height: 1;
}
.box-actions i.has-location,
.sub-list-item i.has-location {
    color: #e74c5e !important;
}
.box-actions i.has-location:hover,
.sub-list-item i.has-location:hover {
    color: #ff6b7d !important;
}
.list-box .sub-list-item .item-delete {
    color: #7a7a5a;
    cursor: pointer;
    font-size: 0.6rem;
}
.list-box .sub-list-item .item-delete:hover {
    color: #e74c5e;
}
.list-box .add-item-btn {
    margin-top: 0.8rem;
    padding: 0.3rem 0.8rem;
    background: #1a1a12;
    border: 1px solid #2a2a1a;
    border-radius: 40px;
    color: #d4c45a;
    cursor: pointer;
    font-size: 0.7rem;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: 0.15s;
}
.list-box .add-item-btn:hover {
    background: #2a2a1a;
    border-color: #f5e56b;
    color: #f5e56b;
}

.resize-handle {
    position: absolute;
    bottom: 4px;
    right: 4px;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    color: #3a3a2a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    user-select: none;
    z-index: 5;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}
.note-box:hover .resize-handle,
.list-box:hover .resize-handle {
    opacity: 1;
    color: #7a7a5a;
}
.resize-handle i {
    font-size: 0.8rem;
}
.resize-handle:hover {
    color: #f5e56b !important;
}

.empty-message {
    color: #7a7a5a;
    font-style: italic;
    font-size: 0.9rem;
    padding: 1rem 0;
    text-align: center;
}
.empty-state-hero {
    text-align: center;
    padding: 4rem 2rem;
    background: #141414;
    border-radius: 18px;
    border: 1px solid #2a2a1a;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80%;
    max-width: 500px;
}
.empty-state-hero i {
    font-size: 3rem;
    color: #3a3a2a;
    margin-bottom: 1.2rem;
}
.empty-state-hero p {
    color: #b8a84a;
    font-size: 1.1rem;
}
.action-btn {
    background: #1a1a12;
    border: 1px solid #2a2a1a;
    padding: 0.25rem 1rem;
    border-radius: 40px;
    font-size: 0.75rem;
    color: #d4c45a;
    cursor: pointer;
    transition: 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.action-btn:hover {
    background: #2a2a1a;
    border-color: #f5e56b;
    color: #f5e56b;
}

.subsections-list {
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #2a2a1a;
}
.subsections-list .subsection-item {
    display: inline-block;
    padding: 0.3rem 1rem;
    margin: 0.2rem 0.4rem;
    background: #1a1a12;
    border: 1px solid #2a2a1a;
    border-radius: 20px;
    color: #d4c45a;
    font-size: 0.85rem;
    cursor: pointer;
    transition: 0.15s;
}
.subsections-list .subsection-item:hover {
    background: #2a2a1a;
    border-color: #f5e56b;
    color: #f5e56b;
}
.subsections-list .subsection-item .sub-delete {
    margin-left: 0.5rem;
    color: #7a7a5a;
    font-size: 0.7rem;
}
.subsections-list .subsection-item .sub-delete:hover {
    color: #e74c5e;
}

/* ── Nested Subsection Tree Styling ── */
.subsection-list li {
    position: relative;
}

/* Indentation for nested levels (depth 1-5) */
.subsection-list li[style*="padding-left: 1.2rem"] { /* depth 1 */
    border-left: 2px solid #2a2a1a;
}
.subsection-list li[style*="padding-left: 2.4rem"] { /* depth 2 */
    border-left: 2px solid #3a3a2a;
}
.subsection-list li[style*="padding-left: 3.6rem"] { /* depth 3 */
    border-left: 2px solid #4a4a3a;
}
.subsection-list li[style*="padding-left: 4.8rem"] { /* depth 4 */
    border-left: 2px solid #5a5a4a;
}
.subsection-list li[style*="padding-left: 6.0rem"] { /* depth 5 */
    border-left: 2px solid #6a6a5a;
}

/* Nested subsection icons get progressively smaller */
.subsection-list li[style*="padding-left: 1.2rem"] > i:first-child { font-size: 0.7rem; }
.subsection-list li[style*="padding-left: 2.4rem"] > i:first-child { font-size: 0.65rem; }
.subsection-list li[style*="padding-left: 3.6rem"] > i:first-child { font-size: 0.6rem; }
.subsection-list li[style*="padding-left: 4.8rem"] > i:first-child { font-size: 0.55rem; }
.subsection-list li[style*="padding-left: 6.0rem"] > i:first-child { font-size: 0.5rem; }

/* Nested text gets slightly smaller */
.subsection-list li[style*="padding-left: 2.4rem"] { font-size: 0.85rem; }
.subsection-list li[style*="padding-left: 3.6rem"] { font-size: 0.8rem; }
.subsection-list li[style*="padding-left: 4.8rem"] { font-size: 0.75rem; }
.subsection-list li[style*="padding-left: 6.0rem"] { font-size: 0.7rem; }

/* Action buttons in nested subsections */
.subsection-list li .section-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}
.subsection-list li .section-actions i {
    font-size: 0.65rem;
}
.subsection-list li[style*="padding-left: 2.4rem"] .section-actions i { font-size: 0.6rem; }
.subsection-list li[style*="padding-left: 3.6rem"] .section-actions i { font-size: 0.55rem; }
.subsection-list li[style*="padding-left: 4.8rem"] .section-actions i { font-size: 0.5rem; }
.subsection-list li[style*="padding-left: 6.0rem"] .section-actions i { font-size: 0.45rem; }

/* Hover effect for nested items */
.subsection-list li:hover {
    background: linear-gradient(to right, #1a1a12, transparent);
}

@media (max-width: 900px) {
    .box-grid--responsive {
        grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr));
    }
}
@media (max-width: 700px) {
    .sidebar { width: 240px; min-width: 240px; }
    .sidebar.hidden { transform: translateX(-100%); margin-right: -240px; }
    .sidebar-toggle-wrapper { padding: 0.8rem 1rem; }
    .sidebar-content { padding-top: 4rem; }
    .box-grid { min-height: 400px; }
    .canvas { padding: 1rem; }
    .box-grid--responsive {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
}
@media (max-width: 480px) {
    .sidebar { width: 200px; min-width: 200px; }
    .sidebar.hidden { margin-right: -200px; }
    .sidebar-content { padding-top: 3.8rem; }
    .canvas-header .title-section h1 { font-size: 1.2rem; }
    .box-grid--responsive {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        padding: 0 0 1.5rem 0;
    }
    .canvas { padding: 0.8rem; }
}
.login-overlay{position:fixed;inset:0;z-index:1000;display:none;place-items:center;background:rgba(0,0,0,.82);padding:1rem}.login-overlay.visible{display:grid}.login-overlay.hidden{display:none}.auth-card{width:min(100%,420px);padding:2rem;border:1px solid #f5e56b;border-radius:14px;background:#161610;color:#f5e56b;box-shadow:0 20px 60px #000}.auth-card h1,.auth-card h2{margin:0 0 1rem}.auth-subtitle{color:#b8a84a;margin:0 0 1rem}.auth-card form{display:grid;gap:.75rem}.auth-card input{padding:.75rem;border:1px solid #777;border-radius:6px;background:#0b0b0b;color:#fff}.auth-btn,.auth-link{padding:.7rem;border-radius:6px;cursor:pointer}.auth-btn{border:0;background:#f5e56b;color:#111;font-weight:700}.auth-btn.danger{background:#c94343;color:#fff}.auth-link{border:0;background:transparent;color:#f5e56b}.auth-message{display:none;margin:.75rem 0;padding:.6rem;border-radius:6px}.auth-error{background:#542020;color:#ffd4d4}.auth-success{background:#1f4d2a;color:#d7ffe0}.user-actions{display:flex;align-items:center;gap:.35rem;margin-bottom:.7rem;font-size:.78rem}.user-action-btn{background:transparent;color:#f5e56b;border:0;cursor:pointer;padding:.3rem}.admin-user-row{display:flex;gap:.5rem;align-items:center;justify-content:space-between;border-top:1px solid #383820;padding:.6rem 0}.admin-delete-btn{border:0;border-radius:4px;background:#c94343;color:#fff;padding:.3rem .5rem;cursor:pointer}

.shared-editor-context { white-space: nowrap; }

.shared-access-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.65rem;
    border: 1px solid #2a2a1a;
    border-radius: 40px;
    color: #b8a84a;
    font-size: 0.75rem;
}

.shared-readonly-content {
    color: #d4c45a;
    line-height: 1.6;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}/* Sidebar labels are controls, not text fields. */
#sidebar, #sidebar .section-title, #sidebar .subsection-list li { user-select: none; caret-color: transparent; }
#sidebar .section-title span, #sidebar .subsection-list li { cursor: pointer; }
/* Shared sections follow the same card layout as personal sections. */
.shared-subsection-grid { margin: 0.8rem 0; gap: 0.8rem; }
.shared-subsection-grid .note-box { position: relative !important; min-height: 120px; width: auto !important; height: auto !important; }
.shared-subsection-grid .shared-subsection-grid { margin-left: 0.7rem; border-left: 1px solid #2a2a1a; padding-left: 0.7rem; }
.shared-recipients { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The shared editor intentionally uses the personal renderer; permissions only change available controls. */
.shared-editor-readonly .editable-title, .shared-editor-readonly .editable-content, .shared-editor-readonly .editable-item { cursor: default; }

/* Sharing access dialogs */
.share-access-card{width:min(92vw,620px);padding:0;overflow:hidden;border-color:#4c4a28;border-radius:18px;background:#171711;box-shadow:0 28px 80px rgba(0,0,0,.72)}
.share-dialog-heading{display:flex;align-items:center;gap:1rem;padding:1.5rem 1.6rem;border-bottom:1px solid #34331f;background:linear-gradient(135deg,#1d1d13,#151510)}
.share-dialog-heading h2{margin:0 0 .2rem;font-size:1.45rem;color:#fff}.share-dialog-heading p{margin:0;color:#999879;font-size:.9rem}.share-dialog-heading strong{color:#f5e56b}
.share-dialog-icon{display:grid;place-items:center;width:44px;height:44px;flex:0 0 44px;border-radius:12px;background:rgba(245,229,107,.12);color:#f5e56b;font-size:1.15rem}
.share-list-label{display:grid;grid-template-columns:1fr 150px;gap:1rem;padding:1rem 1.6rem .45rem;color:#77765e;font-size:.72rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase}
.share-user-list{max-height:min(48vh,380px);overflow-y:auto;padding:.35rem .8rem}.share-user-row{display:grid;grid-template-columns:minmax(0,1fr) 150px;align-items:center;gap:1rem;padding:.75rem .8rem;border:1px solid transparent;border-radius:11px;transition:.16s ease}.share-user-row+.share-user-row{margin-top:.2rem}.share-user-row:hover{background:#202019}.share-user-row.selected{border-color:#3e3d25;background:#202018}
.share-user-identity{display:flex;align-items:center;gap:.75rem;min-width:0;color:#eee}.share-user-identity>span:last-child{display:grid;min-width:0}.share-user-identity strong{overflow:hidden;text-overflow:ellipsis;color:#eee}.share-user-identity small{margin-top:.12rem;color:#85846b;font-size:.75rem}
.share-user-avatar{display:grid!important;place-items:center;width:36px;height:36px;flex:0 0 36px;border-radius:50%;background:#34331f;color:#f5e56b;font-weight:800}.share-user-check{width:17px!important;height:17px!important;padding:0!important;margin:0;accent-color:#f5e56b;cursor:pointer}
.share-user-permission{width:100%;padding:.58rem .7rem;border:1px solid #494831;border-radius:8px;background:#11110d;color:#eee;outline:none}.share-user-permission:focus{border-color:#f5e56b}.share-user-permission:disabled{opacity:.45}
.share-access-help{margin:.8rem 1.6rem;color:#929177;font-size:.82rem}.share-access-help i{margin-right:.35rem;color:#c8ba55}.share-dialog-actions{display:flex;justify-content:flex-end;gap:.55rem;padding:1rem 1.6rem 1.4rem;border-top:1px solid #2d2c1d}.share-dialog-actions .auth-btn,.share-dialog-actions .auth-link{padding:.72rem 1rem}.manage-sharing-btn{display:inline-flex;align-items:center;gap:.4rem}.shared-from-label{font-size:.75rem;color:#89886c}
@media(max-width:560px){.share-access-card{width:96vw}.share-dialog-heading,.share-dialog-actions{padding-left:1rem;padding-right:1rem}.share-list-label{display:none}.share-user-row{grid-template-columns:1fr;gap:.55rem}.share-user-permission{margin-left:48px;width:calc(100% - 48px)}}

/* Empty canvases use one centered card in personal and shared views. */
.canvas .empty-state-hero {
    position: relative;
    top: auto;
    left: auto;
    transform: none;
    margin: 2rem auto;
    width: min(80%, 500px);
    box-sizing: border-box;
}

/* Controls used only on the movable Shared Sections canvas cards. */
.shared-canvas-card .box-title { padding-right: 4.8rem; }
.shared-card-actions { position:absolute; top:.9rem; right:1rem; display:flex; gap:.35rem; }
.shared-card-actions button { border:0; background:transparent; color:#b8a84a; cursor:pointer; padding:.25rem; font-size:.85rem; }
.shared-card-actions button:hover { color:#f5e56b; }
.shared-canvas-card .drag-handle { cursor:grab; margin-right:.45rem; }
.shared-canvas-card .drag-handle:active { cursor:grabbing; }
.shared-hierarchy-subsection[draggable="true"] { cursor:grab; }
.shared-hierarchy-subsection[draggable="true"]:active { cursor:grabbing; }

/* Phone and installed-app layout */
@media (max-width: 700px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; width: min(86vw, 320px); min-width: 0; height: 100dvh; padding-top: max(1.2rem, env(safe-area-inset-top)); padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); box-shadow: 12px 0 32px rgba(0,0,0,.65); z-index: 40; }
    .sidebar.hidden { transform: translateX(-105%); margin-right: 0; }
    .sidebar-toggle-wrapper { padding: max(.7rem, env(safe-area-inset-top)) .85rem .7rem max(.85rem, env(safe-area-inset-left)); }
    .sidebar-toggle-wrapper button { min-height: 44px; }
    .main, .canvas { height: 100dvh; }
}
@media (max-width: 480px) {
    .canvas { padding-bottom: max(1.5rem, env(safe-area-inset-bottom)); }
    .canvas-header { margin-top: 3.2rem; margin-bottom: 1.15rem; }
    .canvas-header .title-section { min-width: 0; }
    .canvas-header .title-section h1, .canvas-header .title-section .editable-title { font-size: 1.25rem; min-width: 0; overflow-wrap: anywhere; }
    .note-box, .list-box { padding: 1rem; border-radius: 12px; }
    .box-delete-btn { opacity: 1; width: 32px; height: 32px; font-size: .8rem; }
    .note-box .note-content .editable-content { font-size: 16px; max-height: 55dvh; }
    .auth-card { max-height: calc(100dvh - 2rem); overflow-y: auto; padding: 1.35rem; }
    .auth-card input, .auth-btn, .auth-link { min-height: 44px; font-size: 16px; }
}
/* Keyboard-selected cards retain a clear, non-editing focus state. */
.note-box.box-selected, .list-box.box-selected { outline: 2px solid #f5e56b; outline-offset: 3px; }

/* Card chrome is selectable as a card, not as text. Only real editor controls
   allow text selection once the user deliberately enters them. */
.note-box,
.list-box {
    user-select: none;
}
.note-box .editable-title,
.note-box .editable-content,
.list-box .editable-title,
.list-box .editable-item,
.item-note-editor textarea {
    user-select: text;
}

/* Let card controls use the available width before wrapping to another row. */
.note-box .box-title,
.list-box .box-title {
    align-content: flex-start;
    flex-wrap: wrap;
}
.note-box .box-title .editable-title,
.list-box .box-title .editable-title {
    min-width: 4rem;
    max-width: 100%;
}
.note-box .box-title .box-actions,
.list-box .box-title .box-actions {
    align-items: center;
    flex: 0 0 auto;
    flex-wrap: nowrap;
}
.list-box .sub-list-item .editable-item {
    flex: 1 1 10rem;
    min-width: min(8rem, 100%);
    max-width: 100%;
}
.list-box .sub-list-item .item-rating {
    flex-wrap: nowrap;
    white-space: nowrap;
}
.list-box .list-rating-badge {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* Absolute-positioned cards define a scrollable workspace through JS-calculated extents. */
.canvas {
    scrollbar-gutter: stable;
    overscroll-behavior: contain;
}
.box-grid {
    min-width: 100%;
    min-height: calc(100vh - 150px);
}
.list-box.fit-to-contents .list-items {
    max-height: none !important;
    overflow-y: visible !important;
}

.canvas-actions {
    position: relative;
    z-index: 2;
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
    width: 100%;
    margin-top: 2rem;
    padding: 1rem 0 2rem;
    border-top: 1px solid #2a2a1a;
}

.note-box.show-all-content .editable-content {
    max-height: none !important;
    overflow: hidden !important;
}

/* Mobile-first app shell */
@media (max-width: 700px) {
    body { min-height: 100dvh; background: radial-gradient(circle at 80% 0%, #1c1b10 0, #0b0b0b 38%); }
    .main { min-width: 0; }
    .sidebar { padding-bottom: max(5.8rem, env(safe-area-inset-bottom)); }
    .sidebar-toggle-wrapper button { backdrop-filter: blur(14px); background: rgba(20,20,20,.86); }
    .canvas { max-width: 100%; overflow-x: hidden; padding: max(1rem, env(safe-area-inset-top)) 1rem calc(6.8rem + env(safe-area-inset-bottom)); scroll-padding-bottom: 7rem; }
    .canvas-header { margin-top: 3.35rem; padding: .85rem .1rem 1rem; gap: .75rem; }
    .canvas-header .personal-title-section { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; flex: 1 1 100%; width: 100%; max-width: 100%; min-width: 0; gap: .5rem; }
    .canvas-header .personal-section-title { width: 100%; max-width: 100%; min-width: 0 !important; }
    .canvas-header .personal-title-section .shared-editor-context { grid-column: 1 / -1; width: fit-content; max-width: 100%; white-space: normal; }
    .canvas-header .personal-title-section .edit-title-btn,
    .canvas-header .personal-title-section .delete-subsection-btn { flex: 0 0 auto; min-width: 32px; min-height: 32px; margin-left: 0 !important; }
    .canvas-header .personal-title-section .subsection-label { min-width: 0; margin-left: 0 !important; white-space: nowrap; }
    .canvas-header .canvas-header-actions { flex: 1 1 100%; min-width: 0; flex-wrap: wrap; }
    .canvas-header .badge { font-size: .72rem; padding: .35rem .7rem; }
    .canvas-header .back-btn { min-height: 40px; padding: .45rem .8rem; }
    .box-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .85rem; min-width: 0; min-height: unset; padding-bottom: 1rem; }
    .box-grid .note-box, .box-grid .list-box { position: relative !important; left: auto !important; top: auto !important; width: 100% !important; max-width: 100%; height: auto !important; min-width: 0; min-height: unset; overflow: visible; }
    .box-grid .drag-handle, .box-grid .resize-handle { display: none !important; }
    .box-grid .note-box { box-shadow: 0 7px 24px rgba(0,0,0,.34); }
    .note-box .box-title, .list-box .box-title { min-height: 38px; }
    .box-delete-btn { opacity: 1; width: 34px; height: 34px; }
    .save-indicator { right: 1rem; bottom: calc(5.8rem + env(safe-area-inset-bottom)); }
    .mobile-dock { position: fixed; z-index: 45; left: max(.75rem, env(safe-area-inset-left)); right: max(.75rem, env(safe-area-inset-right)); bottom: max(.65rem, env(safe-area-inset-bottom)); height: 62px; display: grid; grid-template-columns: 1fr 1.35fr 1fr; align-items: center; gap: .35rem; padding: .35rem; border: 1px solid rgba(245,229,107,.18); border-radius: 22px; background: rgba(22,22,18,.9); box-shadow: 0 12px 35px rgba(0,0,0,.55); backdrop-filter: blur(18px); }
    .mobile-dock button { border: 0; min-height: 52px; border-radius: 17px; color: #d4c45a; background: transparent; font: inherit; font-size: .69rem; font-weight: 650; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .18rem; cursor: pointer; -webkit-tap-highlight-color: transparent; }
    .mobile-dock button i { font-size: 1rem; }
    .mobile-dock .mobile-add-btn { flex-direction: row; gap: .45rem; color: #171710; background: #f5e56b; box-shadow: 0 4px 15px rgba(245,229,107,.2); font-size: .77rem; }
    .mobile-dock button:active { transform: scale(.96); }
}
@media (min-width: 701px) { .mobile-dock { display: none; } }
@media (max-width: 700px) { .desktop-organize-btn { display: none; } }

/* Phone sidebar drawer backdrop */
.sidebar-backdrop { display: none; }
@media (max-width: 700px) {
    .sidebar-backdrop { position: fixed; inset: 0; z-index: 39; display: block; opacity: 0; pointer-events: none; background: rgba(0, 0, 0, .58); backdrop-filter: blur(2px); transition: opacity .22s ease; }
    .sidebar-backdrop.visible { opacity: 1; pointer-events: auto; }
    .sidebar-close-btn { top: max(.75rem, env(safe-area-inset-top)); right: .75rem; width: 44px; height: 44px; border: 1px solid #4a4a35; border-radius: 50%; background: #25251a; color: #f5e56b; font-size: 1rem; }
    .sidebar-close-btn:active { background: #3a3a25; }
}

/* On phones, the complete section row expands/collapses. */
@media (max-width: 700px) {
    .section-group > .section-title { min-height: 52px; padding-top: .7rem; padding-bottom: .7rem; }
    .section-group > .section-title > span:first-child { display: flex; align-items: center; min-width: 0; }
    .section-group > .section-title > span:first-child > i:first-child { display: inline-grid; place-items: center; width: 30px; height: 30px; margin-right: .45rem !important; border-radius: 9px; background: #28281d; color: #f5e56b; }
}

/* Compact selected-canvas header: title/actions left, metadata right. */
.canvas.has-selection .canvas-header {
    align-items: flex-start;
}
.canvas-header-primary {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    min-width: 0;
    gap: 0.9rem;
    flex-wrap: wrap;
}
.canvas-header-primary .personal-title-section,
.canvas-header-primary > .title-section {
    flex: 0 1 auto;
    min-width: 0;
    width: auto;
}
.canvas-header-primary .canvas-header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.45rem !important;
    flex-wrap: wrap;
}
.canvas-header-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.65rem;
    margin-left: auto;
    min-height: 34px;
    flex-wrap: wrap;
}
.canvas-header-meta .edit-title-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #7a7a5a;
    cursor: pointer;
}
.canvas-header-meta .edit-title-btn:hover {
    color: #f5e56b;
    background: #1a1a12;
}
.canvas-header-meta .subsection-label {
    color: #7a7a5a;
    font-size: 0.9rem;
    white-space: nowrap;
}
.canvas-header-meta .delete-subsection-btn {
    margin-left: 0 !important;
}
@media (max-width: 700px) {
    .canvas.has-selection .canvas-header {
        display: flex;
        flex-direction: column;
        align-items: stretch;
    }
    .canvas-header-meta {
        order: -1;
        width: 100%;
        margin-left: 0;
        justify-content: flex-end;
    }
    .canvas-header-primary {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.6rem;
    }
    .canvas-header-primary .personal-title-section,
.canvas-header-primary > .title-section {
        display: flex;
        width: 100%;
        max-width: 100%;
        gap: 0.5rem;
    }
    .canvas-header-primary .canvas-header-actions {
        flex: 1 1 auto;
        width: 100%;
    }
}

/* Phone dock: one clear, full-width Organize action. */
@media (max-width: 700px) {
    .mobile-dock--organize-only {
        grid-template-columns: minmax(0, 1fr);
        height: 70px;
        padding: 0.4rem;
    }
    .mobile-dock--organize-only .mobile-organize-btn {
        width: 100%;
        min-height: 58px;
        flex-direction: row;
        gap: 0.65rem;
        border-radius: 18px;
        background: #f5e56b;
        color: #171710;
        font-size: 0.9rem;
        font-weight: 700;
        box-shadow: 0 4px 15px rgba(245,229,107,.2);
    }
    .mobile-dock--organize-only .mobile-organize-btn i { font-size: 1.1rem; }
}
/* The phone Organize bar is contextual and stays behind an open sidebar. */
@media (max-width: 700px) {
    .mobile-dock--organize-only { display: none; }
    .mobile-dock--organize-only.is-visible { display: grid; }
}
/* Active typing state */
.canvas .note-box:focus-within,
.canvas .list-box:focus-within {
    z-index: 16;
    border-color: #6f6a32;
    box-shadow: 0 14px 38px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(245, 229, 107, 0.2);
}

.mobile-organize-btn.typing-confirm-btn {
    display: inline-flex !important;
    background: #f5e56b;
    border-color: #f5e56b;
    color: #111;
    font-weight: 700;
    box-shadow: 0 5px 18px rgba(245, 229, 107, 0.22);
}

.mobile-organize-btn.typing-confirm-btn:hover,
.mobile-organize-btn.typing-confirm-btn:focus-visible {
    background: #fff19a;
    border-color: #fff19a;
    color: #111;
    outline: 2px solid rgba(245, 229, 107, 0.28);
    outline-offset: 2px;
}

@media (max-width: 700px) {
    .mobile-dock--organize-only.typing-active { display: grid; }
}

/* Expandable notes attached to individual list items. */
.list-box .sub-list-item{flex-wrap:wrap}.item-note-btn{display:inline-grid;place-items:center;order:10;margin-left:auto;flex:0 0 24px;width:24px;height:24px;padding:0;border:1px solid transparent;border-radius:6px;background:transparent;color:#77765e;cursor:pointer}.item-note-btn:hover,.item-note-btn.has-note,.item-note-open .item-note-btn{border-color:#504d29;background:rgba(245,229,107,.1);color:#f5e56b}.item-note-editor{display:none;flex:1 0 100%;order:20;padding:.4rem 0 .15rem 1.65rem}.item-note-open .item-note-editor{display:block}.item-note-editor textarea,.item-note-readonly{box-sizing:border-box;width:100%;min-height:64px;padding:.55rem .65rem;border:1px solid #3c3a23;border-radius:8px;outline:none;resize:vertical;background:#11110d;color:#d8cf79;font:inherit;font-size:.82rem;line-height:1.45}.item-note-editor textarea:focus{border-color:#8e853e;box-shadow:0 0 0 2px rgba(245,229,107,.08)}.item-note-readonly{white-space:pre-wrap}

.item-note-modal{position:fixed;inset:0;z-index:10000;display:grid;place-items:center;padding:clamp(1rem,4vw,3rem);background:rgba(0,0,0,.72);backdrop-filter:blur(5px)}
.item-note-dialog{width:min(760px,94vw);max-height:88vh;overflow:hidden;border:1px solid #56522d;border-radius:16px;background:#181810;box-shadow:0 28px 90px rgba(0,0,0,.75)}
.item-note-dialog header{display:flex;align-items:center;justify-content:space-between;gap:1rem;padding:1rem 1.2rem;border-bottom:1px solid #37351f;background:linear-gradient(135deg,#232216,#171710)}
.item-note-dialog header>div{display:grid;grid-template-columns:auto auto;align-items:center;gap:.25rem .6rem;min-width:0;color:#f5e56b;font-weight:700}
.item-note-dialog header small{grid-column:2;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:#969273;font-size:.76rem;font-weight:400}
.item-note-dialog header button{display:grid;place-items:center;width:34px;height:34px;padding:0;border:1px solid #49462a;border-radius:9px;background:#11110c;color:#aaa681;cursor:pointer}
.item-note-dialog header button:hover{border-color:#80783d;color:#f5e56b}
.item-note-dialog-body{max-height:calc(88vh - 68px);overflow:auto;padding:1.1rem}
.item-note-dialog-body textarea,.item-note-dialog-body .item-note-readonly{display:block;box-sizing:border-box;width:100%;min-height:240px;max-height:62vh;padding:1rem;border:1px solid #454229;border-radius:11px;background:#10100b;color:#e4dc8b;font:inherit;font-size:1rem;line-height:1.6;resize:vertical;white-space:pre-wrap;outline:none}
.item-note-dialog-body textarea:focus{border-color:#a09549;box-shadow:0 0 0 3px rgba(245,229,107,.09)}

.item-note-popover{position:fixed;z-index:10000;display:flex;flex-direction:column;box-sizing:border-box;min-width:260px;max-width:min(520px,calc(100vw - 20px));max-height:calc(100vh - 20px);overflow:hidden;border:1px solid #56522d;border-radius:13px;background:#181810;box-shadow:0 18px 55px rgba(0,0,0,.72)}
.item-note-popover header{display:flex;align-items:center;justify-content:space-between;gap:.75rem;padding:.7rem .8rem;border-bottom:1px solid #37351f;background:linear-gradient(135deg,#232216,#171710)}
.item-note-popover header>div{display:flex;align-items:center;gap:.5rem;min-width:0;color:#f5e56b;font-size:.84rem;font-weight:700}
.item-note-popover header span{overflow:visible;text-overflow:clip;white-space:normal;overflow-wrap:anywhere}
.item-note-popover header button{display:grid;place-items:center;flex:0 0 28px;width:28px;height:28px;padding:0;border:1px solid #49462a;border-radius:7px;background:#11110c;color:#aaa681;cursor:pointer}
.item-note-popover-body{flex:1 1 auto;min-height:0;max-height:none;overflow:auto;overscroll-behavior:contain;padding:.7rem}
.item-note-popover-body textarea,.item-note-popover-body .item-note-readonly{display:block;box-sizing:border-box;width:100%;min-height:88px;max-height:none;padding:.75rem;border:1px solid #454229;border-radius:9px;background:#10100b;color:#e4dc8b;font:inherit;font-size:.92rem;line-height:1.5;resize:none;white-space:pre-wrap;overflow:visible;outline:none}
.item-note-popover-body textarea{overflow:hidden}
.item-note-popover-body textarea:focus{border-color:#a09549;box-shadow:0 0 0 3px rgba(245,229,107,.09)}

.item-note-popover-body textarea,.item-note-popover-body .item-note-readonly{white-space:pre-wrap;tab-size:4;overflow-wrap:anywhere}
