/* ============================================================
   Agentory — Design System 2.0  (refined dark, premium)
   One token source of truth. cockpit.css + ledger.css inherit.
   NOTE: All class names emitted by app.js / ledger.js are preserved.
   ============================================================ */

:root {
  color-scheme: dark;

  /* surfaces (layered) */
  --bg: #0b0c0f;
  --bg-elev: #111318;
  --panel: #15171d;
  --panel-soft: #1c1f27;
  --panel-hover: #232733;
  --surface-glass: rgba(12, 13, 17, 0.72);

  /* lines */
  --border: #262a33;
  --border-strong: #353b48;
  --hairline: rgba(255, 255, 255, 0.06);
  --inset-hi: inset 0 1px 0 rgba(255, 255, 255, 0.04);

  /* text */
  --text: #f4f6fa;
  --muted: #9aa3b2;
  --faint: #6b7280;

  /* accents */
  --accent: #5eead4;
  --accent-2: #2dd4bf;
  --accent-strong: #0f766e;
  --accent-ink: #04211e;
  --accent-soft: rgba(94, 234, 212, 0.1);
  --accent-line: rgba(94, 234, 212, 0.28);
  --violet: #a78bfa;
  --ledger: #f5b544;
  --ledger-soft: rgba(245, 181, 68, 0.12);

  --companion: #38bdf8;
  --companion-strong: #0284c7;
  --companion-bg: rgba(56, 189, 248, 0.07);
  --companion-border: rgba(56, 189, 248, 0.2);

  /* semantic */
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --warm: #f97316;

  /* health states */
  --st-strong: #5eead4;
  --st-stable: #34d399;
  --st-cooling: #fbbf24;
  --st-risk: #fb7185;

  /* radius */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-pill: 999px;

  /* elevation */
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.45);
  --sh-2: 0 10px 30px -12px rgba(0, 0, 0, 0.7);
  --sh-pop: 0 20px 56px -16px rgba(0, 0, 0, 0.78);
  --glow-accent: 0 0 0 1px var(--accent-line), 0 8px 28px -10px rgba(45, 212, 191, 0.45);

  /* type */
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  --maxw: 1160px;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(1100px 620px at 78% -8%, rgba(94, 234, 212, 0.06), transparent 60%),
    radial-gradient(900px 560px at 5% 0%, rgba(167, 139, 250, 0.055), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: rgba(94, 234, 212, 0.25); color: #fff; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #2b303b; border: 3px solid transparent; background-clip: content-box; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #3a4151; background-clip: content-box; }

button, input, select, textarea { font: inherit; }

a { color: inherit; }

/* ---- base button (legacy default — primitives below override per-class) ---- */
button {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-sm);
  color: var(--accent-ink);
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  cursor: pointer;
  font-weight: 650;
  letter-spacing: -0.01em;
  transition: filter 0.16s var(--ease), transform 0.12s var(--ease), border-color 0.16s var(--ease), background 0.16s var(--ease);
}
button:hover { filter: brightness(1.06); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  background: var(--panel-soft);
  transition: border-color 0.16s var(--ease), box-shadow 0.16s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input, select { min-height: 40px; padding: 0 12px; }
textarea { min-height: 140px; padding: 12px; line-height: 1.55; resize: vertical; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-line);
  box-shadow: 0 0 0 3px rgba(94, 234, 212, 0.12);
}

/* ============================================================
   Primitives
   ============================================================ */

.btn,
.cta-primary,
.cta-secondary,
.card-cta,
.nav-auth-btn,
.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 650;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
  transition: filter 0.16s var(--ease), transform 0.12s var(--ease), background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease);
}
.btn:active,
.cta-primary:active,
.cta-secondary:active,
.card-cta:active,
.nav-auth-btn:active { transform: translateY(1px); }

.cta-primary,
.btn-accent,
.nav-auth-btn.btn-accent,
.cta-live,
.download-button {
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: var(--accent-ink);
  border-color: rgba(94, 234, 212, 0.5);
  box-shadow: 0 6px 20px -10px rgba(45, 212, 191, 0.6);
}
.cta-primary:hover,
.btn-accent:hover,
.cta-live:hover,
.download-button:hover { filter: brightness(1.07); border-color: var(--accent); }

.cta-secondary,
.btn-ghost {
  background: var(--panel-soft);
  color: var(--text);
  border-color: var(--border-strong);
}
.cta-secondary:hover,
.btn-ghost:hover { background: var(--panel-hover); border-color: var(--accent-line); color: var(--text); }

.btn-danger { background: rgba(239, 68, 68, 0.14); color: #fecaca; border-color: rgba(239, 68, 68, 0.4); }
.btn-danger:hover { background: rgba(239, 68, 68, 0.22); }

.cta-disabled,
.card-cta.cta-disabled {
  background: transparent;
  border: 1px dashed var(--border-strong);
  color: var(--faint);
  cursor: default;
}
.cta-disabled:hover { filter: none; transform: none; }

.section-label,
.s-label,
.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
}

.s-label {
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--faint);
}
.s-label::after { content: ""; flex: 1; height: 1px; background: linear-gradient(90deg, var(--border), transparent); }

/* lifted card */
.surface-card {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--panel), var(--bg-elev));
  box-shadow: var(--sh-1), var(--inset-hi);
}

.field { display: grid; gap: 6px; }
.field label { font-size: 12px; font-weight: 600; color: var(--muted); }

/* skeleton shimmer for loading states */
.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--panel-soft);
  border-radius: var(--r-sm);
}
.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.06), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { 100% { transform: translateX(100%); } }

.empty-state {
  padding: 28px 18px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r);
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  background: rgba(255, 255, 255, 0.012);
}

/* language toggle (EN / ID) */
.lang-toggle {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--panel-soft);
}
.lang-toggle button {
  min-height: 26px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: none;
}
.lang-toggle button:hover { filter: none; color: var(--text); }
.lang-toggle button.active {
  background: var(--accent-soft);
  color: var(--accent);
}

/* ============================================================
   Agentory platform header
   ============================================================ */

.platform-header,
.agentory-platform-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--surface-glass);
  backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}

.platform-nav,
.agentory-nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.platform-logo,
.agentory-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex: 0 0 auto;
  color: inherit;
}

.platform-logo .mark,
.agentory-brand .mark {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), var(--accent-strong) 60%, var(--violet));
  display: grid;
  place-items: center;
  font-size: 14px;
  color: #06121f;
  font-weight: 900;
  box-shadow: 0 4px 16px -6px rgba(45, 212, 191, 0.6);
}

/* brand logo glyphs (inline sprite, inherit tile color via currentColor) */
.brand-glyph {
  width: 64%;
  height: 64%;
  display: block;
  color: inherit;
  pointer-events: none;
}
.mark .brand-glyph { width: 66%; height: 66%; }
.brand-glyph-sm {
  width: 15px;
  height: 15px;
  display: block;
  color: inherit;
}

.platform-logo .wordmark,
.agentory-brand .wordmark {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}

.platform-links,
.agentory-top-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
}

.agentory-top-nav .nav-left,
.agentory-top-nav .nav-center {
  display: flex;
  align-items: center;
  gap: 2px;
}
.agentory-top-nav .nav-center { margin-left: 6px; }

.platform-links a,
.agentory-top-nav .nav-link {
  padding: 7px 13px;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
  cursor: pointer;
}
.platform-links a:hover,
.agentory-top-nav .nav-link:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.platform-links a.active,
.agentory-top-nav .nav-link.active { color: var(--text); background: var(--accent-soft); }

.platform-right,
.agentory-account {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
}

.platform-login-link,
#agentory-account-link {
  padding: 7px 12px;
  border: 0;
  background: transparent;
  border-radius: var(--r-sm);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  box-shadow: none;
}
.platform-login-link:hover,
#agentory-account-link:hover { color: var(--text); filter: none; }

.nav-auth-btn { min-height: 36px; padding: 0 15px; font-size: 13px; }

/* ============================================================
   Platform views / layout
   ============================================================ */

#agentory-platform-views { display: block; }

.platform-view,
.agentory-platform-section {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 64px;
}

/* hero */
.hero {
  padding: 84px 0 64px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 56px;
  align-items: center;
}
.hero-copy { max-width: 600px; }

.hero-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 20px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 5px 12px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-pill);
  background: var(--accent-soft);
}
.hero-kicker::before { content: "✦"; font-size: 10px; }

.hero h1 {
  margin: 0 0 20px;
  font-size: clamp(38px, 5.4vw, 60px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
  color: var(--text);
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--accent), #5ec9ec 45%, var(--violet));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  margin: 0 0 30px;
  color: var(--muted);
  font-size: 16.5px;
  line-height: 1.65;
  max-width: 500px;
}
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }
.cta-primary, .cta-secondary { padding: 0 22px; min-height: 46px; font-size: 14.5px; }

.hero-agents {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 264px;
}
.hero-agent-card {
  padding: 15px 16px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel), var(--bg-elev));
  box-shadow: var(--sh-1), var(--inset-hi);
  display: flex;
  align-items: center;
  gap: 13px;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease);
}
.hero-agent-card.live[role="button"] { cursor: pointer; }
.hero-agent-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.hero-agent-card.soon { opacity: 0.5; }

.hero-agent-card .agent-ico,
.agent-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  flex: 0 0 auto;
}
.agent-ico.relate { background: rgba(94, 234, 212, 0.12); color: var(--accent); border: 1px solid var(--accent-line); }
.agent-ico.ledger { background: var(--ledger-soft); color: var(--ledger); border: 1px solid rgba(245, 181, 68, 0.3); }
.agent-ico.soon-ico { background: rgba(255, 255, 255, 0.04); border: 1px solid var(--border); color: var(--muted); }

.hero-agent-card .agent-name { font-size: 13.5px; font-weight: 650; }
.hero-agent-card .agent-st { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.hero-agent-card.live .agent-st { color: var(--success); }
.muted-name { color: var(--muted); }

/* products grid + cards */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 18px;
  margin-bottom: 36px;
}
.products-grid-single { grid-template-columns: 1fr; }

.product-card {
  position: relative;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--panel), var(--bg-elev));
  box-shadow: var(--sh-1), var(--inset-hi);
  display: flex;
  flex-direction: column;
  gap: 13px;
  transition: transform 0.18s var(--ease), border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
  overflow: hidden;
}
.product-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-line), transparent);
  opacity: 0;
  transition: opacity 0.2s var(--ease);
}
.product-card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--sh-2), var(--inset-hi); }
.product-card.is-live { border-color: rgba(94, 234, 212, 0.22); }
.product-card.is-live:hover::before { opacity: 1; }
.product-card.is-live:hover { border-color: var(--accent-line); }
.product-card-dashed { border-style: dashed; opacity: 0.62; box-shadow: none; background: transparent; }
.product-card-dashed:hover { transform: none; }

.product-card-hero { flex-direction: row; align-items: center; gap: 30px; padding: 30px 34px; }
.product-hero-ico { width: 56px; height: 56px; font-size: 22px; border-radius: 16px; }
.product-hero-body { flex: 1; min-width: 0; }
.product-hero-cta { white-space: nowrap; flex: 0 0 auto; }

.badge,
.product-card .badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  align-self: flex-start;
}
.badge-live { color: #ccfbf1; background: rgba(20, 184, 166, 0.16); border: 1px solid var(--accent-line); }
.badge-soon, .badge-future { color: var(--muted); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--border); }
.badge-live::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: live-pulse 2s var(--ease) infinite; }
@keyframes live-pulse { 50% { opacity: 0.45; } }

.product-card h3 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; }
.muted-title { color: var(--muted); }
.product-card .tagline { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--accent); margin: 0; }
.product-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.6; flex: 1; }

.features { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0; }
.feature-tag {
  font-size: 11px;
  padding: 4px 9px;
  border-radius: var(--r-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--muted);
}
.feature-tag-companion { color: #bae6fd; background: rgba(56, 189, 248, 0.1); border-color: rgba(56, 189, 248, 0.28); }

.card-cta { align-self: flex-start; padding: 0 18px; min-height: 40px; }

/* page heads / prose / pricing */
.page-head { padding: 56px 0 36px; }
.page-head h2 { margin: 0 0 12px; font-size: 36px; font-weight: 700; letter-spacing: -0.03em; }
.page-head p { margin: 0; color: var(--muted); font-size: 16.5px; max-width: 520px; line-height: 1.6; }

.prose { max-width: 700px; }
.prose h2 { margin: 0 0 16px; font-size: 25px; font-weight: 700; letter-spacing: -0.02em; }
.prose p { color: var(--muted); line-height: 1.75; margin: 0 0 16px; font-size: 15px; }
.prose strong { color: var(--text); }

.pricing-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; margin-top: 8px; }
.pricing-card {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--panel), var(--bg-elev));
  box-shadow: var(--sh-1), var(--inset-hi);
}
.pricing-card-highlight {
  border-color: var(--accent-line);
  box-shadow: var(--glow-accent), var(--inset-hi);
  position: relative;
}
.pricing-card h3 { margin: 0 0 6px; font-size: 18px; font-weight: 700; }
.pricing-card .price { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; color: var(--accent); margin: 10px 0 14px; font-family: var(--mono); }
.pricing-card .price small { font-size: 14px; font-weight: 400; color: var(--muted); font-family: var(--sans); }
.pricing-card p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

.roadmap {
  margin-top: 18px;
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.06), transparent 60%), var(--panel);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 22px;
  align-items: center;
}
.roadmap .icon { font-size: 30px; color: var(--violet); }
.roadmap h3 { margin: 0 0 6px; font-size: 17px; font-weight: 650; }
.roadmap p { margin: 0; color: var(--muted); font-size: 13.5px; line-height: 1.6; }

/* ---- product detail pages (new IA: #agentory-relate-view / -ledger-view) ---- */
.product-detail { padding-top: 56px; }
.detail-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  padding: 14px 0 36px;
  border-bottom: 1px solid var(--hairline);
  margin-bottom: 40px;
}
.detail-hero .agent-ico { width: 56px; height: 56px; font-size: 22px; border-radius: 16px; }
.detail-hero h1 { margin: 14px 0 10px; font-size: clamp(32px, 4.4vw, 46px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; }
.detail-hero .lede { margin: 0 0 8px; max-width: 620px; font-size: 17px; line-height: 1.6; color: var(--muted); }
.detail-hero .hero-ctas { margin-top: 8px; }

.detail-section { margin-bottom: 44px; }
.detail-section > .s-label { margin-bottom: 22px; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.feature-cell {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--panel);
  box-shadow: var(--inset-hi);
}
.feature-cell .fc-ico { font-size: 20px; margin-bottom: 12px; display: block; }
.feature-cell h4 { margin: 0 0 7px; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.feature-cell p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }

.steps-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; counter-reset: step; }
.flow-step { padding: 20px; border: 1px solid var(--border); border-radius: var(--r); background: var(--panel); position: relative; }
.flow-step .fs-num {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  font-family: var(--mono); font-weight: 700; font-size: 13px;
  margin-bottom: 12px;
}
.flow-step h4 { margin: 0 0 6px; font-size: 14.5px; font-weight: 650; }
.flow-step p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }

.detail-cta {
  margin-top: 12px;
  padding: 34px;
  border: 1px solid var(--accent-line);
  border-radius: var(--r-xl);
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.08), rgba(167, 139, 250, 0.06));
  text-align: center;
  box-shadow: var(--inset-hi);
}
.detail-cta h3 { margin: 0 0 8px; font-size: 24px; font-weight: 700; letter-spacing: -0.02em; }
.detail-cta p { margin: 0 auto 20px; max-width: 460px; color: var(--muted); font-size: 14px; line-height: 1.6; }

/* footer */
.platform-footer {
  border-top: 1px solid var(--hairline);
  padding: 28px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--maxw);
  margin: 0 auto;
  font-size: 12.5px;
  color: var(--muted);
  gap: 16px;
  flex-wrap: wrap;
}
.platform-footer .fl { display: flex; align-items: center; gap: 8px; }
.platform-footer .mark-sm { color: var(--accent); font-weight: 700; }
.platform-footer-links { display: flex; align-items: center; gap: 12px; }
.footer-link-btn { border: 0; background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500; padding: 0; min-height: unset; box-shadow: none; }
.footer-link-btn:hover { color: var(--accent); filter: none; }
.footer-sep { color: var(--border-strong); }

/* legacy in-workspace agent switcher (kept; hidden in workspace) */
.agent-switcher { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.agent-card { display: grid; align-content: start; gap: 8px; min-height: 150px; padding: 16px; border: 1px solid var(--border); border-radius: var(--r); background: var(--panel-soft); }
.agent-card h3, .agent-card p { margin: 0; }
.agent-card h3 { font-size: 17px; }
.agent-card p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.active-agent { border-color: var(--accent-line); }
.agent-status { justify-self: start; min-height: 24px; padding: 3px 10px; border-radius: var(--r-pill); color: #ccfbf1; background: rgba(20, 184, 166, 0.16); border: 1px solid var(--accent-line); font-size: 12px; font-weight: 700; }
.agent-status.planned { color: #ddd6fe; background: rgba(167, 139, 250, 0.14); border-color: rgba(167, 139, 250, 0.24); }

/* ============================================================
   Unified workspace shell  (Relate + Ledger)
   ============================================================ */

.shell,
#relate-workspace {
  display: grid;
  grid-template-columns: 324px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  gap: 0;
  min-height: calc(100vh - 60px);
  padding: 0;
}

#relate-workspace-top,
.ws-header {
  grid-column: 1 / -1;
  position: sticky;
  top: 60px;
  z-index: 90;
  background: var(--surface-glass);
  backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 18px;
  height: 54px;
}

.ws-breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 13px; flex: 0 0 auto; }
.ws-breadcrumb a { color: var(--muted); text-decoration: none; transition: color 0.15s var(--ease); }
.ws-breadcrumb a:hover { color: var(--accent); }
.ws-breadcrumb .sep { color: var(--border-strong); }
.ws-breadcrumb strong { color: var(--text); font-weight: 650; }

/* product switcher (workspace top bar) */
.ws-product-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--panel-soft); flex: 0 0 auto; }
.ws-product-switch button,
.ws-product-switch a {
  min-height: 28px; padding: 0 13px; border: 0; border-radius: var(--r-pill);
  background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 600;
  cursor: pointer; box-shadow: none; display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
}
.ws-product-switch button:hover,
.ws-product-switch a:hover { color: var(--text); filter: none; }
.ws-product-switch .active { background: var(--accent-soft); color: var(--accent); }
.ws-product-switch .disabled { opacity: 0.5; cursor: default; }

.ws-tabs,
.relate-internal-nav { display: flex; align-items: center; gap: 2px; flex: 1; flex-wrap: wrap; }

.ws-tab,
.relate-workspace-tab {
  min-height: unset;
  padding: 7px 13px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  box-shadow: none;
  transition: color 0.15s var(--ease), background 0.15s var(--ease);
}
.ws-tab:hover,
.relate-workspace-tab:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); filter: none; }
.ws-tab.active,
.relate-workspace-tab.active { color: var(--accent); background: var(--accent-soft); }

.ws-spacer { flex: 1; }

.ws-account-btn {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
}
.ws-account-btn:hover { border-color: var(--accent-line); color: var(--text); filter: none; }

/* sidebar (Relate contact rail) */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0;
  border-right: 1px solid var(--hairline);
  background: var(--bg-elev);
  overflow-y: auto;
  max-height: calc(100vh - 114px);
  position: sticky;
  top: 114px;
  align-self: start;
}

.workspace {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 24px;
  background: transparent;
  min-height: calc(100vh - 114px);
}

.brand {
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(135deg, rgba(94, 234, 212, 0.08), rgba(167, 139, 250, 0.05));
}
.brand p, .eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; }
.brand h1 { margin: 0; font-size: 20px; line-height: 1.15; letter-spacing: -0.02em; }
.brand span { display: block; margin-top: 6px; color: var(--muted); font-size: 12px; line-height: 1.45; }

#relate-workspace .agentory-hero { display: none !important; }

/* panels */
.panel { display: grid; gap: 12px; padding: 18px; }

.sidebar .panel {
  display: grid !important;
  border-bottom: 1px solid var(--hairline);
  background: transparent;
  border-radius: 0;
  border-left: 0; border-right: 0; border-top: 0;
}
.sidebar .panel:last-child { border-bottom: 0; }

.workspace .panel,
.workspace article.panel {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--panel), var(--bg-elev));
  box-shadow: var(--sh-1), var(--inset-hi);
}

.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel h2 { margin: 0; color: var(--text); font-size: 15px; font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }

.workspace-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--panel);
  box-shadow: var(--inset-hi);
}
.workspace-header h2 { margin: 0; font-size: 22px; letter-spacing: -0.02em; }

.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.button-row { display: flex; gap: 8px; }
.button-row.compact { align-items: center; }

.secondary-button,
.ghost-button {
  border-color: var(--border-strong);
  color: var(--text);
  background: var(--panel-soft);
}
.secondary-button:hover, .ghost-button:hover { background: var(--panel-hover); filter: none; }
.ghost-button { min-height: 32px; padding: 0 12px; font-size: 12px; font-weight: 600; }

/* auth */
.auth-btns { display: flex; gap: 8px; margin-top: 8px; }
.auth-btns button { flex: 1; }
.auth-error {
  margin: 8px 0 0; padding: 9px 11px; border-radius: var(--r-sm);
  font-size: 12px; line-height: 1.4; color: #fecaca;
  background: rgba(239, 68, 68, 0.12); border: 1px solid rgba(239, 68, 68, 0.35);
}
.auth-error:not([hidden]) { display: block; }
button.platform-login-link { border: none; background: transparent; cursor: pointer; font: inherit; }

.github-login-btn {
  width: 100%; margin-bottom: 10px; padding: 11px 12px; border-radius: var(--r-sm);
  border: 1px solid rgba(255, 255, 255, 0.14); background: #24292f; color: #fff; font-weight: 600; cursor: pointer;
}
.github-login-btn:hover { background: #2f363d; filter: none; }
.auth-divider { margin: 10px 0; text-align: center; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }

.account-info, .muted, .content-muted { color: var(--muted); font-size: 13px; line-height: 1.55; }

.data-status-panel {
  margin-top: 12px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--panel-soft); line-height: 1.55; font-size: 13px;
}
.data-status-panel .status-row { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; }
.data-status-panel .status-label { color: var(--muted); }
.data-status-panel .status-ready, .status-ready { color: var(--success); }
.data-status-panel .status-pending, .status-pending { color: var(--warning); }

.setup-steps { margin: 0; padding-left: 18px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }
.setup-steps span { color: var(--accent); font-weight: 700; }

/* contacts rail */
.new-contact { display: grid; grid-template-columns: minmax(0, 1fr) 104px; gap: 8px; }
.contacts-list { display: grid; gap: 7px; max-height: 420px; overflow: auto; }
.contact-card {
  display: grid; gap: 6px; width: 100%; padding: 11px 13px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text); background: var(--panel-soft); text-align: left; cursor: pointer;
  box-shadow: none;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.12s var(--ease);
}
.contact-card:hover { border-color: var(--border-strong); background: var(--panel-hover); transform: none; filter: none; }
.contact-card.active { border-color: var(--accent-line); background: var(--accent-soft); }

.contact-meta, .tag-row { display: flex; flex-wrap: wrap; gap: 5px; }

.pill, .tag, .score, .warning-badge {
  display: inline-flex; align-items: center; min-height: 22px;
  padding: 2px 9px; border-radius: var(--r-pill);
  font-size: 11.5px; font-weight: 650;
}
.pill, .tag { color: #ccfbf1; background: rgba(94, 234, 212, 0.1); border: 1px solid var(--accent-line); }
.score { color: #bbf7d0; background: rgba(34, 197, 94, 0.16); }
.warning-panel { border-color: rgba(245, 158, 11, 0.38) !important; }
.warning-badge { color: #fed7aa; background: rgba(245, 158, 11, 0.16); }

.suggestions, .cards { display: grid; gap: 12px; }
.suggestion-card, .info-card {
  display: grid; gap: 9px; padding: 14px;
  border: 1px solid var(--border); border-radius: var(--r);
  background: var(--panel-soft);
}
.suggestion-card p, .info-card p { margin: 0; line-height: 1.5; }
.suggestion-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.copy-suggestion { min-height: 30px; }

.status {
  position: sticky; bottom: 20px; padding: 11px 15px;
  border: 1px solid var(--border); border-radius: var(--r);
  color: var(--muted); font-size: 13px;
  background: var(--surface-glass); backdrop-filter: blur(10px);
  box-shadow: var(--sh-1);
}
.status.error { color: #fecaca; border-color: rgba(239, 68, 68, 0.5); background: rgba(127, 29, 29, 0.4); }

/* ============================================================
   Dashboard (Today)
   ============================================================ */
.dashboard-panel,
#relateDashboard {
  width: 100%;
  min-height: 380px;
  padding: 22px;
  border-radius: var(--r-lg);
  background: linear-gradient(180deg, var(--panel), var(--bg-elev));
  border: 1px solid var(--border);
  box-shadow: var(--sh-1), var(--inset-hi);
  display: grid;
  gap: 18px;
  align-content: start;
}
#relateDashboard .panel-header h2 { font-size: 18px; }

.dashboard-overview,
#dashboardOverview {
  padding: 16px; border: 1px solid var(--border); border-radius: var(--r);
  background: rgba(0, 0, 0, 0.18); font-size: 13px; display: flex; flex-direction: column; gap: 14px;
}

.dashboard-split { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.dashboard-split-label {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  font-size: 11px; color: var(--accent); font-family: var(--mono);
  text-transform: uppercase; letter-spacing: 0.14em; font-weight: 600;
}

#dashboardActionCenter, #dashboardRecentChanges {
  background: rgba(0, 0, 0, 0.2); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px; min-height: 120px; font-size: 13px; line-height: 1.6;
}

.dash-overview-grid { display: grid; grid-template-columns: repeat(4, minmax(72px, 1fr)); gap: 12px; margin-bottom: 12px; }
.dash-stat {
  display: flex; flex-direction: column; gap: 3px; padding: 12px 13px;
  border: 1px solid var(--border); border-radius: var(--r); background: rgba(0, 0, 0, 0.18);
}
.dash-stat-val { font-size: 22px; font-weight: 700; line-height: 1.05; font-family: var(--mono); letter-spacing: -0.02em; }
.dash-stat-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

.dash-health-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-health-chip { font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: var(--r-pill); border: 1px solid var(--border); background: rgba(255, 255, 255, 0.02); }
.dash-health-chip.strong { color: var(--st-strong); border-color: rgba(94, 234, 212, 0.35); }
.dash-health-chip.stable { color: var(--st-stable); border-color: rgba(52, 211, 153, 0.35); }
.dash-health-chip.cooling { color: var(--st-cooling); border-color: rgba(251, 191, 36, 0.35); }
.dash-health-chip.risk { color: var(--st-risk); border-color: rgba(251, 113, 133, 0.35); }

.dash-action-list, .dash-change-list { display: flex; flex-direction: column; gap: 9px; }
.dash-action-item, .dash-change-item {
  width: 100%; text-align: left; border: 1px solid var(--border); border-radius: var(--r);
  background: rgba(0, 0, 0, 0.14); padding: 12px 13px; cursor: pointer; color: inherit; box-shadow: none;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease), transform 0.12s var(--ease);
}
.dash-action-item:hover, .dash-change-item:hover { border-color: var(--accent-line); background: var(--accent-soft); transform: none; filter: none; }
.dash-action-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.dash-action-reason { margin: 0 0 7px; color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.dash-action-cta { font-size: 11.5px; font-weight: 600; color: var(--accent); }
.dash-urgency { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; padding: 2px 9px; border-radius: var(--r-pill); }
.dash-urgency-high { color: var(--st-risk); background: rgba(251, 113, 133, 0.14); }
.dash-urgency-medium { color: var(--st-cooling); background: rgba(251, 191, 36, 0.14); }
.dash-urgency-low { color: var(--muted); background: rgba(255, 255, 255, 0.06); }
.dash-change-item { display: flex; flex-direction: column; gap: 3px; }
.dash-change-item span { font-size: 12.5px; line-height: 1.45; }
.dash-change-item small { font-size: 11px; color: var(--muted); }
.dash-empty { margin: 0; color: var(--muted); font-size: 12.5px; }
.dashboard-tip { margin: 0; font-size: 12px; color: var(--faint); }

/* cockpit web wrapper */
.cockpit-panel #cockpitContainer:not(:empty) { display: block; }
.web-cockpit-empty {
  padding: 28px 18px; border: 1px dashed var(--border-strong); border-radius: var(--r-lg);
  text-align: center; color: var(--muted); font-size: 13px; background: rgba(255, 255, 255, 0.012);
}
.web-cockpit-empty[hidden], .cockpit-panel #cockpitContainer[hidden] { display: none !important; }

/* companion dashboard (app.js injects) */
.companion-dashboard-panel { font-size: 13px; line-height: 1.55; }
.companion-dashboard-grid {
  display: grid; grid-template-columns: 1fr 260px;
  grid-template-areas: "today cal" "weekly cal"; gap: 16px; padding: 18px 20px;
  background: var(--companion-bg); border: 1px solid var(--companion-border); border-radius: var(--r-lg);
}
.companion-dashboard-grid .companion-card:nth-child(1) { grid-area: today; }
.companion-dashboard-grid .companion-card:nth-child(2) { grid-area: weekly; }
.companion-dashboard-grid .companion-card-wide { grid-area: cal; }
.companion-card { background: rgba(11, 12, 15, 0.45); border: 1px solid rgba(56, 189, 248, 0.15); border-radius: var(--r); padding: 15px; min-height: 0; }
.companion-card-title { margin-bottom: 9px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--companion); }
.companion-card-title::before { content: "✦ "; font-size: 10px; }
.companion-dashboard-grid .companion-card:nth-child(2) .companion-card-title::before,
.companion-dashboard-grid .companion-card-wide .companion-card-title::before { content: ""; }
.companion-muted { margin-top: 8px; color: var(--muted); font-size: 12px; }
.companion-list { margin: 8px 0 0; padding-left: 18px; color: var(--text); }
.companion-card p { margin: 0; line-height: 1.6; }

/* ============================================================
   Analytics
   ============================================================ */
.analytics-contact-hint { margin: 0 0 14px; font-size: 12px; color: var(--muted); }
.analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(220px, 1fr)); gap: 14px; }
.analytics-card { padding: 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: rgba(0, 0, 0, 0.16); min-height: 120px; box-shadow: var(--inset-hi); }
.analytics-card-wide { grid-column: 1 / -1; }
.analytics-card-title { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; font-family: var(--mono); }
.analytics-card-sub { margin: 0 0 12px; font-size: 11.5px; color: var(--muted); }
.analytics-empty { margin: 0; font-size: 12px; color: var(--muted); line-height: 1.55; }
.analytics-health-bars { display: flex; flex-direction: column; gap: 9px; }
.analytics-bar-row { display: grid; grid-template-columns: 92px 1fr 28px; gap: 9px; align-items: center; }
.analytics-bar-label { font-size: 11px; color: var(--muted); }
.analytics-bar-track { height: 8px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.06); overflow: hidden; }
.analytics-bar-fill { height: 100%; border-radius: var(--r-pill); min-width: 2px; transition: width 0.5s var(--ease); }
.analytics-bar-fill.strong { background: var(--st-strong); }
.analytics-bar-fill.stable { background: var(--st-stable); }
.analytics-bar-fill.cooling { background: var(--st-cooling); }
.analytics-bar-fill.risk { background: var(--st-risk); }
.analytics-bar-count { font-size: 12px; font-weight: 700; text-align: right; font-family: var(--mono); }
.analytics-queue-list, .analytics-loop-list { display: flex; flex-direction: column; gap: 9px; }
.analytics-queue-item, .analytics-loop-item {
  width: 100%; text-align: left; border: 1px solid var(--border); border-radius: var(--r);
  background: rgba(0, 0, 0, 0.12); padding: 10px 11px; cursor: pointer; color: inherit; box-shadow: none;
}
.analytics-queue-item:hover, .analytics-loop-item:hover { border-color: var(--accent-line); background: var(--accent-soft); filter: none; }
.analytics-queue-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.analytics-queue-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); color: var(--st-cooling); background: rgba(251, 191, 36, 0.14); }
.analytics-queue-reason { font-size: 12px; color: var(--muted); line-height: 1.45; }
.analytics-loop-item { display: flex; flex-direction: column; gap: 3px; }
.analytics-loop-item span { font-size: 12px; line-height: 1.45; }
.analytics-loop-item small { font-size: 11px; color: var(--muted); }
.analytics-activity-row { display: flex; gap: 16px; margin-bottom: 10px; font-size: 13px; }
.analytics-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.analytics-chip { font-size: 10.5px; padding: 4px 10px; border-radius: var(--r-pill); border: 1px solid var(--border); color: var(--muted); }
.analytics-insight-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 7px; }
.analytics-insight-list li { font-size: 12.5px; line-height: 1.5; }

/* import / settings tab panels */
.import-tab-panel textarea { min-height: 220px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; gap: 36px; padding: 56px 0 44px; }
  .hero-agents { flex-direction: row; width: auto; }
  .hero-agent-card { flex: 1; }
  .products-grid { grid-template-columns: 1fr; }
  .product-card-hero { flex-direction: column; align-items: flex-start; }
  .shell, #relate-workspace { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; border-right: 0; border-bottom: 1px solid var(--hairline); }
  .grid.two, .dashboard-split, .dash-overview-grid, .analytics-grid {
    grid-template-columns: 1fr;
  }
  .companion-dashboard-grid { grid-template-columns: 1fr; grid-template-areas: "today" "weekly" "cal"; }
  .ws-tabs { overflow-x: auto; }
  .platform-nav, .agentory-nav { gap: 12px; padding: 0 16px; }
  .agentory-top-nav .nav-center { display: none; }
}

@media (max-width: 640px) {
  .hero-agents { flex-direction: column; }
  .platform-right .nav-auth-btn { display: none; }
  .dash-overview-grid { grid-template-columns: repeat(2, 1fr); }
  .ws-product-switch { display: none; }
  .page-head h2 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
