:root{
  font-family:system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color-scheme:dark;
  --bg:#111318;
  --panel:#191d25;
  --panel-dark:#11151c;
  --border:#2b3340;
  --muted:#9ba7b8;
  --text:#f5f7fb;
}

*{box-sizing:border-box}
[hidden]{display:none!important}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
}

.shell{
  max-width:1000px;
  margin:0 auto;
  padding:28px 24px 40px;
}

header{
  display:flex;
  justify-content:space-between;
  gap:24px;
  align-items:center;
  margin-bottom:24px;
}

h1{margin:0 0 4px}
h2{margin:0 0 10px;font-size:1.1rem}
p{margin:0;color:#aeb7c6}

.actions,.row{
  display:flex;
  gap:12px;
  align-items:center;
  flex-wrap:wrap;
}
.between{justify-content:space-between}

button,a{
  border:0;
  border-radius:9px;
  padding:9px 14px;
  background:#e9edf5;
  color:#101318;
  text-decoration:none;
  cursor:pointer;
}
button:disabled{opacity:.55;cursor:not-allowed}

.card{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:14px;
  padding:18px;
  margin:14px 0;
}

.stats{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(140px,1fr));
  gap:12px;
}
.stats div{
  background:var(--panel-dark);
  padding:12px;
  border-radius:10px;
  overflow:hidden;
}
.stats small{
  display:block;
  color:var(--muted);
  margin-bottom:4px;
}
.stats strong{
  display:block;
  overflow-wrap:anywhere;
}
.stats strong.state-active{color:#70e1a2}
.stats strong.state-inactive{color:#f095aa}

textarea{
  width:100%;
  min-height:150px;
  margin:10px 0;
  padding:12px;
  border-radius:10px;
  border:1px solid #394453;
  background:#0f1217;
  color:inherit;
  resize:vertical;
}

pre,.secret{
  white-space:pre-wrap;
  word-break:break-word;
  margin:0;
  min-height:80px;
}
.secret{
  margin:12px 0;
  padding:12px;
  background:#0c1016;
  border:1px solid #394453;
  border-radius:10px;
}

.key-row{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  padding:9px 0;
  border-top:1px solid var(--border);
}
.key-row span{overflow-wrap:anywhere}

.table-wrap{overflow:auto}
table{width:100%;border-collapse:collapse}
th,td{
  text-align:left;
  padding:9px;
  border-bottom:1px solid var(--border);
  vertical-align:top;
}
th{color:var(--muted);font-weight:600}
.actions-cell{display:flex;gap:6px;flex-wrap:wrap}
.actions-cell button{padding:6px 8px;font-size:.82rem}

/* Header / identity */
.topbar{
  align-items:center;
  min-height:52px;
  margin-bottom:8px;
}

.brand{
  flex:1 1 340px;
  min-width:260px;
}
.brand h1{
  display:block;
  margin:0;
  font-size:1.45rem;
  line-height:1.12;
  letter-spacing:-.02em;
}
.brand p{
  margin-top:3px;
  color:#aeb7c6;
  font-size:.78rem;
}

.account-area{
  flex:0 0 auto;
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
}

.identity-chip{
  min-width:0;
  max-width:330px;
  display:flex;
  align-items:center;
  gap:10px;
  padding:6px 10px 6px 6px;
  border:1px solid #303846;
  border-radius:999px;
  background:#131820;
}

.avatar-shell{
  position:relative;
  width:38px;
  height:38px;
  min-width:38px;
  flex:0 0 38px;
  border-radius:50%;
  overflow:hidden;
  background:#18202a;
  border:1px solid #3a4656;
}

.avatar,
.avatar-fallback{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  border-radius:50%;
}

.avatar{
  object-fit:cover;
  display:block;
}

.avatar-fallback{
  display:grid;
  place-items:center;
  background:linear-gradient(135deg,#334155,#2563eb);
  color:#fff;
  font-size:.85rem;
  font-weight:800;
}

.identity-text{
  min-width:0;
  display:flex;
  flex-direction:column;
  line-height:1.18;
}

.identity-text strong,
.identity-text small{
  display:block;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.identity-text strong{
  max-width:245px;
  font-size:.88rem;
  font-weight:700;
}

.identity-text small{
  max-width:245px;
  margin-top:3px;
  color:var(--muted);
  font-size:.72rem;
}

.session-actions{
  display:flex;
  align-items:center;
  justify-content:flex-end;
  gap:8px;
  flex-wrap:wrap;
}

.session-pill{
  display:inline-flex;
  align-items:center;
  gap:7px;
  min-height:32px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #3a4351;
  background:#222833;
  color:#d7deea;
  font-size:.82rem;
  font-weight:650;
  white-space:nowrap;
}

.session-dot{
  width:7px;
  height:7px;
  min-width:7px;
  border-radius:50%;
  background:#94a3b8;
  box-shadow:0 0 0 3px rgba(148,163,184,.12);
}

.session-pill.active{
  border-color:#246b4a;
  background:#10291f;
  color:#9ef0c4;
}
.session-pill.active .session-dot{
  background:#41d98b;
  box-shadow:0 0 0 3px rgba(65,217,139,.14);
}

.session-pill.pending{
  border-color:#745b1d;
  background:#2a2310;
  color:#f4d77a;
}
.session-pill.pending .session-dot{
  background:#f3c949;
  box-shadow:0 0 0 3px rgba(243,201,73,.13);
}

.session-pill.inactive{
  border-color:#5c3440;
  background:#2a171d;
  color:#f0a8ba;
}
.session-pill.inactive .session-dot{
  background:#e66f8c;
  box-shadow:0 0 0 3px rgba(230,111,140,.13);
}

#logout{
  padding:7px 11px;
  background:#382129;
  color:#ffd8e2;
  border:1px solid #653342;
  font-size:.82rem;
}
#logout:hover{background:#4b2632}

#login,#adminLink{
  padding:7px 11px;
  font-size:.82rem;
}

/* Answer provenance / billing */
.answer-card{position:relative}
.answer-meta{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
  margin-bottom:12px;
  padding-bottom:12px;
  border-bottom:1px solid var(--border);
}

.route-badge,.metric-badge{
  display:inline-flex;
  align-items:center;
  border-radius:999px;
  padding:5px 9px;
  font-size:.78rem;
  font-weight:700;
  border:1px solid #3b4554;
  background:#11161d;
  color:#cbd5e1;
}

.route-badge.route-exact{
  background:#10291f;
  border-color:#246b4a;
  color:#8ce8b7;
}
.route-badge.route-semantic{
  background:#11233c;
  border-color:#285589;
  color:#9cc8ff;
}
.route-badge.route-ai{
  background:#30240d;
  border-color:#765b1c;
  color:#f4d77a;
}
.route-badge.route-ai-memory{
  background:#251a37;
  border-color:#65458f;
  color:#d7b5ff;
}
.metric-badge.zero{
  color:#8ce8b7;
  border-color:#285b43;
}
.metric-badge.charged{
  color:#f4d77a;
  border-color:#6a531c;
}

@media(max-width:820px){
  .topbar{
    align-items:center;
    flex-direction:row;
    gap:12px;
  }
  .account-area{
    width:auto;
    flex:0 0 auto;
    justify-content:flex-end;
  }
}

@media(max-width:640px){
  .shell{padding:16px 10px 26px}
  .brand h1{font-size:1.2rem}
  .brand p{display:none}
  .account-area{
    align-items:center;
    flex-direction:row;
  }
  .row{align-items:flex-start}
  .key-row{
    align-items:flex-start;
    flex-direction:column;
  }
  .answer-meta{align-items:flex-start}
}


/* Memory explorer: deterministic, zero-AI browsing */
.memory-title-row{margin-bottom:14px}
.zero-ai-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding:6px 10px;
  border-radius:999px;
  border:1px solid #285b43;
  background:#10291f;
  color:#8ce8b7;
  font-size:.78rem;
  font-weight:700;
  white-space:nowrap;
}

.conversation-session-bar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:10px 0 12px;
  padding:9px 10px;
  border:1px solid #303a48;
  border-radius:9px;
  background:#11151c;
  color:var(--muted);
  font-size:.78rem;
}
.conversation-session-bar strong{
  color:#9cc8ff;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-weight:700;
}
.conversation-session-bar button{
  padding:6px 9px;
  font-size:.75rem;
  white-space:nowrap;
}
.library-catalog{
  margin:14px 0;
  padding:11px;
  border:1px solid #2d3745;
  border-radius:10px;
  background:#10151c;
}
.library-catalog .answer-meta{
  margin:0;
  padding:0;
  border:0;
}
#interactionActions{
  margin:14px 0 4px;
  padding-top:12px;
  border-top:1px solid var(--border);
}
#interactionValidationStatus{
  flex:1 1 220px;
  margin:0;
}
.memory-view-switch{
  display:inline-flex;
  gap:6px;
  margin-bottom:14px;
  padding:4px;
  border:1px solid var(--border);
  border-radius:10px;
  background:#11151c;
}
.memory-view-button{
  padding:7px 11px;
  border:1px solid transparent;
  border-radius:8px;
  background:transparent;
  color:var(--muted);
  font-size:.8rem;
  font-weight:700;
}
.memory-view-button:hover{
  background:#1c232d;
  color:var(--text);
}
.memory-view-button.active{
  border-color:#3c526d;
  background:#223047;
  color:#dcecff;
}

.memory-tree-panel{
  min-height:440px;
}
.memory-tree-heading{
  display:flex;
  flex-direction:column;
  gap:3px;
  padding:12px 14px;
  border-bottom:1px solid var(--border);
  background:#151a22;
}
.memory-tree-heading strong{
  font-size:.86rem;
  overflow-wrap:anywhere;
}
.memory-tree-heading span{
  color:var(--muted);
  font-size:.72rem;
}

.memory-tree{
  max-height:590px;
  overflow:auto;
  padding:9px 7px 14px;
}
.memory-tree-folder{
  margin:1px 0;
}
.memory-tree-folder>summary{
  padding:7px 8px;
  border-radius:7px;
  color:#dce6f3;
  cursor:pointer;
  font-size:.84rem;
  line-height:1.3;
  overflow-wrap:anywhere;
}
.memory-tree-folder>summary:hover{
  background:#1a212b;
}
.memory-tree-children{
  margin-left:13px;
  padding-left:8px;
  border-left:1px solid #2c3643;
}
.memory-tree-file{
  width:100%;
  display:block;
  padding:7px 8px;
  border:0;
  border-radius:7px;
  background:transparent;
  color:#c5cfdd;
  text-align:left;
  font-size:.82rem;
  line-height:1.35;
  overflow-wrap:anywhere;
}
.memory-tree-file:hover{
  background:#1a212b;
  color:#fff;
}
.memory-tree-file.selected{
  background:#172235;
  color:#dcecff;
  box-shadow:inset 3px 0 0 #60a5fa;
}
.memory-path{
  margin:-4px 0 14px;
  padding:8px 10px;
  border:1px solid #2b3542;
  border-radius:8px;
  background:#0d1117;
  color:#8fb9e8;
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.73rem;
  line-height:1.4;
  overflow-wrap:anywhere;
}
.memory-original-question{
  margin-top:-5px;
  color:#8290a4;
  font-family:inherit;
  font-size:.7rem;
}
.memory-source{
  min-height:80px;
  max-height:240px;
  margin-bottom:14px;
}
.memory-technical{
  margin-top:12px;
  color:var(--muted);
}
.memory-technical summary{
  cursor:pointer;
  font-size:.78rem;
  font-weight:700;
}
.memory-technical .memory-metadata{
  margin-bottom:0;
}

.memory-controls{
  display:grid;
  grid-template-columns:minmax(220px,1fr) minmax(150px,190px) minmax(150px,190px) auto auto;
  gap:9px;
  margin-bottom:14px;
}

.memory-controls input,
.memory-controls select{
  width:100%;
  min-width:0;
  border:1px solid #394453;
  border-radius:9px;
  background:#0f1217;
  color:var(--text);
  padding:9px 10px;
}

.secondary-button{
  background:#252c37;
  color:#e6ebf2;
  border:1px solid #3b4554;
}
.secondary-button:hover{background:#303947}

.confirm-button{
  background:#174c35;
  color:#b9f7d2;
  border:1px solid #2b7d57;
}
.confirm-button:hover{background:#1d6042}

.danger-button{
  background:#48202b;
  color:#ffd2dc;
  border:1px solid #743647;
}
.danger-button:hover{background:#5b2736}

.memory-layout{
  display:grid;
  grid-template-columns:minmax(260px,34%) minmax(0,1fr);
  gap:14px;
  min-height:360px;
}

.memory-list-panel,
.memory-detail{
  min-width:0;
  border:1px solid var(--border);
  border-radius:12px;
  background:#11151c;
}

.memory-list-panel{
  display:flex;
  flex-direction:column;
  overflow:hidden;
}

.memory-list{
  flex:1;
  max-height:550px;
  overflow:auto;
}

.memory-list-item{
  width:100%;
  display:block;
  text-align:left;
  padding:12px;
  border:0;
  border-bottom:1px solid #252d39;
  border-radius:0;
  background:transparent;
  color:var(--text);
}
.memory-list-item:hover{background:#181e27}
.memory-list-item.selected{
  background:#172235;
  box-shadow:inset 3px 0 0 #60a5fa;
}
.memory-list-item strong{
  display:-webkit-box;
  overflow:hidden;
  font-size:.9rem;
  line-height:1.35;
  overflow-wrap:anywhere;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  line-clamp:2;
}
.memory-list-meta{
  display:flex;
  gap:7px;
  flex-wrap:wrap;
  margin-top:7px;
  color:var(--muted);
  font-size:.7rem;
}
.memory-list-meta span{
  padding:2px 6px;
  border-radius:999px;
  background:#202733;
}

.memory-empty{
  padding:18px;
  color:var(--muted);
}

.memory-pagination{
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
  padding:9px;
  border-top:1px solid var(--border);
}
.memory-pagination button{
  padding:6px 8px;
  font-size:.75rem;
}
#memoryPageLabel{
  color:var(--muted);
  font-size:.78rem;
  white-space:nowrap;
}

.memory-detail{
  padding:16px;
  overflow:hidden;
}
.memory-detail-empty{
  min-height:300px;
  display:grid;
  place-items:center;
  padding:24px;
  color:var(--muted);
  text-align:center;
}
.memory-detail-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:10px;
  flex-wrap:wrap;
}
.memory-detail-top .answer-meta{
  margin:0;
  padding:0;
  border:0;
}
.memory-detail h3{
  margin:16px 0 12px;
  font-size:1.08rem;
  line-height:1.4;
  overflow-wrap:anywhere;
}
.memory-answer-label{
  margin-bottom:7px;
  color:var(--muted);
  font-size:.76rem;
  font-weight:700;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.memory-answer{
  min-height:120px;
  max-height:380px;
  overflow:auto;
  padding:13px;
  border:1px solid #303a48;
  border-radius:10px;
  background:#0c1016;
}

.memory-metadata{
  display:grid;
  grid-template-columns:repeat(3,minmax(0,1fr));
  gap:8px;
  margin:14px 0;
}
.memory-metadata div{
  padding:9px;
  border-radius:9px;
  background:#161b23;
}
.memory-metadata dt{
  color:var(--muted);
  font-size:.7rem;
}
.memory-metadata dd{
  margin:3px 0 0;
  font-size:.83rem;
  overflow-wrap:anywhere;
}

.memory-detail-actions{
  display:flex;
  gap:8px;
  align-items:center;
  flex-wrap:wrap;
}
.memory-detail-actions button{
  padding:7px 10px;
  font-size:.8rem;
}
.memory-validation-status{
  min-height:1.2em;
  margin-top:10px;
  color:var(--muted);
  font-size:.78rem;
}

.library-edit-actions{
  margin-top:10px;
  flex-wrap:wrap;
}
.memory-inline-editor{
  display:grid;
  gap:9px;
  margin:10px 0 14px;
  padding:12px;
  border:1px solid #3b4656;
  border-radius:11px;
  background:#0f141b;
}
.memory-inline-editor label{
  color:#dce6f3;
  font-size:.78rem;
  font-weight:750;
}
.memory-inline-editor textarea{
  width:100%;
  min-height:130px;
  max-height:320px;
  margin:0;
  padding:11px 12px;
  border:1px solid #3a4656;
  border-radius:9px;
  background:#0b1016;
  color:var(--text);
  resize:vertical;
  line-height:1.5;
}
.memory-inline-editor textarea:focus{
  outline:0;
  border-color:#66758b;
  box-shadow:0 0 0 3px rgba(148,163,184,.1);
}
.memory-inline-editor small{
  color:var(--muted);
  line-height:1.45;
}


@media(max-width:900px){
  .memory-tree-panel{min-height:0}
  .memory-tree{max-height:330px}
  .memory-controls{
    grid-template-columns:1fr 1fr;
  }
  .memory-controls input{grid-column:1/-1}
  .memory-layout{grid-template-columns:1fr}
  .memory-list{max-height:300px}
}

@media(max-width:560px){
  .conversation-session-bar{align-items:flex-start;flex-direction:column}
  .memory-controls{grid-template-columns:1fr}
  .memory-controls input{grid-column:auto}
  .memory-metadata{grid-template-columns:1fr 1fr}
  .memory-inline-editor .memory-detail-actions{
    align-items:stretch;
    flex-direction:column;
  }
  .memory-inline-editor .memory-detail-actions button{
    width:100%;
  }
}


/* Primary application tabs */
.main-tabs{
  display:flex;
  align-items:center;
  gap:7px;
  margin:8px 0 6px;
  padding:5px;
  width:max-content;
  max-width:100%;
  overflow-x:auto;
  border:1px solid var(--border);
  border-radius:12px;
  background:#151922;
}
.tab-button{
  flex:0 0 auto;
  padding:8px 13px;
  border:1px solid transparent;
  background:transparent;
  color:#aeb7c6;
  font-size:.86rem;
  font-weight:700;
}
.tab-button:hover{
  background:#202631;
  color:#fff;
}
.tab-button.active{
  border-color:#3c526d;
  background:#223047;
  color:#dcecff;
  box-shadow:0 1px 0 rgba(255,255,255,.04) inset;
}

/* Context transparency */
.context-title-row{margin-bottom:14px}
.context-catalog-status{
  display:block;
  margin-top:5px;
  color:#7f8da1;
  font-size:.69rem;
  line-height:1.35;
}
.context-stats{margin-bottom:14px}
.context-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:12px;
}
.context-box{
  min-width:0;
  padding:14px;
  border:1px solid var(--border);
  border-radius:12px;
  background:#11151c;
}
.context-box h3{
  margin:0 0 4px;
  font-size:.96rem;
}
.context-box>p,
.context-box .row p{
  font-size:.8rem;
  line-height:1.4;
}
.context-last{grid-column:1/-1}
.context-empty{
  padding:16px 0 8px;
  color:var(--muted);
  font-size:.83rem;
}
.context-code{
  min-height:90px;
  max-height:300px;
  overflow:auto;
  margin:7px 0 10px;
  padding:12px;
  border:1px solid #303a48;
  border-radius:10px;
  background:#0b0f14;
  font-size:.79rem;
  line-height:1.45;
}
.context-list{
  display:flex;
  flex-direction:column;
  gap:7px;
  max-height:330px;
  overflow:auto;
  margin-top:10px;
}
.context-list-item{
  width:100%;
  display:block;
  padding:9px 10px;
  border:1px solid #29323e;
  border-radius:9px;
  background:#161b23;
  color:var(--text);
  text-align:left;
}
button.context-list-item{cursor:pointer}
button.context-list-item:hover{background:#1d2530}
.context-list-item strong{
  display:block;
  margin-bottom:4px;
  font-size:.8rem;
  line-height:1.3;
  overflow-wrap:anywhere;
}
.context-list-item small{
  display:block;
  color:var(--muted);
  font-size:.69rem;
  line-height:1.35;
  overflow-wrap:anywhere;
}
.context-object-ref{
  font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
  font-size:.7rem!important;
}
.trace-list .context-list-item.selected{
  border-color:#4d6f99;
  background:#18273a;
}

@media(max-width:760px){
  .main-tabs{width:100%}
  .tab-button{flex:1 0 auto}
  .context-grid{grid-template-columns:1fr}
  .context-last{grid-column:auto}
}


/* ============================================================
   MCMA Chat Workspace
   Presentational shell inspired by the proven MiChat proportions,
   without importing MiChat backend, framework or persistence code.
   ============================================================ */

.shell{
  max-width:1440px;
  padding:20px 22px 34px;
}

.account-modal{
  width:min(900px,calc(100vw - 28px));
  max-width:900px;
  max-height:min(86dvh,860px);
  margin:auto;
  padding:0;
  border:1px solid #354154;
  border-radius:16px;
  background:#121720;
  color:var(--text);
  box-shadow:0 30px 90px rgba(0,0,0,.55);
  overflow:hidden;
}
.account-modal::backdrop{
  background:rgba(4,7,12,.72);
  backdrop-filter:blur(4px);
  -webkit-backdrop-filter:blur(4px);
}
.account-modal-shell{
  max-height:min(86dvh,860px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.account-modal-header{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:16px;
  padding:16px 18px 13px;
  border-bottom:1px solid var(--border);
  background:#171d27;
}
.account-modal-header h2{
  margin:1px 0 3px;
  font-size:1.05rem;
}
.account-modal-header p{
  font-size:.76rem;
}
.account-modal-eyebrow{
  display:block;
  color:#8d9aae;
  font-size:.66rem;
  font-weight:800;
  letter-spacing:.07em;
  text-transform:uppercase;
}
.account-modal-close{
  width:38px;
  height:38px;
  flex:0 0 38px;
  display:grid;
  place-items:center;
  padding:0;
  border:1px solid #394556;
  background:#10161f;
  color:#d8e0eb;
}
.account-modal-close svg{
  width:18px;
  height:18px;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
}
.account-modal-session{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 18px;
  border-bottom:1px solid var(--border);
  background:#10151c;
}
.account-drawer-content{
  flex:1 1 auto;
  min-height:0;
  overflow:auto;
  padding:2px 14px 16px;
}
.account-drawer-content>.card{
  margin:12px 0 0;
}

.chat-workspace{
  position:relative;
  display:grid;
  grid-template-columns:300px minmax(0,1fr);
  height:clamp(400px,calc(100vh - 150px),920px);
  height:clamp(400px,calc(100dvh - 150px),920px);
  min-height:0;
  margin:14px 0 0;
  overflow:hidden;
  border:1px solid var(--border);
  border-radius:16px;
  background:var(--panel);
  box-shadow:0 24px 70px rgba(0,0,0,.22);
}

.chat-sidebar{
  min-width:0;
  display:flex;
  flex-direction:column;
  border-right:1px solid var(--border);
  background:#141922;
}

.chat-sidebar-brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:16px 16px 12px;
}
.chat-sidebar-brand>span:last-child{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.chat-sidebar-brand strong{
  color:var(--text);
  font-size:.96rem;
}
.chat-sidebar-brand small{
  color:var(--muted);
  font-size:.72rem;
}
.chat-brand-mark,
.chat-empty-mark{
  display:grid;
  place-items:center;
  flex:0 0 auto;
  width:34px;
  height:34px;
  border-radius:11px;
  background:linear-gradient(145deg,#e9edf5,#aab7ca);
  color:#101318;
  font-weight:900;
  box-shadow:0 6px 18px rgba(0,0,0,.18);
}

.chat-sidebar-controls{
  padding:10px 14px 14px;
  border-bottom:1px solid var(--border);
}
.btn-new-conversation{
  width:100%;
  min-height:42px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid #dce3ee;
  border-radius:12px;
  background:#edf1f7;
  color:#11151c;
  font-weight:750;
}
.btn-new-conversation:hover{filter:brightness(1.05)}
.conversation-search{
  position:relative;
  display:block;
  margin-top:10px;
}
.conversation-search>span{
  position:absolute;
  left:11px;
  top:50%;
  transform:translateY(-50%);
  color:var(--muted);
  pointer-events:none;
}
.conversation-search input{
  width:100%;
  min-height:38px;
  padding:8px 10px 8px 32px;
  border:1px solid #303948;
  border-radius:10px;
  outline:none;
  background:#0f141b;
  color:var(--text);
}
.conversation-search input:focus{
  border-color:#64748b;
  box-shadow:0 0 0 3px rgba(148,163,184,.11);
}

.chat-sidebar-section{
  padding:12px 14px;
  border-bottom:1px solid var(--border);
}
.chat-sidebar-section.conversations-section{
  flex:1 1 auto;
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
}
.chat-sidebar-label,
.chat-sidebar-label-row{
  color:var(--muted);
  font-size:.69rem;
  font-weight:800;
  letter-spacing:.08em;
  text-transform:uppercase;
}
.chat-sidebar-label-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:8px;
}
.conversation-list-tools{
  display:inline-flex;
  align-items:center;
  gap:4px;
}
.conversation-scroll-button{
  width:25px;
  height:25px;
  display:grid;
  place-items:center;
  padding:0;
  border:1px solid #344052;
  border-radius:7px;
  background:#10161f;
  color:#b8c4d4;
  font-size:.72rem;
}
.conversation-scroll-button:hover:not(:disabled),
.conversation-scroll-button:focus-visible{
  border-color:#65768d;
  color:#fff;
}
.conversation-scroll-button:disabled{
  opacity:.3;
}
.zero-ai-mini{
  padding:2px 6px;
  border:1px solid #374151;
  border-radius:999px;
  color:#8fd8ae;
  font-size:.62rem;
  letter-spacing:0;
}

.conversation-projects{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  margin-top:9px;
}
.conversation-project{
  max-width:100%;
  padding:5px 8px;
  border:1px solid #303948;
  border-radius:999px;
  background:#10151c;
  color:#c9d3df;
  font-size:.72rem;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}

.conversation-list{
  flex:1 1 auto;
  min-height:0;
  display:grid;
  align-content:start;
  gap:4px;
  max-height:none;
  overflow:hidden;
  overscroll-behavior:contain;
  padding-right:2px;
}
.conversation-group{
  display:grid;
  gap:3px;
}
.conversation-group+.conversation-group{margin-top:10px}
.conversation-group-title{
  padding:4px 5px 3px;
  color:#79869a;
  font-size:.68rem;
  font-weight:800;
}
.conversation-item{
  width:100%;
  min-width:0;
  display:block;
  scroll-snap-align:start;
  padding:9px 10px;
  border:1px solid transparent;
  border-radius:10px;
  background:transparent;
  color:var(--text);
  text-align:left;
}
.conversation-item:hover{
  border-color:#303948;
  background:#1b222d;
}
.conversation-item.active{
  border-color:#3d495a;
  background:#222a36;
}
.conversation-item-title{
  display:block;
  overflow:hidden;
  color:#edf2f8;
  font-size:.82rem;
  font-weight:650;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.conversation-item-meta{
  display:flex;
  gap:7px;
  margin-top:3px;
  color:#8f9daf;
  font-size:.66rem;
  white-space:nowrap;
}
.conversation-empty{
  padding:12px 5px;
  color:var(--muted);
  font-size:.78rem;
}
.chat-sidebar-footer{
  flex:0 0 auto;
  margin-top:auto;
  display:grid;
  gap:10px;
  padding:10px 12px;
  border-top:1px solid var(--border);
  color:#bec8d6;
  font-size:.72rem;
}
.chat-history-note{
  display:grid;
  gap:2px;
}
.chat-history-note span{
  color:var(--muted);
  line-height:1.35;
}
.sidebar-account-row{
  min-width:0;
  display:grid;
  grid-template-columns:34px minmax(0,1fr) 36px;
  align-items:center;
  gap:9px;
  padding-top:9px;
  border-top:1px solid #28313e;
}
.sidebar-avatar{
  width:34px;
  height:34px;
  min-width:34px;
  flex-basis:34px;
}
.sidebar-account-copy{
  min-width:0;
  display:flex;
  flex-direction:column;
  gap:2px;
}
.sidebar-account-copy strong,
.sidebar-account-copy small{
  display:block;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.sidebar-account-copy strong{
  color:#edf2f8;
  font-size:.78rem;
}
.sidebar-account-copy small{
  color:#8390a2;
  font-size:.65rem;
}
.sidebar-settings-button{
  width:36px;
  height:36px;
  display:grid;
  place-items:center;
  padding:0;
  border:1px solid #354154;
  background:#10161f;
  color:#c6d0de;
}
.sidebar-settings-button:hover,
.sidebar-settings-button:focus-visible{
  border-color:#63748a;
  color:#fff;
}
.sidebar-settings-button svg{
  width:18px;
  height:18px;
  fill:none;
  stroke:currentColor;
  stroke-width:1.7;
  stroke-linecap:round;
  stroke-linejoin:round;
}

.chat-main-panel{
  min-width:0;
  min-height:0;
  display:flex;
  flex-direction:column;
  overflow:hidden;
  background:#151a22;
}
.chat-conversation-header{
  flex:0 0 auto;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  min-height:72px;
  margin:0;
  padding:12px 18px;
  border-bottom:1px solid var(--border);
  background:rgba(25,29,37,.96);
}
.chat-title-group{
  min-width:0;
  flex:1 1 auto;
}
.chat-title-group h2{
  margin:2px 0 1px;
  overflow:hidden;
  color:var(--text);
  font-size:1rem;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.conversation-title-row{
  min-width:0;
  display:flex;
  align-items:center;
  gap:6px;
}
.conversation-title-row h2{
  flex:0 1 auto;
  min-width:0;
  max-width:min(100%,760px);
}
.conversation-rename-button{
  width:27px;
  height:27px;
  flex:0 0 27px;
  display:grid;
  place-items:center;
  padding:0;
  border:1px solid transparent;
  background:transparent;
  color:#8f9daf;
  font-size:.8rem;
}
.conversation-rename-button:hover,
.conversation-rename-button:focus-visible{
  border-color:#3d4a5d;
  background:#111720;
  color:#fff;
}
.conversation-rename-form{
  min-width:0;
  display:grid;
  grid-template-columns:minmax(140px,1fr) auto auto;
  gap:5px;
  margin:3px 0 2px;
}
.conversation-rename-form input{
  min-width:0;
  height:30px;
  padding:5px 7px;
  border:1px solid #465367;
  border-radius:7px;
  background:#0f141b;
  color:var(--text);
  font-size:.74rem;
}
.conversation-rename-form button{
  min-height:30px;
  padding:5px 8px;
  font-size:.68rem;
}
.chat-eyebrow,
.conversation-id-line{
  display:block;
  color:var(--muted);
  font-size:.67rem;
}
.conversation-id-line strong{
  font-family:ui-monospace,SFMono-Regular,Consolas,monospace;
  font-weight:550;
}
.chat-sidebar-toggle{
  display:none;
  width:36px;
  height:36px;
  padding:0;
  border:1px solid var(--border);
  background:#111720;
  color:var(--text);
}
#conversationReadCost{
  flex:0 0 auto;
}

.chat-messages{
  flex:1 1 auto;
  min-height:0;
  overflow-y:auto;
  overflow-x:hidden;
  overscroll-behavior:contain;
  padding:24px clamp(16px,4vw,56px) 18px;
  scroll-behavior:smooth;
}
.chat-empty-state{
  width:min(560px,90%);
  min-height:100%;
  margin:auto;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:9px;
  text-align:center;
}
.chat-empty-state .chat-empty-mark{
  width:48px;
  height:48px;
  border-radius:15px;
  margin-bottom:5px;
}
.chat-empty-state h3{
  margin:0;
  font-size:1.16rem;
}
.chat-empty-state p{
  max-width:520px;
  line-height:1.55;
}

.chat-message{
  width:100%;
  display:flex;
  flex-direction:column;
  margin:0 auto 18px;
}
.chat-message-user{
  align-items:flex-end;
}
.chat-message-assistant{
  align-items:flex-start;
}
.chat-message-role{
  margin:0 7px 5px;
  color:#7f8da1;
  font-size:.68rem;
  font-weight:750;
  letter-spacing:.04em;
  text-transform:uppercase;
}
.chat-message-content{
  max-width:min(82%,820px);
  padding:11px 14px;
  border:1px solid #2d3644;
  border-radius:16px;
  background:#1a202a;
  color:#edf2f8;
  font-size:.91rem;
  line-height:1.62;
  overflow-wrap:anywhere;
  white-space:pre-wrap;
}
.chat-message-user .chat-message-content{
  border-bottom-right-radius:5px;
  background:#e8edf4;
  border-color:#e8edf4;
  color:#11151c;
}
.chat-message-assistant .chat-message-content{
  border-bottom-left-radius:5px;
}
.chat-message.pending .chat-message-content{
  color:#9aa7b8;
  font-style:italic;
}
.chat-message.error .chat-message-content{
  border-color:#7d3a4a;
  color:#f4b5c4;
}
.chat-message-actions{
  display:flex;
  align-items:center;
  gap:6px;
  margin:6px 7px 0;
}
.chat-message-action{
  min-height:28px;
  padding:4px 8px;
  border:1px solid #354154;
  border-radius:8px;
  background:#111720;
  color:#aeb8c7;
  font-size:.68rem;
  font-weight:700;
  cursor:pointer;
}
.chat-message-action:hover:not(:disabled),
.chat-message-action:focus-visible{
  border-color:#66758b;
  color:#f2f5f9;
}
.chat-message-action:disabled{
  opacity:.45;
  cursor:not-allowed;
}
.chat-message.pending .chat-message-actions{
  visibility:hidden;
}

.chat-message-meta{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  margin:5px 7px 0;
  color:#7f8da1;
  font-size:.66rem;
}
.chat-message-meta span+span::before{
  content:"·";
  margin-right:6px;
  color:#536174;
}

.chat-composer{
  position:relative;
  z-index:5;
  flex:0 0 auto;
  min-width:0;
  max-width:100%;
  padding:10px 16px calc(12px + env(safe-area-inset-bottom,0px));
  border-top:1px solid var(--border);
  background:rgba(20,25,34,.96);
  backdrop-filter:blur(14px) saturate(130%);
  -webkit-backdrop-filter:blur(14px) saturate(130%);
  box-shadow:0 -12px 30px rgba(0,0,0,.12);
}
.chat-composer-meta{
  min-height:22px;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:0 2px 5px;
  color:var(--muted);
  font-size:.68rem;
}
.chat-usage-meta{
  justify-content:flex-end;
  margin:0;
}
.memory-edit-target{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:12px;
  margin:0 2px 8px;
  padding:9px 10px;
  border:1px solid #4b6381;
  border-radius:10px;
  background:#172234;
}
.memory-edit-target>div{
  min-width:0;
  display:grid;
  gap:2px;
}
.memory-edit-target strong{
  color:#e4edf8;
  font-size:.75rem;
}
.memory-edit-target span{
  color:#c4d2e3;
  font-size:.73rem;
  overflow-wrap:anywhere;
}
.memory-edit-target code{
  max-width:100%;
  color:#90a6c0;
  font-size:.64rem;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.memory-edit-target .secondary-button{
  flex:0 0 auto;
  padding:5px 8px;
  font-size:.7rem;
}

.chat-input-shell{
  width:100%;
  min-width:0;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:end;
  gap:8px;
  border:1px solid #384354;
  border-radius:14px;
  padding:6px;
  background:#0e131a;
  overflow:hidden;
  transition:border-color .15s ease,box-shadow .15s ease;
}
.chat-input-shell:focus-within{
  border-color:#66758b;
  box-shadow:0 0 0 3px rgba(148,163,184,.1);
}
.chat-input-shell textarea{
  width:100%;
  min-width:0;
  min-height:48px;
  max-height:160px;
  margin:0;
  padding:11px 9px 8px;
  border:0;
  border-radius:0;
  outline:0;
  resize:none;
  background:transparent;
  color:var(--text);
  line-height:1.45;
}
.chat-composer-actions{
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:12px;
  flex-wrap:wrap;
  margin-top:7px;
}
.chat-composer-options{
  min-width:0;
  display:flex;
  align-items:center;
  gap:12px;
  flex-wrap:wrap;
}
.chat-option{
  display:inline-flex;
  align-items:center;
  gap:6px;
  color:#aeb8c7;
  font-size:.73rem;
  cursor:pointer;
}
.chat-option input{margin:0}
.chat-send-button{
  align-self:end;
  flex:0 0 auto;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:7px;
  min-width:94px;
  min-height:42px;
  margin:0;
  padding:8px 13px;
  border-radius:11px;
  background:#edf1f7;
  color:#101318;
  font-weight:800;
  white-space:nowrap;
}
.chat-send-label{
  line-height:1;
}
.chat-send-icon{
  width:18px;
  height:18px;
  display:block;
  fill:none;
  stroke:currentColor;
  stroke-width:2;
  stroke-linecap:round;
  stroke-linejoin:round;
}

@media (max-width:900px){
  .shell{padding:14px 12px 26px}
  .chat-workspace{
    grid-template-columns:260px minmax(0,1fr);
    height:clamp(390px,calc(100vh - 135px),860px);
    height:clamp(390px,calc(100dvh - 135px),860px);
  }
  #conversationReadCost{display:none}
}

@media (max-width:760px){
  .conversation-list{
    max-height:230px;
  }
  .conversation-rename-form{
    grid-template-columns:minmax(0,1fr) auto auto;
  }
  .topbar{
    align-items:flex-start;
    margin-bottom:12px;
  }
  .brand h1{font-size:1.35rem}
  .brand p{display:none}
  .account-area{flex:1 1 auto}
  .chat-workspace{
    display:block;
    height:clamp(380px,calc(100vh - 125px),800px);
    height:clamp(380px,calc(100dvh - 125px),800px);
    min-height:0;
    overflow:hidden;
  }
  .chat-sidebar{
    position:absolute;
    inset:0 auto 0 0;
    z-index:50;
    width:min(86vw,320px);
    transform:translateX(-103%);
    transition:transform .2s ease;
    box-shadow:18px 0 40px rgba(0,0,0,.35);
  }
  .chat-workspace.sidebar-open .chat-sidebar{
    transform:translateX(0);
  }
  .chat-main-panel{
    height:100%;
  }
  .chat-sidebar-toggle{
    display:grid;
    place-items:center;
  }
  .chat-conversation-header{
    min-height:66px;
    padding:10px 12px;
  }
  .chat-messages{
    padding:18px 12px 14px;
  }
  .chat-message-content{
    max-width:92%;
  }
  .chat-composer{
    padding:9px 10px calc(10px + env(safe-area-inset-bottom,0px));
  }
  .chat-composer-meta{
    align-items:flex-start;
    flex-direction:column;
  }
  .chat-usage-meta{
    width:100%;
    justify-content:flex-start;
  }
}

@media (max-width:520px){
  .main-tabs{
    overflow-x:auto;
    justify-content:flex-start;
  }
  .tab-button{
    flex:0 0 auto;
  }
  .chat-workspace{
    height:clamp(360px,calc(100vh - 118px),740px);
    height:clamp(360px,calc(100dvh - 118px),740px);
    min-height:0;
    border-radius:12px;
  }
  .conversation-id-line{display:none}
  .chat-title-group h2{font-size:.92rem}
  .chat-message-content{
    max-width:96%;
    font-size:.88rem;
  }
  .chat-composer-actions{
    align-items:flex-start;
  }
  .chat-composer-options{
    gap:7px;
  }
  .chat-option{
    font-size:.68rem;
  }
  .chat-input-shell{
    grid-template-columns:minmax(0,1fr) 44px;
    gap:6px;
    padding:5px;
  }
  .chat-send-button{
    width:44px;
    min-width:44px;
    min-height:44px;
    padding:0;
  }
  .chat-send-label{
    display:none;
  }
  .chat-send-icon{
    width:20px;
    height:20px;
  }
  .account-modal{
    width:calc(100vw - 16px);
    max-height:92dvh;
    border-radius:14px;
  }
  .account-modal-shell{
    max-height:92dvh;
  }
  .account-modal-header{
    padding:13px 14px 11px;
  }
  .account-modal-session{
    align-items:flex-start;
    flex-direction:column;
    padding:10px 14px;
  }
  .account-drawer-content{
    padding:2px 10px 12px;
  }
}


/* ============================================================
   Desktop density at browser zoom 100%
   Keep the application visually close to the previous 75%-zoom
   working view without using CSS zoom/transform scaling.
   ============================================================ */
@media (min-width:901px){
  body{
    font-size:14px;
  }

  .shell{
    max-width:1540px;
    padding:10px 14px 18px;
  }

  .topbar{
    min-height:38px;
    margin-bottom:3px;
  }
  .brand{
    min-width:220px;
  }
  .brand h1{
    font-size:1.18rem;
  }
  .brand p{
    margin-top:2px;
    font-size:.67rem;
  }

  .main-tabs{
    gap:4px;
    margin:4px 0;
    padding:3px;
    border-radius:9px;
  }
  .tab-button{
    padding:5px 9px;
    font-size:.76rem;
  }

  .card{
    padding:12px;
    margin:8px 0;
    border-radius:11px;
  }
  .stats{
    gap:8px;
  }
  .stats div{
    padding:8px;
    border-radius:8px;
  }

  .chat-workspace{
    grid-template-columns:250px minmax(0,1fr);
    height:clamp(520px,calc(100vh - 100px),980px);
    height:clamp(520px,calc(100dvh - 100px),980px);
    margin-top:5px;
    border-radius:12px;
  }

  .chat-sidebar-brand{
    gap:8px;
    padding:10px 11px 7px;
  }
  .chat-sidebar-brand strong{
    font-size:.82rem;
  }
  .chat-sidebar-brand small{
    font-size:.62rem;
  }
  .chat-brand-mark{
    width:28px;
    height:28px;
    border-radius:9px;
  }

  .chat-sidebar-controls{
    padding:7px 10px 9px;
  }
  .btn-new-conversation{
    min-height:34px;
    padding:6px 9px;
    border-radius:9px;
    font-size:.76rem;
  }
  .conversation-search{
    margin-top:7px;
  }
  .conversation-search input{
    min-height:31px;
    padding:6px 8px 6px 28px;
    border-radius:8px;
    font-size:.72rem;
  }
  .conversation-search>span{
    left:9px;
    font-size:.72rem;
  }

  .chat-sidebar-section{
    padding:8px 10px;
  }
  .chat-sidebar-label,
  .chat-sidebar-label-row{
    font-size:.61rem;
  }
  .chat-sidebar-label-row{
    margin-bottom:5px;
  }
  .zero-ai-mini{
    padding:1px 5px;
    font-size:.56rem;
  }
  .conversation-projects{
    gap:4px;
    margin-top:6px;
  }
  .conversation-project{
    padding:3px 6px;
    font-size:.64rem;
  }
  .conversation-group+.conversation-group{
    margin-top:6px;
  }
  .conversation-group-title{
    padding:3px 4px 2px;
    font-size:.61rem;
  }
  .conversation-item{
    padding:6px 7px;
    border-radius:8px;
  }
  .conversation-item-title{
    font-size:.74rem;
  }
  .conversation-item-meta{
    gap:5px;
    margin-top:2px;
    font-size:.59rem;
  }
  .conversation-list{
    max-height:none;
  }
  .conversation-scroll-button{
    width:21px;
    height:21px;
    border-radius:6px;
    font-size:.62rem;
  }

  .chat-sidebar-footer{
    gap:7px;
    padding:7px 9px;
    font-size:.64rem;
  }
  .chat-history-note{
    gap:1px;
  }
  .sidebar-account-row{
    grid-template-columns:28px minmax(0,1fr) 30px;
    gap:7px;
    padding-top:6px;
  }
  .sidebar-avatar{
    width:28px;
    height:28px;
    min-width:28px;
    flex-basis:28px;
  }
  .sidebar-account-copy strong{
    font-size:.7rem;
  }
  .sidebar-account-copy small{
    font-size:.58rem;
  }
  .sidebar-settings-button{
    width:30px;
    height:30px;
    border-radius:8px;
  }
  .sidebar-settings-button svg{
    width:15px;
    height:15px;
  }

  .chat-conversation-header{
    min-height:50px;
    gap:10px;
    padding:7px 12px;
  }
  .chat-title-group h2{
    margin:1px 0;
    font-size:.86rem;
  }
  .conversation-rename-button{
    width:22px;
    height:22px;
    flex-basis:22px;
    font-size:.7rem;
  }
  .conversation-rename-form input{
    height:25px;
    font-size:.67rem;
  }
  .conversation-rename-form button{
    min-height:25px;
    padding:4px 6px;
    font-size:.61rem;
  }
  .chat-eyebrow,
  .conversation-id-line{
    font-size:.59rem;
  }
  .zero-ai-badge{
    gap:4px;
    padding:4px 7px;
    font-size:.67rem;
  }

  .chat-messages{
    padding:13px 24px 9px;
  }
  .chat-empty-state{
    gap:6px;
  }
  .chat-empty-state .chat-empty-mark{
    width:38px;
    height:38px;
    border-radius:12px;
  }
  .chat-empty-state h3{
    font-size:.98rem;
  }
  .chat-empty-state p{
    font-size:.76rem;
  }
  .chat-message{
    margin-bottom:11px;
  }
  .chat-message-role{
    margin:0 6px 3px;
    font-size:.59rem;
  }
  .chat-message-content{
    max-width:min(86%,900px);
    padding:8px 11px;
    border-radius:13px;
    font-size:.84rem;
    line-height:1.5;
  }
  .chat-message-actions{
    gap:4px;
    margin:4px 6px 0;
  }
  .chat-message-action{
    min-height:24px;
    padding:3px 7px;
    border-radius:7px;
    font-size:.6rem;
  }
  .chat-message-meta{
    gap:4px;
    margin:3px 6px 0;
    font-size:.58rem;
  }

  .chat-composer{
    padding:6px 10px 7px;
  }
  .chat-composer-meta{
    min-height:17px;
    gap:7px;
    margin:0 1px 3px;
    font-size:.6rem;
  }
  .memory-edit-target{
    gap:8px;
    margin:0 1px 5px;
    padding:6px 8px;
    border-radius:8px;
  }
  .memory-edit-target strong{
    font-size:.67rem;
  }
  .memory-edit-target span{
    font-size:.65rem;
  }
  .memory-edit-target code{
    font-size:.57rem;
  }
  .memory-edit-target .secondary-button{
    padding:4px 6px;
    font-size:.62rem;
  }
  .chat-input-shell{
    gap:6px;
    padding:4px;
    border-radius:10px;
  }
  .chat-input-shell textarea{
    min-height:36px;
    max-height:130px;
    padding:8px 8px 6px;
    font-size:.78rem;
  }
  .chat-send-button{
    min-width:78px;
    min-height:34px;
    padding:6px 9px;
    border-radius:8px;
    font-size:.72rem;
  }
  .chat-send-icon{
    width:15px;
    height:15px;
  }
  .chat-composer-actions{
    gap:8px;
    margin-top:4px;
  }
  .chat-composer-options{
    gap:9px;
  }
  .chat-option{
    gap:4px;
    font-size:.64rem;
  }

  .memory-title-row{
    margin-bottom:9px;
  }
  .memory-view-switch{
    gap:4px;
    margin-bottom:9px;
    padding:3px;
  }
  .memory-view-button{
    padding:5px 8px;
    font-size:.71rem;
  }
  .memory-layout{
    grid-template-columns:minmax(230px,31%) minmax(0,1fr);
    gap:9px;
    min-height:300px;
  }
  .memory-tree-panel{
    min-height:330px;
  }
  .memory-tree-heading{
    gap:2px;
    padding:8px 10px;
  }
  .memory-tree-heading strong{
    font-size:.75rem;
  }
  .memory-tree-heading span{
    font-size:.62rem;
  }
  .memory-tree{
    max-height:500px;
    padding:6px 5px 9px;
  }
  .memory-tree-folder>summary,
  .memory-tree-file{
    padding:5px 6px;
    font-size:.73rem;
  }
  .memory-tree-children{
    margin-left:9px;
    padding-left:6px;
  }
  .memory-detail{
    padding:11px;
  }
  .memory-detail h3{
    margin:10px 0 8px;
    font-size:.94rem;
  }
  .memory-path{
    margin:-2px 0 9px;
    padding:6px 8px;
    font-size:.64rem;
  }
  .memory-answer{
    min-height:90px;
    max-height:330px;
    padding:9px;
  }
  .memory-answer-label{
    margin-bottom:5px;
    font-size:.66rem;
  }
  .memory-metadata{
    gap:6px;
    margin:9px 0;
  }
  .memory-metadata div{
    padding:6px;
  }
  .memory-metadata dt{
    font-size:.61rem;
  }
  .memory-metadata dd{
    margin-top:2px;
    font-size:.73rem;
  }
  .memory-detail-actions{
    gap:6px;
  }
  .memory-detail-actions button{
    padding:5px 8px;
    font-size:.7rem;
  }
  .memory-list{
    max-height:470px;
  }
  .memory-list-item{
    padding:8px;
  }
  .memory-list-item strong{
    font-size:.78rem;
  }
  .memory-list-meta{
    gap:5px;
    margin-top:5px;
    font-size:.61rem;
  }
  .memory-controls{
    grid-template-columns:minmax(200px,1fr) minmax(130px,170px) minmax(130px,170px) auto auto;
    gap:6px;
    margin-bottom:9px;
  }
  .memory-controls input,
  .memory-controls select{
    padding:6px 8px;
    font-size:.7rem;
  }

  .context-title-row,
  .context-stats{
    margin-bottom:9px;
  }
  .context-grid{
    gap:8px;
  }
  .context-box{
    padding:10px;
    border-radius:9px;
  }
  .context-box h3{
    font-size:.84rem;
  }
  .context-box>p,
  .context-box .row p{
    font-size:.7rem;
  }
  .context-code{
    min-height:72px;
    max-height:250px;
    margin:5px 0 7px;
    padding:8px;
    font-size:.69rem;
  }
  .context-list{
    gap:5px;
    max-height:280px;
    margin-top:7px;
  }
  .context-list-item{
    padding:6px 8px;
  }
  .context-list-item strong{
    font-size:.71rem;
  }
  .context-list-item small{
    font-size:.61rem;
  }

  .account-modal{
    width:min(820px,calc(100vw - 40px));
  }
  .account-modal-header{
    padding:12px 14px 10px;
  }
  .account-modal-session{
    padding:8px 14px;
  }
  .account-drawer-content{
    padding:2px 10px 12px;
  }
}
