/* ═══════════════════════════════════════════════════════════════
   CasperGuard — Fobework-inspired dashboard
   Font: Instrument Serif (display) + DM Sans (UI)
   Themes: Charcoal (dark) · Chalk (light)
   ═══════════════════════════════════════════════════════════════ */

[data-theme="charcoal"] {
  --bg: #08080f;
  --bg-shell: #0c0c16;
  --bg-card: rgba(22, 22, 36, 0.85);
  --bg-card-solid: #14141f;
  --bg-hover: rgba(255, 255, 255, 0.04);
  --bg-input: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f0eef8;
  --text-muted: #8b8aa3;
  --text-dim: #5c5b72;
  --purple: #8b5cf6;
  --purple-bright: #a78bfa;
  --purple-glow: rgba(139, 92, 246, 0.35);
  --purple-soft: rgba(139, 92, 246, 0.12);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.12);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --red: #f87171;
  --red-soft: rgba(248, 113, 113, 0.12);
  --orange: #fb923c;
  --orange-soft: rgba(251, 146, 60, 0.12);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
  --shadow-sm: 0 8px 32px rgba(0, 0, 0, 0.35);
  --cta-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  --hero-grad: linear-gradient(135deg, rgba(99,102,241,0.15) 0%, rgba(139,92,246,0.08) 100%);
  --sidebar-active: linear-gradient(90deg, rgba(139,92,246,0.22) 0%, transparent 100%);
}

[data-theme="chalk"] {
  --bg: #eceae6;
  --bg-shell: #f5f3ef;
  --bg-card: rgba(255, 255, 255, 0.92);
  --bg-card-solid: #ffffff;
  --bg-hover: rgba(0, 0, 0, 0.03);
  --bg-input: rgba(0, 0, 0, 0.04);
  --border: rgba(0, 0, 0, 0.08);
  --border-strong: rgba(0, 0, 0, 0.12);
  --text: #14121f;
  --text-muted: #5c5870;
  --text-dim: #9490a8;
  --purple: #7c3aed;
  --purple-bright: #6d28d9;
  --purple-glow: rgba(124, 58, 237, 0.2);
  --purple-soft: rgba(124, 58, 237, 0.08);
  --blue: #2563eb;
  --blue-soft: rgba(37, 99, 235, 0.08);
  --green: #16a34a;
  --green-soft: rgba(22, 163, 74, 0.08);
  --red: #dc2626;
  --red-soft: rgba(220, 38, 38, 0.08);
  --orange: #ea580c;
  --orange-soft: rgba(234, 88, 12, 0.08);
  --shadow: 0 24px 80px rgba(20, 18, 31, 0.08);
  --shadow-sm: 0 8px 32px rgba(20, 18, 31, 0.06);
  --cta-grad: linear-gradient(135deg, #6366f1 0%, #7c3aed 100%);
  --hero-grad: linear-gradient(135deg, rgba(99,102,241,0.08) 0%, rgba(124,58,237,0.05) 100%);
  --sidebar-active: linear-gradient(90deg, rgba(124,58,237,0.1) 0%, transparent 100%);
}

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

html { font-size: 15px; -webkit-font-smoothing: antialiased; }

body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

h1, h2, h3, .brand-text, .section-title, .hero-title, .profile-name,
.analytics-title, .pipeline-title, .portfolio-value {
  font-family: "Instrument Serif", Georgia, serif;
  font-weight: 400;
  letter-spacing: -0.02em;
}

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

.app { display: flex; min-height: 100vh; }

/* ── LEFT SIDEBAR ─────────────────────────────────────────────── */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: var(--bg-shell);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0.85rem;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 200;
}

.sidebar-top { padding: 0 0.35rem; margin-bottom: 1.25rem; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.25rem 0.35rem;
  margin-bottom: 1rem;
}

.brand-icon { width: 32px; height: 32px; flex-shrink: 0; }

.brand-text {
  font-size: 1.35rem;
  color: var(--text);
}

.workspace-pill {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.55rem 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: border-color 0.15s, background 0.15s;
}

.workspace-pill:hover { border-color: var(--purple); color: var(--text); }

.ws-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
  flex-shrink: 0;
}

.ws-role {
  margin-left: auto;
  font-size: 0.68rem;
  color: var(--text-dim);
  background: var(--bg-hover);
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 0 0.15rem; }

.nav-link {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.75rem;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
  margin-bottom: 2px;
}

.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.7; }

.nav-link:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.nav-link.active {
  background: var(--sidebar-active);
  color: var(--purple-bright);
  box-shadow: inset 3px 0 0 var(--purple);
}

.nav-link.active svg { opacity: 1; stroke: var(--purple-bright); }

.nav-sub {
  margin: 0 0 0.5rem 1.85rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--border);
  display: none;
}

.nav-sub.open { display: block; }

.nav-sub-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.4rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  color: var(--text-dim);
  transition: all 0.15s;
}

.nav-sub-link:hover { color: var(--text); background: var(--bg-hover); }

.nav-sub-link.active {
  color: var(--purple-bright);
  font-weight: 600;
}

.sidebar-cta {
  position: relative;
  margin-top: auto;
  padding: 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}

.cta-glow {
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: var(--purple);
  filter: blur(60px);
  opacity: 0.25;
  pointer-events: none;
}

.cta-title {
  font-family: "Instrument Serif", serif;
  font-size: 1rem;
  margin-bottom: 0.35rem;
  position: relative;
}

.cta-desc {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-bottom: 0.85rem;
  position: relative;
}

.cta-btn {
  width: 100%;
  padding: 0.6rem;
  background: var(--cta-grad);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 10px;
  position: relative;
  transition: transform 0.12s, filter 0.15s;
}

.cta-btn:hover { filter: brightness(1.08); }
.cta-btn:active { transform: scale(0.98); }
.cta-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ── SHELL ────────────────────────────────────────────────────── */
.shell {
  flex: 1;
  margin-left: 248px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg);
}

.topbar {
  display: block;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.bc-muted { color: var(--text-dim); }
.bc-sep { color: var(--text-dim); font-size: 0.75rem; }
.bc-current { color: var(--text); font-weight: 500; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field input {
  width: 240px;
  padding: 0.5rem 2.5rem 0.5rem 2.2rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-field input:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-soft);
}

.search-wide { margin-bottom: 1rem; }
.search-wide input { width: 100%; }

.search-ico {
  position: absolute;
  left: 0.75rem;
  width: 16px; height: 16px;
  color: var(--text-dim);
  pointer-events: none;
}

.search-kbd {
  position: absolute;
  right: 0.65rem;
  font-size: 0.65rem;
  color: var(--text-dim);
  background: var(--bg-hover);
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  font-family: inherit;
}

.top-icon {
  width: 36px; height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text-muted);
  transition: all 0.15s;
}

.top-icon svg { width: 18px; height: 18px; }

.top-icon:hover {
  border-color: var(--purple);
  color: var(--purple-bright);
  background: var(--purple-soft);
}

.theme-pill {
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.15s;
}

.theme-pill:hover {
  border-color: var(--purple);
  color: var(--purple-bright);
  background: var(--purple-soft);
}

.live-toggle {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.75rem;
  background: var(--green-soft);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--green);
}

.live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}

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

/* ── BODY GRID ────────────────────────────────────────────────── */
.body-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 0;
  flex: 1;
  align-items: start;
}

.body-grid.full-width { grid-template-columns: 1fr; }
.body-grid.full-width .right-rail { display: none; }

.center-col {
  padding: 1.5rem 1.75rem 2.5rem;
  min-width: 0;
}

.right-rail {
  padding: 1.5rem 1.25rem 2.5rem 0;
  position: sticky;
  top: 68px;
  max-height: calc(100vh - 68px);
  overflow-y: auto;
}

.page { display: none; }
.page.active { display: block; }

/* ── SECTION HEADERS ──────────────────────────────────────────── */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  margin-top: 0.5rem;
}

.section-head:first-child { margin-top: 0; }

.section-title {
  font-size: 1.35rem;
  color: var(--text);
}

.link-btn {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--purple-bright);
  transition: opacity 0.15s;
}

.link-btn:hover { opacity: 0.75; text-decoration: underline; }

/* ── STAT TRIO ────────────────────────────────────────────────── */
.stat-trio {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.15rem 1.25rem;
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s;
}

.stat-card:hover {
  border-color: var(--border-strong);
}

.stat-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0.35rem;
}

.stat-num {
  font-family: "Instrument Serif", serif;
  font-size: 2rem;
  line-height: 1;
  color: var(--text);
}

.stat-ico {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}

.stat-ico svg { width: 20px; height: 20px; }

.stat-ico-purple { background: var(--purple-soft); color: var(--purple-bright); }
.stat-ico-green { background: var(--green-soft); color: var(--green); }
.stat-ico-blue { background: var(--blue-soft); color: var(--blue); }

.stat-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ── HERO BANNER ──────────────────────────────────────────────── */
.hero-banner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 1.35rem 1.5rem;
  margin-bottom: 1.75rem;
  background-image: var(--hero-grad);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  position: relative;
}

.hero-art {
  width: 100px; height: 100px;
  flex-shrink: 0;
  position: relative;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(1px);
}

.hero-orb-1 {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  top: 10px; left: 10px;
  box-shadow: 0 8px 32px var(--purple-glow);
}

.hero-orb-2 {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, #4ade80, #22d3ee);
  top: 0; right: 0;
  opacity: 0.85;
}

.hero-orb-3 {
  width: 28px; height: 28px;
  background: linear-gradient(135deg, #fb923c, #f472b6);
  bottom: 5px; right: 15px;
  opacity: 0.9;
}

.hero-title {
  font-size: 1.25rem;
  margin-bottom: 0.35rem;
}

.hero-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  max-width: 480px;
  line-height: 1.55;
  margin-bottom: 0.85rem;
}

.hero-btn {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--purple-bright);
  transition: opacity 0.15s;
}

.hero-btn:hover { opacity: 0.75; text-decoration: underline; }

/* ── ASSET CARDS (Enrolment style) ────────────────────────────── */
.asset-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.asset-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, transform 0.15s;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.asset-card:hover {
  border-color: var(--purple);
}

.asset-card-art {
  height: 72px;
  border-radius: 12px;
  position: relative;
  overflow: hidden;
}

.asset-card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.06));
}

.art-invoice { background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%); }
.art-estate { background: linear-gradient(135deg, #22d3ee 0%, #3b82f6 100%); }
.art-bond { background: linear-gradient(135deg, #f97316 0%, #ef4444 100%); }
.art-default { background: linear-gradient(135deg, #a855f7 0%, #6366f1 100%); }

.asset-card-title {
  font-family: "Instrument Serif", serif;
  font-size: 1.05rem;
}

.asset-card-meta {
  display: flex;
  gap: 0.85rem;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.asset-card-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.progress-wrap { margin-top: 0.15rem; }

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.progress-bar {
  height: 6px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--cta-grad);
  transition: width 0.6s ease;
}

.asset-card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

.btn-primary {
  flex: 1;
  padding: 0.5rem 0.85rem;
  background: var(--cta-grad);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 10px;
  text-align: center;
  transition: filter 0.15s, transform 0.1s;
}

.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-primary:active { transform: scale(0.98); }

.btn-outline {
  padding: 0.5rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 0.15s;
}

.btn-outline:hover {
  border-color: var(--purple);
  color: var(--purple-bright);
}

/* ── TIMELINE ─────────────────────────────────────────────────── */
.date-chips {
  display: flex;
  gap: 0.35rem;
}

.date-chip {
  padding: 0.3rem 0.65rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-dim);
  border: 1px solid transparent;
  transition: all 0.15s;
}

.date-chip:hover { color: var(--text); background: var(--bg-hover); }

.date-chip.active {
  background: var(--purple-soft);
  color: var(--purple-bright);
  border-color: rgba(139, 92, 246, 0.25);
}

.timeline-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.15rem 1.25rem;
  box-shadow: var(--shadow-sm);
}

.timeline { display: flex; flex-direction: column; gap: 0; }

.timeline-item {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  gap: 0.85rem;
  align-items: start;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.timeline-item:last-child { border-bottom: none; }

.timeline-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.timeline-body h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.timeline-body p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.timeline-avatars {
  display: flex;
  gap: -4px;
}

.t-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid var(--bg-card-solid);
  display: grid;
  place-items: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  margin-left: -6px;
}

.t-avatar:first-child { margin-left: 0; }
.t-avatar-risk { background: linear-gradient(135deg, #6366f1, #8b5cf6); }
.t-avatar-compliance { background: linear-gradient(135deg, #22d3ee, #3b82f6); }
.t-avatar-treasury { background: linear-gradient(135deg, #4ade80, #22c55e); }
.t-avatar-casper { background: linear-gradient(135deg, #fb923c, #f97316); }

/* ── RIGHT RAIL ───────────────────────────────────────────────── */
.profile-card,
.analytics-card,
.portfolio-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.profile-card { text-align: center; }

.profile-avatar-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 0 auto 0.75rem;
}

.profile-avatar {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--cta-grad);
  display: grid;
  place-items: center;
  font-family: "Instrument Serif", serif;
  font-size: 1.5rem;
  color: #fff;
  border: 3px solid var(--bg-card-solid);
  box-shadow: 0 8px 24px var(--purple-glow);
}

.profile-online {
  position: absolute;
  bottom: 4px; right: 4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--green);
  border: 2px solid var(--bg-card-solid);
}

.profile-name { font-size: 1.15rem; margin-bottom: 0.15rem; }

.profile-handle {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-bottom: 1rem;
}

.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.profile-stats div {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.profile-stats strong {
  font-family: "Instrument Serif", serif;
  font-size: 1.2rem;
  color: var(--text);
}

.profile-stats span {
  font-size: 0.65rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.analytics-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.analytics-title { font-size: 1rem; }

.analytics-month {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.donut-wrap {
  position: relative;
  width: 140px;
  height: 140px;
  margin: 0 auto 1.15rem;
}

.donut-wrap svg { width: 100%; height: 100%; }

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.donut-pct {
  font-family: "Instrument Serif", serif;
  font-size: 1.35rem;
  color: var(--text);
}

.donut-sub {
  font-size: 0.65rem;
  color: var(--text-dim);
}

.metric-bars { list-style: none; }

.metric-bars li {
  margin-bottom: 0.75rem;
}

.metric-bars li:last-child { margin-bottom: 0; }

.bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
}

.bar-head span:first-child { color: var(--text-muted); }
.bar-head span:last-child { font-weight: 600; color: var(--text); }

.bar-track {
  height: 5px;
  background: var(--bg-hover);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}

.portfolio-value {
  font-size: 1.75rem;
  color: var(--purple-bright);
  margin: 0.35rem 0 0.15rem;
}

.portfolio-sub {
  font-size: 0.75rem;
  color: var(--text-dim);
}

/* ── TABLES & SECONDARY PAGES ─────────────────────────────────── */
.table-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.data-table { width: 100%; border-collapse: collapse; }

.data-table th {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  background: var(--bg-hover);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.85rem 1rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:hover { background: var(--bg-hover); }

.asset-cell { display: flex; flex-direction: column; gap: 0.1rem; }
.asset-name { font-weight: 600; font-size: 0.85rem; }
.asset-id { font-size: 0.68rem; color: var(--text-dim); font-family: ui-monospace, monospace; }

.badge {
  display: inline-flex;
  padding: 0.18rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
}

.badge-green { background: var(--green-soft); color: var(--green); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-amber { background: var(--orange-soft); color: var(--orange); }

.action-group { display: flex; gap: 0.35rem; flex-wrap: wrap; }

.btn-sm {
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.68rem;
  font-weight: 600;
  transition: filter 0.15s;
}

.btn-sm-green { background: var(--green); color: #fff; }
.btn-sm-blue { background: var(--blue); color: #fff; }
.btn-sm-purple { background: var(--purple); color: #fff; }
.btn-sm-orange { background: var(--orange); color: #fff; }
.btn-sm:hover { filter: brightness(1.1); color: #fff; }

.select-pill {
  padding: 0.4rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  font-size: 0.8rem;
  outline: none;
}

.select-pill:focus { border-color: var(--purple); }

.status-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
}

.status-badge.running {
  background: var(--purple-soft);
  color: var(--purple-bright);
}

.agent-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.agent-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s;
}

.agent-card:hover { border-color: var(--purple); }

.agent-card h3 {
  font-family: "Instrument Serif", serif;
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}

.agent-card p {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  line-height: 1.45;
}

.agent-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-dim);
}

.agent-meta a { color: var(--purple-bright); font-weight: 600; }

.pipeline-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
}

.pipeline-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-top: 1rem;
}

.pipe-step {
  display: flex;
  gap: 0.65rem;
  padding: 0.85rem;
  background: var(--bg-hover);
  border-radius: 12px;
  border: 1px solid var(--border);
}

.pipe-step span {
  font-family: "Instrument Serif", serif;
  font-size: 1.1rem;
  color: var(--purple-bright);
  flex-shrink: 0;
}

.pipe-step strong { display: block; font-size: 0.82rem; margin-bottom: 0.15rem; }
.pipe-step p { font-size: 0.72rem; color: var(--text-muted); }

.contract-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1.25rem;
}

.contract-card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.15rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s;
}

.contract-card:hover {
  border-color: var(--purple);
  color: var(--text);
}

.contract-card h3 {
  font-family: "Instrument Serif", serif;
  font-size: 1rem;
  margin-bottom: 0.5rem;
}

.contract-card p {
  font-size: 0.68rem;
  color: var(--text-dim);
  font-family: ui-monospace, monospace;
  word-break: break-all;
  margin-bottom: 0.75rem;
  line-height: 1.4;
}

.link-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.ext-link {
  padding: 0.65rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s;
}

.ext-link:hover {
  border-color: var(--purple);
  color: var(--purple-bright);
  background: var(--purple-soft);
}

.feed-panel { display: flex; flex-direction: column; gap: 0; }

.feed-entry {
  display: flex;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
}

.feed-time {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--purple-bright);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 4.5rem;
}

.feed-msg { color: var(--text-muted); }

/* ── TOAST ────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  z-index: 9999;
  max-width: 360px;
  animation: toastIn 0.25s ease;
}

.toast.hidden { display: none; }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── RESPONSIVE ───────────────────────────────────────────────── */
@media (max-width: 1280px) {
  .body-grid { grid-template-columns: 1fr; }
  .right-rail {
    position: static;
    max-height: none;
    padding: 0 1.75rem 2rem;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
  }
  .right-rail > * { margin-bottom: 0; }
}

@media (max-width: 1024px) {
  .sidebar { display: none; }
  .shell { margin-left: 0; }
  .stat-trio, .asset-cards, .agent-grid, .contract-grid, .pipeline-steps { grid-template-columns: 1fr; }
  .right-rail { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; padding: 1rem; }
  .search-field input { width: 160px; }
  .live-toggle, .search-kbd { display: none; }
  .center-col { padding: 1rem; }
}
