/* Chat history uses the existing Fusion sidebar tokens and native dialog primitives. */
body.assist-page.fusion-21st .assist-history { display:flex; flex:1 1 auto; flex-direction:column; min-height:150px; overflow:hidden; }
.history-content:not([hidden]) { display:flex; flex:1; flex-direction:column; min-height:0; }
.history-privacy { flex:none; margin:8px 4px 0; min-height:36px; padding:8px; border:1px solid var(--ui-line); border-radius:7px; background:none; color:var(--ui-secondary); font:inherit; font-size:12px; text-align:left; cursor:pointer; }
.history-privacy:hover,.history-privacy[aria-pressed=true] { color:var(--ui-fg); background:var(--ui-muted); }
.history-scroll { min-height:0; overflow:auto; scrollbar-width:thin; flex:1; padding-bottom:8px; }
body.assist-page.fusion-21st .sidebar-nav { flex:0 0 auto; min-height:0; max-height:none; overflow:visible; }
.history-heading { display:flex; align-items:center; gap:4px; padding:16px 4px 5px 8px; }
.history-heading>button:first-child { display:flex; align-items:center; gap:8px; flex:1; padding:0; border:0; background:none; color:var(--ui-secondary); font:inherit; font-size:12px; text-align:left; cursor:pointer; }
.history-heading [aria-expanded=false] span { transform:rotate(-90deg); }
.history-list { list-style:none; padding:0; margin:0; }
.history-row { display:flex; align-items:center; gap:0; min-width:0; border-radius:7px; position:relative; }
.history-row:hover,.history-row:focus-within,.history-row.active { background:color-mix(in srgb,var(--ui-fg) 6%,transparent); }
.history-row.active { background:color-mix(in srgb,var(--ui-fg) 9%,transparent); }
.history-open,.history-project-toggle { display:flex; flex:1; align-items:center; gap:8px; width:0; min-width:0; min-height:36px; padding:7px 8px; border:0; border-radius:7px; background:none; color:var(--ui-fg); font:inherit; font-size:13px; line-height:20px; text-align:left; cursor:pointer; }
.history-name { flex:1; min-width:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.history-row svg,.history-menu svg { width:16px; height:16px; flex:none; }
.history-pin { display:flex; color:var(--ui-secondary); }
.history-pin svg { width:13px; height:13px; }
.history-icon-button { display:inline-flex; align-items:center; justify-content:center; flex:none; width:28px; height:30px; padding:0; border:0; border-radius:6px; background:none; color:var(--ui-secondary); font:inherit; font-size:19px; cursor:pointer; }
.history-icon-button:hover { background:color-mix(in srgb,var(--ui-fg) 8%,transparent); color:var(--ui-fg); }
.history-row>.history-icon-button { opacity:0; }
.history-row:hover>.history-icon-button,.history-row:focus-within>.history-icon-button,.history-row.active>.history-icon-button,.history-row>[aria-expanded=true] { opacity:1; }
.history-project-chats { margin-left:15px; padding-left:7px; border-left:1px solid var(--ui-line); }
.history-more,.history-archive { padding:8px; width:100%; border:0; border-radius:6px; background:none; color:var(--ui-secondary); font:inherit; font-size:12px; text-align:left; cursor:pointer; }
.history-more:hover,.history-archive:hover { color:var(--ui-fg); background:var(--ui-muted); }
.history-archive { flex:none; margin-top:6px; }
.history-empty,.history-notice { margin:6px 8px; font-size:12px; line-height:1.5; color:var(--ui-secondary); overflow-wrap:anywhere; }
.history-notice { flex:none; color:var(--danger,#c62828); }
.history-notice button { border:0; background:none; padding:4px 0; color:inherit; text-decoration:underline; cursor:pointer; }
.history-menu,.history-dialog { box-sizing:border-box; border:1px solid var(--ui-line); background:var(--ui-bg); color:var(--ui-fg); font-family:var(--fusion-font,Inter,sans-serif); box-shadow:0 12px 40px #0002; }
.history-menu { position:fixed; inset:auto; margin:0; width:246px; max-width:calc(100vw - 16px); max-height:calc(100dvh - 16px); padding:6px; border-radius:12px; overflow:auto; }
body.fusion-21st dialog.history-menu::backdrop { background:transparent; backdrop-filter:none; }
.history-menu [role=menuitem] { display:flex; align-items:center; gap:10px; width:100%; min-height:36px; border:0; border-radius:6px; padding:8px 10px; background:none; color:var(--ui-fg); font:inherit; font-size:13px; line-height:20px; text-align:left; cursor:pointer; overflow-wrap:anywhere; }
.history-menu [role=menuitem]:hover,.history-menu [role=menuitem]:focus-visible { background:var(--ui-muted); }
.history-menu hr { margin:5px 4px; border:0; border-top:1px solid var(--ui-line); }
.history-menu .history-danger,.history-dialog .history-danger { color:var(--danger,#c62828); }
.history-menu .history-submenu-caret { margin-left:auto; }
.history-dialog { width:440px; max-width:calc(100vw - 24px); max-height:calc(100dvh - 32px); padding:24px; border-radius:16px; overflow:auto; }
.history-dialog::backdrop { background:#0006; }
.history-dialog h2 { margin:0 0 12px; font-size:19px; font-weight:600; line-height:1.35; overflow-wrap:anywhere; }
.history-dialog p { font-size:13px; line-height:1.6; color:var(--ui-secondary); }
.history-dialog label { display:block; font-size:13px; margin:14px 0 6px; }
.history-dialog input { box-sizing:border-box; width:100%; min-height:40px; padding:8px 10px; border:1px solid var(--ui-line); border-radius:8px; background:var(--ui-muted); color:var(--ui-fg); font:inherit; font-size:14px; }
.history-dialog-actions { display:flex; justify-content:flex-end; flex-wrap:wrap; gap:8px; margin-top:20px; }
.history-dialog-actions button { min-height:36px; border:1px solid var(--ui-line); border-radius:7px; padding:7px 12px; background:var(--ui-bg); color:var(--ui-fg); font:inherit; font-size:13px; cursor:pointer; }
.history-dialog-actions .history-primary { background:var(--fusion-accent,#2b6cb0); color:#fff; border-color:transparent; }
.history-dialog [role=alert] { color:var(--danger,#c62828); }
.history-menu button:disabled,.history-dialog button:disabled,.assist-history button:disabled { opacity:.45; cursor:wait; }
.history-dialog :focus-visible,.history-menu :focus-visible,.assist-history :focus-visible { outline:2px solid var(--fusion-accent,#2b6cb0); outline-offset:2px; }
.assist-project-context { max-width:640px; width:100%; margin:0 auto 8px; padding:0 16px; box-sizing:border-box; color:var(--ui-secondary); font-size:12px; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; }
.chat-share-main { box-sizing:border-box; width:min(100%,760px); padding:32px 20px; margin:auto; }
.chat-share-main a { color:var(--fusion-accent); }
.chat-share-main>button { border:1px solid var(--ui-line); border-radius:7px; padding:8px 12px; background:var(--ui-bg); color:var(--ui-fg); cursor:pointer; }
.chat-share-main header { border-bottom:1px solid var(--ui-line); margin-bottom:28px; padding-bottom:20px; }
.chat-share-main h1 { font-size:26px; overflow-wrap:anywhere; }
.chat-share-main p { color:var(--ui-secondary); }
.chat-share-message { margin:24px 0; }
.chat-share-message h2 { font-size:13px; color:var(--ui-secondary); }
.chat-share-message .chat-share-text { font-size:14px; line-height:1.7; white-space:pre-wrap; overflow-wrap:anywhere; }
.chat-share-message.is-user .chat-share-text { background:var(--ui-muted); border-radius:14px; padding:12px 16px; }
@media(hover:none) { .history-row>.history-icon-button { opacity:1; } }
@media(min-width:901px) {
  /* Show every platform section; history takes the remaining sidebar space. */
  body.assist-page.fusion-21st>.app-sidebar { overflow-y:auto; }
  body.assist-page.fusion-21st .sidebar-nav-group { flex-shrink:0; }
  body.assist-page.fusion-21st .assist-history { flex:1 1 0; min-height:140px; }
  body.assist-page.fusion-21st .sidebar-footer { flex:none; gap:2px; margin-top:6px; padding:8px 8px 0; }
  body.assist-page.fusion-21st .sidebar-footer .toggle-row { min-height:28px; margin:0; padding:2px 0; }
  body.assist-page.fusion-21st .sidebar-footer .sidebar-clear-all { min-height:28px; margin:0; padding:3px 8px; }
  body.assist-page.fusion-21st .sidebar-platform-version { margin:2px 0 0; padding:0; font-size:10px; line-height:14px; }
}
@media(max-width:900px) {
  /* The mobile drawer owns scrolling; nested history must keep its natural height. */
  body.assist-page.fusion-21st .assist-history { height:auto; min-height:0; overflow:visible; flex:0 0 auto; }
  .history-scroll { flex:none; overflow:visible; }
  .history-content:not([hidden]) { flex:none; }
  .history-row>.history-icon-button { opacity:1; }
}
