/* Consensio — design tokens (dark-first) */
:root,
:root[data-theme="dark"],
[data-theme="dark"] {
  --bg-base: #0A0E14;
  --bg-surface: #111827;
  --bg-raised: #1C2533;
  --bg-overlay: #243044;

  --text-primary: #E2E8F0;
  --text-secondary: #94A3B8;
  --text-tertiary: #64748B;

  --accent-info: #3B82F6;
  --accent-success: #10B981;
  --accent-warning: #F59E0B;
  --accent-danger: #EF4444;
  --accent-paper: #6366F1;
  --accent-request: #14B8A6;

  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.15);

  --brand-1: #14B8A6; /* teal */
  --brand-2: #3B82F6; /* blue */
  --brand-3: #6366F1; /* indigo */

  --font-ui: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

:root[data-theme="light"] {
  --bg-base: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-raised: #F1F5F9;
  --bg-overlay: #E2E8F0;

  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-tertiary: #94A3B8;

  --border: rgba(15, 23, 42, 0.10);
  --border-hover: rgba(15, 23, 42, 0.18);
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'cv11', 'ss01';
}
button { font-family: inherit; color: inherit; }
input, textarea, select { font-family: inherit; color: inherit; }

/* Typography scale — ONLY these sizes */
.t-label   { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-secondary); font-weight: 500; }
.t-meta    { font-size: 12px; color: var(--text-secondary); }
.t-body    { font-size: 13px; color: var(--text-primary); }
.t-card    { font-size: 15px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.005em; }
.t-page    { font-size: 18px; font-weight: 600; color: var(--text-primary); letter-spacing: -0.01em; }
.mono      { font-family: var(--font-mono); font-feature-settings: 'zero', 'ss01'; }

/* Surfaces */
.surface { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 6px; }
.raised  { background: var(--bg-raised);  border: 1px solid var(--border); border-radius: 6px; }
.hover-row:hover { background: var(--bg-overlay); }

/* Buttons */
.btn {
  height: 28px; padding: 0 12px; border-radius: 5px;
  border: 1px solid var(--border); background: var(--bg-raised);
  font-size: 12px; font-weight: 500; color: var(--text-primary);
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
}
.btn:hover { background: var(--bg-overlay); border-color: var(--border-hover); }
.btn-primary {
  background: var(--accent-info); border-color: transparent; color: #fff;
}
.btn-primary:hover { background: #2563EB; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--bg-overlay); }
.btn-sm { height: 24px; padding: 0 8px; font-size: 11px; }

/* Chips / pills */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  height: 20px; padding: 0 8px; border-radius: 4px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.01em;
  border: 1px solid transparent;
}
.chip-dot { width: 6px; height: 6px; border-radius: 50%; }

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--accent-info);
  outline-offset: 1px;
  border-radius: 4px;
}

/* Scrollbar */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.18); border-radius: 8px;
  border: 2px solid transparent; background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: rgba(148,163,184,0.32); background-clip: content-box; }

/* Skeleton */
@keyframes shimmer {
  0% { background-position: -400px 0; }
  100% { background-position: 400px 0; }
}
@keyframes opacityPulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 0.7; }
}
.skeleton-pulse {
  background: var(--bg-overlay);
  animation: opacityPulse 1.2s ease-in-out infinite;
  border-radius: 3px;
}
@keyframes rowFlash {
  0%   { background-color: color-mix(in oklab, var(--accent-info) 36%, transparent); }
  100% { background-color: transparent; }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translate(-50%, 8px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.skeleton {
  background: linear-gradient(90deg,
    var(--bg-raised) 0%,
    var(--bg-overlay) 50%,
    var(--bg-raised) 100%);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
  border-radius: 4px;
}

/* Brand mark gradient */
.brand-grad {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
}
.brand-bg {
  background: linear-gradient(135deg, var(--brand-1), var(--brand-2) 55%, var(--brand-3));
}

/* Table */
table.cx { width: 100%; border-collapse: collapse; }
table.cx thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--bg-raised);
  text-align: left;
  font-size: 11px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-secondary);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
table.cx tbody td {
  padding: 12px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
table.cx tbody tr:hover { background: var(--bg-overlay); cursor: pointer; }
table.cx tbody tr.selected { background: color-mix(in oklab, var(--accent-info) 14%, var(--bg-surface)); }

/* Sidebar */
.sb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 5px;
  font-size: 13px; color: var(--text-secondary);
  cursor: pointer; user-select: none;
  border: 1px solid transparent;
}
.sb-item:hover { background: var(--bg-raised); color: var(--text-primary); }
.sb-item.active {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-color: var(--border);
}
.sb-item.active .sb-ico { color: var(--accent-info); }
.sb-ico { width: 16px; height: 16px; flex-shrink: 0; color: var(--text-tertiary); }

/* Kbd */
.kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  font-size: 11px; font-family: var(--font-mono);
  color: var(--text-secondary);
  background: var(--bg-base); border: 1px solid var(--border); border-radius: 3px;
}
