/**
 * AI Editor — Memory tab styles (Memory PR #5, 1.3.0).
 *
 * Settings → Memory tab is the first Preact + htm consumer in the
 * codebase (Decision §9). Class names mirror those used by the Touch 1
 * design canvas (`docs/design/touch-1-memory-ux/project/styles.css`)
 * so the visual vocabulary is consistent if/when more memory surfaces
 * adopt it (consent card PR #6, commit-modal PR #7, @memory chip PR #8).
 *
 * No persona scope, no confidence visuals — kickoff Decisions §1, §2.
 */

/* ============================================
   ROOT + TAB SHELL
   ============================================ */

.mem-tab-root {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.mem-tab {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mem-load-error {
    padding: 0.75rem 1rem;
    background: rgba(241, 76, 76, 0.1);
    border: 1px solid rgba(241, 76, 76, 0.3);
    border-radius: 4px;
    color: var(--error);
    font-size: var(--font-md);
}

/* ============================================
   TOOLBAR
   ============================================ */

.mem-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--border);
}

.mem-toolbar__title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-primary);
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
}

.mem-glyph {
    color: var(--memory);
    font-size: var(--font-xl);
    line-height: 1;
}

.mem-toolbar__count {
    font-size: var(--font-sm);
    color: var(--text-muted);
    font-weight: 400;
}

.mem-toolbar__btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.35rem 0.7rem;
    border-radius: 4px;
    font-size: var(--font-md);
    cursor: pointer;
    transition: background-color 0.1s, border-color 0.1s;
}

.mem-toolbar__btn:hover:not(:disabled) {
    background: var(--bg-hover);
    border-color: var(--border-light);
}

.mem-toolbar__btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mem-toolbar__btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.mem-toolbar__btn--primary:hover:not(:disabled) {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.mem-toolbar__btn--danger {
    color: var(--error);
    border-color: rgba(241, 76, 76, 0.3);
}

.mem-toolbar__btn--danger:hover:not(:disabled) {
    background: rgba(241, 76, 76, 0.1);
}

/* ============================================
   FILE-MODE TOGGLE (pill switch)
   ============================================ */

.mem-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: var(--font-md);
    cursor: pointer;
    transition: background-color 0.1s, border-color 0.1s;
}

.mem-toggle:hover:not(:disabled) {
    background: var(--bg-hover);
}

.mem-toggle:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mem-toggle__switch {
    width: 24px;
    height: 14px;
    background: var(--border-light);
    border-radius: 999px;
    position: relative;
    transition: background-color 0.15s;
}

.mem-toggle__switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-primary);
    transition: transform 0.15s;
}

.mem-toggle--on .mem-toggle__switch {
    background: var(--memory);
}

.mem-toggle--on .mem-toggle__switch::after {
    transform: translateX(10px);
    background: #fff;
}

.mem-toggle code {
    font-family: var(--font-mono);
    font-size: calc(var(--font-md) - 1px);
    color: var(--text-secondary);
}

/* ============================================
   REPO-MODE BANNER
   ============================================ */

.mem-repo-banner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: rgba(78, 201, 176, 0.06);
    border: 1px solid rgba(78, 201, 176, 0.2);
    border-radius: 4px;
    font-size: var(--font-md);
    color: var(--text-secondary);
}

.mem-repo-banner__dot {
    color: var(--memory);
    font-size: var(--font-md);
}

.mem-repo-banner__paths {
    color: var(--text-muted);
}

.mem-repo-banner__paths--empty {
    font-style: italic;
}

.mem-repo-banner code {
    font-family: var(--font-mono);
    font-size: calc(var(--font-md) - 1px);
    color: var(--text-primary);
}

/* ============================================
   FILTERS (search + scope chips)
   ============================================ */

.mem-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.mem-filters__search {
    flex: 1 1 240px;
    min-width: 0;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: var(--font-md);
}

.mem-filters__search:focus {
    outline: none;
    border-color: var(--accent);
}

.mem-filters__chips {
    display: flex;
    gap: 0.3rem;
}

.mem-scope-chip {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    font-size: var(--font-sm);
    cursor: pointer;
    text-transform: lowercase;
    transition: background-color 0.1s, border-color 0.1s, color 0.1s;
}

.mem-scope-chip:hover {
    color: var(--text-primary);
    border-color: var(--border-light);
}

.mem-scope-chip--active {
    background: var(--bg-active);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* ============================================
   GRID (split pane)
   ============================================ */

.mem-grid {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: 0.75rem;
    align-items: start;
}

@media (max-width: 768px) {
    .mem-grid {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   LIST + ROW
   ============================================ */

.mem-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.1rem;
}

.mem-list--empty {
    padding: 1.5rem 1rem;
    text-align: center;
    color: var(--text-muted);
    background: var(--bg-secondary);
    border: 1px dashed var(--border);
    border-radius: 4px;
}

.mem-list__hint {
    margin-top: 0.4rem;
    font-size: var(--font-sm);
    color: var(--text-muted);
}

.mem-list__hint code {
    font-family: var(--font-mono);
    color: var(--text-secondary);
}

.mem-row {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.5rem;
    align-items: start;
    padding: 0.5rem 0.6rem;
    background: var(--bg-secondary);
    border: 1px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.1s, border-color 0.1s;
}

.mem-row:hover {
    background: var(--bg-tertiary);
}

.mem-row--selected {
    background: var(--bg-active);
    border-color: var(--accent);
}

.mem-row:focus {
    outline: none;
    border-color: var(--accent);
}

.mem-row__body {
    min-width: 0;
}

.mem-row__kv {
    font-size: var(--font-md);
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mem-row__key {
    font-family: var(--font-mono);
    font-weight: 600;
    color: var(--accent);
}

.mem-row__colon {
    color: var(--text-muted);
}

.mem-row__meta {
    margin-top: 0.2rem;
    font-size: var(--font-xs);
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    align-items: center;
}

.mem-row__sep {
    color: var(--text-muted);
}

/* ============================================
   SCOPE BADGE (used in row + detail)
   ============================================ */

.mem-scope-badge {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 3px;
    font-size: var(--font-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    line-height: 1.5;
    align-self: start;
}

.mem-scope-badge--user {
    background: rgba(14, 125, 202, 0.15);
    color: var(--accent);
    border: 1px solid rgba(14, 125, 202, 0.3);
}

.mem-scope-badge--workspace {
    background: rgba(78, 201, 176, 0.15);
    color: var(--success);
    border: 1px solid rgba(78, 201, 176, 0.3);
}

/* ============================================
   SOURCE TAG
   ============================================ */

.mem-source-tag {
    display: inline-block;
    padding: 0.05rem 0.35rem;
    border-radius: 3px;
    font-size: var(--font-xs);
    color: var(--text-secondary);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    line-height: 1.5;
}

.mem-source-tag--user-explicit {
    color: var(--text-primary);
    border-color: var(--border-light);
}

.mem-source-tag--agent-proposed {
    color: var(--warning);
    border-color: rgba(220, 220, 170, 0.3);
}

.mem-source-tag--inferred {
    color: var(--text-muted);
    font-style: italic;
}

/* ============================================
   DETAIL PANE
   ============================================ */

.mem-detail {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.mem-detail--empty {
    color: var(--text-muted);
    font-style: italic;
    text-align: center;
    padding: 1.5rem 1rem;
}

.mem-detail__title {
    margin: 0;
    font-size: var(--font-md);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.mem-detail__title--audit {
    margin-top: 0.5rem;
}

.mem-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.mem-field__label {
    font-size: var(--font-xs);
    color: var(--text-muted);
    text-transform: lowercase;
}

.mem-field__input,
.mem-field__textarea {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: var(--font-md);
    font-family: var(--font-mono);
    width: 100%;
    box-sizing: border-box;
}

.mem-field__input:focus,
.mem-field__textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.mem-field__input--readonly {
    color: var(--text-secondary);
    cursor: not-allowed;
}

.mem-field__textarea {
    resize: vertical;
    min-height: 4rem;
    line-height: 1.4;
}

.mem-detail__tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}

.mem-detail__category {
    font-family: var(--font-mono);
    font-size: var(--font-xs);
    color: var(--text-muted);
}

/* ============================================
   AUDIT
   ============================================ */

.mem-audit-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 300px;
    overflow-y: auto;
}

.mem-audit-entry {
    font-size: var(--font-sm);
    color: var(--text-secondary);
    padding: 0.35rem 0.5rem;
    background: var(--bg-tertiary);
    border-radius: 3px;
    border-left: 2px solid var(--border-light);
}

.mem-audit-entry--empty {
    border-left-color: transparent;
    background: transparent;
    color: var(--text-muted);
    font-style: italic;
}

.mem-audit-entry__when {
    color: var(--text-primary);
    font-weight: 600;
}

.mem-audit-entry__action {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: calc(var(--font-sm) - 1px);
}

.mem-audit-entry__actor {
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: calc(var(--font-sm) - 1px);
}

.mem-audit-entry__reason {
    margin-top: 0.2rem;
    font-size: calc(var(--font-sm) - 1px);
    color: var(--text-muted);
    font-style: italic;
}

.mem-detail__actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.4rem;
}

.mem-detail__actions .mem-toolbar__btn--primary {
    flex: 1;
}

/* ============================================
   CONSENT CARD (Memory PR #6 — Touch 1 Flow 1)
   Inline card the chat renders when memory_remember
   returns `pending_consent`. Two visual variants:
   default inline + quiet single-line. Shares the
   `mem-*` token vocabulary with the Settings tab.
   ============================================ */

.chat-message.mem-consent-slot {
    /* Slot inserted by messages.js — own no padding/margin so the card
       inside it sits flush with the surrounding chat-message rhythm. */
    padding: 0;
    background: transparent;
    border: none;
}

.mem-consent {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.7rem 0.85rem;
    margin: 0.35rem 0;
    background: var(--bg-tertiary, rgba(255, 255, 255, 0.03));
    border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
    border-radius: 6px;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.mem-consent.is-saved {
    border-color: var(--accent, #4eb1f3);
    background: rgba(78, 177, 243, 0.05);
}

.mem-consent.is-dismissed {
    /* Empty state — slot left in place but the card collapses so the
       chat reflow is consistent regardless of the resolution outcome. */
    display: none;
}

.mem-consent--gone,
.mem-consent--error {
    padding: 0.4rem 0.6rem;
    font-size: var(--font-sm, 12px);
    color: var(--text-muted);
}

.mem-consent--error {
    color: var(--error, #f14c4c);
    border-color: rgba(241, 76, 76, 0.3);
}

.mem-consent__head {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    color: var(--text-secondary);
    font-size: var(--font-sm, 12px);
}

.mem-consent__title {
    font-weight: 600;
    color: var(--text-primary);
}

.mem-consent__scope {
    margin-left: auto;
    color: var(--text-muted);
    font-size: var(--font-xs, 11px);
}

.mem-consent__scope code {
    font-family: var(--font-mono);
    background: rgba(0, 0, 0, 0.25);
    padding: 1px 4px;
    border-radius: 2px;
}

.mem-consent__body {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.mem-consent__kv {
    font-family: var(--font-mono);
    font-size: var(--font-md, 13px);
    color: var(--text-primary);
    word-break: break-word;
}

.mem-consent__key {
    font-weight: 600;
    color: var(--accent, #4eb1f3);
}

.mem-consent__colon {
    color: var(--text-muted);
}

.mem-consent__value {
    color: var(--text-primary);
}

.mem-consent__input {
    display: inline-block;
    width: 100%;
    margin-top: 0.25rem;
    padding: 4px 6px;
    font-family: var(--font-mono);
    font-size: inherit;
    color: var(--text-primary);
    background: var(--bg-secondary, rgba(0, 0, 0, 0.25));
    border: 1px solid var(--border);
    border-radius: 3px;
    outline: none;
}

.mem-consent__input:focus {
    border-color: var(--accent, #4eb1f3);
}

.mem-consent__why {
    color: var(--text-muted);
    font-size: var(--font-xs, 11px);
    line-height: 1.5;
}

.mem-consent__why code {
    font-family: var(--font-mono);
    color: var(--text-secondary);
    background: rgba(0, 0, 0, 0.25);
    padding: 1px 4px;
    border-radius: 2px;
}

.mem-consent__error {
    margin-top: 0.25rem;
    padding: 0.35rem 0.5rem;
    color: var(--error, #f14c4c);
    background: rgba(241, 76, 76, 0.08);
    border-left: 2px solid var(--error, #f14c4c);
    font-size: var(--font-xs, 11px);
}

.mem-consent__actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.mem-consent__spacer {
    flex: 1;
}

.mem-consent__undo {
    color: var(--accent, #4eb1f3);
    cursor: pointer;
    text-decoration: underline;
}

.mem-consent__undo:hover {
    color: var(--accent-hover, #6cc1f7);
}

/* ----- Quiet single-line variant ----- */

.mem-consent--quiet {
    padding: 0.35rem 0.5rem;
    border-style: dashed;
    background: transparent;
}

.mem-consent__line {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: var(--font-sm, 12px);
}

.mem-consent__icon {
    color: var(--accent, #4eb1f3);
}

.mem-consent__label {
    color: var(--text-secondary);
}

.mem-consent__preview {
    flex: 1;
    min-width: 0;
    color: var(--text-muted);
    font-family: var(--font-mono);
    font-size: var(--font-xs, 11px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ----- Buttons ----- */

.mem-btn {
    padding: 4px 10px;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 3px;
    color: var(--text-primary);
    font-size: var(--font-xs, 11px);
    cursor: pointer;
    line-height: 1.4;
}

.mem-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--text-muted);
}

.mem-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.mem-btn--ghost {
    border-color: transparent;
    color: var(--text-muted);
}

.mem-btn--ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.mem-btn--primary {
    background: var(--accent, #4eb1f3);
    border-color: var(--accent, #4eb1f3);
    color: var(--bg-primary, #1e1e1e);
    font-weight: 600;
}

.mem-btn--primary:hover:not(:disabled) {
    background: var(--accent-hover, #6cc1f7);
    border-color: var(--accent-hover, #6cc1f7);
}

.mem-btn__kbd {
    margin-left: 0.4rem;
    padding: 0 4px;
    border: 1px solid currentColor;
    border-radius: 2px;
    font-size: 0.85em;
    opacity: 0.7;
}

/* ==========================================================================
   Commit-modal "Memory updates" section — Touch 1 Flow 3A/3B (PR #7)
   ========================================================================== */

.commit-section {
    margin-top: 1rem;
    padding: 0.75rem 0.85rem;
    border-radius: 4px;
    border-left: 3px solid var(--border);
    background: rgba(255, 255, 255, 0.02);
}

.commit-section--mem {
    border-left-color: var(--accent, var(--memory, #4eb1f3));
    background: color-mix(in srgb, var(--accent, #4eb1f3) 6%, transparent);
}

.commit-section--warn {
    border-left-color: #d97a3a;
    background: rgba(217, 122, 58, 0.08);
}

.commit-section__head {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.commit-section__title {
    font-size: var(--font-sm, 0.85rem);
    font-weight: 600;
    color: var(--text-primary);
}

.commit-section__title--mem {
    color: var(--accent, var(--memory, #4eb1f3));
}

.commit-section__title--warn {
    color: #d97a3a;
}

.commit-section__count {
    font-size: var(--font-xs, 0.75rem);
    color: var(--text-muted);
    font-family: var(--font-mono);
}

.commit-section__hint {
    margin: 0 0 0.6rem 0;
    font-size: var(--font-xs, 0.75rem);
    color: var(--text-secondary);
    line-height: 1.4;
}

.commit-section__hint strong {
    color: var(--text-primary);
}

.commit-section__hint code,
.branch-row__name {
    font-family: var(--font-mono);
    font-size: 0.9em;
    padding: 1px 4px;
    background: var(--bg-darker, rgba(0, 0, 0, 0.25));
    border-radius: 2px;
    color: var(--text-secondary);
}

.commit-section__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.6rem;
}

.commit-file--mem {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: var(--font-sm, 0.85rem);
}

.commit-file--mem .path {
    flex: 1;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--text-secondary);
    background: transparent;
    padding: 0;
}

.commit-file--mem.is-disabled {
    opacity: 0.6;
}

.commit-file--mem.is-disabled .path {
    text-decoration: line-through;
    text-decoration-color: var(--text-muted);
}

.commit-file--mem input[type="checkbox"][disabled] {
    cursor: not-allowed;
}

.src-link {
    cursor: pointer;
    color: var(--accent, #4eb1f3);
    font-size: var(--font-xs, 0.75rem);
    user-select: none;
}

.src-link:hover {
    text-decoration: underline;
}

.commit-mem-diff {
    font-family: var(--font-mono);
    font-size: 11px;
    background: var(--bg-darker, #1a1a1a);
    padding: 0.6rem 0.75rem;
    border-radius: 3px;
    margin: 0.4rem 0 0.6rem 1.6rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 240px;
    overflow-y: auto;
}

.commit-mem-diff[hidden] {
    display: none;
}

.branch-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    margin-bottom: 0.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 3px;
    font-size: var(--font-xs, 0.75rem);
}

.branch-row__label {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.branch-row__protected {
    color: #d97a3a;
    background: rgba(217, 122, 58, 0.12);
    border: 1px solid rgba(217, 122, 58, 0.3);
    border-radius: 3px;
    padding: 1px 6px;
    font-size: 0.85em;
}

/* ============================================
   @MEMORY CHIP — inline chat citation picker
   (Memory PR #8, 1.3.0)
   Mounted into #memoryChipRoot inside .chat-input-area; shows when the
   user types `@memory` in the textarea. Visual vocabulary mirrors
   .mem-consent so the three Memory surfaces feel consistent.
   ============================================ */

.memory-chip-root {
    /* Slot reserved for the popover. The chip itself uses absolute
       positioning so it overlays content above the input without
       displacing it. The slot has no visual presence when empty. */
    position: relative;
    min-height: 0;
}

.mem-chip {
    position: absolute;
    bottom: 0.5rem;       /* float above the input */
    left: 0;
    right: 0;
    background: var(--bg-secondary, #252525);
    border: 1px solid var(--border, #3a3a3a);
    border-radius: 6px;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.35);
    padding: 0.5rem 0.6rem;
    font-size: var(--font-md);
    z-index: 20;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 18rem;
    overflow: hidden;
}

.mem-chip__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

.mem-chip__title {
    color: var(--memory, #b388ff);
    font-weight: 600;
    letter-spacing: 0.01em;
}

.mem-chip__hint {
    color: var(--text-muted);
}

.mem-chip__hint code {
    background: var(--bg-tertiary);
    padding: 0 0.3em;
    border-radius: 2px;
    color: var(--text-primary);
}

.mem-chip__list {
    list-style: none;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    max-height: 12rem;
}

.mem-chip__item {
    display: grid;
    grid-template-columns: auto auto 1fr;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.35rem 0.5rem;
    border-radius: 3px;
    cursor: default;
}

.mem-chip__item.is-active {
    background: var(--accent-translucent, rgba(54, 153, 255, 0.18));
    outline: 1px solid var(--accent, #3699ff);
}

.mem-chip__scope {
    font-size: var(--font-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    padding: 0 0.35em;
    border: 1px solid var(--border);
    border-radius: 2px;
    line-height: 1.4;
}

.mem-chip__key {
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: var(--font-md);
    white-space: nowrap;
}

.mem-chip__value {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.mem-chip__empty {
    color: var(--text-muted);
    font-size: var(--font-sm);
    padding: 0.4rem 0.5rem;
}

.mem-chip__empty code {
    color: var(--text-primary);
    background: var(--bg-tertiary);
    padding: 0 0.3em;
    border-radius: 2px;
}

.mem-chip__foot {
    display: flex;
    gap: 0.9rem;
    padding-top: 0.3rem;
    border-top: 1px solid var(--border);
    color: var(--text-muted);
    font-size: var(--font-xs);
}

.mem-chip__kbd {
    display: inline-block;
    padding: 0 0.35em;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 2px;
    font-family: var(--font-mono);
    font-size: 0.85em;
    color: var(--text-secondary);
}
