📄 App.css
/home/palash/git/local-ai/src/App.css
Language: css • Lines: 1839
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0f0f1a;
  color: #e0e0e0;
  font-family: 'Inter', 'SF Pro', '-apple-system', sans-serif;
}

#root {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

::-webkit-scrollbar { width: 6px }
::-webkit-scrollbar-track { background: transparent }
::-webkit-scrollbar-thumb { background: #333; border-radius: 3px }
::-webkit-scrollbar-thumb:hover { background: #555 }

/* ---- Fixed Header ---- */
#model-bar {
  display: flex !important;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #1a1a2e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 12px;
  flex-shrink: 0;
  height: 48px;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
}

#sidebar-toggle {
  background: none;
  border: none;
  color: #888;
  font-size: 22px;
  cursor: pointer;
  padding: 0 6px 0 0;
  line-height: 1;
  transition: color .2s;
}

#sidebar-toggle:hover {
  color: #fff;
}

#model-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

#model-dot.chat_loaded {
  background: #4ade80;
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.4);
}

#model-dot.image_active {
  background: #f472b6;
  box-shadow: 0 0 8px rgba(244, 114, 182, 0.4);
}

#model-dot.loading {
  background: #fbbf24;
  animation: pulse .8s ease-in-out infinite;
}

#model-dot.unloaded {
  background: #6b7280;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

#model-label {
  font-size: 12px;
  color: #e0e0e0;
}

/* ---- User Menu ---- */
#user-menu {
  position: relative;
  margin-left: auto;
  cursor: pointer;
}

#user-name {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 12px;
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all .2s;
  white-space: nowrap;
}

#user-name:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.2);
}

#user-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 4px;
  z-index: 999;
  min-width: 100px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

#user-dropdown.open {
  display: block;
}

#user-dropdown button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  background: none;
  color: #f87171;
  font-size: 12px;
  cursor: pointer;
  border-radius: 6px;
  text-align: left;
  font-family: inherit;
}

#user-dropdown button:hover {
  background: rgba(248, 113, 113, 0.1);
}

#user-dropdown button.task-menu-item {
  position: relative;
  color: #94a3b8;
}

#user-dropdown button.task-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* ---- App Container ---- */
#app-container {
  display: flex;
  flex-direction: column;
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

/* ---- Sidebar ---- */
#sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 99;
  display: none;
  backdrop-filter: blur(4px);
}

#sidebar-overlay.open {
  display: block;
}

#sidebar {
  position: fixed;
  top: 48px;
  left: 0;
  width: 280px;
  height: calc(100% - 48px);
  padding-bottom: 16px;
  background: rgba(22, 22, 42, 0.95);
  backdrop-filter: blur(16px);
  border-right: 1px solid rgba(255, 255, 255, 0.06);
  z-index: 100;
  transform: translateX(-100%);
  transition: transform .35s cubic-bezier(.4, 0, .2, 1);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#sidebar.open {
  transform: translateX(0);
}

#sidebar-header {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}

#new-chat-btn {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
}

#new-chat-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

#session-list {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
}

.session-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 2px;
  transition: all .2s;
}

.session-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.session-item.active {
  background: rgba(74, 108, 247, 0.15);
  border-left: 2px solid #4a6cf7;
}

.session-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 450;
}

.session-actions {
  display: flex;
  gap: 2px;
  opacity: 1;
}

.session-actions button {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 14px;
  border-radius: 6px;
  color: #e0e0e0;
}

/* ---- Overload Warning ---- */
#overload-warn {
  animation: pulseWarn 1.5s ease-in-out infinite alternate;
  background: #991b1b;
  color: #fff;
  text-align: center;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 500;
}

@keyframes pulseWarn {
  from { opacity: .8; }
  to { opacity: 1; }
}

/* ---- Chat Area ---- */
#chat {
  flex: 1;
  overflow-y: auto;
  padding: 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  scroll-behavior: smooth;
  min-height: 0;
}

.msg {
  max-width: 78%;
  padding: 14px 18px;
  border-radius: 14px;
  line-height: 1.6;
  position: relative;
  animation: fadeIn .25s ease;
}

.msg-timestamp {
  position: absolute;
  top: 4px;
  right: 10px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.3);
  pointer-events: none;
  font-weight: 500;
  letter-spacing: 0.3px;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.msg:hover .copy-btn {
  opacity: 1;
}

.user {
  background: linear-gradient(135deg, #2d3a5e, #3a4a7a);
  align-self: flex-end;
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 12px rgba(45, 58, 94, 0.3);
}

.bot {
  background: rgba(42, 42, 62, 0.8);
  backdrop-filter: blur(8px);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.04);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
}

.bot img {
  max-width: 100%;
  border-radius: 10px;
  margin-top: 10px;
  cursor: pointer;
  transition: transform .2s;
}

.bot img:hover {
  transform: scale(1.02);
}

.msg-header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.msg-elapsed {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 500;
  letter-spacing: 0.3px;
  margin-right: 4px;
  white-space: nowrap;
}

.copy-btn {
  opacity: 0;
  transition: opacity .2s;
  background: none;
  border: none;
  cursor: pointer;
  color: #666;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 6px;
  margin-left: auto;
  font-family: inherit;
}

.copy-btn:hover,
.copy-btn.force-show {
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.06);
}

.speak-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(96, 165, 250, 0.12);
  border: 1px solid rgba(96, 165, 250, 0.3);
  cursor: pointer;
  color: #60a5fa;
  padding: 0;
  flex-shrink: 0;
  transition: background .2s, color .2s, border-color .2s;
  font-family: inherit;
}

.speak-btn:hover {
  background: rgba(96, 165, 250, 0.22);
  color: #93c5fd;
}

.speak-btn.speaking {
  background: rgba(244, 114, 182, 0.15);
  border-color: rgba(244, 114, 182, 0.35);
  color: #f472b6;
}

.share-btn {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.3);
  cursor: pointer;
  color: #34d399;
  padding: 0;
  flex-shrink: 0;
  transition: background .2s, color .2s, border-color .2s;
  font-family: inherit;
}

.share-btn:hover {
  background: rgba(52, 211, 153, 0.22);
  color: #6ee7b7;
}

.share-btn:disabled {
  opacity: 0.6;
  cursor: default;
}

.share-error {
  color: #f87171;
  font-size: 11px;
  margin-left: 6px;
}

/* ---- Share Modal ---- */
.share-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.share-modal {
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  width: 100%;
  max-width: 460px;
  padding: 16px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 8px;
}

.share-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
  font-family: inherit;
}

.share-modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.share-modal-hint {
  color: #94a3b8;
  font-size: 12px;
  margin: 0 0 12px;
  line-height: 1.5;
}

.share-modal-url {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: #e0e0e0;
  font-size: 13px;
  font-family: monospace;
  outline: none;
  margin-bottom: 12px;
}

.share-modal-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.share-modal-actions button,
.share-open-link {
  padding: 8px 14px;
  border-radius: 8px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  font-family: inherit;
}

.share-copy-btn {
  background: linear-gradient(135deg, #34d399, #0ea5e9);
  color: #06281f;
}

.share-copy-btn:hover {
  filter: brightness(1.1);
}

.share-open-link {
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.share-open-link:hover {
  background: rgba(255, 255, 255, 0.14);
}

/* ---- Code Block Copy ---- */
.code-block {
  position: relative;
}
.code-block .copy-code-btn {
  position: absolute;
  top: 6px;
  right: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #999;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity .2s;
  font-family: inherit;
  z-index: 1;
}
.code-block:hover .copy-code-btn {
  opacity: 1;
}
.code-block .copy-code-btn:hover {
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.12);
}

/* ---- File chip (uploaded files shown in messages) ---- */
.file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 2px 0;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #e0e0e0;
  text-decoration: none;
  font-size: 13px;
  max-width: 100%;
  vertical-align: middle;
}
.file-chip:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.file-chip-icon {
  flex-shrink: 0;
  color: #60a5fa;
}
.file-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Image Download ---- */
.image-wrap > img {
  display: block;
  max-width: 100%;
}
.img-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.img-actions .img-download-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e0e0e0;
  font-size: 12px;
  padding: 4px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background .2s;
  font-family: inherit;
}
.img-actions .img-download-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

/* ---- Tool Badges ---- */
.tool-badge {
  font-size: 11px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: .3px;
  position: relative;
  cursor: default;
}

.tool-badge.search {
  background: rgba(30, 58, 95, 0.6);
  color: #60a5fa;
  cursor: pointer;
}

.tool-badge.image {
  background: rgba(59, 31, 59, 0.6);
  color: #f472b6;
}

.tool-badge.edit {
  background: rgba(20, 83, 45, 0.6);
  color: #34d399;
}

.tool-badge.fetch {
  background: rgba(124, 58, 237, 0.25);
  color: #a78bfa;
}

.tool-badge.research {
  background: rgba(16, 71, 62, 0.6);
  color: #5eead4;
}

.fetch-info-btn {
  background: none;
  border: 1px solid rgba(167, 139, 250, 0.4);
  color: #a78bfa;
  border-radius: 50%;
  width: 16px;
  height: 16px;
  line-height: 1;
  font-size: 10px;
  padding: 0;
  margin-left: 6px;
  cursor: pointer;
  vertical-align: middle;
  transition: all .15s;
}

.fetch-info-btn:hover {
  background: rgba(167, 139, 250, 0.2);
  border-color: #a78bfa;
}

/* ---- Page Details Modal ---- */
.page-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  backdrop-filter: blur(2px);
}

.page-modal {
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  width: 100%;
  max-width: 640px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.page-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
  font-weight: 600;
  color: #e2e8f0;
}

.page-modal-close {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 14px;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  line-height: 1;
}

.page-modal-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.page-modal-body {
  padding: 16px;
  overflow-y: auto;
  font-size: 13px;
  color: #cbd5e1;
}

.page-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 8px;
}

.page-modal-url {
  display: block;
  color: #60a5fa;
  word-break: break-all;
  font-size: 12px;
  margin-bottom: 12px;
  text-decoration: none;
}

a.page-modal-url:hover {
  text-decoration: underline;
}

.page-modal-content {
  white-space: pre-wrap;
  line-height: 1.6;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 12px;
  font-size: 12px;
  color: #a5b4c8;
}

.page-modal-body.error .page-modal-error-msg {
  color: #f87171;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.25);
  border-radius: 8px;
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Search Popup ---- */
.search-popup {
  display: block;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 50;
  background: #1a1a2e;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 12px;
  padding-top: 18px;
  min-width: 300px;
  max-width: 420px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
}

.search-popup a {
  padding: 6px 0;
}

.search-popup a:hover {
  text-decoration: underline;
}

/* ---- Status Box ---- */
@keyframes spin {
  to { transform: rotate(360deg); }
}

.status-box {
  border: 1px solid #2a2a3e;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color .2s;
}

.status-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 500;
}

.status-header .left-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-box .spinner {
  width: 12px;
  height: 12px;
  border: 2px solid #334155;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  flex-shrink: 0;
}

.status-box .status-text {
  color: #e2e8f0;
}

.status-box[data-state="thinking"] { border-color: #334155; }
.status-box[data-state="thinking"] .spinner { color: #60a5fa; }
.status-box[data-state="thinking"] .status-icon { color: #60a5fa; }

.status-box[data-state="search"] { border-color: #1e3a5f; }
.status-box[data-state="search"] .spinner { color: #60a5fa; }

.status-box[data-state="generate-image"] { border-color: #4a1a4a; }
.status-box[data-state="generate-image"] .spinner { color: #c084fc; }

.status-box[data-state="edit-image"] { border-color: #1a4a2a; }
.status-box[data-state="edit-image"] .spinner { color: #34d399; }

.reasoning-block {
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.reasoning-block summary {
  cursor: pointer;
  padding: 6px 10px;
  font-size: 12px;
  color: #ada9a9;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  list-style: none;
  transition: background .2s;
}
.reasoning-block summary::-webkit-details-marker {
  display: none;
}
.reasoning-block summary:hover {
  background: rgba(75, 70, 4, 0.158);
}
.reasoning-summary-label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}
.reasoning-summary-label::before {
  content: '';
  width: 0;
  height: 0;
  border-left: 5px solid #888;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .2s;
}
.reasoning-block[open] .reasoning-summary-label::before {
  transform: rotate(90deg);
}
.reasoning-copy-btn {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.08);
  cursor: pointer;
  color: #666;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 6px;
  font-family: inherit;
}
.reasoning-copy-btn:hover {
  color: #e0e0e0;
  background: rgba(255, 255, 255, 0.06);
}
.reasoning-text {
  margin: 0;
  padding: 8px 12px;
  font-size: 12px;
  color: #bbb;
  line-height: 1.5;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.reasoning-text p { margin: 4px 0; }
.reasoning-text code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 4px;
  border-radius: 3px;
}
.reasoning-text pre {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 6px;
  padding: 8px;
  overflow-x: auto;
  margin: 6px 0;
}
.reasoning-text pre code { background: none; padding: 0; }
.reasoning-text ul, .reasoning-text ol { padding-left: 18px; margin: 4px 0; }
.reasoning-text blockquote { border-left: 2px solid #4a6cf7; padding-left: 10px; margin: 4px 0; color: #999; }

/* ---- Message Content ---- */
.msg-content p { margin: 4px 0; }

.msg-content pre {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 12px;
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.msg-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 13px;
}

.msg-content p code {
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 13px;
}

.msg-content pre code {
  background: none;
  padding: 0;
}

.msg-content .mermaid {
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 16px;
  margin: 8px 0;
  overflow-x: auto;
  text-align: center;
}

.msg-content .mermaid svg {
  max-width: 100%;
  height: auto;
}

.reasoning-text .mermaid {
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  padding: 16px;
  margin: 8px 0;
  overflow-x: auto;
}

.msg-content ul,
.msg-content ol {
  padding-left: 20px;
  margin: 6px 0;
}

.msg-content blockquote {
  border-left: 3px solid #4a6cf7;
  padding-left: 12px;
  margin: 8px 0;
  color: #999;
}

.msg-content table {
  border-collapse: collapse;
  margin: 8px 0;
  width: 100%;
  font-size: 13px;
}

.msg-content th,
.msg-content td {
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  text-align: left;
}

.msg-content th {
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
}

.msg-content a {
  color: #60a5fa;
  text-decoration: none;
}

.msg-content a:hover {
  text-decoration: underline;
}

.msg-content h1, .msg-content h2, .msg-content h3, .msg-content h4 {
  margin: 10px 0 4px;
  font-weight: 600;
}

.msg-content h1 { font-size: 1.3em; }
.msg-content h2 { font-size: 1.15em; }
.msg-content h3 { font-size: 1.05em; }
.msg-content hr { border: none; border-top: 1px solid rgba(255, 255, 255, 0.06); margin: 12px 0; }

.msg-content.empty-response { color: #666; font-size: 13px; padding: 4px 0; }

.msg-content .katex { font-size: 1.05em; }
.msg-content .katex-display { margin: 8px 0; overflow-x: auto; overflow-y: hidden; }

/* ---- Input Bar ---- */
#input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 20px 14px;
  background: rgba(15, 15, 26, 0.95);
  backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  align-items: flex-end;
  flex-shrink: 0;
}

#msg-input {
  flex: 1;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
  font-size: 14px;
  resize: none;
  outline: none;
  font-family: inherit;
  line-height: 1.5;
  max-height: 120px;
  transition: border-color .2s;
}

#msg-input:focus {
  border-color: rgba(74, 108, 247, 0.5);
}

#input-bar button {
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all .2s;
  flex-shrink: 0;
  font-family: inherit;
}

#send-btn {
  background: linear-gradient(135deg, #4a6cf7, #6a4cf7);
  color: #fff;
}

#send-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(74, 108, 247, 0.35);
}

#send-btn:active {
  transform: translateY(0);
}

#send-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

#send-btn .send-icon {
  display: none;
}

#research-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #a0a0b8;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  transition: all .2s;
}

#research-toggles {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

#research-toggle:hover {
  border-color: rgba(74, 108, 247, 0.4);
  color: #e0e0e0;
}

#research-toggle:has(input:checked) {
  border-color: rgba(106, 76, 247, 0.6);
  color: #c4a6ff;
  background: rgba(106, 76, 247, 0.12);
}

#research-toggle input {
  accent-color: #6a4cf7;
  cursor: pointer;
}

#cpu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #a0a0b8;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  user-select: none;
  transition: all .2s;
}

#cpu-toggle:hover:not(.disabled) {
  border-color: rgba(74, 108, 247, 0.4);
  color: #e0e0e0;
}

#cpu-toggle:has(input:checked) {
  border-color: rgba(74, 108, 247, 0.6);
  color: #7fb8ff;
  background: rgba(74, 108, 247, 0.12);
}

#cpu-toggle.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

#cpu-toggle input {
  accent-color: #4a6cf7;
  cursor: pointer;
}

#cpu-toggle.disabled input {
  cursor: not-allowed;
}

#attach-btn {
  background: rgba(255, 255, 255, 0.04);
  color: #888;
  font-size: 20px;
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

#attach-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #e0e0e0;
}

#image-preview {
  max-width: 100px;
  max-height: 70px;
  border-radius: 8px;
  display: none;
  object-fit: cover;
}

input[type=file] {
  display: none;
}

#file-badge {
  display: none;
  background: rgba(74, 108, 247, 0.15);
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 12px;
  align-items: center;
  gap: 8px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid rgba(74, 108, 247, 0.2);
}
/* ---- Image Lightbox ---- */
#image-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  z-index: 200;
  display: none;
  backdrop-filter: blur(8px);
  animation: fadeIn .2s ease;
  overflow: hidden;
  cursor: grab;
}

#image-overlay.open {
  display: block;
}

#image-overlay .img-wrap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  pointer-events: none;
}

#image-overlay .img-wrap img {
  max-width: 92vw;
  max-height: 92vh;
  border-radius: 8px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.5);
  animation: fadeIn .25s ease;
  transition: transform .1s ease;
  transform-origin: center center;
  pointer-events: auto;
  user-select: none;
  -webkit-user-drag: none;
}

#image-overlay .zoom-label {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translate(-50%);
  color: #fff9;
  font-size: 13px;
  background: #00000080;
  padding: 4px 12px;
  border-radius: 6px;
  pointer-events: none;
}

/* ---- Login Screen ---- */
#login-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #0f0f1a;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn .3s ease;
}

#login-overlay.hidden {
  display: none;
}

.login-box {
  background: rgba(22, 22, 42, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 40px;
  width: 340px;
  box-shadow: 0 8px 48px rgba(0, 0, 0, 0.4);
}

.login-box h2 {
  margin-bottom: 24px;
  text-align: center;
  font-weight: 600;
  font-size: 22px;
}

.login-box input {
  width: 100%;
  padding: 12px 16px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.04);
  color: #e0e0e0;
  font-size: 14px;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.login-box input:focus {
  border-color: rgba(74, 108, 247, 0.5);
}

.login-box button {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, #4a6cf7, #6a4cf7);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all .2s;
  margin-top: 4px;
  font-family: inherit;
}

.login-box button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(74, 108, 247, 0.35);
}

.login-box .login-error {
  color: #f87171;
  font-size: 13px;
  text-align: center;
  margin-top: 10px;
  display: none;
}

.login-box .login-error.show {
  display: block;
}

.login-share-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 18px 0 14px;
}

.login-share-input {
  margin-bottom: 8px;
}

.login-share-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #a5b4c8;
  font-weight: 500;
  font-size: 13px;
}

.login-share-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
  transform: none;
  box-shadow: none;
}

/* ---- Public Share View ---- */
#public-share-view {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px 16px 48px;
  min-height: 100vh;
  box-sizing: border-box;
}

.public-share-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
}

.public-share-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: #94a3b8;
}

.public-share-exit {
  background: rgba(74, 108, 247, 0.12);
  border: 1px solid rgba(74, 108, 247, 0.3);
  color: #a5b4ff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.public-share-exit:hover {
  background: rgba(74, 108, 247, 0.22);
}

.public-share-meta {
  font-size: 12px;
  color: #94a3b8;
  margin-bottom: 12px;
}

.public-share-status {
  color: #94a3b8;
  font-size: 14px;
  padding: 24px 0;
}

.public-share-status.error {
  color: #f87171;
}

/* ---- Token Indicator ---- */
#token-indicator {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #666;
}

#context-donut {
  flex-shrink: 0;
}

.token-compressed {
  color: #fbbf24;
  opacity: 0.9;
  margin-left: 4px;
  font-weight: 600;
}

#reminder-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  background: #f87171;
  color: #fff;
  font-size: 9px;
  border-radius: 50%;
  width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

/* ---- Task Panel ---- */
#task-panel {
  position: fixed;
  top: 48px;
  right: 0;
  width: 320px;
  max-height: calc(100vh - 48px);
  background: #1a1a2e;
  border-left: 1px solid rgba(255,255,255,0.08);
  padding: 8px;
  overflow-y: auto;
  z-index: 998;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#task-panel-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  font-size: 13px;
  color: #94a3b8;
  font-weight: 600;
}

#task-panel-header button {
  background: none;
  border: 1px solid rgba(255,255,255,0.12);
  color: #94a3b8;
  border-radius: 4px;
  padding: 2px 8px;
  cursor: pointer;
  font-size: 13px;
}

#task-panel-header button:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

#task-panel-close {
  margin-left: auto;
}

#task-form {
  display: flex;
  gap: 4px;
  padding: 4px 6px;
}

#task-form input {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 4px 8px;
  color: #e2e8f0;
  font-size: 12px;
}

#task-form select {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 4px;
  padding: 4px;
  color: #e2e8f0;
  font-size: 12px;
}

#task-form button {
  background: rgba(74,222,128,0.15);
  border: 1px solid rgba(74,222,128,0.3);
  color: #4ade80;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 12px;
}

#task-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 12px;
  transition: background .15s;
}

.task-item:hover {
  background: rgba(255,255,255,0.04);
}

.task-item.done .task-title {
  text-decoration: line-through;
  opacity: 0.4;
}

.task-item input[type="checkbox"] {
  accent-color: #4ade80;
  cursor: pointer;
}

.task-title {
  flex: 1;
  color: #e2e8f0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.task-status {
  font-size: 10px;
  color: #666;
}

.task-due {
  font-size: 10px;
  color: #666;
}

.task-delete {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 0 2px;
  font-size: 12px;
  opacity: 0;
  transition: opacity .15s;
}

.task-item:hover .task-delete {
  opacity: 1;
}

.task-delete:hover {
  color: #f87171;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  #model-tps {
    display: none;
  }

  .msg {
    max-width: 90%;
  }

  .session-actions {
    opacity: 1;
  }

  .copy-btn {
    opacity: 1;
  }

  .code-block .copy-code-btn {
    opacity: 1;
  }

  #input-bar {
    padding: 8px 12px 10px;
    gap: 6px;
    flex-wrap: wrap;
  }

  #research-toggles {
    order: 3;
    flex-basis: 100%;
    gap: 6px;
  }

  #research-toggle, #cpu-toggle {
    padding: 6px 10px;
    font-size: 11px;
  }

  #input-bar button {
    padding: 8px 10px;
    font-size: 14px;
  }

  #attach-btn {
    font-size: 16px;
    padding: 8px 10px;
  }

  #send-btn .send-icon {
    display: inline;
  }

  #send-btn .send-text {
    display: none;
  }

  #send-btn {
    padding: 8px 10px;
    font-size: 16px;
  }

  #msg-input {
    padding: 8px 12px;
    font-size: 13px;
  }

  #task-panel {
    width: 100%;
    max-width: 320px;
  }
}

#location-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#location-dialog {
  background: #1a1a2e;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 28px 32px;
  max-width: 380px;
  width: 90%;
  text-align: center;
}

#location-icon {
  font-size: 36px;
  margin-bottom: 12px;
}

#location-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 10px;
}

#location-desc {
  font-size: 14px;
  color: #999;
  line-height: 1.5;
  margin-bottom: 20px;
}

#location-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

#location-deny-btn, #location-allow-btn {
  padding: 8px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: none;
}

#location-deny-btn {
  background: #333;
  color: #ccc;
}

#location-allow-btn {
  background: #4a6cf7;
  color: #fff;
}

#location-deny-btn:hover {
  background: #444;
}

#location-allow-btn:hover {
  background: #5b7dfa;
}