#link-to-planner-btn {
    background: linear-gradient(135deg, var(--primary-color, #8e82ff), var(--secondary-color, #6b7280));
    color: var(--text-on-accent, #ffffff);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    cursor: pointer;
    margin-bottom: 10px;
    font-size: 0.9em;
    font-weight: 600;
    transition: background 0.2s ease, transform 0.1s ease;
}

#link-to-planner-btn:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

/* Notes Widget Expanded State */
.notes-widget-content.expanded {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: min(680px, calc(100vw - 32px)) !important;
    height: min(520px, calc(100vh - 48px)) !important;
    z-index: 2000 !important;
    box-shadow: var(--shadow-elevated, 0 10px 40px rgba(0, 0, 0, 0.3));
    border-radius: 20px;
    background: linear-gradient(180deg,
        color-mix(in srgb, var(--card-background, #ffffff) 95%, var(--bg-surface, #f8fafc) 5%),
        color-mix(in srgb, var(--bg-surface, #f8fafc) 85%, var(--card-background, #ffffff) 15%));
    color: var(--text-color, #333);
    overflow: hidden;
    /* Reset any inherited grid placement if possible, though 'fixed' handles it */
}

/* Add a backdrop when expanded */
.notes-widget-content.expanded::before {
    content: '';
    position: fixed;
    top: -50vh;
    left: -50vw;
    width: 200vw;
    height: 200vh;
    background: var(--overlay-backdrop, rgba(0, 0, 0, 0.4));
    z-index: -1;
    pointer-events: all; /* Catch clicks? */
}

/* Ensure editor wrapper takes full height */
.notes-editor-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

.ql-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.ql-editor {
    flex: 1;
    overflow-y: auto;
}

.notes-expanded-header button:hover {
    color: var(--text-danger, #991b1b);
    background-color: var(--surface-subtle, rgba(0,0,0,0.05));
    border-radius: 50%;
}

.notes-expanded-header {
    padding: 14px 16px;
    background: color-mix(in srgb, var(--card-background, #ffffff) 92%, var(--bg-surface, #f8fafc) 8%);
    border-bottom: 1px solid color-mix(in srgb, var(--border-color, #dfe4e2) 78%, transparent);
}

.notes-expanded-copy {
    gap: 6px;
}

.notes-expanded-title {
    font-size: 1.3rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.notes-expanded-subtitle {
    display: block;
    font-size: 0.92rem;
    line-height: 1.5;
    color: color-mix(in srgb, var(--text-secondary, #64748b) 78%, transparent);
}

.notes-expanded-meta {
    font-size: 0.82rem;
    font-weight: 700;
    color: color-mix(in srgb, var(--text-secondary, #64748b) 88%, transparent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.notes-close-button {
    width: 40px;
    height: 40px;
    border-radius: 999px;
}

.notes-editor-wrapper .widget-control-bar {
    gap: 12px;
    padding: 12px 14px 14px;
    background: color-mix(in srgb, var(--card-background, #ffffff) 92%, var(--bg-surface, #f8fafc) 8%);
    border-top: 1px solid color-mix(in srgb, var(--border-color, #dfe4e2) 78%, transparent);
}

.notes-editor-wrapper .widget-control-bar .primary-actions,
.notes-editor-wrapper .widget-control-bar .secondary-actions {
    gap: 10px;
}

.notes-editor-wrapper .widget-control-bar .primary-actions button,
.notes-editor-wrapper .widget-control-bar .secondary-actions button {
    min-height: 40px;
    padding: 10px 14px;
    border-radius: 999px;
}

.notes-editor-wrapper .ql-toolbar {
    padding: 0.45rem 0.55rem 0.35rem;
    border-bottom: 1px solid color-mix(in srgb, var(--border-color, #dfe4e2) 76%, transparent);
    background: color-mix(in srgb, var(--card-background, #ffffff) 94%, var(--bg-surface, #f8fafc) 6%);
}

.notes-editor-wrapper .ql-container {
    background: var(--card-background, #ffffff);
}

.notes-editor-wrapper .ql-editor {
    padding: 1rem 1.1rem 1.15rem;
    font-size: 1rem;
    line-height: 1.65;
}

.notes-editor-wrapper .ql-editor.ql-blank::before {
    left: 1.1rem;
    right: 1.1rem;
    color: color-mix(in srgb, var(--text-secondary, #64748b) 76%, transparent);
    font-style: normal;
}
