/* ═══════════════════════════════════════════════════════════════
   AI OFFICE AGENT — COMMAND CENTER STYLES
   Palette: Volcanic Glass — #1A1A1A, #333, #FF6B2B, #FFB088
   Fonts: Outfit (body) + Geist Mono (data)
═══════════════════════════════════════════════════════════════ */

/* ─── RESET & BASE ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Dark theme (default) */
  --bg-base:       #0E0E0E;
  --bg-surface:    #161616;
  --bg-elevated:   #1E1E1E;
  --bg-hover:      #252525;
  --bg-active:     #2A2A2A;
  --border:        #2C2C2C;
  --border-subtle: #222222;

  --text-primary:  #F0EDE8;
  --text-secondary:#9A9590;
  --text-muted:    #5A5550;
  --text-inverse:  #0E0E0E;

  --accent:        #FF6B2B;
  --accent-dim:    rgba(255, 107, 43, 0.15);
  --accent-glow:   rgba(255, 107, 43, 0.25);
  --accent-warm:   #FFB088;
  --accent-hot:    #FF4500;

  --green:  #4ADE80;
  --red:    #F87171;
  --yellow: #FBBF24;
  --blue:   #60A5FA;

  --sidebar-w: 240px;
  --topbar-h:  56px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-sm: 5px;

  --font-body: 'Outfit', sans-serif;
  --font-mono: 'Geist Mono', 'Courier New', monospace;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.6);
  --shadow-accent: 0 0 20px rgba(255,107,43,0.2);

  --transition: 0.18s ease;
}

[data-theme="light"] {
  --bg-base:       #F5F3F0;
  --bg-surface:    #FFFFFF;
  --bg-elevated:   #FAFAF9;
  --bg-hover:      #F0EDE8;
  --bg-active:     #E8E4DF;
  --border:        #E0DDD8;
  --border-subtle: #ECEAE6;

  --text-primary:  #1A1A1A;
  --text-secondary:#5A5550;
  --text-muted:    #9A9590;
  --text-inverse:  #FFFFFF;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
}

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ─── SIDEBAR ───────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
  transition: width var(--transition), min-width var(--transition);
  overflow: hidden;
}

.sidebar.collapsed {
  width: 60px;
  min-width: 60px;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 16px 14px;
  border-bottom: 1px solid var(--border-subtle);
  min-height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.logo-icon {
  width: 34px;
  height: 34px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-text {
  display: flex;
  flex-direction: column;
  white-space: nowrap;
  overflow: hidden;
}

.logo-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.3px;
}

.logo-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--accent);
  letter-spacing: 1.5px;
  font-weight: 500;
}

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: color var(--transition), background var(--transition);
}
.sidebar-toggle:hover { color: var(--text-primary); background: var(--bg-hover); }

/* Agent Status */
.agent-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--transition);
}
.status-dot.online  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.status-dot.offline { background: var(--red); }
.status-dot.warning { background: var(--yellow); }

.status-text {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
}

/* Navigation */
.nav-menu {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 12px 0;
}

.nav-section-label {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 1.8px;
  color: var(--text-muted);
  padding: 12px 16px 6px;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  border-radius: 0;
  transition: all var(--transition);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.nav-item.active {
  color: var(--accent);
  background: var(--accent-dim);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  background: var(--accent-dim);
  color: var(--accent);
  padding: 2px 6px;
  border-radius: 99px;
  min-width: 20px;
  text-align: center;
  white-space: nowrap;
}

.nav-badge.pulse {
  animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  overflow: hidden;
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.logout-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  flex-shrink: 0;
}
.logout-btn:hover { color: var(--red); background: rgba(248,113,113,0.1); }

/* ─── MAIN CONTENT ──────────────────────────────────────────── */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  transition: margin-left var(--transition);
}

.sidebar.collapsed ~ .main-content {
  margin-left: 60px;
}

/* ─── TOPBAR ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius-sm);
}

.page-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.breadcrumb-root { color: var(--text-muted); }
.breadcrumb-sep  { color: var(--border); }
.breadcrumb-current { color: var(--text-primary); font-weight: 600; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 7px 12px;
  color: var(--text-muted);
  transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--accent); }
.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  width: 180px;
}
.search-bar input::placeholder { color: var(--text-muted); }

.topbar-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  cursor: pointer;
  padding: 7px 9px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
}
.topbar-btn:hover { color: var(--text-primary); border-color: var(--accent); background: var(--accent-dim); }

.notification-btn {
  position: relative;
  cursor: pointer;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  transition: all var(--transition);
}
.notification-btn:hover { color: var(--text-primary); border-color: var(--accent); background: var(--accent-dim); }

.notif-dot {
  position: absolute;
  top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}

/* ─── PAGES ─────────────────────────────────────────────────── */
.page {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
  animation: fadeIn 0.2s ease;
}
.page.active { display: block; }

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

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
  line-height: 1.2;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-hot);
  border-color: var(--accent-hot);
  box-shadow: var(--shadow-accent);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
.btn-ghost:hover {
  color: var(--text-primary);
  border-color: var(--accent);
  background: var(--accent-dim);
}

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  font-family: var(--font-body);
  padding: 0;
  transition: opacity var(--transition);
}
.link-btn:hover { opacity: 0.7; }

/* ─── KPI CARDS ─────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition), transform var(--transition);
  cursor: default;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--border);
  transition: background var(--transition);
}

.kpi-card:hover {
  border-color: var(--border);
  transform: translateY(-1px);
}

.kpi-card[data-type="email"]:hover::before  { background: #60A5FA; }
.kpi-card[data-type="files"]:hover::before  { background: var(--green); }
.kpi-card[data-type="sheets"]:hover::before { background: #34D399; }
.kpi-card[data-type="ai"]:hover::before     { background: var(--accent); }

.kpi-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}

.email-icon  { background: rgba(96,165,250,0.12); color: #60A5FA; }
.files-icon  { background: rgba(74,222,128,0.12); color: var(--green); }
.sheets-icon { background: rgba(52,211,153,0.12); color: #34D399; }
.ai-icon     { background: var(--accent-dim); color: var(--accent); }

.kpi-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -1px;
}

.kpi-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.kpi-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: auto;
}

/* ─── CHARTS ────────────────────────────────────────────────── */
.charts-row {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
  margin-bottom: 20px;
}

.chart-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.chart-header h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.chart-controls {
  display: flex;
  gap: 4px;
}

.chart-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
}
.chart-btn.active, .chart-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

.chart-body {
  position: relative;
  height: 200px;
}

/* ─── BOTTOM ROW ────────────────────────────────────────────── */
.bottom-row {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 14px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-header h3 {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

/* Activity Feed */
.activity-feed {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.feed-list { display: flex; flex-direction: column; gap: 2px; }

.feed-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
}
.feed-item:hover { background: var(--bg-hover); }

.feed-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}
.feed-dot.info    { background: var(--blue); }
.feed-dot.success { background: var(--green); }
.feed-dot.warning { background: var(--yellow); }
.feed-dot.error   { background: var(--red); }

.feed-content { flex: 1; min-width: 0; }
.feed-msg  { font-size: 12.5px; color: var(--text-primary); line-height: 1.4; }
.feed-time { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); margin-top: 2px; }

.feed-skeleton {
  height: 40px;
  background: linear-gradient(90deg, var(--bg-elevated) 25%, var(--bg-hover) 50%, var(--bg-elevated) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.5s infinite;
  margin-bottom: 4px;
}

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Quick Actions */
.quick-actions {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
}

.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  transition: all var(--transition);
  text-align: center;
}
.action-tile:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
  transform: translateY(-1px);
}

/* ─── STATS BAR ─────────────────────────────────────────────── */
.stats-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stat-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-pill.accent {
  background: var(--accent-dim);
  border-color: var(--accent-glow);
  color: var(--accent);
}

.stat-num {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 14px;
  color: var(--text-primary);
}

.stat-pill.accent .stat-num { color: var(--accent); }

/* ─── FILTER BAR ────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-input {
  flex: 1;
  min-width: 200px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
.filter-input:focus { border-color: var(--accent); }
.filter-input::placeholder { color: var(--text-muted); }

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

.toggle-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

/* ─── EMAIL LIST ────────────────────────────────────────────── */
.email-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.email-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: start;
  cursor: pointer;
  transition: all var(--transition);
}
.email-item:hover { border-color: var(--border); background: var(--bg-elevated); }
.email-item.unread { border-left: 3px solid var(--accent); }

.email-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  flex-shrink: 0;
}

.email-body { min-width: 0; }
.email-from { font-size: 13px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.email-subject { font-size: 12.5px; color: var(--text-secondary); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-preview { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.email-summary { font-size: 11.5px; color: var(--accent-warm); margin-top: 4px; font-style: italic; }

.email-meta { text-align: right; flex-shrink: 0; }
.email-time { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.email-actions { display: flex; gap: 4px; margin-top: 6px; justify-content: flex-end; }
.email-action-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 10px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
}
.email-action-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-dim); }

/* ─── DROP ZONE ─────────────────────────────────────────────── */
.drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 24px;
  text-align: center;
  transition: all var(--transition);
  cursor: pointer;
  margin-bottom: 8px;
}
.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.drop-icon { color: var(--text-muted); margin-bottom: 12px; }
.drop-text { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 6px; }
.drop-sub  { font-size: 12px; color: var(--text-muted); margin-bottom: 16px; }

/* ─── DATA TABLE ────────────────────────────────────────────── */
.file-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: var(--bg-hover); }

.table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 32px !important;
  font-size: 13px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font-mono);
}
.status-badge.success { background: rgba(74,222,128,0.12); color: var(--green); }
.status-badge.error   { background: rgba(248,113,113,0.12); color: var(--red); }
.status-badge.pending { background: rgba(251,191,36,0.12); color: var(--yellow); }
.status-badge.online  { background: rgba(74,222,128,0.12); color: var(--green); }
.status-badge.offline { background: rgba(248,113,113,0.12); color: var(--red); }

/* ─── LOG LIST ──────────────────────────────────────────────── */
.log-list { display: flex; flex-direction: column; gap: 4px; }

.log-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.log-time { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); flex-shrink: 0; }
.log-op   { font-family: var(--font-mono); font-size: 10px; color: var(--accent); flex-shrink: 0; }
.log-file { color: var(--text-secondary); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-rows { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); flex-shrink: 0; }

/* ─── SHEETS GRID ───────────────────────────────────────────── */
.sheets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.sheet-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all var(--transition);
}
.sheet-card:hover { border-color: var(--border); transform: translateY(-1px); }

.sheet-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sheet-icon {
  width: 36px;
  height: 36px;
  background: rgba(52,211,153,0.12);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #34D399;
  font-size: 18px;
}

.sheet-name { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.sheet-id   { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }
.sheet-meta { display: flex; gap: 12px; margin-top: 12px; }
.sheet-stat { font-size: 11px; color: var(--text-muted); }
.sheet-stat strong { color: var(--text-primary); font-family: var(--font-mono); }

.sheet-actions { display: flex; gap: 6px; margin-top: 14px; }

/* ─── CONNECTION BANNER ─────────────────────────────────────── */
.connection-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
}

.banner-icon { font-size: 24px; flex-shrink: 0; }
.banner-text { flex: 1; }
.banner-text strong { display: block; font-size: 14px; color: var(--text-primary); margin-bottom: 2px; }
.banner-text span   { font-size: 12px; color: var(--text-muted); }

/* ─── AI LAYOUT ─────────────────────────────────────────────── */
.ai-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
  height: calc(100vh - var(--topbar-h) - 120px);
}

.chat-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.chat-welcome {
  text-align: center;
  padding: 40px 20px;
  margin: auto;
  max-width: 400px;
}

.welcome-icon {
  font-size: 40px;
  margin-bottom: 16px;
  display: block;
}

.chat-welcome h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.chat-welcome p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.suggestion-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 99px;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
}
.chip:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* Chat Messages */
.chat-msg {
  display: flex;
  gap: 10px;
  max-width: 85%;
  animation: msgIn 0.2s ease;
}

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

.chat-msg.user { margin-left: auto; flex-direction: row-reverse; }

.msg-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}

.chat-msg.user .msg-avatar { background: var(--accent-dim); color: var(--accent); }
.chat-msg.ai   .msg-avatar { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }

.msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.6;
  max-width: 100%;
}

.chat-msg.user .msg-bubble {
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius) var(--radius-sm) var(--radius) var(--radius);
}

.chat-msg.ai .msg-bubble {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm) var(--radius) var(--radius) var(--radius);
}

.msg-time {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text-muted);
  margin-top: 4px;
  text-align: right;
}

.chat-msg.ai .msg-time { text-align: left; }

/* Typing indicator */
.typing-indicator {
  display: flex;
  gap: 4px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm) var(--radius) var(--radius) var(--radius);
  width: fit-content;
}

.typing-dot {
  width: 6px;
  height: 6px;
  background: var(--text-muted);
  border-radius: 50%;
  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); opacity: 0.4; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Chat Input */
.chat-input-area {
  border-top: 1px solid var(--border-subtle);
  padding: 14px 16px;
}

.chat-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 8px 8px 14px;
  transition: border-color var(--transition);
}
.chat-input-wrap:focus-within { border-color: var(--accent); }

.chat-input-wrap textarea {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13.5px;
  resize: none;
  max-height: 120px;
  line-height: 1.5;
}
.chat-input-wrap textarea::placeholder { color: var(--text-muted); }

.send-btn {
  width: 34px;
  height: 34px;
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background var(--transition);
}
.send-btn:hover { background: var(--accent-hot); }
.send-btn:disabled { background: var(--bg-hover); color: var(--text-muted); cursor: not-allowed; }

.chat-footer-info {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}

/* AI Sidebar */
.ai-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.ai-sidebar-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px;
}

.ai-sidebar-section h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.command-list { display: flex; flex-direction: column; gap: 4px; }

.command-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  color: var(--text-secondary);
  font-family: var(--font-body);
  text-align: left;
  transition: all var(--transition);
}
.command-item:hover {
  background: var(--accent-dim);
  border-color: var(--accent-glow);
  color: var(--text-primary);
}

.cmd-icon { font-size: 14px; flex-shrink: 0; }

.ai-status-card { display: flex; flex-direction: column; gap: 8px; }

.ai-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
}

.ai-status-row span:last-child {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ─── SETTINGS ──────────────────────────────────────────────── */
.settings-layout {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 20px;
}

.settings-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.settings-tab {
  background: none;
  border: none;
  text-align: left;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition);
}
.settings-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.settings-tab.active { background: var(--accent-dim); color: var(--accent); }

.settings-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.settings-section { margin-bottom: 28px; }
.settings-section:last-child { margin-bottom: 0; }

.settings-section h3 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-subtle);
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: var(--accent); }

.form-group select option { background: var(--bg-elevated); }

.form-error {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.3);
  color: var(--red);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 12px;
}

/* ─── TASKS LIST ────────────────────────────────────────────── */
.tasks-list { display: flex; flex-direction: column; gap: 8px; }

.task-item {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: all var(--transition);
}
.task-item:hover { border-color: var(--border); }

.task-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.task-info { flex: 1; min-width: 0; }
.task-name { font-size: 13.5px; font-weight: 600; color: var(--text-primary); margin-bottom: 3px; }
.task-cron { font-family: var(--font-mono); font-size: 11px; color: var(--accent); }
.task-meta { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.task-toggle {
  width: 36px;
  height: 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 99px;
  cursor: pointer;
  position: relative;
  transition: all var(--transition);
  flex-shrink: 0;
}
.task-toggle.on { background: var(--accent); border-color: var(--accent); }
.task-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: #fff;
  border-radius: 50%;
  transition: transform var(--transition);
}
.task-toggle.on::after { transform: translateX(16px); }

/* ─── REPORTS GRID ──────────────────────────────────────────── */
.reports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.report-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 18px;
  transition: all var(--transition);
}
.report-card:hover { border-color: var(--border); transform: translateY(-1px); }

.report-type {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.report-title { font-size: 14px; font-weight: 600; color: var(--text-primary); margin-bottom: 8px; }
.report-preview { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 14px; }
.report-footer { display: flex; justify-content: space-between; align-items: center; }
.report-date { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }

/* ─── MODALS ────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modalIn 0.2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(-10px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 { font-size: 15px; font-weight: 600; color: var(--text-primary); }

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.modal-close:hover { color: var(--text-primary); background: var(--bg-hover); }

.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border-subtle); display: flex; gap: 8px; justify-content: flex-end; }

/* Login Modal */
.login-modal { max-width: 380px; }

.login-header {
  text-align: center;
  padding: 32px 24px 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.login-logo {
  width: 56px;
  height: 56px;
  background: var(--accent-dim);
  border: 1px solid var(--accent-glow);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.login-header h2 { font-size: 18px; font-weight: 700; color: var(--text-primary); margin-bottom: 6px; }
.login-header p  { font-size: 13px; color: var(--text-muted); }

.login-form { padding: 20px 24px; }
.login-hint { text-align: center; font-size: 11px; color: var(--text-muted); padding: 0 24px 20px; font-family: var(--font-mono); }

/* ─── TOASTS ────────────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 260px;
  max-width: 360px;
  pointer-events: all;
  animation: toastIn 0.25s ease;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--red); }
.toast.warning { border-left: 3px solid var(--yellow); }
.toast.info    { border-left: 3px solid var(--blue); }

.toast-icon { font-size: 16px; flex-shrink: 0; }
.toast-msg  { flex: 1; line-height: 1.4; }

/* ─── EMPTY STATE ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}

.empty-icon { font-size: 40px; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 13px; line-height: 1.6; margin-bottom: 20px; }

/* ─── RESPONSIVE ────────────────────────────────────────────── */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row { grid-template-columns: 1fr; }
  .bottom-row { grid-template-columns: 1fr; }
  .ai-layout { grid-template-columns: 1fr; }
  .ai-sidebar { display: none; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .mobile-menu-btn { display: flex; }
  .search-bar { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page { padding: 16px; }
  .settings-layout { grid-template-columns: 1fr; }
  .settings-nav { flex-direction: row; flex-wrap: wrap; }
}

@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; }
  .page-actions { width: 100%; }
}

/* ─── UTILITY ───────────────────────────────────────────────── */
.mono { font-family: var(--font-mono); }
.text-accent { color: var(--accent); }
.text-muted  { color: var(--text-muted); }
.text-green  { color: var(--green); }
.text-red    { color: var(--red); }
.hidden { display: none !important; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }