/* === toolsinsight.cc v32 - Insight Technologies Design System === */
:root {
  --bg: #0F1820;
  --card: #1D2B3A;
  --accent: #1A8FBF;
  --accent-hover: #1478A3;
  --accent-light: rgba(26,143,191,0.12);
  --text: #fff;
  --text-muted: #6B94A6;
  --danger: #e74c3c;
  --success: #2ecc71;
  --warning: #f39c12;
  --radius: 0.65rem;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Raleway', sans-serif;
  min-height: 100vh;
}

/* ========== LOGIN ========== */
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg), #0a1018);
}
.login-card {
  background: var(--card); padding: 2.5rem; border-radius: var(--radius);
  width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  border: 1px solid rgba(26,143,191,0.15);
}
.login-card h1 {
  font-family: 'Montserrat', sans-serif; font-size: 1.8rem;
  color: var(--accent); margin-bottom: 0.25rem;
}
.login-card .subtitle { color: var(--text-muted); margin-bottom: 1.5rem; font-size: 0.9rem; }
.login-card input {
  width: 100%; padding: 0.85rem; margin-bottom: 0.75rem;
  background: var(--bg); border: 1px solid rgba(26,143,191,0.2);
  border-radius: var(--radius); color: var(--text); font-size: 1rem;
}
.login-card input:focus { outline: none; border-color: var(--accent); }
.login-card button {
  width: 100%; padding: 0.85rem; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius); font-size: 1rem;
  font-weight: 700; cursor: pointer; font-family: 'Montserrat', sans-serif;
}
.login-card button:hover { background: var(--accent-hover); }
.login-card .error { color: var(--danger); font-size: 0.85rem; margin-top: 0.75rem; min-height: 1.2em; }

/* ========== HEADER ========== */
.header {
  background: var(--card); border-bottom: 1px solid rgba(26,143,191,0.15);
  padding: 0.5rem 1rem; display: flex; align-items: center;
  justify-content: space-between; position: sticky; top: 0; z-index: 100;
}
.header .logo {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: 'Montserrat', sans-serif; font-weight: 800;
  font-size: 1.1rem; color: var(--accent);
}
.header .user-info { display: flex; align-items: center; gap: 0.75rem; }
.header .user-info span { color: var(--text-muted); font-size: 0.85rem; }
.header .badge {
  background: var(--accent); color: #fff; padding: 0.15rem 0.5rem;
  border-radius: 1rem; font-size: 0.7rem; font-weight: 700;
}
.header button {
  background: transparent; border: 1px solid var(--accent); color: var(--accent);
  padding: 0.35rem 0.75rem; border-radius: var(--radius); cursor: pointer; font-size: 0.8rem;
}
.header button:hover { background: var(--accent); color: #fff; }
.burger {
  display: none; background: transparent; border: none;
  color: var(--text); font-size: 1.5rem; cursor: pointer;
  position: sticky; top: 0; z-index: 101;
}

/* ========== OLLAMA BAR ========== */
.ollama-bar {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 1rem;
  background: rgba(26,143,191,0.05); border-bottom: 1px solid rgba(26,143,191,0.1);
  flex-wrap: wrap;
  position: sticky; top: 48px; z-index: 99;
}
.ollama-bar input, .ollama-bar select {
  flex: 1; min-width: 120px; padding: 0.4rem 0.5rem;
  background: var(--bg); border: 1px solid rgba(26,143,191,0.2);
  border-radius: 0.35rem; color: var(--text); font-size: 0.8rem;
}
.ollama-bar button {
  padding: 0.4rem 0.75rem; background: var(--accent); color: #fff;
  border: none; border-radius: 0.35rem; cursor: pointer;
  font-size: 0.8rem; white-space: nowrap;
}
.ollama-bar button:hover { background: var(--accent-hover); }
.status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0;
}
.status-dot.on { background: var(--success); }
.status-dot.off { background: var(--danger); }
.ollama-status { font-size: 0.75rem; color: var(--text-muted); }

/* ========== MAIN LAYOUT ========== */
.main-layout { display: flex; height: calc(100vh - 110px); }

/* ========== SIDEBAR ========== */
.sidebar {
  width: 300px;
  min-width: 300px;
  background: var(--card);
  border-right: 1px solid rgba(26,143,191,0.1);
  overflow-y: auto; flex-shrink: 0;
}
.sidebar .nav-item {
  padding: 0.75rem 1rem; cursor: pointer;
  border-bottom: 1px solid rgba(26,143,191,0.05);
  font-size: 0.85rem; display: flex; align-items: center; gap: 0.6rem;
  white-space: nowrap;
}
.sidebar .nav-item:hover { background: var(--accent-light); }
.sidebar .nav-item.active {
  background: var(--accent-light);
  border-left: 3px solid var(--accent); font-weight: 700;
}
.sidebar .nav-item .nav-icon {
  width: 20px; height: 20px; display: flex; align-items: center;
  justify-content: center; font-size: 1rem; flex-shrink: 0;
}

/* ========== CHAT AREA ========== */
.chat-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.chat-wrapper { flex: 1; display: flex; flex-direction: column; min-height: 0; }

/* ========== SESSION TABS ========== */
.session-tabs {
  display: flex; gap: 0.25rem; padding: 0.4rem 0.75rem;
  background: var(--bg); border-bottom: 1px solid rgba(26,143,191,0.1);
  overflow-x: auto; align-items: center;
  position: sticky; top: 0; z-index: 6;
}
.session-tab {
  padding: 0.35rem 0.75rem; background: var(--card);
  border: 1px solid rgba(26,143,191,0.15); border-radius: var(--radius);
  cursor: pointer; font-size: 0.75rem; white-space: nowrap;
  display: flex; align-items: center; gap: 0.3rem;
}
.session-tab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.session-tab .del { color: var(--danger); margin-left: 0.25rem; font-weight: 700; cursor: pointer; }
.session-tab .rename { color: var(--text-muted); margin-left: 0.15rem; cursor: pointer; font-size: 0.65rem; }
.session-tab .rename:hover { color: var(--accent); }
.session-tab.new-tab {
  background: transparent; border: 1px dashed var(--accent);
  color: var(--accent); font-weight: 700;
}
.session-tab.new-tab:hover { background: var(--accent-light); }
.session-tab.delete-all {
  background: transparent; border: 1px solid var(--danger);
  color: var(--danger); margin-left: auto;
}
.session-tab.delete-all:hover { background: rgba(231,76,60,0.1); }

/* ========== CHAT MESSAGES ========== */
.chat-messages { flex: 1; overflow-y: auto; padding: 1rem; }
.chat-msg {
  margin-bottom: 0.75rem; max-width: 85%; padding: 0.75rem 1rem;
  border-radius: var(--radius); line-height: 1.5; font-size: 0.9rem;
  word-wrap: break-word; overflow-wrap: break-word; word-break: break-word;
}
.chat-msg pre { 
  max-width: 100%; overflow-x: auto; white-space: pre; 
  background: var(--bg); padding: 0.5rem; border-radius: 0.35rem;
  margin: 0.5rem 0; font-size: 0.8rem;
}
.chat-msg code {
  background: var(--bg); padding: 0.1rem 0.3rem; border-radius: 0.25rem;
  font-size: 0.85em;
}
.chat-msg pre code {
  background: transparent; padding: 0;
}
.chat-msg ul, .chat-msg ol {
  padding-left: 1.5rem; margin: 0.25rem 0;
}
.chat-msg li {
  margin: 0.15rem 0;
}
.chat-msg a {
  color: var(--accent); text-decoration: underline;
}
.chat-msg strong {
  color: #fff; font-weight: 700;
}
/* Tables in chat */
.chat-msg table {
  border-collapse: collapse; width: 100%; margin: 0.5rem 0; font-size: 0.85rem;
}
.chat-msg th {
  border: 1px solid rgba(26,143,191,0.3); padding: 0.3rem 0.5rem;
  background: rgba(26,143,191,0.1); text-align: left;
}
.chat-msg td {
  border: 1px solid rgba(26,143,191,0.15); padding: 0.3rem 0.5rem;
}
.chat-msg h2, .chat-msg h3, .chat-msg h4 {
  font-family: 'Montserrat', sans-serif;
}
.chat-msg.user { background: var(--accent); color: #fff; margin-left: auto; }
.chat-msg.assistant {
  background: var(--card); border: 1px solid rgba(26,143,191,0.1);
  margin-right: auto;
}
.chat-msg.tool-bubble { font-size: 0.8rem; margin: 0.25rem 0; max-width: 95%; }
.chat-msg.tool-bubble.running {
  border: 1px solid var(--warning); background: rgba(243,156,18,0.05);
}
.chat-msg.tool-bubble.done {
  border: 1px solid var(--success); background: rgba(46,204,113,0.05);
}
.chat-msg.tool-bubble.error {
  border: 1px solid var(--danger); background: rgba(231,76,60,0.05);
}

/* ========== CHAT INPUT ========== */
.chat-input-area {
  display: flex; gap: 0.5rem; padding: 0.75rem;
  background: var(--card); border-top: 1px solid rgba(26,143,191,0.1);
  align-items: center;
  position: sticky; bottom: 0; z-index: 5;
}
.chat-input-area textarea {
  flex: 1; padding: 0.6rem; background: var(--bg);
  border: 1px solid rgba(26,143,191,0.2); border-radius: var(--radius);
  color: var(--text); resize: none; font-family: inherit;
  font-size: 0.85rem; min-height: 40px; max-height: 120px;
}
.chat-input-area button {
  padding: 0.5rem 1rem; background: var(--accent); color: #fff;
  border: none; border-radius: var(--radius); cursor: pointer;
  font-weight: 700; white-space: nowrap;
}
.chat-input-area button:hover { background: var(--accent-hover); }
.chat-input-area button:disabled { opacity: 0.4; cursor: not-allowed; }
.chat-input-area button.stop-btn {
  background: #e74c3c !important;
  color: #fff !important;
  font-weight: 800 !important;
  padding: 0.5rem 1rem !important;
  font-size: 0.85rem !important;
  letter-spacing: normal !important;
  border: none !important;
  animation: pulse-stop 1s infinite;
}
@keyframes pulse-stop {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231,76,60,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(231,76,60,0); }
}
.chat-input-area select {
  padding: 0.4rem; background: var(--bg);
  border: 1px solid rgba(26,143,191,0.2); border-radius: var(--radius);
  color: var(--text); font-size: 0.8rem;
}
.retry-label { font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }

/* ========== RIGHT PANELS ========== */
.right-panel {
  width: 280px; background: var(--card);
  border-left: 1px solid rgba(26,143,191,0.1);
  overflow-y: auto; flex-shrink: 0; display: none;
}
.right-panel.open { display: block; }
.right-panel h3 {
  padding: 0.75rem; font-family: 'Montserrat', sans-serif;
  font-size: 0.9rem; color: var(--accent);
  border-bottom: 1px solid rgba(26,143,191,0.1);
  display: flex; justify-content: space-between; align-items: center;
}
.close-panel {
  background: transparent; border: none; color: var(--accent);
  cursor: pointer; font-size: 1.2rem;
}
.tool-item {
  padding: 0.5rem 0.75rem; cursor: pointer;
  border-bottom: 1px solid rgba(26,143,191,0.05);
  font-size: 0.8rem; display: flex; justify-content: space-between; align-items: center;
}
.tool-item:hover { background: var(--accent-light); }
.tool-item .tool-actions { display: flex; gap: 0.25rem; }
.tool-item .tool-actions button {
  background: transparent; border: 1px solid var(--accent);
  color: var(--accent); padding: 0.15rem 0.4rem;
  border-radius: 0.25rem; cursor: pointer; font-size: 0.7rem;
}
.tool-item .tool-actions button:hover { background: var(--accent); color: #fff; }
.todo-item {
  padding: 0.4rem 0.75rem; font-size: 0.8rem;
  display: flex; align-items: center; gap: 0.4rem;
  border-bottom: 1px solid rgba(26,143,191,0.05);
}
.todo-item.done { color: var(--text-muted); text-decoration: line-through; }
.todo-item.doing { color: var(--warning); }
.todo-item .icon { font-size: 0.7rem; flex-shrink: 0; }

/* ========== MODALS ========== */
.modal-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 200;
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--card); padding: 1.5rem; border-radius: var(--radius);
  width: 90%; max-width: 600px; max-height: 80vh; overflow-y: auto;
  border: 1px solid rgba(26,143,191,0.15);
}
.modal h3 { font-family: 'Montserrat', sans-serif; color: var(--accent); margin-bottom: 1rem; }
.modal input, .modal textarea {
  width: 100%; padding: 0.5rem; margin-bottom: 0.5rem;
  background: var(--bg); border: 1px solid rgba(26,143,191,0.2);
  border-radius: var(--radius); color: var(--text);
  font-family: monospace; font-size: 0.85rem;
}
.modal textarea { min-height: 300px; resize: vertical; }
#toolCodeMsg { font-size: 0.8rem; margin-top: 0.25rem; min-height: 1.2em; }
#pwMsg { font-size: 0.8rem; margin-top: 0.25rem; min-height: 1.2em; }
.btn-row { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.btn-primary {
  background: var(--accent); color: #fff; border: none;
  padding: 0.5rem 1rem; border-radius: var(--radius);
  cursor: pointer; font-weight: 700;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
  background: transparent; border: 1px solid var(--accent);
  color: var(--accent); padding: 0.5rem 1rem;
  border-radius: var(--radius); cursor: pointer;
}
.btn-secondary:hover { background: var(--accent); color: #fff; }

/* ========== FILE EXPLORER ========== */
.file-explorer-modal {
  max-width: 95vw !important;
  max-height: 90vh !important;
  width: 95vw;
}
/* Close button at top right, always visible */
.file-explorer-modal .modal-close-top {
  position: sticky; top: 0; float: right; z-index: 10;
  background: var(--danger); color: #fff; border: none;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 1.2rem; cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  margin: -0.5rem -0.5rem 0 0;
}
.file-explorer-modal .modal-close-top:hover { background: #c0392b; }
.drop-zone {
  border: 2px dashed rgba(26,143,191,0.3);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  margin-bottom: 0.75rem;
  transition: all 0.3s;
  background: rgba(26,143,191,0.03);
}
.drop-zone.dragover {
  border-color: var(--accent);
  background: var(--accent-light);
}
.drop-zone-text {
  color: var(--text-muted);
  font-size: 0.9rem;
}
.breadcrumb {
  padding: 0.4rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}
.file-list { list-style: none; }
.file-list .file-item {
  padding: 0.5rem 0.75rem; display: flex; align-items: center; gap: 0.5rem;
  border-bottom: 1px solid rgba(26,143,191,0.05);
  font-size: 0.85rem;
}
.file-list .file-item:hover { background: var(--accent-light); }
.file-list .file-item .file-icon { font-size: 1.1rem; flex-shrink: 0; width: 24px; text-align: center; }
.file-list .file-item .file-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-list .file-item .file-size { color: var(--text-muted); font-size: 0.75rem; flex-shrink: 0; }
.file-list .file-item .btn-del {
  background: transparent; border: 1px solid var(--danger);
  color: var(--danger); padding: 0.15rem 0.4rem;
  border-radius: 0.25rem; cursor: pointer; font-size: 0.7rem; flex-shrink: 0;
}
.file-list .file-item .btn-del:hover { background: var(--danger); color: #fff; }

/* ========== USER LIST ========== */
.user-list { list-style: none; }

/* ========== LOADING DOTS ========== */
.loading-dots { display: inline-flex; gap: 4px; align-items: center; }
.loading-dots span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); animation: bounce 1.4s infinite ease-in-out both;
}
.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* ========== TOGGLE BUTTONS ========== */
.toggle-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 0;
  flex-wrap: wrap;
  position: sticky;
  top: 36px;
  z-index: 4;
  background: var(--bg);
}
.toggle-btn {
  padding: 0.35rem 0.75rem;
  border: 1px solid rgba(26,143,191,0.2);
  border-radius: 6px;
  background: var(--card);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  font-family: 'Raleway', sans-serif;
  transition: all 0.2s;
}
.toggle-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}
.toggle-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ========== FILE EXPLORER PARENT DIR ========== */
.parent-dir {
  background: rgba(52,179,228,0.08) !important;
  border: 1px dashed var(--accent) !important;
}
.parent-dir:hover {
  background: rgba(52,179,228,0.15) !important;
}

/* ========== DOWNLOAD BUTTON ========== */
.btn-dl {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  transition: background 0.2s;
}
.btn-dl:hover {
  background: rgba(52,179,228,0.15);
}


/* ========== TOOL EXPAND BUTTON ========== */
.tool-expand-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  cursor: pointer;
  font-size: 0.65rem;
  margin-left: 0.3rem;
  vertical-align: middle;
}
.tool-expand-btn:hover {
  background: var(--accent);
  color: #fff;
}
.tool-detail-short, .tool-detail-full {
  word-break: break-all;
}


/* ========== STATUS BAR ========== */
.status-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.75rem;
  background: rgba(26,143,191,0.06);
  border-bottom: 1px solid rgba(26,143,191,0.1);
  border-left: 3px solid var(--accent);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  transition: all 0.3s;
  position: sticky;
  top: 0;
  z-index: 5;
}
.status-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}


/* ========== CODE EDITOR (v34) ========== */
.code-editor-wrapper {
  display: flex;
  border: 1px solid rgba(26,143,191,0.2);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg);
  min-height: 400px;
  max-height: 70vh;
}
.code-editor-gutter {
  background: rgba(0,0,0,0.3);
  color: var(--text-muted);
  padding: 0.5rem 0.5rem;
  text-align: right;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  user-select: none;
  min-width: 40px;
  overflow: hidden;
}
.code-editor-gutter span {
  display: block;
  line-height: 1.5;
}
.code-editor-input {
  flex: 1;
  position: relative;
  overflow: auto;
}
.code-editor-input textarea {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100%;
  min-height: 100%;
  padding: 0.5rem;
  background: transparent;
  border: none;
  color: transparent;
  caret-color: var(--accent);
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  resize: none;
  z-index: 2;
  white-space: pre;
  overflow: auto;
}
.code-editor-input pre {
  margin: 0;
  padding: 0.5rem;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.5;
  white-space: pre;
  pointer-events: none;
  z-index: 1;
  color: var(--text);
}
/* Syntax colors */
.syn-kw { color: #c678dd; font-weight: 700; }
.syn-str { color: #98c379; }
.syn-com { color: #5c6370; font-style: italic; }
.syn-num { color: #d19a66; }
.syn-dec { color: #61afef; }
.syn-builtin { color: #e5c07b; }

/* ========== MOBILE ========== */
@media (max-width: 768px) {
  html, body { overflow-x: hidden; width: 100%; }
  .burger { display: block; }
  
  /* Header compact */
  .header { padding: 0.4rem 0.5rem; flex-wrap: wrap; gap: 0.25rem; }
  .header .logo { font-size: 0.9rem; }
  .header .user-info { gap: 0.3rem; }
  .header .user-info span { font-size: 0.7rem; }
  .header .badge { font-size: 0.6rem; padding: 0.1rem 0.35rem; }
  .header button { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
  
  /* Sidebar overlay */
  .sidebar {
    position: fixed; left: -300px; top: 0; bottom: 0;
    z-index: 150; transition: left 0.3s; width: 280px; min-width: 280px;
  }
  .sidebar.open { left: 0; }
  /* Close button inside sidebar on mobile */
  .sidebar-close-btn {
    display: block;
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: var(--danger);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    z-index: 5;
  }
  /* Dark overlay behind sidebar on mobile */
  .sidebar.open::before {
    content: '';
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: -1;
  }
  
  /* Main layout stacks */
  .main-layout { flex-direction: column; height: auto; width: 100%; overflow-x: hidden; }
  .chat-area { width: 100%; height: calc(100vh - 150px); min-width: 0; }
  .chat-wrapper { width: 100%; min-width: 0; }
  
  /* Right panels overlay */
  .right-panel {
    position: fixed; right: -280px; top: 0; bottom: 0;
    z-index: 150; transition: right 0.3s; width: 260px;
  }
  .right-panel.open { right: 0; }
  
  /* Ollama bar stacks */
  .ollama-bar { flex-direction: column; padding: 0.4rem 0.5rem; }
  .ollama-bar input, .ollama-bar select { width: 100%; min-width: 0; }
  
  /* Chat messages full width */
  .chat-messages { padding: 0.5rem; }
  .chat-msg { max-width: 95%; font-size: 0.85rem; padding: 0.6rem 0.75rem; }
  
  /* Session tabs scrollable */
  .session-tabs { padding: 0.3rem 0.4rem; gap: 0.15rem; flex-wrap: nowrap; overflow-x: auto; }
  .session-tab { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
  
  /* Chat input compact */
  .chat-input-area { padding: 0.5rem; gap: 0.3rem; flex-wrap: wrap; }
  .chat-input-area textarea { font-size: 0.8rem; min-height: 36px; }
  .chat-input-area button { font-size: 0.75rem; padding: 0.35rem 0.6rem; }
  .chat-input-area select { font-size: 0.7rem; }
  .retry-label { font-size: 0.65rem; }
  
  /* Toggle row */
  .toggle-row { padding: 0.3rem 0.5rem; gap: 0.3rem; }
  .toggle-btn { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
  
  /* Status bar */
  .status-bar { font-size: 0.7rem; padding: 0.25rem 0.5rem; }
  
  /* File explorer full screen */
  .file-explorer-modal {
    max-width: 100vw !important;
    max-height: 100vh !important;
    width: 100vw;
    border-radius: 0;
  }
  
  /* Modals full width */
  .modal { width: 95%; max-width: 95vw; padding: 1rem; }
  .modal textarea { min-height: 200px; }
  
  /* Login card */
  .login-card { max-width: 95vw; padding: 1.5rem; }
}

/* File download link in chat bubbles */
.file-dl-link {
  display: inline-block;
  margin-top: 6px;
  padding: 4px 10px;
  background: rgba(26,143,191,0.12);
  border: 1px solid rgba(26,143,191,0.3);
  border-radius: 6px;
  color: var(--accent) !important;
  text-decoration: none !important;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}
.file-dl-link:hover {
  background: rgba(26,143,191,0.22);
  border-color: var(--accent);
  transform: translateY(-1px);
}

/* Tool detail popup */
.tool-detail-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 10000;
  display: flex; align-items: center; justify-content: center;
}
.tool-detail-modal {
  background: var(--card); border-radius: 12px;
  max-width: 90vw; max-height: 85vh; width: 700px;
  overflow-y: auto; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.tool-detail-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1rem 1.5rem; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--card); z-index: 1;
}
.tool-detail-header h3 { margin: 0; font-size: 1.1rem; }
.tool-detail-close {
  background: #c0392b; color: #fff; border: none;
  width: 32px; height: 32px; border-radius: 50%;
  font-size: 1.2rem; cursor: pointer; line-height: 1;
}
.tool-detail-body { padding: 1rem 1.5rem; }
.tool-detail-body h4 { margin: 0.75rem 0 0.25rem; color: var(--accent); font-size: 0.9rem; }
.tool-detail-body pre {
  background: #0a0f14; border: 1px solid var(--border);
  border-radius: 8px; padding: 1rem; overflow-x: auto;
  font-size: 0.8rem; line-height: 1.5; max-height: 50vh;
}
.tool-detail-body code { color: #e0e0e0; white-space: pre-wrap; word-break: break-word; }
.tool-bubble { cursor: pointer; transition: background 0.2s; }
.tool-bubble:hover { filter: brightness(1.1); }
