/* Reset and Base Styles */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6; background-color: #f0f2f5; color: #1c1e21;
    padding-bottom: 120px;
}
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 140px;
    margin-top: calc(var(--header-offset, 70px) + 16px);
}

/* Header Styles */
.main-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1010;
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background-color: #ffffff;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.08);
    gap: 16px;
    min-height: 64px;
}

.dark-mode .main-header {
    background-color: #1a1a1a;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.main-header h1 {
    font-size: 1.5rem;
    font-weight: 600;
    color: #000;
    margin-right: auto;
    margin-bottom: 0;
}

.dark-mode .main-header h1 {
    color: #fff;
}

/* Search Container Styles */
.search-surface {
    margin-bottom: 18px;
    padding: 18px 20px;
    border: 1px solid #dbe3ec;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.dark-mode .search-surface {
    background: #202833;
    border-color: #3d4758;
    box-shadow: none;
}

.search-container {
    display: flex;
    align-items: flex-end;
    gap: 16px;
}

.search-input-container {
    flex: 1;
    position: relative;
}

#searchInput {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1rem;
    border: 1px solid #d6dee8;
    border-radius: 16px;
    font-size: 1rem;
    background-color: #fff;
}
.dark-mode #searchInput {
    background-color: #2d2d2d;
    border-color: #444;
    color: #fff;
}

/* Search Suggestions and History */
.search-suggestions,
.search-history {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    z-index: 1000;
    max-height: 300px;
    overflow-y: auto;
    display: none;
    border: 1px solid #e0e4e8;
}
.search-suggestions.active,
.search-history.active {
    display: block;
}
.suggestion-item,
.history-item {
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #2d3436;
}
.suggestion-item:hover,
.history-item:hover {
    background-color: #f8f9fa;
}
.suggestion-item.highlighted {
    background-color: #f0f7ff;
    color: #007bff;
}
.history-item .time {
    font-size: 0.8em;
    color: #a0a0a0;
}

/* Filter Groups */
.search-filters {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.filter-group {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 112px;
}
.filter-group label {
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #607286;
}
.dark-mode .filter-group label {
    color: #a8b2c0;
}
.filter-group select {
    min-height: 48px;
    padding: 0.75rem 0.875rem;
    border: 1px solid #d6dee8;
    border-radius: 16px;
    background-color: #fff;
}
.dark-mode .filter-group select {
    background-color: #2d2d2d;
    border-color: #444;
    color: #fff;
}

/* Dark Mode Styles */
body.dark-mode {
    background-color: #1a1a1a;
    color: #ffffff;
}
body.dark-mode .custom-date-inputs {
    background: #2d2d2d;
    border-color: #404040;
}
body.dark-mode .custom-date-inputs label {
    color: #a0a0a0;
}
body.dark-mode .custom-date-inputs input[type="date"] {
    background: #363636;
    border-color: #404040;
    color: #e0e0e0;
}
body.dark-mode .filter-group {
    background: #2d2d2d;
    border-color: #404040;
}
body.dark-mode .filter-group select {
    background-color: #2d2d2d;
    color: #e0e0e0;
}
body.dark-mode .search-suggestions,
body.dark-mode .search-history {
    background: #2d2d2d;
    border-color: #404040;
}
body.dark-mode .suggestion-item,
body.dark-mode .history-item {
    color: #e0e0e0;
}
body.dark-mode .suggestion-item:hover,
body.dark-mode .history-item:hover {
    background-color: #363636;
}
body.dark-mode .suggestion-item.highlighted {
    background-color: #0056b3;
    color: #ffffff;
}

/* Note Card Styles */
.note-card {
    background: white;
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    transition: all 0.2s ease;
    border: 1px solid #e0e4e8;
    display: flex;
    flex-direction: column;
    position: relative;
    height: fit-content;
    min-height: 100px;
    overflow: hidden;
}
.note-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 32px rgba(15, 23, 42, 0.12);
}
.note-card-editable {
    cursor: pointer;
}
.note-card-editable:focus-visible {
    outline: 3px solid rgba(26, 115, 232, 0.24);
    outline-offset: 4px;
}
.note-card.pinned {
    border-left: 4px solid #007bff;
    background-color: #f8fbff;
}
.note-card h3 {
    margin: 0 0 15px 0;
    color: #2d3436;
    font-size: 1.2rem;
}
.note-card .content-area {
    margin-bottom: 15px;
}
.note-card .action-items-header {
    margin: 15px 0 10px 0;
    color: #636e72;
    font-size: 1rem;
}
.note-card .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    color: #636e72;
    font-size: 0.9rem;
    margin-bottom: 15px;
}

/* Card Actions */
.note-card .card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid transparent;
}
.note-card .content-area + .card-actions:not(:has(~ .meta)),
.note-card h3 + .card-actions:not(:has(~ .content-area)):not(:has(~ .meta)) {
    border-top-color: #f0f0f0;
}
.note-card .meta + .card-actions {
    border-top-color: transparent;
    padding-top: 0;
    margin-top: 5px;
}

/* Button Styles */
.card-actions button {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #636e72;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
}
.card-actions button:hover {
    background-color: rgba(0, 123, 255, 0.1);
    color: #007bff;
}
.card-actions button.active {
    color: #007bff;
}
.card-actions button svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
}

/* Pin Button Styles */
.pin-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}
.pin-btn:hover {
    background-color: rgba(0, 0, 0, 0.05);
}
.pin-btn.active {
    background-color: var(--accent-color);
    color: white;
}
.dark-mode .pin-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}
.dark-mode .pin-btn.active {
    background-color: var(--dark-accent-color);
}

/* Dark Mode Card Styles */
body.dark-mode .note-card {
    background: #2d2d2d;
    border-color: #404040;
    box-shadow: none;
}
body.dark-mode .note-card h3 {
    color: #e0e0e0;
}
body.dark-mode .note-card .action-items-header {
    color: #a0a0a0;
}
body.dark-mode .note-card .meta {
    color: #a0a0a0;
}
body.dark-mode .note-card .card-actions {
    border-top-color: #404040;
}
body.dark-mode .note-card .card-actions button {
    color: #a0a0a0;
}
body.dark-mode .note-card .card-actions button:hover {
    background-color: rgba(0, 123, 255, 0.2);
    color: #007bff;
}

/* Root Variables */
:root {
    --header-offset: 70px;
    --pinned-bg-color: rgba(64, 156, 255, 0.05);
    --dark-pinned-bg-color: rgba(82, 172, 255, 0.1);
    --accent-rgb: 64, 156, 255;
    --dark-accent-rgb: 82, 172, 255;
    --background-color: #ffffff;
    --text-color: #2d3436;
    --accent-color: #007bff;
}

body.dark-mode {
    --background-color: #2d2d2d;
    --text-color: #e0e0e0;
    --accent-color: #0056b3;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1100;
    justify-content: center;
    align-items: center;
}

#noteModal {
    align-items: center;
    padding: 24px 16px;
    overflow: hidden;
}

.modal.show {
    display: flex !important;
}

.modal-content {
    background-color: var(--background-color);
    color: var(--text-color);
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.modal-content h2 {
    color: var(--text-color);
    margin: 0 0 20px 0;
}

.modal-form-scrollable label {
    color: var(--text-color);
}

.modal-form-scrollable input[type="text"],
.modal-form-scrollable input[type="date"],
.modal-form-scrollable textarea {
    background-color: var(--background-color);
    color: var(--text-color);
    border: 1px solid var(--text-color);
}

.modal-form-scrollable {
    min-height: 0;
    overflow-y: auto;
    padding-right: 10px;
}

.close-btn {
    position: absolute;
    right: 10px;
    top: 10px;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-color);
    background: none;
    border: none;
    padding: 5px;
    line-height: 1;
}

.close-btn:hover {
    color: var(--accent-color);
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e0e4e8;
}

.dark-mode .modal-actions {
    border-top-color: #404040;
}

.modal-actions button {
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    border: none;
    background: #f0f2f5;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 100px;
    justify-content: center;
}

.modal-actions button:hover {
    transform: translateY(-1px);
}

.modal-actions button:active {
    transform: translateY(0);
}

#modalCancelBtn {
    background-color: #f0f2f5;
    border: none;
    color: #4a4a4a;
}

#modalSaveBtn {
    background-color: #007bff;
    border: none;
    color: white;
}

#modalCancelBtn:hover {
    background-color: #e4e6e9;
}

#modalSaveBtn:hover {
    background-color: #0056b3;
    transform: translateY(-1px);
}

#modalSaveBtn:active {
    transform: translateY(0);
}

#confirmDialogCancelBtn {
    background-color: #f0f2f5;
    color: #4a4a4a;
}

.dark-mode #modalCancelBtn {
    background-color: #363636;
    color: #e0e0e0;
}

.dark-mode #modalSaveBtn {
    background-color: #0056b3;
}

.dark-mode #modalCancelBtn:hover {
    background-color: #404040;
}

.dark-mode #modalSaveBtn:hover {
    background-color: #003d80;
}

.dark-mode #confirmDialogCancelBtn {
    background: #273244;
    color: #e2e8f0;
}

/* Add icons to buttons */
#modalSaveBtn::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z'%3E%3C/path%3E%3Cpolyline points='17 21 17 13 7 13 7 21'%3E%3C/polyline%3E%3Cpolyline points='7 3 7 8 15 8'%3E%3C/polyline%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

#modalCancelBtn::before {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a4a4a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
}

.dark-mode #modalCancelBtn::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e0e0e0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='18' y1='6' x2='6' y2='18'%3E%3C/line%3E%3Cline x1='6' y1='6' x2='18' y2='18'%3E%3C/line%3E%3C/svg%3E");
}

/* Improve form input styles */
.modal-form-scrollable input[type="text"],
.modal-form-scrollable input[type="date"],
.modal-form-scrollable textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    font-size: 0.95rem;
    background-color: var(--background-color);
    color: var(--text-color);
    transition: all 0.2s ease;
}

.modal-form-scrollable input[type="text"]:focus,
.modal-form-scrollable input[type="date"]:focus,
.modal-form-scrollable textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
    outline: none;
}

.dark-mode .modal-form-scrollable input[type="text"],
.dark-mode .modal-form-scrollable input[type="date"],
.dark-mode .modal-form-scrollable textarea {
    border-color: #404040;
    background-color: #363636;
}

.dark-mode .modal-form-scrollable input[type="text"]:focus,
.dark-mode .modal-form-scrollable input[type="date"]:focus,
.dark-mode .modal-form-scrollable textarea:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.2);
}

.note-modal-content {
    width: min(880px, 100%);
    max-width: 880px;
    max-height: min(860px, calc(100vh - 48px));
    padding: 24px 24px 18px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 32px 80px rgba(15, 23, 42, 0.24);
}

.note-modal-header {
    margin-bottom: 16px;
    padding-right: 36px;
    flex-shrink: 0;
}

.note-modal-eyebrow {
    margin-bottom: 6px;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #5f6c7b;
}

.heading-with-help {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    position: relative;
    max-width: 100%;
}

.note-modal-title-block {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.note-modal-title-row {
    align-items: center;
}

.heading-with-help h2,
.heading-with-help h3 {
    margin-bottom: 0;
}

.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.info-tooltip-btn {
    width: 16px;
    height: 16px;
    border: none;
    border-radius: 0;
    background: transparent;
    color: #7a8799;
    line-height: 1;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    position: relative;
    top: -0.12em;
    transition: color 0.2s ease, transform 0.2s ease;
}

.info-tooltip-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 1.35;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.info-tooltip-btn:hover,
.info-tooltip-btn:focus-visible,
.info-tooltip.is-open .info-tooltip-btn {
    color: #1f4f8a;
    background: transparent;
    transform: translateY(-0.5px);
    outline: none;
}

.info-tooltip-popover {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%);
    margin-left: var(--tooltip-shift, 0px);
    width: min(260px, calc(100vw - 32px));
    max-width: calc(100vw - 32px);
    padding: 12px 14px;
    border: 1px solid #d8e0ea;
    border-radius: 14px;
    background: #ffffff;
    color: #526172;
    font-size: 0.88rem;
    line-height: 1.5;
    box-shadow: 0 14px 30px rgba(15, 23, 42, 0.14);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
    z-index: 5;
}

.info-tooltip-popover::before {
    display: none;
}

.info-tooltip:hover .info-tooltip-popover,
.info-tooltip:focus-within .info-tooltip-popover,
.info-tooltip.is-open .info-tooltip-popover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.note-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
    flex: 1;
    min-height: 0;
}

.note-form-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
    flex: 1;
    min-height: 0;
}

.note-form-section {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.field-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.field-heading-main {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.field-heading label {
    margin-bottom: 0;
}

.field-hint {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #eef3f8;
    color: #607286;
    font-size: 0.78rem;
    font-weight: 600;
}

.field-helper {
    font-size: 0.88rem;
    line-height: 1.5;
    color: #6b7280;
}

.note-editor-shell {
    padding: 18px;
    border: 1px solid #e5eaf0;
    border-radius: 20px;
    background: linear-gradient(180deg, #fbfcfe 0%, #f4f7fb 100%);
}

.note-editor-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;
    padding: 6px 4px;
    border-radius: 999px;
    background: #e9eef5;
}

.note-tab-btn {
    border: none;
    background: transparent;
    color: #607286;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 10px 16px;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.note-tab-btn.active {
    background: #ffffff;
    color: #1f2937;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.08);
}

.note-tab-panel {
    margin-top: 18px;
}

.note-tab-panel[hidden] {
    display: none !important;
}

.note-tab-stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.panel-intro {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.panel-intro h3 {
    margin: 0 0 4px;
    color: #1f2937;
    font-size: 1.05rem;
}

.secondary-inline-btn,
.ghost-inline-btn {
    border-radius: 999px;
    font-size: 0.88rem;
    font-weight: 600;
    padding: 10px 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.secondary-inline-btn {
    border: 1px solid #d6dee8;
    background: #ffffff;
    color: #334155;
}

.secondary-inline-btn:hover,
.ghost-inline-btn:hover {
    transform: translateY(-1px);
}

.ghost-inline-btn {
    border: 1px solid #d6dee8;
    background: #f8fafc;
    color: #475569;
}

.deadline-input-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 10px;
}

.deadline-input-row input[type="date"] {
    flex: 1 1 220px;
    width: min(100%, 240px);
    max-width: 240px;
    min-width: 0;
}

.deadline-input-row .ghost-inline-btn {
    flex: 0 0 auto;
    white-space: nowrap;
}

.action-items-editor {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-item-row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) 40px;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid #dbe3ec;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 4px 16px rgba(148, 163, 184, 0.08);
}

.action-item-row-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #007bff;
}

.action-item-row-input {
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 0.95rem;
}

.action-item-row-input:focus {
    outline: none;
}

.action-item-action-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #eef2f7;
    color: #607286;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.action-item-action-btn svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.action-item-action-btn:hover,
.action-item-action-btn:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.action-item-action-btn.is-add {
    background: #e9f2ff;
    color: #1d6fdb;
}

.action-item-action-btn.is-edit {
    background: #edf3fa;
    color: #4a6c96;
}

.action-item-action-btn.is-delete {
    background: #eef2f7;
    color: #607286;
}

.action-item-action-btn.is-add:hover,
.action-item-action-btn.is-add:focus-visible {
    background: #dbeafe;
    color: #185abc;
}

.action-item-action-btn.is-edit:hover,
.action-item-action-btn.is-edit:focus-visible {
    background: #dfe9f5;
    color: #355274;
}

.action-item-action-btn.is-delete:hover,
.action-item-action-btn.is-delete:focus-visible {
    background: #e2e8f0;
    color: #1f2937;
}

.editor-surface {
    border: 1px solid #dbe3ec;
    border-radius: 18px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.editor-surface trix-toolbar {
    padding: 10px;
    border-bottom: 1px solid #dbe3ec;
    background: #f8fafc;
}

.editor-surface trix-toolbar .trix-button-group {
    border-color: #d4dce6;
}

.editor-surface trix-toolbar .trix-button {
    background: #ffffff;
}

.editor-surface trix-editor {
    min-height: 260px;
    padding: 20px;
    border: none;
    font-size: 1rem;
    line-height: 1.7;
}

.note-form .modal-actions {
    margin-top: 0;
    padding-top: 16px;
    background: var(--background-color);
    flex-shrink: 0;
    position: relative;
    z-index: 1;
}

.dark-mode .note-modal-eyebrow,
.dark-mode .field-helper {
    color: #a8b2c0;
}

.dark-mode .panel-intro h3 {
    color: #f8fafc;
}

.dark-mode .info-tooltip-btn {
    background: transparent;
    color: #a8b2c0;
}

.dark-mode .info-tooltip-btn:hover,
.dark-mode .info-tooltip-btn:focus-visible,
.dark-mode .info-tooltip.is-open .info-tooltip-btn {
    color: #ffffff;
    background: transparent;
}

.dark-mode .info-tooltip-popover {
    border-color: #475569;
    background: #18212d;
    color: #dbe7f3;
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

.dark-mode .info-tooltip-popover::before {
    background: #18212d;
    border-left-color: #475569;
    border-top-color: #475569;
}

.dark-mode .field-hint {
    background: #334155;
    color: #dbe7f3;
}

.dark-mode .note-editor-shell {
    border-color: #404040;
    background: linear-gradient(180deg, #20232b 0%, #171a20 100%);
}

.dark-mode .note-editor-tabs {
    background: #202833;
}

.dark-mode .note-tab-btn {
    color: #a8b2c0;
}

.dark-mode .note-tab-btn.active {
    background: #2d3748;
    color: #ffffff;
    box-shadow: none;
}

.dark-mode .secondary-inline-btn,
.dark-mode .ghost-inline-btn {
    border-color: #475569;
    color: #e2e8f0;
}

.dark-mode .secondary-inline-btn {
    background: #1f2937;
}

.dark-mode .ghost-inline-btn {
    background: #273244;
}

.dark-mode .action-item-row {
    background: #202833;
    border-color: #3d4758;
    box-shadow: none;
}

.dark-mode .action-item-row-input {
    color: #f8fafc;
}

.dark-mode .action-item-action-btn.is-add {
    background: #1e3a5f;
    color: #93c5fd;
}

.dark-mode .action-item-action-btn.is-edit {
    background: #314158;
    color: #c1d4ee;
}

.dark-mode .action-item-action-btn.is-delete {
    background: #334155;
    color: #cbd5e1;
}

.dark-mode .action-item-action-btn.is-add:hover,
.dark-mode .action-item-action-btn.is-add:focus-visible {
    background: #234873;
    color: #bfdbfe;
}

.dark-mode .action-item-action-btn.is-edit:hover,
.dark-mode .action-item-action-btn.is-edit:focus-visible {
    background: #3a4d66;
    color: #e2e8f0;
}

.dark-mode .action-item-action-btn.is-delete:hover,
.dark-mode .action-item-action-btn.is-delete:focus-visible {
    background: #475569;
    color: #ffffff;
}

.dark-mode .editor-surface {
    background: #111827;
    border-color: #334155;
}

.dark-mode .editor-surface trix-toolbar {
    background: #1f2937;
    border-bottom-color: #334155;
}

.dark-mode .editor-surface trix-toolbar .trix-button-group {
    border-color: #475569;
}

@media (max-width: 768px) {
    .note-modal-content {
        width: 100vw;
        max-width: none;
        height: 100dvh;
        max-height: 100dvh;
        padding: calc(env(safe-area-inset-top) + 16px) 16px calc(env(safe-area-inset-bottom) + 12px);
        border-radius: 0;
        box-shadow: none;
    }

    .note-modal-header {
        padding-right: 40px;
    }

    #noteModal {
        padding: 0;
        align-items: stretch;
    }

    .note-editor-shell {
        padding: 12px;
    }

    .note-tab-btn {
        width: 100%;
        justify-content: center;
        font-size: 0.82rem;
        padding: 10px 6px;
    }

    .panel-intro {
        flex-direction: column;
        gap: 12px;
    }

    .deadline-input-row input[type="date"] {
        flex: 1 1 168px;
        width: 100%;
        max-width: 190px;
    }

    .action-item-row {
        grid-template-columns: 24px minmax(0, 1fr) 32px;
        padding: 10px 12px;
    }

    .editor-surface trix-editor {
        min-height: 280px;
        padding: 16px;
    }

    #noteModal .close-btn {
        top: calc(env(safe-area-inset-top) + 12px);
        right: 16px;
    }

    .modal-form-scrollable {
        padding-right: 0;
    }
}

/* Notes Grid Layout */
#notesGrid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0 56px;
    align-items: start;
}

/* Scrollbar Styles */
.modal-form-scrollable::-webkit-scrollbar {
    width: 8px;
}

.modal-form-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.modal-form-scrollable::-webkit-scrollbar-thumb {
    background-color: #ddd;
    border-radius: 4px;
}

.dark-mode .modal-form-scrollable::-webkit-scrollbar-thumb {
    background-color: #444;
}

/* Responsive Design */
@media (max-width: 768px) {
    #notesGrid {
        grid-template-columns: 1fr;
        padding: 16px 0 80px;
    }
}

/* Keyboard Shortcuts Modal */
.shortcuts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.shortcut-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.dark-mode .shortcut-item {
    border-bottom-color: #444;
}

.shortcut-key {
    background-color: #f5f5f5;
    padding: 4px 8px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 0.9em;
    color: #333;
}

.dark-mode .shortcut-key {
    background-color: #333;
    color: #fff;
}

.shortcut-description {
    color: #666;
    flex: 1;
    margin-left: 16px;
}

.dark-mode .shortcut-description {
    color: #aaa;
}

#shortcutsModal .modal-content {
    max-width: 500px;
}

#shortcutsModal h2 {
    margin: 0;
    color: #333;
    font-size: 1.5em;
}

.dark-mode #shortcutsModal h2 {
    color: #fff;
}

/* Header Actions */
.header-actions {
    position: relative;
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
}

.menu-toggle-btn {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    width: 40px;
    height: 40px;
}

.search-toggle-btn {
    display: none;
}

.dark-mode .menu-toggle-btn {
    color: #fff;
}

.menu-toggle-btn:hover,
.menu-toggle-btn.active {
    background-color: rgba(0, 0, 0, 0.05);
}

.dark-mode .menu-toggle-btn:hover,
.dark-mode .menu-toggle-btn.active {
    background-color: rgba(255, 255, 255, 0.1);
}

.header-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #fff;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.16);
    border-radius: 16px;
    padding: 8px;
    min-width: 200px;
    margin-top: 8px;
    z-index: 1020;
}

.dark-mode .header-menu {
    background-color: #2d2d2d;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.header-menu.show {
    display: block;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    width: 100%;
    border: none;
    background: none;
    color: #333;
    cursor: pointer;
    font-size: 0.9rem;
    text-align: left;
    border-radius: 12px;
}

.dark-mode .menu-item {
    color: #fff;
}

.menu-item:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

.dark-mode .menu-item:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.menu-item svg {
    width: 16px;
    height: 16px;
}

.add-note-fab {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 3.5rem;
    height: 3.5rem;
    border-radius: 50%;
    background-color: #007bff;
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 24px rgba(0, 123, 255, 0.24);
    transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
    z-index: 1005;
}

.dark-mode .add-note-fab {
    background-color: #0056b3;
}

.add-note-fab:hover {
    transform: translateY(-2px);
    background-color: #0056b3;
    box-shadow: 0 14px 28px rgba(0, 86, 179, 0.28);
}

.dark-mode .add-note-fab:hover {
    background-color: #003d80;
}

@media (max-width: 768px) {
    .main-header {
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        min-height: 56px;
    }

    .main-header h1 {
        margin-right: 0;
        flex: 1;
        font-size: 1.375rem;
        line-height: 1.2;
    }

    .container {
        padding: 16px 16px 112px;
        margin-top: calc(var(--header-offset, 70px) + 12px);
    }

    .search-toggle-btn {
        display: flex;
    }

    .header-menu {
        display: none;
        position: absolute;
        top: calc(100% + 8px);
        right: 0;
        flex-direction: column;
        background-color: #fff;
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
        border-radius: 12px;
        padding: 0.5rem;
        min-width: 220px;
    }

    .dark-mode .header-menu {
        background-color: #1a1a1a;
    }

    .header-menu.show {
        display: flex;
    }

    .menu-item {
        width: 100%;
        justify-content: flex-start;
    }

    .search-surface {
        display: none;
        padding: 14px 16px;
        margin-bottom: 12px;
    }

    .search-surface.is-open {
        display: block;
    }

    .search-container {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .search-input-container {
        width: 100%;
    }

    .search-filters {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .filter-group select,
    .clear-filters-btn {
        width: 100%;
    }

    .clear-filters-btn {
        justify-content: center;
    }

    .add-note-fab {
        width: 2.5rem;
        height: 2.5rem;
        right: 1rem;
        bottom: 1.25rem;
    }
}

.message-container {
    position: fixed;
    bottom: max(16px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    width: 100%;
    max-width: 560px;
    pointer-events: none;
    padding: 0 16px;
}

.status-message:empty,
.error-message:empty {
    display: none;
}

.status-message,
.error-message {
    padding: 14px 20px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
    pointer-events: auto;
    text-align: center;
    width: 100%;
    animation: fadeIn 0.3s ease-in-out;
    margin: 0;
}

.status-message {
    background-color: #4caf50;
    color: white;
}

.error-message {
    background-color: #f44336;
    color: white;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 0.9;
        transform: translateY(0);
    }
}

.dark-mode .status-message {
    background-color: #43a047;
}

.dark-mode .error-message {
    background-color: #d32f2f;
}

.message-container:empty {
    display: none;
}

/* Note Content Styles */
.note-content {
    margin-bottom: 15px;
    color: #4a4a4a;
    font-size: 0.95rem;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    overflow: visible;
    max-height: none;
}

.dark-mode .note-content {
    color: #e0e0e0;
}

/* List styles in note content */
.note-content ul {
    list-style-type: disc;
    padding-left: 24px;
    margin: 0.5em 0;
}

.note-content ol {
    list-style-type: decimal;
    padding-left: 24px;
    margin: 0.5em 0;
}

.note-content ul ul,
.note-content ol ol,
.note-content ul ol,
.note-content ol ul {
    margin: 0.2em 0;
}

.note-content li {
    margin-bottom: 0.3em;
}

.note-content [data-trix-attributes*="level-1"] {
    margin-left: 2em;
}

.note-content [data-trix-attributes*="level-2"] {
    margin-left: 4em;
}

.note-content [data-trix-attributes*="level-3"] {
    margin-left: 6em;
}

/* Action Items Styles */
.action-items {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.action-items li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
    color: #4a4a4a;
    font-size: 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}

.action-items li:last-child {
    border-bottom: none;
}

.action-items li input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
}

.action-items li.completed {
    color: #888;
    text-decoration: line-through;
}

.dark-mode .action-items li {
    color: #e0e0e0;
    border-bottom-color: #404040;
}

.dark-mode .action-items li.completed {
    color: #888;
}

/* Tag Styles */
.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    min-height: 32px;
    padding: 4px;
    border: 1px solid #e0e4e8;
    border-radius: 6px;
    background: var(--background-color);
}

.dark-mode .tags-container {
    border-color: #404040;
}

.tag-input-container {
    display: flex;
    gap: 8px;
}

#tagInput {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e0e4e8;
    border-radius: 6px;
    font-size: 0.9rem;
    background: var(--background-color);
    color: var(--text-color);
}

.dark-mode #tagInput {
    border-color: #404040;
}

#tagInput:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.tag {
    display: inline-flex;
    align-items: center;
    background-color: #e1e8ed;
    color: #2c3e50;
    border-radius: 15px;
    padding: 4px 12px;
    margin: 4px;
    font-size: 0.9em;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tag:hover {
    background-color: #d1d8dd;
}

.tag-remove {
    margin-left: 6px;
    font-weight: bold;
    cursor: pointer;
    opacity: 0.7;
}

.tag-remove:hover {
    opacity: 1;
}

.dark-mode .tag {
    background-color: #2c3e50;
    color: #e1e8ed;
}

.dark-mode .tag:hover {
    background-color: #34495e;
}

/* Tag Filter Styles */
.filter-tag {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    background: #f0f2f5;
    color: #4a4a4a;
    border-radius: 16px;
    font-size: 0.9rem;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s ease;
}

.dark-mode .filter-tag {
    background: #363636;
    color: #e0e0e0;
}

.filter-tag.selected {
    background: #e8f0fe;
    color: #1a73e8;
}

.dark-mode .filter-tag.selected {
    background: #1a3f6d;
    color: #89b4f7;
}

.filter-tag:hover {
    background: #e8f0fe;
    color: #1a73e8;
}

.dark-mode .filter-tag:hover {
    background: #1a3f6d;
    color: #89b4f7;
}

/* Note Deadline Styles */
.note-deadline {
    color: #666;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.note-deadline svg {
    color: #007bff;
    flex-shrink: 0;
}

.dark-mode .note-deadline {
    color: #aaa;
    border-bottom-color: #404040;
}

/* Note Header Styles */
.note-header {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.note-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
    color: #2d3436;
}

.note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #f0f0f0;
}

.note-date {
    font-size: 0.85rem;
    color: #666;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.dark-mode .note-footer {
    border-top-color: #404040;
}

.dark-mode .note-date {
    color: #aaa;
}

.note-date svg {
    color: #007bff;
    flex-shrink: 0;
}

.dark-mode .note-title {
    color: #e0e0e0;
}

/* Note Actions */
.note-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    margin-left: auto;
}

.note-actions button {
    width: 36px;
    height: 36px;
    background: #ffffff;
    border: 1px solid #d6dee8;
    padding: 0;
    cursor: pointer;
    color: #636e72;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
}

.note-actions button:hover {
    background-color: #f4f8ff;
    border-color: #aac3e6;
    color: #1a73e8;
}

.dark-mode .note-actions button {
    background: #202833;
    border-color: #3d4758;
    color: #a0a0a0;
}

.dark-mode .note-actions button:hover {
    background-color: #273449;
    border-color: #5f7ea6;
    color: #93c5fd;
}

/* Pin Button */
.pin-btn.pinned {
    color: #007bff;
}

.dark-mode .pin-btn.pinned {
    color: #007bff;
}

@media (max-width: 520px) {
    .note-footer {
        flex-wrap: nowrap;
        gap: 8px;
    }

    .note-date {
        font-size: 0.8rem;
    }

    .note-actions {
        width: auto;
        justify-content: flex-end;
        gap: 6px;
    }

    .note-actions button {
        width: 34px;
        height: 34px;
    }
}

/* Empty State */
.no-notes-message {
    text-align: center;
    padding: 40px;
    color: #666;
    font-size: 1.1rem;
}

.dark-mode .no-notes-message {
    color: #aaa;
}

.clear-filters-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid #d6dee8;
    border-radius: 16px;
    background-color: #fff;
    color: #334155;
    cursor: pointer;
    font-size: 0.92rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.clear-filters-btn:hover {
    background-color: #f8fbff;
    border-color: #aac3e6;
    color: #1f4f8a;
}

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

.dark-mode .clear-filters-btn {
    background-color: #202833;
    border-color: #3d4758;
    color: #dbe7f3;
}

.dark-mode .clear-filters-btn:hover {
    background-color: #273449;
    border-color: #5f7ea6;
    color: #ffffff;
}

/* Form Styles */
.modal-form-scrollable > div {
    margin-bottom: 20px;
}

.modal-form-scrollable label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.modal-form-scrollable textarea {
    min-height: 100px;
    resize: vertical;
}

/* Trix Editor Styles */
trix-editor {
    min-height: 200px;
    background: white;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    padding: 12px;
    color: var(--text-color);
}

/* Enable nesting level buttons */
trix-toolbar .trix-button--icon-increase-nesting-level,
trix-toolbar .trix-button--icon-decrease-nesting-level {
    opacity: 1 !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    display: inline-block !important;
}

trix-toolbar .trix-button--icon-increase-nesting-level:disabled,
trix-toolbar .trix-button--icon-decrease-nesting-level:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Fix list alignment and indentation in Trix editor */
trix-editor ul,
trix-editor ol {
    padding-left: 24px;
    margin: 0.5em 0;
}

trix-editor ul > li,
trix-editor ol > li {
    margin-left: 1em;
    padding-left: 0.5em;
}

/* Indentation levels */
trix-editor [data-trix-attributes*="level-1"] {
    margin-left: 2em !important;
}

trix-editor [data-trix-attributes*="level-2"] {
    margin-left: 4em !important;
}

trix-editor [data-trix-attributes*="level-3"] {
    margin-left: 6em !important;
}

/* Dark mode specific styles for nesting buttons */
.dark-mode trix-toolbar .trix-button--icon-increase-nesting-level,
.dark-mode trix-toolbar .trix-button--icon-decrease-nesting-level {
    background: #2d2d2d;
    border-color: #404040;
}

.dark-mode trix-toolbar .trix-button--icon-increase-nesting-level:hover,
.dark-mode trix-toolbar .trix-button--icon-decrease-nesting-level:hover {
    background: #363636;
}

.dark-mode trix-toolbar .trix-button--icon-increase-nesting-level.trix-active,
.dark-mode trix-toolbar .trix-button--icon-decrease-nesting-level.trix-active {
    background: #404040;
}

/* Hide attach file button */
trix-toolbar .trix-button-group--file-tools {
    display: none !important;
}

/* Trix Editor Dark Mode */
.dark-mode trix-toolbar {
    background-color: #1a1a1a;
    border-color: #404040;
}

.dark-mode trix-toolbar .trix-button-group {
    border-color: #404040;
}

.dark-mode trix-toolbar .trix-button {
    background: #202833;
    border-color: #3d4758;
    color: #dbe7f3;
    filter: none;
    box-shadow: none;
}

.dark-mode trix-toolbar .trix-button:hover:not(:disabled) {
    background: #273449;
    border-color: #5f7ea6;
}

.dark-mode trix-toolbar .trix-button.trix-active {
    background: #314158;
    border-color: #6d8cb5;
    color: #ffffff;
}

.dark-mode trix-toolbar .trix-button:disabled {
    background: #1b2430;
    border-color: #334155;
    opacity: 0.56;
}

.dark-mode trix-toolbar .trix-button--icon {
    filter: none;
}

.dark-mode trix-toolbar .trix-button--icon::before {
    filter: brightness(0) invert(0.92);
    opacity: 0.88;
}

.dark-mode trix-toolbar .trix-button:hover:not(:disabled)::before,
.dark-mode trix-toolbar .trix-button.trix-active::before {
    opacity: 1;
}

.dark-mode trix-toolbar .trix-button:disabled::before {
    opacity: 0.3;
}

.dark-mode trix-toolbar .trix-dialog {
    background-color: #1a1a1a;
    border-color: #404040;
    box-shadow: 0 0.3em 1em #000000;
}

.dark-mode trix-toolbar .trix-input {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

.dark-mode trix-toolbar .trix-dialog__link-fields {
    color: #e0e0e0;
}

.dark-mode trix-editor {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

.dark-mode trix-editor:focus {
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0, 86, 179, 0.2);
}

.virtual-note {
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
}

.dark-mode .virtual-note {
    background-color: #2d3436;
    border-color: #4a4a4a;
}

.virtual-note .note-title {
    color: #2c3e50;
    font-weight: 600;
}

.dark-mode .virtual-note .note-title {
    color: #dfe6e9;
}

.virtual-note .action-items li {
    border-bottom: 1px solid #e9ecef;
    padding: 8px 0;
}

.dark-mode .virtual-note .action-items li {
    border-bottom-color: #4a4a4a;
}

.virtual-note .item-source {
    font-size: 0.85em;
    color: #6c757d;
    font-style: italic;
    margin-left: 8px;
}

.dark-mode .virtual-note .item-source {
    color: #a0a0a0;
}

.virtual-note input[type="checkbox"] {
    cursor: not-allowed;
    opacity: 0.7;
}

.header-menu .menu-item.danger {
    color: #dc3545;
}

.header-menu .menu-item.danger:hover {
    background-color: #dc3545;
    color: white;
}

.dark-mode .header-menu .menu-item.danger {
    color: #ff6b6b;
}

.dark-mode .header-menu .menu-item.danger:hover {
    background-color: #dc3545;
    color: white;
}

/* Search, settings, archive, and tag filter overrides */
.search-toggle-btn {
    display: flex;
}

.search-surface {
    display: none;
}

.search-surface.is-open {
    display: block;
}

.search-surface-header,
.tag-filter-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.search-surface-header h2,
.tag-filter-header h2 {
    font-size: 1rem;
    font-weight: 700;
    color: #1f2937;
}

.tag-filter-section {
    margin-bottom: 18px;
    padding: 16px 20px;
    border: 1px solid #dbe3ec;
    border-radius: 24px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.tag-filter-container,
.note-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-tag {
    appearance: none;
    border: 1px solid #d6dee8;
    background: #f8fbff;
    color: #475569;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1;
}

.filter-tag.selected,
.filter-tag:hover {
    background: #e8f0fe;
    border-color: #aac3e6;
    color: #1a73e8;
}

.note-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.note-state-pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 999px;
    background: #e5e7eb;
    color: #5b6574;
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.note-card.archived {
    background: #f3f5f7;
    border-color: #d9e1e9;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.note-card.archived:hover {
    transform: none;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.note-card.archived .note-title,
.note-card.archived .note-content,
.note-card.archived .action-items li,
.note-card.archived .note-date,
.note-card.archived .note-deadline {
    color: #778295;
}

.archive-btn.active {
    color: #1a73e8;
    border-color: #aac3e6;
    background: #f4f8ff;
}

.settings-modal-content,
.help-modal-content,
.confirm-modal-content {
    width: min(680px, calc(100vw - 32px));
    max-width: 680px;
    max-height: min(820px, calc(100vh - 32px));
    border-radius: 28px;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.confirm-modal-content {
    max-width: 460px;
    padding: 24px;
    gap: 18px;
}

.confirm-dialog-copy {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.confirm-dialog-copy p {
    color: #5f6c7b;
    line-height: 1.6;
}

.settings-modal-header {
    margin-bottom: 0;
    padding-right: 0;
}

.settings-modal-header p {
    margin-top: 0;
}

.settings-modal-body {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
    gap: 20px;
    padding: 20px 24px 24px;
    scrollbar-gutter: stable;
}

.settings-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-section h3 {
    font-size: 1rem;
    color: #1f2937;
}

.settings-choice-group {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.settings-choice-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid #d6dee8;
    border-radius: 18px;
    background: #f8fbff;
    cursor: pointer;
    font-weight: 600;
    color: #334155;
}

.settings-choice-card input,
.settings-toggle input {
    accent-color: #1a73e8;
}

.settings-choice-card:has(input:checked) {
    border-color: #aac3e6;
    background: #e8f0fe;
    color: #1a73e8;
}

.settings-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid #d6dee8;
    border-radius: 16px;
    background: #ffffff;
    color: #334155;
    font-weight: 500;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.settings-dropdown-field {
    position: relative;
}

.settings-field select {
    min-height: 48px;
    padding: 0.75rem 0.875rem;
    border: 1px solid #d6dee8;
    border-radius: 16px;
    background: #ffffff;
}

.settings-select-trigger {
    min-height: 48px;
    width: 100%;
    padding: 0.75rem 0.875rem;
    border: 1px solid #d6dee8;
    border-radius: 16px;
    background: #ffffff;
    color: #334155;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font: inherit;
    text-align: left;
}

.settings-select-trigger svg {
    flex-shrink: 0;
}

.settings-select-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    z-index: 12;
    display: none;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
    border: 1px solid #d6dee8;
    border-radius: 16px;
    background: #ffffff;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    overflow-y: auto;
}

.settings-select-menu.is-open {
    display: flex;
}

.settings-select-option {
    width: 100%;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: #334155;
    padding: 10px 12px;
    text-align: left;
    font: inherit;
    cursor: pointer;
}

.settings-select-option:hover,
.settings-select-option.is-selected {
    background: #e8f0fe;
    color: #1a73e8;
}

.help-list {
    display: grid;
    gap: 10px;
    padding-left: 18px;
    color: #475569;
}

.modal-actions button.danger,
#confirmDialogConfirmBtn.danger {
    background: #d93025;
    color: #ffffff;
    border: none;
}

.modal-actions button.danger:hover,
#confirmDialogConfirmBtn.danger:hover {
    background: #b42318;
}

.dark-mode .search-surface,
.dark-mode .tag-filter-section {
    background: #202833;
    border-color: #3d4758;
    box-shadow: none;
}

.dark-mode .search-surface-header h2,
.dark-mode .tag-filter-header h2,
.dark-mode .settings-section h3 {
    color: #f8fafc;
}

.dark-mode .filter-tag {
    background: #1f2937;
    border-color: #475569;
    color: #dbe7f3;
}

.dark-mode .filter-tag.selected,
.dark-mode .filter-tag:hover {
    background: #273449;
    border-color: #5f7ea6;
    color: #93c5fd;
}

.dark-mode .note-state-pill {
    background: #334155;
    color: #dbe7f3;
}

.dark-mode .note-card.archived {
    background: #232c36;
    border-color: #3d4758;
}

.dark-mode .note-card.archived .note-title,
.dark-mode .note-card.archived .note-content,
.dark-mode .note-card.archived .action-items li,
.dark-mode .note-card.archived .note-date,
.dark-mode .note-card.archived .note-deadline {
    color: #9aa8bc;
}

.dark-mode .archive-btn.active {
    background: #273449;
    border-color: #5f7ea6;
    color: #93c5fd;
}

.dark-mode .settings-modal-content,
.dark-mode .help-modal-content,
.dark-mode .confirm-modal-content {
    background: #18212d;
    border: 1px solid #334155;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
}

.dark-mode .confirm-dialog-copy p,
.dark-mode .settings-modal-header p,
.dark-mode .help-list {
    color: #a8b2c0;
}

.dark-mode .settings-choice-card,
.dark-mode .settings-toggle,
.dark-mode .settings-field select,
.dark-mode .settings-select-trigger {
    background: #202833;
    border-color: #3d4758;
    color: #e2e8f0;
}

.dark-mode .settings-select-menu {
    background: #202833;
    border-color: #3d4758;
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.32);
}

.dark-mode .settings-select-option {
    color: #e2e8f0;
}

.dark-mode .settings-select-option:hover,
.dark-mode .settings-select-option.is-selected {
    background: #273449;
    color: #93c5fd;
}

.dark-mode .settings-choice-card:has(input:checked) {
    background: #273449;
    border-color: #5f7ea6;
    color: #93c5fd;
}

@media (max-width: 768px) {
    .settings-modal-content,
    .help-modal-content,
    .confirm-modal-content {
        width: calc(100vw - 24px);
        max-height: calc(100dvh - 24px);
        border-radius: 20px;
    }

    .confirm-modal-content {
        padding: 20px 18px;
    }

    .settings-choice-group {
        grid-template-columns: 1fr;
    }

    .tag-filter-section {
        padding: 14px 16px;
    }
}

/* Material 3 cleanup pass */
:root {
    --md-sys-color-primary: #275ea7;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #d8e2ff;
    --md-sys-color-on-primary-container: #0b1b3f;
    --md-sys-color-secondary-container: #e8edf4;
    --md-sys-color-on-secondary-container: #233040;
    --md-sys-color-surface: #f6f8fc;
    --md-sys-color-surface-container-low: #ffffff;
    --md-sys-color-surface-container: #ffffff;
    --md-sys-color-surface-container-high: #f0f3f8;
    --md-sys-color-surface-container-highest: #e7ebf2;
    --md-sys-color-on-surface: #1a1d24;
    --md-sys-color-on-surface-variant: #5b6574;
    --md-sys-color-outline: #c2c9d4;
    --md-sys-color-outline-variant: #dde3ec;
    --md-sys-color-inverse-surface: #2c313a;
    --md-sys-color-inverse-on-surface: #f2f5fb;
    --md-sys-color-error: #b3261e;
    --md-sys-color-error-container: #f9dedc;
    --md-sys-color-on-error-container: #410e0b;
    --md-sys-elevation-1: 0 1px 2px rgba(15, 23, 42, 0.08), 0 8px 24px rgba(15, 23, 42, 0.06);
    --md-sys-elevation-2: 0 12px 32px rgba(15, 23, 42, 0.12);
    --md-sys-elevation-3: 0 20px 40px rgba(15, 23, 42, 0.16);
    --background-color: var(--md-sys-color-surface-container);
    --text-color: var(--md-sys-color-on-surface);
    --accent-color: var(--md-sys-color-primary);
}

body.dark-mode {
    --md-sys-color-primary: #aac7ff;
    --md-sys-color-on-primary: #0a2f6b;
    --md-sys-color-primary-container: #15315c;
    --md-sys-color-on-primary-container: #d8e2ff;
    --md-sys-color-secondary-container: #2a3443;
    --md-sys-color-on-secondary-container: #dce5f2;
    --md-sys-color-surface: #11161d;
    --md-sys-color-surface-container-low: #171c24;
    --md-sys-color-surface-container: #1a212c;
    --md-sys-color-surface-container-high: #212a36;
    --md-sys-color-surface-container-highest: #2a3441;
    --md-sys-color-on-surface: #eef2f8;
    --md-sys-color-on-surface-variant: #a7b4c6;
    --md-sys-color-outline: #4c5a6e;
    --md-sys-color-outline-variant: #344254;
    --md-sys-color-inverse-surface: #e7edf6;
    --md-sys-color-inverse-on-surface: #1c1f26;
    --md-sys-color-error: #ffb4ab;
    --md-sys-color-error-container: #601410;
    --md-sys-color-on-error-container: #ffdad6;
    --md-sys-elevation-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 28px rgba(0, 0, 0, 0.22);
    --md-sys-elevation-2: 0 18px 36px rgba(0, 0, 0, 0.28);
    --md-sys-elevation-3: 0 24px 48px rgba(0, 0, 0, 0.34);
    --background-color: var(--md-sys-color-surface-container);
    --text-color: var(--md-sys-color-on-surface);
    --accent-color: var(--md-sys-color-primary);
}

body {
    font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    background: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
}

.main-header,
.search-surface,
.tag-filter-section,
.note-card,
.settings-modal-content,
.help-modal-content,
.confirm-modal-content {
    background: var(--md-sys-color-surface-container);
    border-color: var(--md-sys-color-outline-variant);
    box-shadow: var(--md-sys-elevation-1);
}

.main-header {
    background: color-mix(in srgb, var(--md-sys-color-surface-container) 88%, transparent);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: none;
}

.main-header h1,
.note-title,
.search-surface-header h2,
.tag-filter-header h2,
.settings-section h3,
.panel-intro h3,
.field-heading label {
    color: var(--md-sys-color-on-surface);
}

.menu-toggle-btn,
.clear-filters-btn,
.secondary-inline-btn,
.ghost-inline-btn,
.filter-group select,
.settings-select-trigger,
#searchInput,
#tagInput,
.tags-container,
.settings-choice-card,
.settings-toggle,
.settings-field select {
    border-color: var(--md-sys-color-outline);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.menu-toggle-btn:hover,
.menu-toggle-btn.active,
.clear-filters-btn:hover,
.secondary-inline-btn:hover,
.ghost-inline-btn:hover {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.field-hint,
.note-state-pill.is-archived,
.filter-tag {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-color: transparent;
}

.filter-tag.selected,
.filter-tag:hover {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    border-color: transparent;
}

.note-card {
    border-radius: 24px;
    padding: 20px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.note-card:hover {
    box-shadow: var(--md-sys-elevation-2);
}

.note-card.pinned {
    border-left: none;
    background: color-mix(in srgb, var(--md-sys-color-primary-container) 44%, var(--md-sys-color-surface-container));
}

.note-card.archived {
    background: color-mix(in srgb, var(--md-sys-color-surface-container-high) 86%, var(--md-sys-color-surface-container));
}

.note-card.archived:hover {
    box-shadow: var(--md-sys-elevation-1);
}

.note-card-title-row {
    align-items: flex-start;
}

.note-state-group {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    margin-left: auto;
}

.note-state-pill {
    border-radius: 999px;
    padding: 5px 10px;
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0;
    text-transform: none;
}

.note-state-pill.is-pinned {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

.note-content,
.note-date,
.note-deadline,
.field-helper,
.settings-modal-header p,
.help-list,
.confirm-dialog-copy p {
    color: var(--md-sys-color-on-surface-variant);
}

.note-footer {
    align-items: center;
    gap: 12px;
}

.note-actions {
    margin-left: auto;
    position: relative;
}

.note-overflow {
    position: relative;
}

.note-actions .note-overflow-trigger {
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 20px;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
    padding: 0;
}

.note-actions .note-overflow-trigger:hover,
.note-actions .note-overflow-trigger[aria-expanded="true"] {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    border-color: transparent;
}

.note-overflow-menu {
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    min-width: 220px;
    padding: 8px;
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 18px;
    background: var(--md-sys-color-surface-container-high);
    box-shadow: var(--md-sys-elevation-3);
    display: none;
    flex-direction: column;
    gap: 4px;
    z-index: 20;
}

.note-overflow.is-open .note-overflow-menu {
    display: flex;
}

.note-actions .note-overflow-menu .note-overflow-item {
    width: 100%;
    height: auto;
    border: none;
    background: transparent;
    border-radius: 12px;
    padding: 10px 12px;
    color: var(--md-sys-color-on-surface);
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.92rem;
    font-weight: 500;
    cursor: pointer;
    text-align: left;
}

.note-actions .note-overflow-menu .note-overflow-item:hover {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
    transform: none;
}

.note-overflow-item.danger {
    color: var(--md-sys-color-error);
}

.note-modal-content {
    width: min(920px, calc(100vw - 32px));
    max-width: 920px;
    max-height: min(92vh, calc(100vh - 32px));
    padding: 0;
    border-radius: 28px;
    border: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container);
    box-shadow: var(--md-sys-elevation-3);
}

.note-modal-header {
    position: sticky;
    top: 0;
    z-index: 4;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    margin-bottom: 0;
    padding: 16px 24px;
    background: color-mix(in srgb, var(--md-sys-color-surface-container) 94%, transparent);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.note-modal-nav-btn,
.dialog-shell-nav-btn {
    position: static;
    right: auto;
    top: auto;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--md-sys-color-on-surface-variant);
}

.note-modal-nav-btn:hover,
.dialog-shell-nav-btn:hover {
    background: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.dialog-shell-header {
    position: sticky;
    top: 0;
    z-index: 4;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 16px 24px;
    background: color-mix(in srgb, var(--md-sys-color-surface-container, #ffffff) 94%, transparent);
    backdrop-filter: blur(18px);
    border-bottom: 1px solid var(--md-sys-color-outline-variant, #dde3ec);
}

.dialog-shell-title-block {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.dialog-shell-title-block h2 {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 500;
    letter-spacing: 0;
}

.dialog-shell-title-block p {
    margin: 0;
    color: #5f6c7b;
    line-height: 1.55;
}

.dialog-shell-action-btn {
    min-width: 80px;
    min-height: 40px;
    padding: 0 18px;
    border: none;
    border-radius: 20px;
    background: var(--md-sys-color-primary, #1a73e8);
    color: var(--md-sys-color-on-primary, #ffffff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 10px 22px rgba(26, 115, 232, 0.22);
    transition: background-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.dialog-shell-action-btn:hover {
    background: var(--md-sys-color-primary, #1558b0);
    box-shadow: 0 12px 26px rgba(21, 88, 176, 0.26);
    transform: translateY(-1px);
}

.dialog-shell-action-btn-secondary {
    background: var(--md-sys-color-secondary-container, #e8edf4);
    color: var(--md-sys-color-on-secondary-container, #233040);
    box-shadow: none;
}

.dialog-shell-action-btn-secondary:hover {
    background: var(--md-sys-color-surface-container-highest, #dfe5ed);
    color: var(--md-sys-color-on-surface, #1a1d24);
    box-shadow: none;
}

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

.note-modal-title-row {
    gap: 8px;
}

.note-modal-title-block h2 {
    font-size: 1.375rem;
    font-weight: 500;
    letter-spacing: 0;
}

.note-modal-eyebrow {
    display: none;
}

#modalSaveBtn {
    min-width: 88px;
    min-height: 40px;
    padding: 0 18px;
    border: none;
    border-radius: 20px;
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: none;
}

#modalSaveBtn::before {
    display: none;
}

#modalSaveBtn:hover {
    background: color-mix(in srgb, var(--md-sys-color-primary) 88%, black);
    transform: none;
    box-shadow: none;
}

.note-form {
    gap: 0;
}

.note-form-body {
    padding: 20px 24px 24px;
    gap: 22px;
}

.modal-form-scrollable {
    padding-right: 0;
}

.note-editor-shell {
    padding: 16px;
    border-radius: 24px;
    border: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-high);
}

.note-editor-tabs {
    gap: 8px;
    padding: 4px;
    background: var(--md-sys-color-secondary-container);
}

.note-tab-btn {
    min-height: 44px;
    border-radius: 999px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
}

.note-tab-btn.active {
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    box-shadow: none;
}

.editor-surface {
    border-radius: 24px;
    border-color: var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container);
    box-shadow: none;
}

.editor-surface trix-toolbar {
    padding: 12px;
    border-bottom-color: var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-highest);
}

.editor-surface trix-toolbar .trix-button {
    border-radius: 12px;
    background: var(--md-sys-color-surface-container);
}

.editor-surface trix-editor {
    min-height: 320px;
    padding: 20px;
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
}

.add-note-fab {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    box-shadow: var(--md-sys-elevation-2);
}

.add-note-fab:hover {
    background: color-mix(in srgb, var(--md-sys-color-primary-container) 88%, var(--md-sys-color-primary));
    color: var(--md-sys-color-on-primary-container);
    box-shadow: var(--md-sys-elevation-3);
}

.message-container {
    bottom: max(16px, env(safe-area-inset-bottom));
    z-index: 1200;
}

.snackbar {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    width: min(520px, 100%);
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--md-sys-color-inverse-surface);
    color: var(--md-sys-color-inverse-on-surface);
    box-shadow: var(--md-sys-elevation-3);
    opacity: 0;
    transform: translateY(18px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.snackbar.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.snackbar.is-error {
    background: var(--md-sys-color-error-container);
    color: var(--md-sys-color-on-error-container);
}

body.snackbar-visible .add-note-fab {
    bottom: calc(max(16px, env(safe-area-inset-bottom)) + 78px);
}

.settings-modal-content,
.help-modal-content,
.confirm-modal-content {
    border-radius: 28px;
    border: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container);
    box-shadow: var(--md-sys-elevation-2);
}

.settings-select-trigger,
.settings-select-menu {
    border-color: var(--md-sys-color-outline);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.settings-select-menu {
    box-shadow: var(--md-sys-elevation-2);
}

.settings-select-option:hover,
.settings-select-option.is-selected {
    background: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
}

@media (max-width: 768px) {
    #noteModal {
        padding: 0;
        align-items: stretch;
    }

    #settingsModal,
    #helpModal {
        align-items: stretch;
    }

    .note-modal-content {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }

    .settings-modal-content,
    .help-modal-content {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        border-radius: 0;
        border: none;
    }

    .note-modal-header {
        padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
        gap: 12px;
    }

    .settings-modal-header-shell {
        padding: calc(env(safe-area-inset-top) + 12px) 16px 12px;
        gap: 12px;
    }

    .note-modal-title-block h2 {
        font-size: 1.25rem;
    }

    .dialog-shell-title-block h2 {
        font-size: 1.25rem;
    }

    .note-form-body {
        padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px);
        gap: 18px;
    }

    .settings-modal-body {
        padding: 16px 16px calc(env(safe-area-inset-bottom) + 24px);
        gap: 18px;
    }

    .note-editor-shell {
        padding: 12px;
    }

    .editor-surface trix-editor {
        min-height: 280px;
        padding: 16px;
    }

    .dialog-shell-action-btn {
        min-width: 72px;
        padding: 0 16px;
    }

    body.snackbar-visible .add-note-fab {
        bottom: calc(max(12px, env(safe-area-inset-bottom)) + 74px);
    }
}
