/* ── Context Graph — Shared Styles ─────────────────────────────────
   Common CSS for all Context Graph web pages.
   Import via: <link rel="stylesheet" href="/static/common.css">
   ────────────────────────────────────────────────────────────────── */

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: #111827; }

/* ── Tokens ── */
:root {
  --navy: #1A0E5C;
  --primary: #6D28D9;
  --primary-light: #EDE9FE;
  --bg: #f5f5fa;
  --surface: #ffffff;
  --text: #111827;
  --text-2: #374151;
  --text-3: #6B7280;
  --muted: #9CA3AF;
  --border: #E5E7EB;
  --border-2: #D1D5DB;
  --green: #059669;
  --red: #DC2626;
  --amber: #D97706;
  --blue: #2563EB;
  --font-mono: 'SF Mono', 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}

/* ── Topbar ── */
.topbar {
  height: 48px;
  background: var(--navy);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 12px;
  flex-shrink: 0;
  z-index: 100;
}
.topbar-logo { height: 26px; width: auto; margin-right: 6px; }
.topbar-back {
  color: rgba(255,255,255,0.55);
  font-size: 13px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color 0.15s;
}
.topbar-back:hover { color: #fff; }
.topbar-sep { color: rgba(255,255,255,0.2); }
.topbar-title { color: #fff; font-size: 14px; font-weight: 600; letter-spacing: -0.2px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-stat { color: rgba(255,255,255,0.45); font-size: 12px; }
.topbar-badge {
  font-size: 11px; font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(255,255,255,0.12);
  color: rgba(255,255,255,0.75);
}

/* ── Common layout patterns ── */
.cg-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.cg-sidebar {
  width: 300px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
}
.cg-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ── Tab bar ── */
.cg-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 24px;
  flex-shrink: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.cg-tab-btn {
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.cg-tab-btn:hover { color: var(--navy); }
.cg-tab-btn.active { color: var(--navy); border-bottom-color: var(--primary); }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }

/* ── Utility ── */
.cg-empty { text-align: center; padding: 40px 24px; color: var(--muted); font-size: 13px; }
.cg-loading { text-align: center; padding: 32px; color: var(--text-3); font-size: 13px; }

/* ── Mobile responsive — global ── */
@media (max-width: 768px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar-back { font-size: 12px; }
  .topbar-title { font-size: 13px; }
  .topbar-stat { font-size: 10px; }
  .topbar-badge { font-size: 10px; padding: 2px 6px; }

  .cg-layout { flex-direction: column; }
  .cg-sidebar {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
  }
  .cg-tab-bar { padding: 0 12px; }
  .cg-tab-btn { padding: 8px 10px; font-size: 11px; }
}

@media (max-width: 480px) {
  .topbar { height: 44px; }
  .topbar-logo { height: 22px; }
  .cg-sidebar { max-height: 160px; }
}
