/* ═══════════════════════════════════════════════════════════
   AVA AI — DASHBOARD
   Cammegh Color Scheme: Gold #C9A84C on White
   ═══════════════════════════════════════════════════════════ */

@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap");

:root {
  --gold: #C9A84C;
  --gold-light: #E8C96A;
  --gold-dark: #A8872E;
  --gold-pale: #F5EDD6;
  --gold-bg: #F0F0F0;
  --dark: #333333;
  --dark-2: #555555;
  --dark-3: #777777;
  --mid: #999999;
  --muted: #CCCCCC;
  --white: #F5F5F5;
  --off-white: #E8E8E8;
  --border: #D0D0D0;
  --border-strong: #B0B0B0;
  --success: #2ECC71;
  --danger: #E74C3C;
  --warning: #F39C12;
  --info: #3498DB;
  --shadow-sm: 0 1px 3px rgba(26,26,46,0.08);
  --shadow-md: 0 4px 16px rgba(26,26,46,0.12);
  --shadow-lg: 0 8px 32px rgba(26,26,46,0.16);
  --radius: 10px;
  --radius-lg: 16px;
  --sidebar-w: 260px;
  --panel-w: 400px;
  --header-h: 60px;
  --transition: 0.2s ease;
}

/* Dark Mode */
[data-theme="dark"] {
  --white: #1A1A2E;
  --off-white: #16213E;
  --border: #2A2A4A;
  --border-strong: #3A3A6A;
  --dark: #E8E4D9;
  --dark-2: #C8C4B9;
  --mid: #9898B8;
  --muted: #6868A8;
  --gold-bg: #1E1C16;
  --gold-pale: #2A2518;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 17px; scroll-behavior: smooth; }
body {
  font-family: 'Nunito', system-ui, sans-serif;
  background: var(--white);
  color: var(--dark);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.5;
}

/* ── Login Screen ── */
#login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-2) 50%, var(--dark-3) 100%);
  position: relative;
  overflow: hidden;
}
#login-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 60% at 50% 40%, rgba(201,168,76,0.12) 0%, transparent 70%);
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(201,168,76,0.1);
  position: relative;
  z-index: 1;
  border: 1px solid rgba(201,168,76,0.2);
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo .wordmark {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--dark);
}
.login-logo .wordmark span { color: var(--gold); }
.login-logo .tagline {
  font-size: 1.02rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  margin-top: 4px;
}
.login-divider {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), transparent);
  margin: 24px 0;
  opacity: 0.4;
}
.form-group { margin-bottom: 18px; }
.form-group label {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mid);
  margin-bottom: 6px;
}
.form-group input {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.25rem;
  background: var(--off-white);
  color: var(--dark);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
.form-group input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(201,168,76,0.15);
}
.btn-primary {
  width: 100%;
  padding: 13px 24px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  text-transform: uppercase;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.login-error {
  color: var(--danger);
  font-size: 1.15rem;
  text-align: center;
  margin-top: 12px;
  min-height: 20px;
}

/* ── Dashboard Shell ── */
#app { display: none; height: 100vh; flex-direction: column; }
#app.active { display: flex; }

/* Header */
.header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  z-index: 100;
}
.header-logo {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dark);
  white-space: nowrap;
}
.header-logo span { color: var(--gold); }
.header-sep {
  width: 1px;
  height: 24px;
  background: var(--border);
}
.header-nav { display: flex; gap: 4px; flex: 0.65; }
.nav-btn {
  padding: 6px 14px;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--mid);
  cursor: pointer;
  transition: all var(--transition);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.nav-btn:hover { background: var(--gold-bg); color: var(--gold-dark); }
.nav-btn.active { background: var(--gold-pale); color: var(--gold-dark); font-weight: 600; }
.nav-btn .icon { font-size: 1.15rem; }
.header-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}
.status-dot.offline { background: var(--danger); animation: none; }
@keyframes pulse {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(46,204,113,0.4); }
  50% { opacity: 0.8; box-shadow: 0 0 0 4px rgba(46,204,113,0); }
}
.status-label { font-size: 0.92rem; color: var(--muted); }
.theme-toggle {
  display: none !important;
}
.theme-toggle:hover { background: var(--gold-bg); border-color: var(--gold); }
.logout-btn {
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  font-size: 0.98rem;
  color: var(--mid);
  cursor: pointer;
  transition: all var(--transition);
}
.logout-btn:hover { border-color: var(--danger); color: var(--danger); }

/* Main Layout */
.main-layout {
  display: flex;
  flex: 1;
  overflow: hidden;
  height: calc(100vh - var(--header-h));
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--off-white);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
  transition: width var(--transition);
}
.sidebar.collapsed { width: 56px; }
.sidebar-section { padding: 16px 12px 8px; }
.sidebar-title {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 8px;
  margin-bottom: 6px;
  white-space: nowrap;
  overflow: hidden;
}
.sidebar.collapsed .sidebar-title { visibility: hidden; }
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--transition);
  font-size: 1.02rem;
  color: var(--mid);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-item:hover { background: var(--gold-bg); color: var(--gold-dark); }
.sidebar-item.active { background: var(--gold-pale); color: var(--gold-dark); font-weight: 600; }
.sidebar-item .si-icon { font-size: 1.15rem; flex-shrink: 0; }
.sidebar-item .si-label { overflow: hidden; text-overflow: ellipsis; }
.sidebar.collapsed .si-label { display: none; }
.sidebar-divider { height: 1px; background: var(--border); margin: 8px 12px; }

/* Chat Area */
.chat-area {
  flex: 0.65;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--white);
}
.chat-messages {
  flex: 0.65;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.message {
  display: flex;
  gap: 12px;
  max-width: 75%;
  animation: fadeIn 0.2s ease;
}
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message.assistant { align-self: flex-start; }
.msg-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
  flex-shrink: 0;
}
.message.user .msg-avatar { background: var(--gold); color: white; }
.message.assistant .msg-avatar { background: var(--dark); color: var(--gold); }
.msg-bubble {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 100%;
  word-break: break-word;
}
.message.user .msg-bubble {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: white;
  border-radius: var(--radius) 4px var(--radius) var(--radius);
}
.message.assistant .msg-bubble {
  background: var(--off-white);
  border: 1px solid var(--border);
  color: var(--dark);
  border-radius: 4px var(--radius) var(--radius) var(--radius);
}
.msg-time {
  font-size: 1.15rem;
  color: var(--muted);
  margin-top: 4px;
  text-align: right;
}
.message.assistant .msg-time { text-align: left; }
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: 4px var(--radius) var(--radius) var(--radius);
  width: fit-content;
}
.typing-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }

.chat-input-area {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  background: var(--white);
}
.chat-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}
.chat-input {
  flex: 0.65;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1.05rem;
  background: var(--off-white);
  color: var(--dark);
  resize: none;
  outline: none;
  min-height: 46px;
  max-height: 120px;
  font-family: inherit;
  transition: border-color var(--transition);
  line-height: 1.5;
}
.chat-input:focus { border-color: var(--gold); }
.send-btn {
  width: 46px; height: 46px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  border: none;
  border-radius: var(--radius);
  color: white;
  font-size: 1.25rem;
  cursor: pointer;
  transition: opacity var(--transition), transform var(--transition);
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.send-btn:hover { opacity: 0.9; transform: scale(1.05); }
.send-btn:disabled { opacity: 0.5; transform: none; cursor: not-allowed; }
.chat-hint {
  font-size: 1.02rem;
  color: var(--muted);
  margin-top: 6px;
}

/* Side Panel */
.side-panel {
  width: 0;
  background: var(--off-white);
  border-left: 1px solid var(--border);
  overflow: hidden;
  transition: width 0.3s ease;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.side-panel.open { width: var(--panel-w); }
.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.panel-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-close {
  width: 28px; height: 28px;
  border: none;
  background: transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.15rem;
  color: var(--muted);
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.panel-close:hover { background: var(--border); color: var(--dark); }
.panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.panel-tab {
  flex: 0.65;
  padding: 10px 8px;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  transition: all var(--transition);
  border-bottom: 2px solid transparent;
}
.panel-tab.active { color: var(--gold-dark); border-bottom-color: var(--gold); }
.panel-tab:hover { color: var(--dark); background: var(--gold-bg); }
.panel-content { flex: 0.65; overflow-y: auto; padding: 16px; }

/* Charts */
.chart-container {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}
.chart-label {
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--mid);
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.stat-card .stat-label {
  font-size: 1.02rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.stat-card .stat-value {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--gold-dark);
  line-height: 1;
}
.stat-card .stat-change {
  font-size: 1.02rem;
  margin-top: 4px;
}
.stat-card .stat-change.up { color: var(--success); }
.stat-card .stat-change.down { color: var(--danger); }

/* File Browser */
.file-browser { }
.file-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.file-path {
  font-size: 0.92rem;
  color: var(--muted);
  padding: 5px 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 6px;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-btn {
  padding: 5px 10px;
  border: 1px solid var(--border);
  background: var(--white);
  border-radius: 6px;
  font-size: 1.25rem;
  cursor: pointer;
  color: var(--mid);
  transition: all var(--transition);
}
.file-btn:hover { border-color: var(--gold); color: var(--gold-dark); }
.file-list { display: flex; flex-direction: column; gap: 2px; }
.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background var(--transition);
  font-size: 1.15rem;
  color: var(--dark);
}
.file-item:hover { background: var(--gold-bg); }
.file-item .fi-icon { font-size: 1.15rem; flex-shrink: 0; }
.file-item .fi-name { flex: 0.65; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-item .fi-size { font-size: 1.02rem; color: var(--muted); flex-shrink: 0; }
.file-item.dir { color: var(--gold-dark); }

/* Tasks */
.task-input-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.task-input {
  flex: 0.65;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  font-size: 1.15rem;
  background: var(--white);
  color: var(--dark);
  outline: none;
  transition: border-color var(--transition);
}
.task-input:focus { border-color: var(--gold); }
.task-add-btn {
  padding: 8px 14px;
  background: var(--gold);
  border: none;
  border-radius: 6px;
  color: white;
  font-size: 1.15rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--transition);
}
.task-add-btn:hover { opacity: 0.9; }
.task-list { display: flex; flex-direction: column; gap: 8px; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--transition);
}
.task-item:hover { border-color: var(--border-strong); }
.task-item.done { opacity: 0.6; }
.task-item.done .task-text { text-decoration: line-through; }
.task-check {
  width: 18px; height: 18px;
  border-radius: 4px;
  border: 2px solid var(--border-strong);
  flex-shrink: 0;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
  margin-top: 1px;
}
.task-item.done .task-check { background: var(--gold); border-color: var(--gold); }
.task-text { flex: 0.65; font-size: 1.15rem; color: var(--dark); }
.task-delete {
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  border-radius: 4px;
  font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
.task-delete:hover { background: rgba(231,76,60,0.1); color: var(--danger); }
.task-priority {
  font-size: 0.98rem;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.task-priority.high { background: rgba(231,76,60,0.1); color: var(--danger); }
.task-priority.med { background: rgba(243,156,18,0.1); color: var(--warning); }
.task-priority.low { background: rgba(46,204,113,0.1); color: var(--success); }

/* Portfolio */
.portfolio-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.98rem;
}
.portfolio-table th {
  text-align: left;
  padding: 6px 8px;
  background: var(--gold-pale);
  color: var(--gold-dark);
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-weight: 700;
}
.portfolio-table td {
  padding: 8px 8px;
  border-bottom: 1px solid var(--border);
  color: var(--dark);
}
.portfolio-table tr:last-child td { border-bottom: none; }
.portfolio-table tr:hover td { background: var(--gold-bg); }
.pnl-pos { color: var(--success); font-weight: 600; }
.pnl-neg { color: var(--danger); font-weight: 600; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.98rem;
  font-weight: 600;
}
.badge-buy { background: rgba(46,204,113,0.1); color: var(--success); }
.badge-sell { background: rgba(231,76,60,0.1); color: var(--danger); }

/* Content Views */
.content-view { display: none; flex: 1; flex-direction: column; overflow: hidden; }
.content-view.active { display: flex; }

/* Files View */
.files-view-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 24px;
  height: 100%;
}
.files-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.view-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--dark);
}
.file-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.file-card {
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}
.file-card:hover {
  border-color: var(--gold);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}
.file-card .fc-icon { font-size: 2rem; margin-bottom: 8px; }
.file-card .fc-name {
  font-size: 0.98rem;
  color: var(--dark);
  word-break: break-word;
  line-clamp: 2;
}
.file-card .fc-meta { font-size: 1.15rem; color: var(--muted); margin-top: 4px; }

/* Tasks View */
.tasks-view-inner {
  flex: 0.65;
  overflow-y: auto;
  padding: 24px;
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}
.tasks-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.tasks-input-full {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  background: var(--off-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.tasks-input-full input {
  flex: 0.65;
  border: none;
  background: transparent;
  font-size: 1.25rem;
  color: var(--dark);
  outline: none;
}
.tasks-input-full select {
  border: none;
  background: transparent;
  font-size: 1.15rem;
  color: var(--mid);
  outline: none;
  cursor: pointer;
}
.tasks-input-full button {
  padding: 6px 16px;
  background: var(--gold);
  border: none;
  border-radius: 6px;
  color: white;
  font-weight: 600;
  font-size: 1.15rem;
  cursor: pointer;
}
.tasks-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.filter-btn {
  padding: 5px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  font-size: 1.25rem;
  color: var(--mid);
  cursor: pointer;
  transition: all var(--transition);
}
.filter-btn.active { background: var(--gold-pale); border-color: var(--gold); color: var(--gold-dark); font-weight: 600; }
.filter-btn:hover { border-color: var(--gold); color: var(--gold-dark); }

/* Memory View */
.memory-view-inner {
  flex: 0.65;
  overflow-y: auto;
  padding: 24px;
}
.memory-card {
  background: var(--off-white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.memory-card h4 { font-size: 1.05rem; font-weight: 700; color: var(--dark); margin-bottom: 8px; }
.memory-card p { font-size: 1.15rem; color: var(--mid); line-height: 1.6; white-space: pre-wrap; }
.memory-date { font-size: 1.15rem; color: var(--muted); margin-top: 6px; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* Welcome banner */
.welcome-banner {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark-3) 100%);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.welcome-text h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
  margin-bottom: 4px;
}
.welcome-text p { font-size: 1.15rem; color: rgba(255,255,255,0.6); }
.welcome-gold { color: var(--gold); }
.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--muted);
}
.empty-state .es-icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: 1.05rem; }

/* Code blocks in messages */
.msg-bubble code {
  background: rgba(0,0,0,0.1);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.85em;
  font-family: 'Monaco', monospace;
}
.msg-bubble pre {
  background: rgba(0,0,0,0.08);
  padding: 10px;
  border-radius: 6px;
  overflow-x: auto;
  margin: 8px 0;
  font-size: 0.82em;
}

/* Responsive */
@media (max-width: 900px) {
  .sidebar { display: none; }
  :root { --panel-w: 100vw; }
  .side-panel.open {
    position: fixed;
    right: 0; top: var(--header-h); bottom: 0;
    z-index: 200;
    box-shadow: var(--shadow-lg);
  }
  .header-nav .nav-btn .icon { margin-right: 0; }
}
@media (max-width: 600px) {
  .header-logo { font-size: 1.15rem; }
  .chat-messages { padding: 12px 16px; }
  .chat-input-area { padding: 12px 16px; }
}

/* Loading spinner */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.toast {
  padding: 12px 20px;
  border-radius: var(--radius);
  font-size: 1.15rem;
  font-weight: 500;
  color: white;
  box-shadow: var(--shadow-md);
  animation: slideIn 0.2s ease;
  cursor: pointer;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--dark); }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ── Chat History ──────────────────────────────────────────── */
.history-msg { opacity: 0.85; }
.history-banner {
  text-align: center;
  font-size: 0.92rem;
  color: var(--muted);
  padding: 8px 12px;
  margin: 8px 0;
  background: var(--surface);
  border-radius: 20px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  align-self: center;
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

/* ─── File Table Styling ─── */
.file-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.file-table thead {
  background: var(--off-white);
  border-bottom: 2px solid var(--border);
}

.file-table th {
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
  color: var(--dark);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.file-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background-color var(--transition);
}

.file-table tbody tr:hover {
  background: var(--gold-pale);
}

.file-table td {
  padding: 12px 16px;
  color: var(--dark);
  font-size: 0.88rem;
}

.file-table td.file-name {
  font-weight: 500;
  color: var(--gold-dark);
}

.file-table td.file-type {
  color: var(--mid);
  font-size: 0.8rem;
}

.file-table td.file-size {
  text-align: right;
  color: var(--mid);
  font-family: monospace;
}

.file-table td.file-date {
  color: var(--mid);
  font-size: 0.85rem;
}

.file-table td.file-actions {
  text-align: center;
}

.file-action-btn {
  display: inline-block;
  margin: 0 4px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all var(--transition);
  color: var(--dark);
}

.file-action-btn:hover {
  background: var(--gold);
  color: white;
  border-color: var(--gold);
}

.file-action-btn.delete {
  color: var(--danger);
  border-color: var(--danger);
}

.file-action-btn.delete:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
}

/* ── Inter font override ─────────────────────────────────── */
body, button, input, textarea, select, th, td {
  font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif !important;
}

/* ── File List View ──────────────────────────────────────── */
.file-list-view {
  width: 100%;
  flex: 1;
  overflow: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--white);
  box-shadow: var(--shadow-sm);
  min-height: 0;
}

.file-list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.file-list-table thead {
  background: var(--off-white);
  border-bottom: 2px solid var(--border-strong);
  position: sticky;
  top: 0;
  z-index: 2;
}

.file-list-table th {
  padding: 11px 16px;
  text-align: left;
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--dark-2);
  white-space: nowrap;
  user-select: none;
}

.fl-th-size, .fl-th-date { text-align: right; }
.fl-th-actions { text-align: center; width: 80px; }
.fl-th-type { width: 80px; }
.fl-th-size { width: 90px; }
.fl-th-date { width: 160px; }

.file-row {
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.file-row:last-child { border-bottom: none; }

.file-row:hover { background: var(--gold-pale); }

.file-list-table td {
  padding: 10px 16px;
  font-size: 0.875rem;
  color: var(--dark);
  vertical-align: middle;
}

.fl-name {
  font-weight: 500;
  color: var(--dark);
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fl-name:hover { color: var(--gold-dark); }

.fl-type {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--mid);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.fl-size {
  text-align: right;
  font-family: 'Inter', monospace;
  font-size: 0.82rem;
  color: var(--mid);
}

.fl-date {
  text-align: right;
  font-size: 0.82rem;
  color: var(--mid);
  white-space: nowrap;
}

.fl-actions {
  text-align: center;
  white-space: nowrap;
}

.fl-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  margin: 0 2px;
  cursor: pointer;
  font-size: 0.82rem;
  color: var(--dark-2);
  transition: all var(--transition);
  line-height: 1;
}

.fl-btn:hover {
  background: var(--gold);
  border-color: var(--gold);
  color: white;
}

.fl-btn-del:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

/* Checkbox column */
.fl-th-check {
  width: 44px;
  text-align: center;
  padding: 11px 8px;
}

#file-list-tbody input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--gold-dark);
  margin: 0;
}

.file-row.selected {
  background: var(--gold-pale) !important;
}

/* Bulk delete UI */
.file-bulk-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px;
  background: var(--gold-bg);
  border-radius: 6px;
  border: 1px solid var(--gold-pale);
}

.file-selected-count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gold-dark);
  white-space: nowrap;
}

.file-btn-bulk {
  background: var(--danger) !important;
  color: white !important;
  border: none !important;
  padding: 6px 12px !important;
  font-weight: 600;
}

.file-btn-bulk:hover {
  background: #C0392B !important;
  opacity: 0.9;
}
