/* ArkChrome design tokens */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&family=JetBrains+Mono:wght@400;500&family=Fraunces:opsz,wght@9..144,500;9..144,600&display=swap');

:root {
  --bg-primary: #0B0B10;
  --bg-secondary: #111118;
  --bg-surface: #16161F;
  --bg-surface-hover: #1E1E2A;
  --bg-elevated: #1A1A24;

  --border-subtle: #1F1F2E;
  --border-strong: #2D2D42;
  --border-focus: #6D5CFF;

  --text-primary: #EDEEF3;
  --text-secondary: #A8ADB9;
  --text-tertiary: #6B7180;
  --text-inverse: #0B0B10;

  --brand-primary: #6D5CFF;
  --brand-primary-dim: #4D3ECC;
  --brand-accent: #00D4B4;

  --success: #4ADE80;
  --warning: #FBBF24;
  --danger: #F87171;

  --code-bg: #0D0D14;
  --code-inline-bg: #1E1E2E;
  --code-keyword: #C084FC;
  --code-string: #7DD3FC;
  --code-comment: #6B7180;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  --shadow-1: 0 1px 2px rgba(0,0,0,0.35);
  --shadow-2: 0 4px 12px rgba(0,0,0,0.30), 0 2px 4px rgba(0,0,0,0.20);
  --shadow-3: 0 12px 32px rgba(0,0,0,0.35), 0 4px 8px rgba(0,0,0,0.25);
  --glow-brand: 0 0 24px rgba(109, 92, 255, 0.15);

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-numeric: 'Fraunces', serif;
}

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

html, body {
  background: var(--bg-primary);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

#root { min-height: 100vh; }

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* Typography helpers */
.display { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.h2 { font-family: var(--font-display); font-weight: 700; font-size: clamp(32px, 4vw, 44px); line-height: 1.1; letter-spacing: -0.02em; }
.h3 { font-family: var(--font-display); font-weight: 600; font-size: 24px; line-height: 1.2; letter-spacing: -0.01em; }
.h4 { font-family: var(--font-display); font-weight: 600; font-size: 18px; line-height: 1.25; }
.label {
  font-family: var(--font-body); font-weight: 500; font-size: 12px;
  letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-tertiary);
}
.numeric { font-family: var(--font-numeric); font-weight: 600; font-variation-settings: "opsz" 144; letter-spacing: -0.02em; line-height: 1; }
.mono { font-family: var(--font-mono); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  border-radius: var(--radius-md);
  font-weight: 500; font-size: 14px;
  transition: all 160ms var(--ease);
  white-space: nowrap;
  user-select: none;
}
.btn-md { height: 40px; padding: 0 16px; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-lg { height: 48px; padding: 0 20px; font-size: 15px; }

.btn-primary {
  background: var(--brand-primary); color: white;
}
.btn-primary:hover { background: var(--brand-primary-dim); box-shadow: var(--shadow-2), var(--glow-brand); }
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
  background: transparent; color: var(--text-primary);
  border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-surface); border-color: var(--border-focus); }

.btn-ghost { color: var(--text-secondary); }
.btn-ghost:hover { color: var(--text-primary); background: var(--bg-surface); }

.btn-danger { background: var(--danger); color: white; }

.btn .arrow { transition: transform 160ms var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }

/* Card */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
}

/* Input */
.input {
  height: 40px;
  padding: 0 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  transition: border-color 120ms var(--ease), box-shadow 120ms var(--ease);
  width: 100%;
}
.input::placeholder { color: var(--text-tertiary); }
.input:focus { outline: none; border-color: var(--brand-primary); box-shadow: 0 0 0 2px rgba(109, 92, 255, 0.25); }

/* Pill */
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 12px;
  border-radius: 9999px;
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--border-strong);
  color: var(--text-secondary);
}
.pill-accent {
  border-color: rgba(0, 212, 180, 0.3);
  color: var(--brand-accent);
  background: rgba(0, 212, 180, 0.05);
}
.pill-accent .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-accent); box-shadow: 0 0 8px var(--brand-accent); }

/* Badge */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  height: 22px; padding: 0 8px;
  border-radius: 4px;
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-success { background: rgba(74, 222, 128, 0.1); color: var(--success); }
.badge-danger { background: rgba(248, 113, 113, 0.1); color: var(--danger); }
.badge-warning { background: rgba(251, 191, 36, 0.1); color: var(--warning); }
.badge-violet { background: rgba(109, 92, 255, 0.12); color: var(--brand-primary); }
.badge-muted { background: var(--bg-surface-hover); color: var(--text-secondary); }

/* Layout helpers */
.container { max-width: 1200px; margin: 0 auto; padding: 0 32px; }
.container-wide { max-width: 1440px; margin: 0 auto; padding: 0 32px; }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-primary); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #3a3a52; }

/* Nav */
.topnav {
  position: sticky; top: 0; z-index: 50;
  height: 64px;
  background: rgba(11, 11, 16, 0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}
.topnav-inner {
  max-width: 1440px; margin: 0 auto;
  height: 100%; padding: 0 32px;
  display: flex; align-items: center; gap: 40px;
}
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
.logo-mark {
  width: 24px; height: 24px;
}
.nav-links { display: flex; gap: 28px; }
.nav-link {
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  position: relative;
  transition: color 120ms var(--ease);
}
.nav-link:hover { color: var(--text-primary); }
.nav-link.active { color: var(--brand-primary); }
.nav-link.active::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: -20px;
  height: 1px; background: var(--brand-primary);
}

/* Hero background trail pattern */
.trail-bg {
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='600' height='600' viewBox='0 0 600 600'><g fill='none' stroke='%236D5CFF' stroke-width='0.8' opacity='0.06'><path d='M0 150 C 100 100, 180 220, 300 180 S 520 120, 600 200'/><path d='M0 380 C 120 330, 200 420, 340 400 S 500 440, 600 380'/><path d='M0 520 C 80 500, 220 560, 360 520 S 540 500, 600 540'/><path d='M30 40 C 120 80, 280 40, 420 120 S 580 200, 600 140'/></g></svg>");
  background-size: 600px 600px;
  pointer-events: none;
}
.violet-glow {
  position: absolute; top: -200px; right: -200px;
  width: 520px; height: 520px;
  background: radial-gradient(circle, rgba(109,92,255,0.10) 0%, rgba(109,92,255,0) 65%);
  pointer-events: none;
}

/* Terminal */
.terminal {
  background: var(--code-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-3);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.55;
}
.terminal-chrome {
  height: 36px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; padding: 0 14px;
  gap: 10px;
}
.traffic { display: flex; gap: 6px; }
.traffic span { width: 11px; height: 11px; border-radius: 50%; }
.traffic .r { background: #ff5f56; }
.traffic .y { background: #ffbd2e; }
.traffic .g { background: #27c93f; }
.terminal-title { flex: 1; text-align: center; font-family: var(--font-body); font-size: 12px; color: var(--text-tertiary); }
.terminal-body { padding: 16px 18px; min-height: 280px; color: var(--text-secondary); }
.terminal-body .line { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-pass { color: var(--brand-accent); }
.t-fail { color: var(--danger); }
.t-dim { color: var(--text-tertiary); }
.terminal-footer {
  border-top: 1px solid var(--border-subtle);
  padding: 10px 18px;
  font-family: var(--font-body);
  font-size: 12px;
  display: flex; justify-content: space-between;
  color: var(--text-tertiary);
}
.terminal-footer b { color: var(--text-primary); font-weight: 600; }

/* Code */
.codeblock {
  background: var(--code-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  font-family: var(--font-mono);
  font-size: 13px;
  overflow: hidden;
}
.codeblock pre { padding: 18px 20px; overflow-x: auto; }
.k { color: var(--code-keyword); }
.s { color: var(--code-string); }
.c { color: var(--code-comment); }
.fn { color: #93C5FD; }

/* Table */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left;
  font-weight: 500; font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-tertiary);
  padding: 12px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-subtle);
  height: 40px;
}
.table th:first-child { border-top-left-radius: 12px; }
.table th:last-child { border-top-right-radius: 12px; }
.table td {
  padding: 16px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  height: 56px;
}
.table tr:hover td { background: var(--bg-surface); color: var(--text-primary); }
.table tr:last-child td { border-bottom: none; }

/* Sidebar app shell */
.app-shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.app-side {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-subtle);
  padding: 20px 12px;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.app-side .logo { padding: 0 12px 24px; }
.app-side .nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 14px; font-weight: 500;
  transition: all 120ms var(--ease);
  cursor: pointer;
}
.app-side .nav-item:hover { color: var(--text-primary); background: var(--bg-surface); }
.app-side .nav-item.active { color: var(--text-primary); background: var(--bg-surface); }
.app-side .nav-item.active svg { color: var(--brand-primary); }
.app-side .nav-item svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-tertiary); }
.app-side .nav-item.active svg { color: var(--brand-primary); }

.app-side-foot {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex; align-items: center; gap: 10px;
  padding: 12px;
}
.avatar { width: 32px; height: 32px; border-radius: 9999px; background: linear-gradient(135deg, #6D5CFF, #00D4B4); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: white; }
.user-meta { line-height: 1.2; font-size: 13px; }
.user-meta .u-name { color: var(--text-primary); font-weight: 500; }
.user-meta .u-sub { color: var(--text-tertiary); font-size: 11px; }

.app-main { display: flex; flex-direction: column; min-width: 0; }
.app-topbar {
  height: 56px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  background: var(--bg-primary);
  position: sticky; top: 0; z-index: 30;
}
.breadcrumb { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-secondary); }
.breadcrumb .sep { color: var(--text-tertiary); }
.breadcrumb .current { color: var(--text-primary); font-weight: 500; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.app-content { padding: 32px; flex: 1; }

/* Focus ring util */
.icon-btn {
  width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  transition: all 120ms var(--ease);
}
.icon-btn:hover { background: var(--bg-surface); color: var(--text-primary); }

/* Status dot */
.dot {
  width: 8px; height: 8px; border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.dot-success { background: var(--success); box-shadow: 0 0 8px var(--success); }
.dot-danger { background: var(--danger); }
.dot-warning { background: var(--warning); }
.dot-running { background: var(--brand-primary); box-shadow: 0 0 8px var(--brand-primary); animation: pulse 1.5s ease-in-out infinite; }

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

/* Divider */
.divider { height: 1px; background: var(--border-subtle); }

/* Sparkline inline */
.sparkline { display: block; }

/* kbd */
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}

/* Tweaks panel */
.tweaks-panel {
  position: fixed; bottom: 20px; right: 20px; z-index: 1000;
  width: 280px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-3);
  padding: 16px;
}
.tweaks-panel h4 { font-family: var(--font-display); font-size: 14px; margin-bottom: 12px; }
.tweak-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; font-size: 13px; color: var(--text-secondary); }
.tweak-row select, .tweak-row input[type="color"] {
  background: var(--bg-surface); border: 1px solid var(--border-strong); color: var(--text-primary);
  border-radius: 6px; padding: 4px 8px; font-size: 12px;
}

/* Tabs */
.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--border-subtle); }
.tab {
  padding: 12px 16px;
  font-size: 14px; font-weight: 500;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  transition: color 120ms var(--ease);
}
.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--text-primary); border-bottom-color: var(--brand-primary); }

/* Chart bar */
.bar-chart { display: flex; align-items: flex-end; gap: 28px; height: 280px; padding: 20px 0; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; }
.bar-group .bars { flex: 1; display: flex; gap: 6px; align-items: flex-end; width: 100%; justify-content: center; }
.bar { width: 26px; border-radius: 3px 3px 0 0; position: relative; }
.bar-ark { background: var(--brand-primary); }
.bar-pw { background: var(--border-strong); }
.bar-label { font-size: 11px; color: var(--text-tertiary); text-align: center; }

/* Section */
section { position: relative; }

/* Focusring accessibility */
*:focus-visible { outline: 2px solid var(--brand-primary); outline-offset: 2px; border-radius: 4px; }
