.memory-header{flex-wrap:wrap}
.memory-header>h1{min-width:0}
.memory-header .memory-actions{margin-left:auto}
.memory-actions,.memory-section-head,.memory-meta{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
.memory-section-head{justify-content:space-between;gap:10px 16px}
.memory-tabs{display:flex;gap:25px;border-bottom:1px solid var(--line);margin-bottom:15px;overflow:auto}
.memory-tabs a{display:inline-flex;align-items:center;gap:6px;border-bottom:2px solid transparent;padding:9px 0 11px;
  font-weight:550;white-space:nowrap;color:var(--muted)}
.memory-tabs a:hover,.memory-tabs a[aria-current]{color:var(--accent)}
.memory-tabs a[aria-current]{border-color:var(--accent)}
.memory-tabs a:focus-visible{outline-offset:-3px}
.memory-count{border-radius:4px;background:#ecebe2;color:#686d5f;font-size:11px;padding:0 5px}
.memory-tabs [aria-current] .memory-count{background:var(--accent-pale);color:var(--accent)}
.memory-panel{display:grid;grid-template-columns:minmax(0,1fr) max-content;column-gap:14px}
.memory-list-head,.memory-row{grid-column:1/-1;padding-inline:20px}
.memory-list-head{display:flex;align-items:center;justify-content:space-between;gap:8px 16px;padding-block:10px;background:#f5f5ef;
  border-bottom:1px solid var(--line);border-radius:11px 11px 0 0}
.memory-list-filter{display:flex;flex-wrap:wrap;gap:3px}
.memory-list-filter button{min-height:30px;padding:4px 10px;border-radius:6px;color:var(--muted);font-size:13px;font-weight:550}
.memory-list-filter button:hover{background:#eaeae1;color:var(--ink)}
.memory-list-filter button[aria-pressed="true"]{background:var(--accent-pale);color:var(--accent)}
.memory-list-total{flex:none;color:var(--muted);font-size:12px}
.memory-list-selection,.memory-merge-context{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
.memory-list-selection .btn{min-height:32px;padding-block:4px;font-size:13px}
.memory-row{position:relative;display:grid;grid-template-columns:subgrid;align-items:start;padding-block:17px;cursor:pointer}
.memory-row+.memory-row{border-top:1px solid #e9eae2}
.memory-row:last-child{border-radius:0 0 11px 11px}
.memory-row:hover{background:#faf8f2}
.memory-row-selected{background:#f8f2e8}
:is(.memory-row,.memory-result):has(.memory-title:focus-visible){outline:2px solid #ad6440;outline-offset:-3px}
.memory-row-main{min-width:0}
.memory-row-selectable{display:grid;grid-template-columns:auto minmax(0,1fr);gap:9px}
.memory-row-copy{min-width:0}
.memory-row-selection{position:relative;z-index:1;display:grid;place-items:center;width:24px;height:24px;cursor:pointer}
.memory-row-selection input,.memory-source-choice input{width:15px;height:15px;margin:0;accent-color:var(--accent)}
.memory-row:has([data-select-memory]:checked){background:var(--accent-pale)}
.memory-row-title,.memory-row-labels{display:flex;align-items:center;min-width:0}
.memory-row-title{gap:5px 9px}
.memory-row-title h2{min-width:0}
.memory-row-labels{gap:5px}
.memory-row h2,.memory-result h3{font-size:15px;font-weight:650;letter-spacing:0;line-height:1.5}
.memory-row h2{font-size:16px}
.memory-title{padding:0;text-align:left;color:inherit;font:inherit;max-width:100%;overflow-wrap:anywhere}
.memory-row-title .memory-title{display:block}
.memory-row .memory-title span,.memory-excerpt{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.memory-title::after{position:absolute;inset:0;content:""}
.memory-row-selected .memory-title{color:var(--accent)}
.memory-title:focus-visible{outline:none}
.memory-excerpt{max-width:37rem;margin-top:4px;color:var(--muted);font-size:13px;line-height:1.6}
.memory-meta{gap:4px 12px;color:var(--muted);font-size:12px}
.memory-row .memory-meta{margin-top:8px;font-size:11px}
.memory-scope-label{color:var(--accent);font-weight:550;overflow-wrap:anywhere}
.memory-row-scope{min-width:0;padding:2px 7px;border-radius:5px;background:#efefe6;color:#4f5449;font-weight:550;overflow-wrap:anywhere}
.memory-progress{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;padding:2px 6px;border-radius:5px;
  background:#f6f0e5;color:#775822;font-size:11px}
.memory-row-actions{position:relative;z-index:1;display:flex;justify-content:flex-end;align-items:center;gap:4px;white-space:nowrap}
.memory-row-actions>.btn{min-height:32px;padding:5px 10px;font-size:12px}
.memory-row-actions .memory-main-action{border-color:#bc9b83}
.memory-row-edit{color:var(--muted)}
.memory-row-edit:hover:not(:disabled){background:#eeeee7;color:var(--ink)}
.memory-row-actions .danger-text{color:#a03932}
.memory-row-actions .danger-text:hover{background:#faeeeb;border-color:#e8c2bc}
.memory-index-demo{margin-top:12px}
.memory-index-demo button{padding-left:0}
.memory-result{position:relative;cursor:pointer;padding-inline:6px}
.memory-result h3{margin-bottom:5px}
.memory-demo-action{color:var(--muted);font-size:12px}
.memory-card{padding:22px;min-width:0}
.memory-card h2{font-size:17px;letter-spacing:0}
.memory-empty{color:var(--muted);font-size:13px;padding:20px 18px}
.memory-panel>.memory-empty{grid-column:1/-1}
.memory-card .memory-empty{padding:14px 0 0}
.memory-back{margin-bottom:14px}
.memory-text-pair{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px}
.memory-text-pair .memory-card{border:1px solid var(--line);border-radius:8px;background:var(--surface);padding:14px}
.memory-text-pair h3,.memory-drawer-content>section h3{font-size:14px;letter-spacing:0}
.memory-prose,.memory-evidence blockquote{margin:12px 0 0;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.75}
.memory-evidence blockquote{padding:10px 12px;background:#f7f5ee;border-left:2px solid #b99c75;font-size:13px}
.memory-callout{display:flex;align-items:flex-start;gap:8px;background:#fbf2e4;color:#775822;
  border:1px solid #ecdcbe;border-radius:8px;padding:10px 12px;margin-bottom:14px;font-size:13px}
.memory-decisions{list-style:none;margin:12px 0 0;padding:0}
.memory-decisions li{padding:12px 0;border-top:1px solid var(--line)}
.memory-decisions li:last-child{padding-bottom:0}
.memory-decisions li>div{display:flex;align-items:center;flex-wrap:wrap;gap:5px 8px;font-size:12px}
.memory-decisions li p{margin-top:6px;font-size:13px;white-space:pre-wrap;overflow-wrap:anywhere}
.memory-dialog{width:min(580px,calc(100vw - 32px))}
.memory-dialog [hidden]{display:none}
.memory-dialog .memory-check{margin-top:0}
.memory-form-status{color:#9c422d;font-size:13px}
.memory-form-status:empty{position:absolute}
.memory-review-dialog{width:min(730px,calc(100vw - 32px))}
.memory-review-title{overflow-wrap:anywhere}
.memory-review-form .memory-text-pair{max-height:34dvh;overflow:auto;overscroll-behavior:contain}
.memory-review-result{max-width:200px}
.memory-review-hint{font-size:12px;margin-top:-9px}
.memory-history summary{color:var(--accent);font-size:13px}
.memory-drawer-content{display:grid;gap:17px;padding:18px 22px 24px}
.memory-drawer-content .memory-text-pair{grid-template-columns:1fr}
.memory-drawer-content>section{padding:0}
.memory-drawer-content .memory-callout{margin:0}
.memory-dialog textarea,.memory-textarea{resize:vertical}
.memory-textarea{border:1px solid #ced0c5;border-radius:7px;background:white;padding:12px;min-width:0;line-height:1.65}
.memory-check{display:flex;align-items:center;gap:8px;cursor:pointer;width:fit-content;font-size:13px}
.memory-check input,.memory-create-modes input{accent-color:var(--accent);margin:0}
.memory-create-modes{border:0;margin:0 0 16px;padding:0;display:flex;gap:8px}
.memory-create-modes label{display:flex;align-items:center;gap:7px;padding:7px 10px;border:1px solid var(--line);border-radius:7px;cursor:pointer}
.memory-create-modes label:has(input:checked){border-color:var(--accent);background:#fdf6f1;color:var(--accent)}
.memory-dialog form > .memory-create-modes{margin:0}
.memory-input-pane,.memory-scope-options{border:0;padding:0;margin:0;min-width:0}
.memory-write-policy{font-size:13px}
.memory-context{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,140px),1fr));gap:10px}
.memory-context [hidden]{display:none}
.memory-context:not(:has(label:not([hidden]))){display:none}
.memory-context input{min-width:0}
.memory-settings-dialog{width:min(660px,calc(100vw - 32px))}
.memory-scope-options>legend{padding:0;margin-bottom:9px;font-size:13px;font-weight:650}
.memory-policy-wrap{min-width:0;border:1px solid var(--line);border-radius:9px;overflow:auto}
.memory-policy-table{width:100%;border-collapse:collapse;table-layout:fixed;text-align:left;font-size:13px}
.memory-policy-table th,.memory-policy-table td{padding:8px 13px;border-bottom:1px solid var(--line)}
.memory-policy-table thead{background:#f3f4ed;color:var(--muted)}
.memory-policy-table thead th{font-size:12px;font-weight:550}
.memory-policy-table th:first-child{width:38%}
.memory-policy-table tbody th{font-weight:650}
.memory-policy-table tbody tr:last-child>*{border-bottom:0}
.memory-policy-table select{width:100%;font-size:13px;min-height:34px}
.memory-policy-models{display:grid;gap:10px;padding-top:12px;border-top:1px solid var(--line)}
.memory-policy-models h3{font-size:13px}
.memory-model-fields{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,205px),1fr));align-items:start;gap:10px;font-size:13px}
.memory-prompt-settings{padding:10px 12px;border:1px solid var(--line);border-radius:8px}
.memory-prompt-settings summary{cursor:pointer;font-size:13px;font-weight:600}
.memory-prompt-settings > p{margin:8px 0;font-size:12px}
.memory-prompt-editor{border-top:1px solid var(--line);padding-block:8px}
.memory-prompt-editor:last-child{padding-bottom:0}
.memory-prompt-status{float:inline-end;color:var(--muted);font-size:12px;font-weight:400}
.memory-prompt-body{gap:8px;margin-top:8px}
.memory-prompt-body textarea{font-size:13px;line-height:1.65}
.memory-prompt-actions{display:flex;justify-content:flex-end;flex-wrap:wrap;gap:6px}
.kt-query.memory-scoped-query{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:center}
.memory-search-context{grid-column:1/-1;display:grid;gap:10px;margin-bottom:6px}
.memory-scope-options{display:flex;flex-wrap:wrap;gap:6px 16px}
.memory-organize-panel>.memory-list-head{border-radius:11px 11px 0 0}
.memory-pagination{grid-column:1/-1;display:flex;justify-content:flex-end;align-items:center;gap:12px;
  padding:10px 20px;border-top:1px solid var(--line);color:var(--muted);font-size:12px}
.memory-pagination .btn{min-height:32px;padding-block:4px}
.memory-task-row{position:relative;display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;
  gap:10px;padding:14px 20px;border-top:1px solid var(--line);cursor:pointer}
.memory-list-head+.memory-task-row{border-top:0}
.memory-task-row:last-child{border-radius:0 0 11px 11px}
.memory-task-row:hover{background:#faf8f2}
.memory-task-row:has(.memory-title:focus-visible){outline:2px solid #ad6440;outline-offset:-3px}
.memory-task-row:has([data-select-idle]:checked){background:var(--accent-pale)}
.memory-task-row>.ic{align-self:center;color:var(--muted)}
.memory-idle-row{grid-template-columns:auto minmax(0,1fr) auto}
.memory-task-main{min-width:0}
.memory-task-main h3{font-size:15px;font-weight:650;overflow-wrap:anywhere}
.memory-task-main .memory-meta{margin-top:7px}
.memory-task-comparison{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px 18px}
.memory-task-comparison section+section{border-inline-start:1px solid var(--line);padding-inline-start:18px}
.memory-task-comparison p,.memory-task-excerpt{margin-top:4px;color:var(--muted);font-size:13px;line-height:1.6;
  overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow-wrap:anywhere}
.memory-idle-toolbar{display:flex;align-items:center;flex-wrap:wrap;gap:6px 12px;min-height:50px;padding:6px 20px}
.memory-idle-all{display:flex;align-items:center;gap:6px;font-size:13px;cursor:pointer}
.memory-idle-all input{accent-color:var(--accent)}
.memory-idle-toolbar .memory-list-selection{margin-inline-start:auto}
.memory-idle-toolbar [hidden],.memory-list-selection [hidden]{display:none}
.memory-idle-toolbar .danger-text{color:#a03932}
.memory-idle-settings input{width:88px}
.memory-merge-dialog{width:min(920px,calc(100vw - 32px))}
.memory-merge-context{font-size:13px}
.memory-merge-grid{display:grid;grid-template-columns:minmax(0,1.1fr) minmax(0,1fr);gap:18px;align-items:start}
.memory-merge-grid h3{font-size:14px}
.memory-source-list{display:grid;align-content:start;max-height:46dvh;overflow:auto;overscroll-behavior:contain;
  border:1px solid var(--line);border-radius:8px;margin-top:8px}
.memory-source-record{min-width:0;padding:10px 12px;overflow-wrap:anywhere}
.memory-source-record+.memory-source-record{border-top:1px solid var(--line)}
.memory-source-record:has(input:checked){background:var(--canvas)}
.memory-source-choice{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:start;gap:7px;font-size:13px;cursor:pointer}
.memory-source-choice input{margin-top:2px}
.memory-source-record summary{color:var(--accent);cursor:pointer;font-size:12px}
.memory-source-record>details>summary{margin:5px 0 0 22px}
.memory-source-content{display:grid;gap:10px;margin-top:8px;font-size:13px;line-height:1.6}
.memory-source-content h4{font-size:12px;margin:0 0 3px}
.memory-source-content :is(p,blockquote){margin:0;white-space:pre-wrap;overflow-wrap:anywhere}
.memory-merge-draft{display:grid;gap:9px;min-width:0}
.memory-merge-draft>p{font-size:12px;line-height:1.5}
.memory-merge-draft .field textarea{min-height:110px}
.memory-merge-actions{margin-top:0}
.memory-keep-separate{margin-inline-end:auto}
.memory-source-history>.memory-source-record:first-of-type{margin-top:8px}
.memory-source-history summary small{margin-inline-start:6px;font-size:11px}
@media(max-width:740px){
  .memory-header .memory-actions{margin-left:0}
}
@media(max-width:680px){
  .memory-panel{display:block}
  .memory-list-head,.memory-row{gap:8px;padding-inline:12px}
  .memory-row{grid-template-columns:minmax(0,1fr) auto}
  .memory-row:has([data-action="review"], [data-action="retry-index"], [data-action="repair"]) .memory-row-main{grid-column:1/-1}
  .memory-row-actions{grid-column:2;flex-wrap:wrap}
}
@media(max-width:560px){
  .memory-tabs{gap:16px;font-size:13px}
  .memory-card{padding:15px}
  .memory-list-filter button{padding-inline:6px}
  .memory-row{padding-block:13px}
  .memory-row-title{flex-wrap:wrap}
  .memory-row h2{font-size:15px}
  .memory-policy-table th,.memory-policy-table td{padding-inline:5px}
  .memory-policy-table select{padding-inline:6px 22px;background-position:right 5px center}
  .memory-text-pair{grid-template-columns:1fr}
  .memory-drawer-content{padding-inline:16px}
  .memory-review-form .memory-text-pair{max-height:none}
  .memory-task-row,.memory-pagination,.memory-idle-toolbar{padding-inline:12px}
  .memory-task-comparison,.memory-merge-grid{grid-template-columns:minmax(0,1fr)}
  .memory-task-comparison section+section{border-inline-start:0;border-top:1px solid var(--line);padding:8px 0 0}
  .memory-source-list{max-height:33dvh}
  .memory-merge-dialog{padding:16px}
}
