/* Memory settings share the application's dark surfaces, with explicit text
   colors so dialogs and generated content never inherit a light-theme default. */
.memory-section,
.memory-dialog {
    --memory-surface: #172033;
    --memory-control: #0e1625;
    --memory-text: #f8fafc;
    --memory-secondary: #bdc9db;
    --memory-border: #435570;
    --memory-link: #a9d2ff;
    color: var(--memory-text);
    color-scheme: dark;
}
.memory-section {
    margin: 1rem 0;
    padding: 1rem;
    border: 1px solid var(--memory-border);
    border-radius: 14px;
    background: var(--memory-surface);
}
.memory-section h3 { margin: 0 0 .5rem; color: var(--memory-text); }
.memory-section p { line-height: 1.5; color: var(--memory-secondary); }
.memory-section select,
.memory-dialog textarea {
    width: 100%;
    font: inherit;
    padding: .75rem;
    border: 1px solid var(--memory-border);
    border-radius: 9px;
    background: var(--memory-control);
    color: var(--memory-text);
}
.memory-section select option { background: var(--memory-control); color: var(--memory-text); }
.memory-section summary { cursor: pointer; font-weight: 600; min-height: 44px; color: var(--memory-text); }
.memory-section blockquote,
.memory-dialog blockquote {
    margin: .8rem 0;
    padding-left: .8rem;
    border-left: 3px solid var(--memory-border);
    color: var(--memory-secondary);
    line-height: 1.5;
}
.memory-section .btn-secondary,
.memory-dialog .btn-secondary { color: var(--memory-text); }
.memory-body { padding-top: .8rem; }
.memory-card { border-top: 1px solid var(--memory-border); padding: .8rem 0; }
.memory-card p { color: var(--memory-text); }
.memory-card small { display: block; color: var(--memory-secondary); }
.memory-source {
    display: block;
    min-height: 44px;
    text-align: left;
    color: var(--memory-link);
    background: transparent;
    border: 0;
    text-decoration: underline;
    padding: .4rem 0;
    font: inherit;
}
.memory-actions { display: flex; flex-direction: column; gap: .8rem; margin-bottom: 1rem; }
.memory-section a { color: var(--memory-link); }
.memory-actions a { min-height: 32px; }
.memory-session { display: flex; flex-direction: column; gap: .6rem; margin: 1rem 0; color: var(--memory-secondary); }
.memory-status { line-height: 1.5; color: var(--text-primary, #f8fafc); }
.memory-section .memory-notice { padding: .75rem; border-radius: 8px; background: #302919; color: #fde4a6; }
.memory-dialog {
    margin: auto;
    width: min(92vw, 560px);
    max-height: 85vh;
    overflow-y: auto;
    padding: 1.2rem;
    border: 1px solid var(--memory-border);
    border-radius: 14px;
    background: var(--memory-surface);
    font-family: var(--font-family, sans-serif);
}
.memory-dialog::backdrop { background: rgba(4, 8, 16, .72); }
.memory-dialog label { display: block; margin: 1rem 0; color: var(--memory-text); }
.memory-dialog textarea { min-height: 140px; margin-top: .5rem; }
.memory-dialog p { overflow-wrap: anywhere; line-height: 1.5; color: var(--memory-secondary); }
.memory-dialog button { margin: .4rem .4rem .4rem 0; }
.memory-section :focus-visible,
.memory-dialog :focus-visible { outline: 3px solid var(--memory-link); outline-offset: 3px; }
.memory-legacy { margin: 1rem 0; }
.memory-legacy-text {
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    max-height: 22rem;
    overflow-y: auto;
    font: inherit;
    line-height: 1.6;
    padding: 1rem;
    border: 1px solid var(--memory-border);
    border-radius: 8px;
    background: var(--memory-control);
    color: var(--memory-text);
}
