/* ── Notes — two-pane list + editor (JARVIS-128) ──────
   Apple-Notes shape in the existing Jarvis palette. Every colour here is a
   custom property from style.css :root — nothing new is introduced. */

.notes-shell {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 1rem;
    /* Fill the viewport under the navbar so the body textarea is tall enough
       to type a whole meeting into without the page itself scrolling. */
    height: calc(100vh - 8rem);
    min-height: 420px;
}

/* ── Left pane ───────────────────────────────────────── */
.notes-list-pane {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.notes-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0.875rem;
    border-bottom: 1px solid var(--border-light);
}

.notes-title {
    font-size: 1rem;
    color: var(--text-bright);
    margin: 0;
}

.notes-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    padding: 0.5rem 0.875rem;
    border-bottom: 1px solid var(--border-light);
}

.notes-filter:empty { display: none; }

.notes-list {
    flex: 1;
    overflow-y: auto;
}

.note-row {
    display: block;
    width: 100%;
    text-align: left;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border-light);
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    font: inherit;
    color: inherit;
}

.note-row:hover { background: var(--surface-hover); }

.note-row.active {
    background: var(--surface-hover);
    /* Left rule instead of a fill — reads as "selected" without fighting the
       hover state on an adjacent row. */
    box-shadow: inset 3px 0 0 var(--accent);
}

.note-row-title {
    display: block;
    color: var(--text-bright);
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-row-title.untitled {
    color: var(--text-muted);
    font-weight: 400;
    font-style: italic;
}

.note-row-meta {
    display: block;
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.note-row-meta .note-row-date { color: var(--text-muted); }
.note-row-meta .note-row-snippet { color: var(--text-muted); opacity: 0.8; }

.note-row-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-top: 0.25rem;
}

/* ── Tag chips ───────────────────────────────────────── */
.note-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 0.6875rem;
    padding: 0.0625rem 0.5rem;
    line-height: 1.5;
}

.note-tag-filter {
    cursor: pointer;
    font: inherit;
    font-size: 0.6875rem;
}

.note-tag-filter:hover { border-color: var(--text-muted); color: var(--text); }

.note-tag-filter.active {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(88, 166, 255, 0.1);
}

.note-tag-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.875rem;
    line-height: 1;
    padding: 0;
}

.note-tag-remove:hover { color: var(--red); }

/* ── Right pane ──────────────────────────────────────── */
.notes-editor-pane {
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

/* An explicit `display` beats the UA's `[hidden] { display: none }`, so the
   two panes that toggle via the hidden attribute have to opt back out. */
.notes-placeholder[hidden],
.notes-editor[hidden] { display: none; }

.notes-placeholder {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.notes-editor {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-height: 0;  /* lets the textarea shrink instead of overflowing the grid */
    padding: 0.75rem 1rem 1rem;
}

.notes-editor-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-light);
}

.note-save-state {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-align: right;
}

.note-save-state.error { color: var(--red); }

/* The editor inputs are deliberately chrome-less — a note should feel like
   paper, not a form. Focus shows a subtle underline rather than a box. */
.note-date-input,
.note-title-input,
.note-tag-input,
.note-body-input {
    background: transparent;
    border: none;
    color: var(--text);
    font-family: inherit;
    outline: none;
    padding: 0;
}

.note-date-input {
    color: var(--text-muted);
    font-size: 0.75rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.125rem 0.25rem;
}

.note-date-input:hover,
.note-date-input:focus { border-color: var(--border); }

/* Recolour the native picker glyph — it renders black-on-dark otherwise. */
.note-date-input::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }

.note-title-input {
    color: var(--text-bright);
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 0.75rem;
    width: 100%;
}

.note-title-input::placeholder { color: var(--text-muted); opacity: 0.6; }

.note-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    margin: 0.5rem 0 0.25rem;
}

.note-tag-input {
    color: var(--text);
    font-size: 0.75rem;
    min-width: 7rem;
    flex: 1;
}

.note-tag-input::placeholder { color: var(--text-muted); opacity: 0.7; }

.note-body-input {
    flex: 1;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    line-height: 1.7;
    resize: none;
    min-height: 0;
}

.note-body-input::placeholder { color: var(--text-muted); opacity: 0.6; }

/* JARVIS-141: mobile-only toggle bar for the notes pop-out drawer.
   Desktop-hidden; the drawer mechanics live in the narrow-screen query. */
.notes-mobile-bar { display: none; }

/* ── Narrow screens: the list becomes a pop-out drawer ──
   JARVIS-141: instead of stacking a 40vh strip above the editor (which
   crowds the phone viewport), the notes list slides in from the left on
   demand. The editor gets the whole viewport; the drawer overlays it. */
@media (max-width: 800px) {
    .notes-shell {
        grid-template-columns: 1fr;
        height: calc(100vh - 8rem);
    }
    .notes-list-pane {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: min(86vw, 320px);
        border-radius: 0;
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        z-index: 150;
    }
    .notes-list-pane.open { transform: translateX(0); }
    .notes-list { max-height: none; }
    .notes-editor-pane { min-height: 60vh; }
    .notes-mobile-bar {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        padding: 0.5rem 0.75rem;
        border-bottom: 1px solid var(--border-light);
    }
    /* JARVIS-134 phone pass: bump tap targets to the 44px minimum so the
       list and the + New control are thumb-friendly. */
    .note-row { padding: 0.75rem 0.875rem; min-height: 44px; }
    #notes-new-btn { min-height: 40px; padding-left: 0.875rem; padding-right: 0.875rem; }
}
@media (prefers-reduced-motion: reduce) {
    .notes-list-pane { transition: none; }
}
