.memory-menu-note { margin-left:auto; font-size:11px; opacity:.65; }
.memory-overlay[hidden] { display:none !important; }
.memory-overlay { position:fixed; inset:0; z-index:1400; display:flex; align-items:center; justify-content:center; padding:28px; background:rgba(26,22,38,.32); backdrop-filter:blur(7px); }
.memory-panel { --memory-paper:#fff; --memory-soft:#f7f5fb; background:var(--memory-paper); color:var(--text); width:min(1420px,100%); height:min(940px,calc(100dvh - 56px)); display:flex; flex-direction:column; border:1px solid var(--border2); border-radius:22px; box-shadow:0 24px 90px rgba(32,24,60,.22); overflow:hidden; font-family:var(--font); }
/* Pair this dialog's surfaces with the same appearance palette as its text.
   Classic keeps the defaults above; private mode retains its own night palette. */
html[data-appearance-tone] body:not(.private-active) .memory-panel { --memory-paper:var(--ap-panel); --memory-soft:var(--ap-soft); box-shadow:var(--ap-shadow); }
.memory-header { display:flex; justify-content:space-between; align-items:flex-start; padding:24px 28px 14px; gap:18px; }
.memory-eyebrow { font-size:10px; font-weight:800; letter-spacing:2px; color:var(--accent); margin-bottom:5px; }
.memory-header h2 { font-size:25px; letter-spacing:.2px; line-height:1.3; }
.memory-subtitle { font-size:12px; color:var(--text-2); margin-top:7px; }
.memory-close { width:34px; height:34px; border:1px solid var(--border); border-radius:50%; background:var(--memory-soft); color:var(--text-2); font-size:25px; line-height:1; flex-shrink:0; cursor:pointer; }
.memory-counters { display:flex; gap:10px; padding:0 28px; }
.memory-counter { display:flex; align-items:baseline; gap:8px; padding:8px 14px; border:1px solid var(--border); background:var(--memory-soft); color:var(--text); border-radius:10px; font:inherit; cursor:pointer; }
.memory-counter[aria-pressed="true"] { border-color:var(--accent); }
.memory-counter strong { font-size:21px; font-weight:750; }
.memory-counter span { color:var(--text-2); font-size:11px; }
.memory-note { margin:10px 28px 0; color:var(--text-2); font-size:11px; line-height:1.7; }
.memory-controls { display:flex; gap:8px; padding:16px 28px; border-bottom:1px solid var(--border); }
.memory-search-wrap { flex:1; min-width:100px; }
.memory-search,.memory-select,.memory-button { font:inherit; font-size:12px; color:var(--text); border:1px solid var(--border2); background:var(--memory-paper); border-radius:8px; min-height:36px; padding:7px 11px; }
.memory-search { width:100%; background:var(--memory-soft); }
.memory-select { max-width:180px; cursor:pointer; }
.memory-button { cursor:pointer; }
.memory-button:hover:not(:disabled),.memory-close:hover { background:var(--surface); }
.memory-button:disabled { opacity:.4; cursor:default; }
.memory-panel :is(button,input,select,summary):focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
.memory-workspace { display:grid; grid-template-columns:210px 300px minmax(0,1fr); min-height:0; flex:1; }
.memory-structure { padding:16px 12px; background:var(--memory-paper); border-right:1px solid var(--border); overflow-y:auto; min-height:0; }
.memory-tree > summary { font-size:12px; font-weight:800; cursor:pointer; padding:2px 3px 5px; }
.memory-tree > .memory-muted { padding:0 3px; font-size:10px; }
.memory-tree-all { width:100%; border:1px solid var(--border); background:var(--memory-soft); color:var(--text-2); border-radius:7px; padding:8px; font:inherit; font-size:11px; cursor:pointer; margin:8px 0 10px; }
.memory-tree-group { border-top:1px solid var(--border); padding:6px 0; }
.memory-tree-group > summary { cursor:pointer; color:var(--text-2); }
.memory-tree-type,.memory-tree-scope { font:inherit; color:var(--text); background:transparent; border:1px solid transparent; border-radius:7px; cursor:pointer; padding:7px; text-align:left; justify-content:space-between; gap:8px; }
.memory-tree-type { display:inline-flex; width:calc(100% - 19px); font-size:12px; font-weight:750; }
.memory-tree-type strong { color:var(--text-2); font-size:11px; }
.memory-tree-scope { display:flex; width:100%; font-size:10px; color:var(--text-2); }
.memory-tree-branches { margin:3px 0 3px 9px; border-left:1px solid var(--border2); padding-left:9px; }
.memory-tree-type:hover,.memory-tree-scope:hover,.memory-tree-type[aria-pressed="true"],.memory-tree-scope[aria-pressed="true"] { background:var(--surface); color:var(--text); border-color:var(--border); }
.memory-list-panel { min-height:0; display:flex; flex-direction:column; border-right:1px solid var(--border); background:var(--memory-soft); }
.memory-result-count { font-size:11px; color:var(--text-2); padding:14px 18px 10px; }
.memory-list { overflow-y:auto; min-height:0; flex:1; padding:0 10px 10px; }
.memory-list-item { width:100%; text-align:left; display:block; background:transparent; border:1px solid transparent; border-radius:10px; padding:13px 12px; margin-bottom:5px; color:var(--text); font:inherit; cursor:pointer; }
.memory-list-item:hover { background:var(--memory-paper); }
.memory-list-item[aria-pressed="true"] { background:var(--memory-paper); border-color:var(--border2); box-shadow:0 2px 9px rgba(80,50,130,.05); }
.memory-item-title { display:block; font-size:13px; font-weight:750; line-height:1.65; overflow-wrap:anywhere; }
.memory-item-description { display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; color:var(--text-2); font-size:11px; line-height:1.7; margin:5px 0 9px; overflow-wrap:anywhere; }
.memory-item-meta { display:flex; align-items:center; flex-wrap:wrap; gap:6px; font-size:10px; color:var(--text-2); }
.memory-state { margin-left:auto; color:var(--text-2); }
.memory-state.archived { font-style:italic; }
.memory-chip { display:inline-block; background:var(--surface); color:var(--accent-h); padding:3px 7px; border-radius:5px; font-size:10px; line-height:1.4; }
.memory-pagination { padding:12px; border-top:1px solid var(--border); display:flex; gap:8px; justify-content:space-between; align-items:center; }
.memory-pagination span { font-size:11px; color:var(--text-2); }
.memory-pagination .memory-button { min-height:30px; font-size:11px; }
.memory-detail { padding:24px 28px 40px; min-width:0; overflow-y:auto; outline:none; }
.memory-placeholder { display:flex; align-items:center; justify-content:center; min-height:260px; padding:24px; font-size:13px; color:var(--text-2); text-align:center; line-height:1.9; }
.memory-detail-heading h2 { font-size:21px; line-height:1.6; margin:9px 0 4px; overflow-wrap:anywhere; }
.memory-edit-open { margin-top:12px; border-color:var(--accent); color:var(--accent-h); }
.memory-detail-nav { display:flex; flex-wrap:wrap; gap:6px; margin:18px 0 4px; padding-bottom:15px; border-bottom:1px solid var(--border); }
.memory-detail-step { font:inherit; font-size:10px; border:1px solid var(--border); color:var(--text-2); background:var(--memory-soft); border-radius:6px; padding:6px 8px; cursor:pointer; }
.memory-detail-step:hover { border-color:var(--accent); color:var(--text); }
.memory-shorter { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-top:16px; }
.memory-shorter > .memory-section { margin:0; border:1px solid var(--border); border-radius:10px; padding:13px; background:var(--memory-soft); }
.memory-shorter .memory-prose { font-size:12px; }
.memory-slug { font-family:var(--mono); font-size:10px; color:var(--text-2); overflow-wrap:anywhere; }
.memory-metadata { display:grid; grid-template-columns:1fr 1fr; gap:13px 20px; margin:20px 0; padding:17px; border:1px solid var(--border); background:var(--memory-soft); border-radius:12px; }
.memory-metadata dt { color:var(--text-2); font-size:10px; margin-bottom:3px; }
.memory-metadata dd { font-size:12px; line-height:1.65; overflow-wrap:anywhere; }
.memory-section { margin:22px 0 0; }
.memory-section h3 { font-size:12px; margin-bottom:9px; font-weight:800; }
.memory-prose,.memory-source-text { font-size:13px; line-height:1.95; white-space:pre-wrap; overflow-wrap:anywhere; }
.memory-muted { font-size:11px; line-height:1.8; color:var(--text-2); margin:5px 0; overflow-wrap:anywhere; }
.memory-empty { padding:22px 12px; color:var(--text-2); font-size:12px; line-height:1.85; }
.memory-source { margin:12px 0; border:1px solid var(--border); border-radius:10px; padding:14px; }
.memory-source strong { font-size:12px; overflow-wrap:anywhere; }
.memory-source blockquote { border-left:3px solid var(--border2); margin-top:10px; padding-left:12px; }
.memory-source-notice { font-size:12px; line-height:1.85; padding:12px; background:var(--memory-soft); border-left:3px solid var(--accent); border-radius:4px; margin:10px 0; }
.memory-source-text { background:var(--memory-soft); border-radius:8px; margin-top:12px; padding:14px; }
.memory-section > .memory-button { margin:5px 5px 0 0; }
.memory-revision { border:1px solid var(--border); border-radius:10px; margin:10px 0; }
.memory-revision summary { padding:12px; cursor:pointer; font-size:11px; line-height:1.8; overflow-wrap:anywhere; }
.memory-revision-body { padding:0 15px 18px; }
.memory-revision-body h4 { font-size:13px; margin-top:10px; }
.memory-back { display:none; }
.memory-edit-heading h2,.memory-edit-title { font-size:21px; line-height:1.5; }
.memory-edit-form { padding-bottom:6px; }
.memory-edit-help { font-size:11px; color:var(--text-2); line-height:1.9; padding:12px 0; }
.memory-field { display:block; margin:14px 0; min-width:0; }
.memory-field-label { display:block; font-size:12px; font-weight:750; margin-bottom:7px; }
.memory-field-input { display:block; width:100%; min-width:0; background:var(--memory-paper); color:var(--text); border:1px solid var(--border2); border-radius:8px; padding:9px 11px; font:inherit; font-size:12px; line-height:1.75; }
textarea.memory-field-input { resize:vertical; min-height:70px; }
textarea.memory-field-input[name="body"] { min-height:260px; font-size:13px; }
.memory-field-input:focus { outline:2px solid var(--accent); outline-offset:2px; }
.memory-field-input:disabled { opacity:.65; background:var(--memory-soft); }
.memory-field-hint { display:block; font-size:10px; line-height:1.8; color:var(--text-2); margin:5px 0 0; }
.memory-edit-group { border:1px solid var(--border); border-radius:12px; padding:10px 16px 16px; margin:22px 0 12px; }
.memory-edit-group legend { font-size:12px; padding:0 8px; font-weight:800; }
.memory-edit-grid { display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
.memory-edit-grid .memory-field { margin:8px 0; }
.memory-scope-reference .memory-field-input { margin-top:8px; }
.memory-edit-actions { position:sticky; bottom:-40px; z-index:2; display:flex; justify-content:flex-end; gap:8px; background:var(--memory-paper); padding:14px 0; border-top:1px solid var(--border); margin-top:16px; }
.memory-save { background:var(--accent); color:var(--memory-paper); border-color:var(--accent); font-weight:750; }
.memory-save:hover:not(:disabled) { background:var(--accent-h); color:var(--memory-paper); }
.memory-edit-status { background:var(--memory-soft); border-radius:10px; font-size:12px; line-height:1.8; padding:12px; margin:12px 0; overflow-wrap:anywhere; }
.memory-edit-status:empty { display:none; }
.memory-edit-status .memory-button { margin-top:9px; }
.memory-conflict-preview { border-top:1px solid var(--border2); margin-top:14px; }
.memory-conflict-preview:empty { display:none; }
.memory-sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
body.private-active .memory-panel { --memory-paper:#211d2d; --memory-soft:#191623; color-scheme:dark; }
@media (min-width:761px) and (max-width:1050px) {
  .memory-workspace { grid-template-columns:265px minmax(0,1fr); grid-template-rows:auto minmax(0,1fr); }
  .memory-structure { grid-column:1 / -1; max-height:145px; padding:10px 16px; border-right:0; border-bottom:1px solid var(--border); }
  .memory-tree-group { display:inline-block; vertical-align:top; width:190px; margin-right:12px; }
  .memory-controls { flex-wrap:wrap; }
  .memory-search-wrap { min-width:200px; }
}
@media (max-width:760px) {
  .memory-overlay { padding:0; }
  .memory-panel { width:100%; height:100dvh; max-height:none; border-radius:0; border:0; }
  .memory-header { padding:18px 18px 12px; }
  .memory-header h2 { font-size:22px; }
  .memory-subtitle { font-size:11px; line-height:1.7; }
  .memory-counters { padding:0 18px; gap:7px; }
  .memory-counter { padding:7px 9px; gap:6px; }
  .memory-counter strong { font-size:18px; }
  .memory-note { margin:9px 18px 0; }
  .memory-controls { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); padding:12px 18px; gap:8px; }
  .memory-search-wrap { grid-column:1 / -1; min-width:0; }
  .memory-select { width:100%; min-width:0; max-width:none; }
  .memory-workspace { display:flex; flex-direction:column; overflow:hidden; }
  .memory-structure { flex:none; max-height:165px; border-right:0; border-bottom:1px solid var(--border); padding:11px 18px; }
  .memory-list-panel { flex:1; min-height:0; border-right:0; }
  .memory-detail { display:none; height:100%; padding:18px 18px 32px; }
  .memory-show-detail .memory-list-panel { display:none; }
  .memory-show-detail .memory-structure { display:none; }
  .memory-show-detail .memory-detail { display:block; }
  .memory-show-detail .memory-controls,.memory-show-detail .memory-counters,.memory-show-detail .memory-note { display:none; }
  .memory-show-detail .memory-header { border-bottom:1px solid var(--border); }
  .memory-back { display:inline-block; margin-bottom:16px; }
  .memory-metadata { gap:12px; padding:13px; }
  .memory-shorter { grid-template-columns:1fr; gap:10px; }
  .memory-edit-actions { bottom:-32px; }
  .memory-edit-grid { grid-template-columns:1fr; }
}
