/* AgentOS Theme — Shared Design System */
:root {
  /* Backgrounds */
  --bg: #0A0A0B;
  --bg-base: #0A0A0B;
  --surface: #111113;
  --bg-surface: #111113;
  --surface2: #1A1A1E;
  --bg-elevated: #1A1A1E;
  --bg-overlay: #222228;
  --bg-sidebar: #0E0E10;

  /* Borders */
  --border: #2A2A30;
  --border-subtle: #1F1F24;
  --border-default: #2A2A30;
  --border-hover: #3A3A42;

  /* Text */
  --text: #EDEDEF;
  --text-primary: #EDEDEF;
  --text-dim: #A0A0A8;
  --text-secondary: #A0A0A8;
  --text-muted: #5C5C66;
  --text-tertiary: #5C5C66;

  /* Status */
  --green: #3ECF8E;
  --yellow: #F5A623;
  --red: #EF4444;
  --blue: #3B82F6;
  --status-active: #3ECF8E;
  --status-error: #EF4444;
  --status-warning: #F59E0B;

  /* Source-specific (backward compat) */
  --ads-bg: rgba(160,160,168,0.06);
  --ads-hdr: #1A1A1E;
  --ads-accent: #A0A0A8;
  --slack-bg: rgba(139,92,246,0.08);
  --slack-hdr: #8B5CF6;
  --slack-accent: #A78BFA;
  --hb-bg: rgba(249,115,22,0.08);
  --hb-hdr: #F97316;
  --hb-accent: #FB923C;
  --mp-bg: rgba(99,102,241,0.08);
  --mp-hdr: #6366F1;
  --mp-accent: #818CF8;
  --delta-bg: rgba(255,255,255,0.02);
  --delta-hdr: #2A2A30;

  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}

/* Sidebar — AgentOS style */
.bobby-sidebar {
  width: 72px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 2px;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
}

.bobby-sidebar .nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  width: 100%;
  padding: 0 4px;
}

.bobby-sidebar .nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 64px;
  min-height: 40px;
  padding: 4px 2px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 16px;
  color: var(--text-tertiary);
  transition: background 150ms, color 150ms;
  gap: 1px;
}
.bobby-sidebar .nav a .nav-text {
  font-size: 9px;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 62px;
}

.bobby-sidebar .nav a:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.bobby-sidebar .nav a.active {
  background: rgba(139, 92, 246, 0.12);
  color: #A78BFA;
}

.bobby-sidebar .nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  width: 3px;
  height: 20px;
  background: #8B5CF6;
  border-radius: 0 3px 3px 0;
}

.bobby-sidebar .sidebar-label {
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-tertiary);
  padding: 8px 0 2px;
  text-align: center;
}

/* Content offset for sidebar (unified sidebar is 240px) */
.container, .main-content { margin-left: 240px; }

/* Buttons */
.btn {
  padding: 6px 14px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--bg-elevated);
  color: var(--text-primary);
  font-size: 12px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: all 150ms;
}
.btn:hover { background: var(--bg-overlay); border-color: var(--border-hover); }
.btn-primary, .btn.active { background: #8B5CF6; color: #fff; border-color: #8B5CF6; }
.btn-primary:hover { background: #7C3AED; }

/* Tables */
table { border-collapse: collapse; }
th { 
  background: var(--bg-elevated);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
}
td { font-size: 13px; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); }
tr:hover td { background: rgba(255,255,255,0.02); }

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 16px;
  transition: border-color 150ms;
}
.card:hover { border-color: var(--border-hover); }

/* Header */
header h1, .page-title { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.subtitle { font-size: 12px; color: var(--text-secondary); }

/* Inputs */
input, select {
  background: var(--bg-base);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  padding: 8px 12px;
  transition: border-color 150ms;
}
input:focus, select:focus { outline: none; border-color: #8B5CF6; }

/* ============================================
   RESPONSIVE — Mobile & Tablet
   ============================================ */

/* Tablet: sidebar collapses to icons only */
@media (max-width: 900px) {
  .bobby-sidebar {
    width: 44px;
  }
  .bobby-sidebar .sidebar-label {
    display: none;
  }
  .bobby-sidebar .nav a {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }
  .container, .main-content, .main {
    margin-left: 72px !important;
  }
}

/* Mobile: sidebar becomes top bar or hidden */
@media (max-width: 600px) {
  .bobby-sidebar {
    width: 100%;
    height: 48px;
    flex-direction: row;
    position: fixed;
    top: 0;
    left: 0;
    border-right: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 0 8px;
    overflow-x: auto;
    overflow-y: hidden;
    z-index: 200;
  }
  .bobby-sidebar .logo {
    display: none;
  }
  .bobby-sidebar .sidebar-label {
    display: none;
  }
  .bobby-sidebar .nav {
    flex-direction: row;
    gap: 0;
    padding: 0;
    width: auto;
  }
  .bobby-sidebar .nav a {
    width: 36px;
    height: 36px;
    font-size: 15px;
    flex-shrink: 0;
  }
  .container, .main-content, .main {
    margin-left: 0 !important;
    margin-top: 52px !important;
    padding: 12px !important;
  }

  /* Tables scroll horizontally */
  table { display: block; overflow-x: auto; white-space: nowrap; }

  /* Cards stack */
  .card { margin-bottom: 8px; }

  /* KPI cards responsive */
  .kpi-cards, .summary-cards {
    flex-direction: column !important;
    gap: 8px !important;
  }

  /* Header smaller */
  header h1, .page-title { font-size: 16px; }
  h1 { font-size: 18px; }
  h2 { font-size: 15px; }

  /* Date range picker stacks */
  .date-range { flex-wrap: wrap; gap: 4px; }
  .date-range input[type="date"] { width: 130px; font-size: 12px; }

  /* Buttons smaller */
  .btn, button { font-size: 11px; padding: 6px 10px; }
}

/* Small mobile */
@media (max-width: 380px) {
  .bobby-sidebar .nav a {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }
  .container, .main-content, .main {
    padding: 8px !important;
  }
  th, td { padding: 4px 6px; font-size: 11px; }
}

/* Responsive: adjust for unified sidebar */
@media (max-width: 768px) {
  .container, .main-content, .main { margin-left: 72px !important; }
}
@media (max-width: 600px) {
  .container, .main-content, .main { margin-left: 0 !important; margin-top: 52px !important; }
}
