:root{
  --primary: #0C8742; /* CLA green - accent only */
  --bg: #f7f7f7;
  --workspace-bg: #f7f7f7;
  --surface: #ffffff;
  --surface-strong: #f2f4f3;
  --surface-soft: #f8faf8;
  --border: rgba(0,0,0,0.06);
  --text: #111111;
  --muted: #6e6e6e;
  --chat-input-bg: #f2f4f3;
  --chat-input-border: rgba(0,0,0,0.08);
  --chat-overlay: rgba(255,255,255,0);
  --chat-bg-opacity: 0.22;
  --chat-bg-filter: none;
  --chat-window-border: rgba(0,0,0,0.06);
  --session-sidebar-bg: #ffffff;
  --session-sidebar-border: rgba(0,0,0,0.08);
  --session-search-bg: #f7f9f6;
  --session-search-border: rgba(0,0,0,0.08);
  --session-item-bg: rgba(255,255,255,0.96);
  --session-item-hover: rgba(0,0,0,0.03);
  --session-item-active-bg: rgba(12,135,66,0.08); /* green allowed as accent */
  --session-item-active-border: rgba(12,135,66,0.18);
  --welcome-card-bg: rgba(255,255,255,0.60);
  --welcome-card-border: rgba(0,0,0,0.06);
  --suggestion-bg: rgba(255,255,255,0.88);
  --welcome-title-color: #111111;
  --welcome-text-color: #6e6e6e;
  --header-title-color: #000000;
  --header-copy-color: #6e6e6e;
  --message-user-bg: rgba(229,243,234,0.90);
  --message-user-border: rgba(12,135,66,0.28);
  --message-user-text: #11402c;
  --message-assistant-bg: rgba(244,246,244,0.92);
  --message-assistant-border: rgba(0,0,0,0.08);
  --message-assistant-text: #1f2920;
}
html[data-theme="dark"]{
  --bg: #111111;
  --workspace-bg: #111111;
  --surface: #151515;
  --surface-strong: #181818;
  --surface-soft: #1c1c1c;
  --border: rgba(255,255,255,0.06);
  --text: #fdfdfd;
  --muted: #A3A3A3;
  --chat-input-bg: #1C1C1C;
  --chat-input-border: rgba(255,255,255,0.04);
  --chat-overlay: rgba(0,0,0,0.72); /* neutral dark overlay */
  --chat-bg-opacity: 0.12;
  --chat-bg-filter: none;
  --chat-window-border: rgba(42,42,42,0.6);
  --session-sidebar-bg: #151515;
  --session-sidebar-border: rgba(42,42,42,0.6);
  --session-search-bg: #121212;
  --session-search-border: rgba(42,42,42,0.6);
  --session-item-bg: transparent;
  --session-item-hover: rgba(255,255,255,0.02);
  --session-item-active-bg: rgba(12,135,66,0.06); /* accent only */
  --session-item-active-border: rgba(12,135,66,0.16);
  --welcome-card-bg: rgba(18,18,18,0.60);
  --welcome-card-border: rgba(255,255,255,0.04);
  --suggestion-bg: rgba(18,18,18,0.82);
  --welcome-title-color: #F2F2F2;
  --welcome-text-color: #A3A3A3;
  --header-title-color: #000000;
  --header-copy-color: #C5C5C5;
  /* Preserve approved message colors - do not change these */
  --message-user-bg: rgba(23,60,42,0.70);
  --message-user-border: rgba(12,135,66,0.4);
  --message-user-text: #e7f0e8;
  --message-assistant-bg: rgba(36,42,38,0.70);
  --message-assistant-border: rgba(255,255,255,0.08);
  --message-assistant-text: #e8eee6;
}
*{box-sizing:border-box}
@media (prefers-reduced-motion: reduce){
  *,*::before,*::after{animation-duration:0.001ms!important;animation-iteration-count:1!important;transition-duration:0.001ms!important;scroll-behavior:auto!important}
}
html, body{height:100%;margin:0;font-family:Inter,Segoe UI,Arial,Helvetica,sans-serif;background:var(--bg);color:var(--text);overflow:hidden}
button, input, textarea{font:inherit}
.app{display:flex;flex-direction:column;height:100vh;overflow:hidden;background:var(--bg)}
.navbar{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:0 20px;height:55px;background:#fff;border-bottom:1px solid rgba(0,0,0,0.08);flex-shrink:0}
.navbar-brand{display:flex;align-items:center;gap:10px}
.navbar-logo{height:34px;width:auto;object-fit:contain}
.navbar-title{font-size:0.95rem;font-weight:700;color:var(--primary);letter-spacing:0.04em}
.navbar-nav{display:flex;align-items:center;flex-wrap:wrap;gap:16px}
.navbar-theme-btn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;border-radius:8px;border:1px solid rgba(0,0,0,0.1);background:#f5f5f5;color:black;cursor:pointer;transition:all 0.2s ease;font-size:1rem}
.navbar-theme-btn:hover{background:#e8e8e8;border-color:var(--primary)}
.nav-link{font-size:0.82rem;text-decoration:none;color:#1e1e1e;text-transform:uppercase;letter-spacing:0.12em;padding:0 0;transition:color 0.2s ease}
.nav-link:hover{color:var(--primary)}
.nav-link.active{color:var(--primary);font-weight:700;border-bottom:2px solid var(--primary);padding-bottom:4px}
.workspace{display:flex;flex:1;min-height:0;overflow:hidden;background:var(--workspace-bg)}
.chat-panel{width:270px;min-width:260px;height:100%;display:flex;flex-direction:column;gap:12px;padding:18px;background:var(--session-sidebar-bg);border-right:1px solid var(--session-sidebar-border);overflow:hidden;min-height:0;flex-shrink:0;transition:width 0.16s ease}
.chat-panel-header{display:flex;align-items:center;justify-content:space-between;gap:10px;flex-shrink:0}
.sidebar-title{font-size:0.98rem;font-weight:700;color:var(--text)}
.sidebar-subtitle{font-size:0.86rem;color:var(--muted);margin-top:2px;line-height:1.3}
.new-chat{border:none;background:var(--primary);color:#fff;padding:10px 14px;border-radius:12px;cursor:pointer;transition:background 0.2s ease;white-space:nowrap}
.new-chat:hover{background:#0e9f4c}
.chat-search{flex-shrink:0}
.chat-search input{width:100%;padding:10px 12px;border-radius:12px;border:1px solid var(--session-search-border);background:var(--session-search-bg);color:var(--text);outline:none}
.chat-search input::placeholder{color:var(--muted)}
.chat-list-wrapper{flex:1;min-height:0;overflow:hidden;display:flex;flex-direction:column}
.chat-list{flex:1;display:flex;flex-direction:column;gap:8px;padding-right:6px;overflow-y:auto;overflow-x:hidden;min-height:0}
.chat-list::-webkit-scrollbar{width:8px}
.chat-list::-webkit-scrollbar-thumb{background:rgba(0,0,0,0.28);border-radius:999px}
.chat-list::-webkit-scrollbar-track{background:rgba(0,0,0,0.06)}
.chat-list{scrollbar-width:thin;scrollbar-color:rgba(0,0,0,0.28) rgba(0,0,0,0.06)}
.session-item-row{position:relative;display:flex;align-items:center;gap:8px}
.chat-item{flex:1;min-width:0;padding:10px 12px;border-radius:12px;background:var(--session-item-bg);border:1px solid var(--session-sidebar-border);color:var(--text);cursor:pointer;transition:all 0.18s ease;display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-align:left;max-width:100%}
.chat-item.active{border-color:var(--session-item-active-border);background:var(--session-item-active-bg);}
.chat-item:hover{background:var(--session-item-hover);border-color:var(--session-item-active-border)}
.session-more-btn{flex-shrink:0;width:30px;height:30px;border-radius:8px;border:1px solid var(--session-sidebar-border);background:transparent;display:flex;align-items:center;justify-content:center;cursor:pointer}
.session-more-btn:hover{background:var(--session-item-hover);border-color:var(--session-item-active-border)}
.session-more-icon{width:18px;height:18px;object-fit:contain}
.session-menu-portal{position:fixed;inset:0;pointer-events:none;z-index:90}
.session-menu{position:fixed;min-width:140px;padding:6px;border-radius:12px;background:var(--surface);border:1px solid var(--session-sidebar-border);box-shadow:0 12px 24px rgba(0,0,0,0.16);z-index:90;display:flex;flex-direction:column;gap:4px;pointer-events:auto}
.session-menu-item{display:flex;align-items:center;gap:8px;padding:10px 12px;border:none;border-radius:8px;background:transparent;color:var(--text);text-align:left;cursor:pointer}
.session-menu-item:hover{background:var(--session-item-hover);color:var(--primary)}
.session-menu-item .menu-icon{width:16px;height:16px;object-fit:contain}
.session-footer{padding-top:18px;border-top:1px solid var(--session-sidebar-border);flex-shrink:0}
.sidebar-actions{display:flex;gap:10px;margin-bottom:18px}
.icon-btn{width:40px;height:40px;border-radius:12px;border:1px solid var(--session-sidebar-border);background:transparent;color:var(--text);cursor:pointer;display:flex;align-items:center;justify-content:center;transition:border-color 0.16s ease, color 0.16s ease}
.icon-btn:hover{border-color:var(--primary);color:var(--primary)}
.control-icon{width:20px;height:20px;object-fit:contain}
.icon.icon-sun{display:inline-flex;width:22px;height:22px;font-size:20px;align-items:center;justify-content:center}
.icon{display:inline-flex;width:20px;height:20px;fill:currentColor}
.profile-panel{display:flex;align-items:center;gap:12px}
.profile-avatar{width:40px;height:40px;border-radius:50%;background:rgba(0,0,0,0.06);color:var(--primary);display:flex;align-items:center;justify-content:center;font-weight:700;font-size:0.95rem}
.profile-info{display:flex;flex-direction:column;min-width:0}
.profile-name{font-size:0.95rem;font-weight:700;color:var(--text)}
.profile-role{font-size:0.82rem;color:var(--muted)}
.chat-main{flex:1;display:flex;flex-direction:column;min-width:0;min-height:0;overflow:hidden;padding:18px;position:relative;isolation:isolate}
.chat-resize-handle{width:8px;flex:0 0 8px;cursor:col-resize;position:relative;background:transparent}
.chat-resize-handle::before{content:'';position:absolute;inset:8px 2px; border-left:1px solid var(--session-sidebar-border); border-right:1px solid var(--session-sidebar-border); border-radius:999px; opacity:0.6; transition:opacity 0.2s ease}
.chat-resize-handle:hover::before,.chat-resize-handle:active::before{opacity:1; background:rgba(12,135,66,0.08)}
.chat-background-image{position:absolute;inset:0;background-image:url("../assets/Images/chatbackground_image.png");background-repeat:no-repeat;background-position:center;background-size:cover;pointer-events:none;z-index:0;opacity:0.4}
.chat-background-tint{position:absolute;inset:0;pointer-events:none;z-index:1;background:transparent}
.chat-content{position:relative;z-index:2;opacity:1;filter:none;mix-blend-mode:normal;display:flex;flex:1;flex-direction:column;min-height:0}
.chat-content > .chat-header,
.chat-content > .welcome-card,
.chat-content > .input-card,
.chat-content .chat-window-shell{
  max-width:1200px; /* wider chat area */
  margin:0 auto;
  width:100%;
}
.chat-header,.welcome-card,.chat-body,.input-card{position:relative;z-index:2;opacity:1;filter:none;mix-blend-mode:normal}
.chat-header{flex-shrink:0;padding-bottom:4px}
.chat-header-title,.chat-page-title{font-size:1.25rem;font-weight:700;color:#000000;line-height:1.15;opacity:1;filter:none;mix-blend-mode:normal}
.chat-header-copy,.chat-page-subtitle{margin-top:6px;color:var(--header-copy-color);line-height:1.6;max-width:720px;opacity:1;filter:none;mix-blend-mode:normal}
html[data-theme="dark"] .chat-background-tint{background:rgba(0, 0, 0, 0.72)}
html[data-theme="dark"] .chat-header .chat-header-title,
html[data-theme="dark"] .chat-header .chat-page-title{color:#000000 !important;opacity:1 !important;filter:none !important;mix-blend-mode:normal !important}
html[data-theme="dark"] .chat-header .chat-header-copy,
html[data-theme="dark"] .chat-header .chat-page-subtitle{color:#d1d5db !important;opacity:1 !important;filter:none !important;mix-blend-mode:normal !important}
.welcome-card{padding:24px 18px;background:var(--welcome-card-bg);border:1px solid var(--welcome-card-border);border-radius:16px;max-width:520px;width:min(520px, calc(100% - 32px));box-shadow:0 8px 20px rgba(0,0,0,0.04);position:relative;z-index:1;flex:0 0 auto;align-self:center;display:flex;flex-direction:column;align-items:center;text-align:center;margin-inline:auto}
.welcome-card#welcomeCard{width:700px;max-width:700px;}
.welcome-icon{width:42px;height:42px;border-radius:12px;background:var(--success-soft);display:flex;align-items:center;justify-content:center;font-size:1.2rem;color:var(--primary);margin-bottom:12px}
.welcome-title{font-size:1.25rem;font-weight:700;margin-bottom:6px;color:var(--welcome-title-color)}
.welcome-subtitle{color:var(--welcome-text-color);line-height:1.5;margin-bottom:12px;max-width:760px}
.suggestions{display:flex;flex-direction:column;gap:8px;width:100%}
.suggestion-btn{width:100%;text-align:left;padding:12px 16px;border-radius:12px;border:1px solid var(--welcome-card-border);background:var(--suggestion-bg);color:var(--text);cursor:pointer;transition:all 0.18s ease;white-space:normal;height:52px;display:flex;align-items:center}
.suggestion-btn:hover{border-color:var(--primary);color:var(--primary);background:rgba(12,135,66,0.04)}
.chat-body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;display:flex;flex-direction:column;position:relative}

/* Scrollbar styling for the full-width main chat scroll owner (.chat-body) */
.chat-body{
  /* Firefox */
  scrollbar-width:thin;
  scrollbar-color: rgba(0,0,0,0.25) transparent; /* thumb, track */
}

/* WebKit-based browsers */
.chat-body::-webkit-scrollbar{
  width:10px;
}
.chat-body::-webkit-scrollbar-track,
.chat-body::-webkit-scrollbar-track-piece,
.chat-body::-webkit-scrollbar-corner{
  background: transparent;
}
.chat-body::-webkit-scrollbar-thumb{
  background: rgba(0,0,0,0.25);
  border-radius: 999px;
  border: 2px solid transparent; /* make thumb appear thinner */
  background-clip: content-box;
}

/* Dark theme overrides */
html[data-theme="dark"] .chat-body{
  scrollbar-color: rgba(255,255,255,0.35) transparent;
}
html[data-theme="dark"] .chat-body::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.35);
}
.chat-window-shell{flex:1;min-height:0;overflow:visible;border-radius:0;border:none;box-shadow:none;position:relative;z-index:1;background:transparent;max-width:1200px;margin:0 auto;width:100%}
.conversation-tracker-rail{position:fixed;right:var(--tracker-right,12px);top:70%;transform:translateY(-50%);z-index:110;height:70vh;width:20px;display:block}
.conversation-tracker-rail::before{content:'';display:block;margin-left:-20px;height:30%;width:8px;border-radius:6px;background:repeating-linear-gradient(to bottom, rgba(12,135,66,0.18) 0 10px, transparent 10px 20px)}

.conversation-tracker-panel{position:absolute;right:calc(var(--tracker-right,12px) + 26px);top:15%;transform:translateY(-50%) translateX(8px);width:320px;max-height:70vh;overflow-y:auto;overflow-x:hidden;background:var(--surface);border:1px solid var(--chat-window-border);border-radius:12px;padding:8px;box-shadow:0 12px 40px rgba(0,0,0,0.12);opacity:0;transition:all 0.18s ease;pointer-events:none}
.conversation-tracker-rail.open .conversation-tracker-panel{opacity:1;transform:translateY(-50%) translateX(0);pointer-events:auto}
.tracker-chip{display:flex;align-items:center;gap:8px;padding:8px 10px;border-radius:10px;border:1px solid transparent;background:var(--surface);color:var(--text);cursor:pointer;text-align:left;transition:all 0.18s ease;min-width:0;width:100%}
.tracker-chip:hover{border-color:var(--primary);background:rgba(12,135,66,0.06);transform:translateX(-6px)}
.tracker-index{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border-radius:999px;background:var(--primary);color:white;font-size:0.73rem;font-weight:700;flex-shrink:0}
.tracker-text{font-size:0.84rem;line-height:1.35;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1}
.tracker-highlight{border-color:var(--primary);background:rgba(12,135,66,0.06)}

.tracker-hover-preview{position:fixed;right:360px;top:120px;z-index:120;max-width:420px;background:var(--surface);border:1px solid var(--chat-window-border);border-radius:12px;padding:12px;box-shadow:0 12px 40px rgba(0,0,0,0.2);color:var(--text)}

/* Theme-aware dashed rail color */
.conversation-tracker-rail::before{background:repeating-linear-gradient(to bottom, rgba(12,135,66,0.18) 0 10px, transparent 10px 20px)}

/* Panel scrollbars */
.conversation-tracker-panel::-webkit-scrollbar, .tracker-hover-preview::-webkit-scrollbar { width: 10px; }
.conversation-tracker-panel::-webkit-scrollbar-track, .tracker-hover-preview::-webkit-scrollbar-track { background: transparent; }
.conversation-tracker-panel::-webkit-scrollbar-thumb, .tracker-hover-preview::-webkit-scrollbar-thumb { background: rgba(12,135,66,0.85); border-radius: 999px; }
.conversation-tracker-panel { scrollbar-width: thin; scrollbar-color: rgba(12,135,66,0.85) transparent; }
.tracker-hover-preview { scrollbar-width: thin; scrollbar-color: rgba(12,135,66,0.85) transparent; }
.tracker-hover-preview .preview-title{font-weight:700;margin-bottom:6px;color:var(--primary);font-size:0.95rem;word-wrap:break-word;white-space:normal;line-height:1.4}
.tracker-hover-preview .preview-body{font-size:0.88rem;color:var(--muted);max-height:220px;overflow:auto}

/* ensure tracker isn't shown on very small screens */
@media (max-width:900px){
  .conversation-tracker{display:none}
}
.chat-window{display:block;padding:16px 16px 12px 16px;background:transparent;border-radius:16px;width:100%}
.chat-window::-webkit-scrollbar{width:10px}
.chat-window::-webkit-scrollbar-track{background:transparent}
.chat-window::-webkit-scrollbar-thumb{background:rgba(0,0,0,0.12);border-radius:999px}
.msg-title{font-weight:700;color:var(--primary);margin-bottom:12px}
.assistant-msg,.user-msg{display:inline-block;width:auto;max-width:85%;padding:12px 14px;border-radius:16px;border:1px solid var(--border);line-height:1.5;white-space:pre-wrap}
.assistant-msg{background:var(--message-assistant-bg);align-self:flex-start;color:var(--message-assistant-text);border-color:var(--message-assistant-border)}
.user-msg{background:var(--message-user-bg);align-self:flex-end;color:var(--message-user-text);border-color:var(--message-user-border);max-width:75%}
#attachmentPreview{margin-bottom:10px}
.attachment-list{display:flex;flex-direction:column;gap:6px;padding:6px 6px;border-radius:10px;background:transparent;max-width:100%;max-height:140px;overflow:auto}
.attachment-row{display:flex;align-items:center;gap:8px;padding:6px 10px;border-radius:10px;background:var(--surface);border:1px solid var(--chat-input-border);min-height:36px}
.attachment-row .att-icon{width:20px;height:20px;flex:0 0 20px;display:flex;align-items:center;justify-content:center;font-size:0.95rem}
.attachment-row .file-name-wrap{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.attachment-row .file-name{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:0.95rem;color:var(--text)}
.attachment-row .file-meta{font-size:0.78rem;color:var(--muted);margin-left:6px}
.attachment-row .file-error{font-size:0.75rem;color:#dc2626;line-height:1.3}
.attachment-row.status-error{border-color:rgba(220,38,38,0.35);background:rgba(220,38,38,0.05)}
.attachment-row .remove-attachment{background:transparent;border:none;color:var(--muted);cursor:pointer;padding:6px 8px;flex:0 0 auto}
.att-spinner{width:14px;height:14px;border-radius:50%;border:2px solid var(--border);border-top-color:var(--primary);animation:attachment-spin 0.7s linear infinite}
@keyframes attachment-spin{to{transform:rotate(360deg)}}
.attachment-notice{font-size:0.78rem;color:#dc2626;padding:2px 6px 6px}
.message-attachments{margin-top:10px;display:flex;flex-direction:column;gap:6px}
.message-attachments .attachment-row{background:transparent;border:1px solid rgba(255,255,255,0.04);height:32px;padding:6px 8px}
.message-attachments .file-name{color:inherit;font-size:0.95rem}
.input-card{padding:12px;border-radius:20px;background:var(--surface);border:1px solid var(--chat-input-border);position:relative;z-index:2;margin:12px auto 0;flex-shrink:0;max-width:1200px;width:100%}
.input-box{display:flex;align-items:center;gap:10px;padding:8px 10px;border-radius:20px;background:var(--chat-input-bg);border:1px solid var(--chat-input-border)}
.upload-btn{width:38px;height:38px;border-radius:12px;border:1px solid var(--chat-input-border);background:transparent;color:var(--primary);cursor:pointer;display:flex;align-items:center;justify-content:center}
#fileUpload{display:none}
textarea#messageInput{flex:1;min-height:40px;max-height:140px;padding:8px 10px;border:none;border-radius:14px;background:transparent;color:var(--text);resize:none;outline:none;line-height:1.4;overflow:hidden;overflow-wrap:break-word}
textarea#messageInput::placeholder{color:var(--muted)}
.send-btn{border:none;padding:0 14px;height:40px;border-radius:18px;background:var(--primary);color:#fff;cursor:pointer;transition:background 0.16s ease;display:flex;align-items:center;justify-content:center}
.send-btn:hover{background:#0e9f4c}
@media (max-width:1080px){
  .chat-panel{width:300px}
}
@media (max-width:900px){
  .navbar{flex-wrap:wrap;gap:12px}
  .navbar-nav{gap:12px}
  .workspace{flex-direction:column}
  .chat-panel{width:100%;min-width:0;border-right:none;border-bottom:1px solid rgba(0,0,0,0.08)}
  .chat-main{padding:18px}
}

/* Dark-theme scrollbar override: neutral thumb */
html[data-theme="dark"] .chat-window::-webkit-scrollbar-thumb,
html[data-theme="dark"] .chat-list::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,0.18);
}
html[data-theme="dark"] .chat-list::-webkit-scrollbar-track{
  background: rgba(255,255,255,0.04);
}
html[data-theme="dark"] .chat-list{
  scrollbar-color: rgba(255,255,255,0.18) rgba(255,255,255,0.04);
}
html[data-theme="dark"] .notification-icon,
html[data-theme="dark"] .attachment-icon,
html[data-theme="dark"] .session-more-icon{
  filter: brightness(0) invert(1);
}
.dialog-overlay{position:fixed;inset:0;background:rgba(0,0,0,0.45);display:flex;align-items:center;justify-content:center;z-index:80;padding:16px}
.dialog-overlay[hidden]{display:none}
.dialog-card{width:min(420px,100%);padding:20px;border-radius:16px;background:var(--surface);border:1px solid var(--session-sidebar-border);box-shadow:0 16px 40px rgba(0,0,0,0.16)}
.dialog-title{font-size:1.05rem;font-weight:700;margin-bottom:8px;color:var(--text)}
.dialog-description{margin-bottom:16px;color:var(--muted);line-height:1.6}
.dialog-error{min-height:18px;margin-bottom:10px;color:#d64545;font-size:0.9rem}
.dialog-actions{display:flex;justify-content:flex-end;gap:10px}
.dialog-btn{border:none;border-radius:10px;padding:10px 14px;cursor:pointer;font-weight:600}
.dialog-btn.secondary{background:transparent;border:1px solid var(--session-sidebar-border);color:var(--text)}
.dialog-btn.danger{background:#d64545;color:#fff}
.dialog-btn:disabled{opacity:0.7;cursor:not-allowed}

.message-follow-ups {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.follow-up-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 8px;
}

.follow-up-chips-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

.follow-up-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.9rem;
  line-height: 1.4;
  text-align: left;
  font-weight: 500;
  min-height: 40px;
  white-space: normal;
  word-break: break-word;
}

.chip-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  min-width: 24px;
  background-color: var(--primary);
  color: white;
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chip-text {
  flex: 1;
  display: block;
}

.follow-up-chip:hover {
  border-color: var(--primary);
  background: rgba(12, 135, 66, 0.08);
  transform: translateX(4px);
}

.follow-up-chip:active {
  transform: translateX(2px);
}

.assistant-msg strong {
  color: var(--primary);
  font-weight: 700;
}
.assistant-msg code {
  font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 4px;
  border-radius: 4px;
  font-size: 0.9em;
}
[data-theme="dark"] .assistant-msg code {
  background: rgba(255, 255, 255, 0.1);
}

/* RAG Search Citations Styling */
.citations-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--border);
  width: 100%;
}
.citations-header-title {
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
}
.confidence-hedge {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}
.confidence-hedge svg {
  flex-shrink: 0;
  margin-top: 1px;
}
.citation-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.02);
  transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 0;
}
.citation-card:hover {
  border-color: var(--primary);
  box-shadow: 0 6px 16px rgba(12,135,66,0.12);
  transform: translateY(-2px);
}
.citation-card-collapsed {
  margin-top: 0;
}
.citation-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  margin-top: 2px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}
.citation-toggle-btn:hover {
  border-color: var(--primary);
  background: rgba(12, 135, 66, 0.06);
}
.citation-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.citation-badge {
  background: rgba(12,135,66,0.1);
  color: var(--primary);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.citation-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  min-width: 0;
  cursor: default;
}
.citation-title:hover {
  /* On hover, allow scrolling to read the full title */
  overflow-x: auto;
  text-overflow: clip;
}
.citation-excerpt {
  margin: 2px 0 0;
  padding: 8px 10px;
  background: rgba(12, 135, 66, 0.05);
  border-radius: 6px;
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--text);
  font-style: italic;
}
.citation-excerpt::before { content: '\201C'; }
.citation-excerpt::after { content: '\201D'; }
.citation-details {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  font-size: 0.8rem;
  color: var(--muted);
  border-top: 1px solid rgba(0,0,0,0.03);
  padding-top: 8px;
}
html[data-theme="dark"] .citation-details {
  border-top: 1px solid rgba(255,255,255,0.03);
}
.citation-detail-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  flex: 0 0 auto;
}
/* Title field spans full width and scrolls horizontally so it stays on one line */
.citation-detail-item.is-title {
  width: 100%;
  flex: 0 0 100%;
  margin-bottom: 2px;
}
.citation-detail-item.is-title .citation-detail-value {
  white-space: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  text-overflow: clip;
  scrollbar-width: thin;
  scrollbar-color: rgba(0,0,0,0.18) transparent;
  padding-bottom: 2px;
  max-width: 100%;
}
.citation-detail-item.is-title .citation-detail-value::-webkit-scrollbar {
  height: 4px;
}
.citation-detail-item.is-title .citation-detail-value::-webkit-scrollbar-thumb {
  background: rgba(0,0,0,0.18);
  border-radius: 999px;
}
html[data-theme="dark"] .citation-detail-item.is-title .citation-detail-value::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.2);
}
.citation-detail-label {
  color: var(--muted);
  font-weight: 700;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.citation-detail-value {
  color: var(--text);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
  line-height: 1.4;
}

/* Deep Link Citation Actions */
.citation-card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  margin-bottom: 2px;
  gap: 8px;
  min-width: 0;
}
.open-citation-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  background-color: var(--primary-light);
  border: 1px solid rgba(12, 135, 66, 0.15);
  color: var(--primary);
  font-family: inherit;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
}
.open-citation-btn svg {
  width: 10px;
  height: 10px;
}
.open-citation-btn:hover {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}
html[data-theme="dark"] .open-citation-btn {
  background-color: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.2);
  color: #10b981;
}
html[data-theme="dark"] .open-citation-btn:hover {
  background-color: #10b981;
  border-color: #10b981;
  color: #ffffff;
}

/* Markdown formatting inside assistant messages — emphasis, not document headers */
.assistant-msg h1, .assistant-msg h2, .assistant-msg h3 {
  margin-top: 1em;
  margin-bottom: 0.4em;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
}
.assistant-msg h1 { font-size: 1.15rem; color: var(--primary); }
.assistant-msg h2 { font-size: 1.08rem; }
.assistant-msg h3 { font-size: 1.02rem; }

.assistant-msg p {
  margin-bottom: 0.9em;
  line-height: 1.65;
}
.assistant-msg ul, .assistant-msg ol {
  margin-bottom: 1em;
  padding-left: 24px;
}
.assistant-msg li {
  margin-bottom: 0.4em;
}

/* Responsive Table Container */
.table-container {
  width: 100%;
  overflow-x: auto;
  margin: 1.2rem 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background-color: var(--surface);
  box-shadow: 0 2px 8px rgba(0,0,0,0.01);
}
.table-container table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  color: var(--text);
  min-width: 450px;
}
.table-container th {
  background-color: var(--surface-strong);
  font-weight: 700;
  padding: 10px 14px;
  border-bottom: 2px solid var(--border);
}
.table-container td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}

/* Citation Ref Link (Superscript) */
.citation-ref-link {
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.75rem;
  vertical-align: super;
  margin-left: 2px;
  padding: 1px 4px;
  border-radius: 4px;
  background-color: rgba(12, 135, 66, 0.06);
  transition: all 0.2s ease;
}
.citation-ref-link:hover {
  background-color: var(--primary);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(12, 135, 66, 0.2);
}

/* Inline Citation Breadcrumbs Row */
.citations-breadcrumbs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
}
.citation-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  background-color: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.22s ease;
}
.citation-breadcrumb-item:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: rgba(12, 135, 66, 0.04);
  transform: translateY(-1px);
}
.citation-breadcrumb-item svg {
  width: 12px;
  height: 12px;
}

/* Highlighted Citation Card */
.citation-card.highlight {
  animation: highlight-glow 1.8s ease-out;
}
@keyframes highlight-glow {
  0% { box-shadow: 0 0 0 0 rgba(12, 135, 66, 0.4); border-color: var(--primary); background-color: rgba(12, 135, 66, 0.05); }
  50% { box-shadow: 0 0 14px 4px rgba(12, 135, 66, 0.25); border-color: var(--primary); background-color: rgba(12, 135, 66, 0.05); }
  100% { box-shadow: 0 4px 12px rgba(0,0,0,0.02); border-color: var(--border); background-color: var(--surface); }
}

/* Message Action Buttons (Feedback Loop) */
.message-bubble-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  margin-bottom: 16px;
}
.message-actions {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  padding-left: 4px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.message-bubble-wrapper:hover .message-actions {
  opacity: 1;
}
.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.18s ease;
  position: relative;
}
.action-btn:hover {
  background-color: var(--surface-strong);
  color: var(--text);
}
.action-btn.active {
  color: var(--primary);
}
.action-btn.active.thumbs-down {
  color: #dc2626;
}

/* Tooltip for Copy Action */
.action-btn[data-tooltip]::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background-color: #1f2937;
  color: #ffffff;
  font-size: 0.7rem;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
  z-index: 50;
}
.action-btn[data-tooltip]:hover::before {
  opacity: 1;
  visibility: visible;
}

/* Citations Breadcrumbs Styling */
.citations-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 10px;
  margin-bottom: 10px;
  font-size: 0.8rem;
  color: var(--muted);
  width: 100%;
}
.citations-breadcrumbs-label {
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  margin-right: 4px;
}
.citation-breadcrumb-item-chain {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-family: inherit;
  font-size: 0.8rem;
  text-decoration: underline;
}
.citation-breadcrumb-item-chain:hover {
  background-color: rgba(12, 135, 66, 0.08);
  color: #0b7339;
}
.citation-breadcrumb-separator {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.75rem;
}
.citation-breadcrumb-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.citation-breadcrumb-item svg {
  width: 12px;
  height: 12px;
}
.citation-breadcrumb-item:hover {
  border-color: var(--primary);
  color: var(--primary);
  background-color: rgba(12, 135, 66, 0.04);
}

