/* CoreMesh Task Forge — control room UI (restored design + motion polish) */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg: #05060a;
  --bg-soft: #08090f;
  --panel: #0b0e16;
  --panel-2: #0e1220;
  --line: #1b2130;
  --line-soft: #151a28;
  --text: #e8ebf4;
  --muted: #8b93a7;
  --faint: #5b6378;
  --blue: #3b82f6;
  --blue-2: #60a5fa;
  --blue-soft: rgba(59,130,246,.14);
  --green: #22c55e;
  --amber: #f59e0b;
  --red: #ef4444;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 18px 50px rgba(0,0,0,.45);
  --ease: cubic-bezier(.22,.8,.3,1);
}
html[data-theme="light"] {
  --bg: #f3f5fa;
  --bg-soft: #eef1f8;
  --panel: #ffffff;
  --panel-2: #f7f9ff;
  --line: #dde3f0;
  --line-soft: #e8edf8;
  --text: #121726;
  --muted: #5a6478;
  --faint: #8a93a8;
  --blue-soft: rgba(59,130,246,.10);
  --shadow: 0 16px 40px rgba(24,38,80,.12);
}

html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.55 "Inter", "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  background:
    radial-gradient(1100px 480px at 18% -10%, rgba(59,130,246,.12), transparent 60%),
    radial-gradient(900px 420px at 92% 0%, rgba(96,165,250,.08), transparent 55%),
    var(--bg);
  transition: background .4s var(--ease), color .4s var(--ease);
}
::selection { background: rgba(59,130,246,.35); }

/* ====== Motion primitives ====== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideInLeft { from { opacity: 0; transform: translateX(-10px); } to { opacity: 1; transform: none; } }
@keyframes ring { 0% { transform: scale(1); opacity: .6; } 70% { transform: scale(3.2); opacity: 0; } 100% { transform: scale(3.2); opacity: 0; } }
.pulse { position: relative; }
.pulse::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; opacity: 0; animation: ring 2.2s ease-out infinite; pointer-events: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { from { background-position: -400px 0; } to { background-position: 400px 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(22px) scale(.97); } to { opacity: 1; transform: none; } }

.view.active .anim { animation: fadeUp .55s var(--ease) both; }
.view.active .anim:nth-child(2), .view.active .trio-grid .anim:nth-child(2) { animation-delay: .07s; }
.view.active .anim:nth-child(3), .view.active .trio-grid .anim:nth-child(3) { animation-delay: .14s; }
.view.active .anim:nth-child(4) { animation-delay: .2s; }
.view.active .anim:nth-child(5) { animation-delay: .26s; }
/* CSP-safe stagger (no inline styles): first 12 rows/cards in a list */
.feed-row:nth-child(1), .task-row:nth-child(1), .record-card:nth-child(1), .system-card:nth-child(1) { animation-delay: .03s; }
.feed-row:nth-child(2), .task-row:nth-child(2), .record-card:nth-child(2), .system-card:nth-child(2) { animation-delay: .07s; }
.feed-row:nth-child(3), .task-row:nth-child(3), .record-card:nth-child(3), .system-card:nth-child(3) { animation-delay: .11s; }
.feed-row:nth-child(4), .task-row:nth-child(4), .record-card:nth-child(4), .system-card:nth-child(4) { animation-delay: .15s; }
.feed-row:nth-child(5), .task-row:nth-child(5), .record-card:nth-child(5), .system-card:nth-child(5) { animation-delay: .19s; }
.feed-row:nth-child(6), .task-row:nth-child(6), .record-card:nth-child(6) { animation-delay: .23s; }
.feed-row:nth-child(7), .task-row:nth-child(7), .record-card:nth-child(7) { animation-delay: .27s; }
.feed-row:nth-child(8), .task-row:nth-child(8), .record-card:nth-child(8) { animation-delay: .31s; }
.feed-row:nth-child(n+9), .task-row:nth-child(n+9), .record-card:nth-child(n+9) { animation-delay: .34s; }
.task-actions .text-button { padding: 7px 4px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ====== Top bar ====== */
.topbar-wrap {
  position: sticky; top: 0; z-index: 60;
  padding: 14px 0 10px;
  background: linear-gradient(to bottom, var(--bg) 0%, var(--bg) 55%, transparent 100%);
}
.topbar {
  display: flex; align-items: center; gap: 18px;
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 9px 12px 9px 14px;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  animation: fadeUp .5s var(--ease) both;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); min-width: 0; flex: 0 1 auto; }
.brand-orbit {
  position: relative; width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  border: 1.5px solid var(--blue);
  background: radial-gradient(circle at 32% 28%, rgba(96,165,250,.35), rgba(59,130,246,.08));
}
.brand-orbit::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid rgba(96,165,250,.35); border-top-color: transparent; border-left-color: transparent;
  animation: spin 7s linear infinite;
}
.brand-orbit.small { width: 38px; height: 38px; }
.brand-glyph { font-weight: 800; font-size: 12px; letter-spacing: .04em; color: var(--blue-2); }
.brand-name { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand-name em { font-style: normal; font-weight: 600; color: var(--text); }
.scan-short { display: none; }
.drawer-foot-actions { display: inline-flex; align-items: center; gap: 12px; }
.drawer-foot-actions .text-button { display: none; padding: 0; }

.top-nav { display: flex; gap: 2px; margin-left: auto; margin-right: auto; }
.top-link {
  appearance: none; border: 0; background: transparent; color: var(--muted);
  font: 600 13.5px/1 inherit; font-family: inherit; padding: 9px 13px; border-radius: 999px;
  cursor: pointer; position: relative; transition: color .25s var(--ease), background .25s var(--ease);
}
.top-link:hover { color: var(--text); }
.top-link.active { color: var(--blue-2); }
.top-link.active::after {
  content: ""; position: absolute; left: 50%; bottom: 3px; width: 16px; height: 2px;
  transform: translateX(-50%); border-radius: 2px;
  background: linear-gradient(90deg, var(--blue), var(--blue-2));
}

.bar-actions { display: flex; align-items: center; gap: 8px; flex: none; margin-left: auto; }
.bar-button {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  display: grid; place-items: center; cursor: pointer;
  transition: transform .2s var(--ease), border-color .25s, background .25s;
}
.bar-button:hover { transform: translateY(-1px); border-color: var(--blue); }
.bar-button:active { transform: scale(.94); }
.hamburger { display: grid; gap: 3.5px; }
.hamburger i { width: 15px; height: 1.8px; background: currentColor; border-radius: 2px; display: block; }

.health-pill {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2);
  padding: 7px 12px; font-size: 11px; font-weight: 800; letter-spacing: .08em;
  transition: border-color .3s, color .3s;
}
.health-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); position: relative; flex: none; }
.health-pill.healthy { color: var(--green); }
.health-pill.healthy i { background: var(--green); }
.health-pill.healthy i::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: var(--green); animation: ring 2.4s ease-out infinite; }
.health-pill.warn { color: var(--amber); } .health-pill.warn i { background: var(--amber); }
.health-pill.error { color: var(--red); } .health-pill.error i { background: var(--red); }

.scan-button {
  appearance: none; border: 0; cursor: pointer; font-family: inherit; white-space: nowrap;
  padding: 9px 16px; border-radius: 999px; color: #fff; font-weight: 700; font-size: 13px;
  background: linear-gradient(135deg, var(--blue), #2563eb);
  box-shadow: 0 6px 18px rgba(59,130,246,.35);
  transition: transform .2s var(--ease), box-shadow .25s, filter .25s;
}
.scan-button:hover { transform: translateY(-1px); box-shadow: 0 9px 24px rgba(59,130,246,.45); }
.scan-button:active { transform: scale(.96); }
.scan-button.loading { pointer-events: none; filter: saturate(.6); position: relative; }
.scan-button.loading::after {
  content: ""; display: inline-block; width: 11px; height: 11px; margin-left: 8px;
  border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%;
  vertical-align: -2px; animation: spin .8s linear infinite;
}

/* ====== Drawer ====== */
.nav-drawer {
  position: fixed; top: 14px; right: 14px; z-index: 80;
  width: min(300px, calc(100vw - 28px));
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); padding: 18px;
  opacity: 0; transform: translateY(-10px) scale(.98); pointer-events: none;
  transition: opacity .3s var(--ease), transform .3s var(--ease);
}
.nav-drawer.open { opacity: 1; transform: none; pointer-events: auto; }
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 70; border: 0;
  background: rgba(3,5,10,.55); backdrop-filter: blur(2px);
  animation: fadeIn .25s both;
}
.drawer-head { display: flex; align-items: center; gap: 11px; margin-bottom: 14px; }
.drawer-head h2 { margin: 0; font-size: 16px; }
.drawer-close {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
  font-size: 16px; cursor: pointer; transition: color .2s, border-color .2s;
}
.drawer-close:hover { color: var(--text); border-color: var(--blue); }
.drawer-label { display: block; margin: 4px 2px 8px; }
.drawer-nav { display: grid; gap: 4px; }
.drawer-link {
  display: flex; align-items: center; gap: 11px;
  border: 1px solid transparent; background: transparent; color: var(--text);
  font-family: inherit; font-size: 13.5px; text-align: left;
  padding: 10px 12px; border-radius: var(--radius-sm); cursor: pointer;
  transition: background .2s var(--ease), border-color .2s, transform .2s var(--ease);
}
.drawer-link span { width: 20px; text-align: center; color: var(--muted); }
.drawer-link:hover { background: var(--panel-2); transform: translateX(2px); }
.drawer-link.active { background: var(--blue-soft); border-color: rgba(59,130,246,.4); }
.drawer-link.active span, .drawer-link.active strong { color: var(--blue-2); }
.drawer-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 13px; border-top: 1px solid var(--line-soft); font-size: 12px; color: var(--muted); }
.drawer-foot a { color: var(--blue-2); text-decoration: none; }

/* ====== Layout ====== */
.page-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 34px 0 40px; }
.view { display: none; }
.view.active { display: block; }

.hero { padding: 26px 4px 6px; text-align: left; }
.lead-kicker { display: inline-flex; align-items: center; gap: 9px; color: var(--muted); font-size: 12.5px; font-weight: 600; letter-spacing: .02em; }
.signal-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); color: var(--blue); position: relative; flex: none; }
.signal-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: currentColor; animation: ring 2.2s ease-out infinite; }
.signal-dot.green { background: var(--green); color: var(--green); }
.hero-title { margin: 12px 0 10px; font-size: clamp(32px, 5vw, 52px); line-height: 1.08; font-weight: 800; letter-spacing: -.02em; }
.grad {
  background: linear-gradient(92deg, var(--blue) 0%, var(--blue-2) 55%, #93c5fd 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.page-title { margin: 0 0 6px; font-size: clamp(28px, 4vw, 40px); font-weight: 800; letter-spacing: -.02em; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 22px 2px 20px; }
.page-head p { margin: 0; color: var(--muted); }

.eyebrow { font-size: 10.5px; font-weight: 800; letter-spacing: .14em; color: var(--faint); text-transform: uppercase; }
.eyebrow.blue { color: var(--blue-2); }
.muted { color: var(--muted); font-size: 12.5px; }
.small-note { margin: 2px 0 10px; font-size: 11.5px; letter-spacing: .03em; }

/* ====== Panels ====== */
.panel {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  transition: transform .3s var(--ease), border-color .3s var(--ease), box-shadow .3s var(--ease);
}
@media (hover: hover) {
  .panel:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--blue) 45%, var(--line)); box-shadow: 0 14px 34px rgba(0,0,0,.35); }
  .panel.compact:hover, .status-details:hover { transform: none; box-shadow: none; }
}
.panel h2 { margin: 10px 0 14px; font-size: 18px; }
.panel.compact { padding: 18px; }
.section-symbol {
  width: 36px; height: 36px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 10px; color: var(--blue-2);
  background: var(--blue-soft); font-size: 15px;
}
.trio-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 26px 0; }

.metric-rows { display: grid; }
.metric-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 11px 0; border-bottom: 1px solid var(--line-soft);
}
.metric-row:last-child { border-bottom: 0; }
.metric-row span { color: var(--muted); font-size: 13px; }
.metric-row strong { font-size: 20px; font-weight: 800; font-variant-numeric: tabular-nums; }
.metric-row .usdc { font-size: 17px; }
.warn-amount { color: var(--amber); }
.metric-row .state-word { font-size: 12px; letter-spacing: .1em; color: var(--green); }

.mini-feed { display: grid; gap: 2px; min-height: 120px; }
.feed-row {
  display: grid; grid-template-columns: 54px 1fr auto; gap: 10px; align-items: baseline;
  padding: 8px 6px; border-radius: 9px;
  animation: slideInLeft .4s var(--ease) both;
  transition: background .2s;
}
.feed-row:hover { background: var(--panel-2); }
.feed-tag {
  font: 700 10px/1.5 ui-monospace, "JetBrains Mono", Menlo, monospace;
  letter-spacing: .1em; color: var(--blue-2);
}
.feed-tag.ok { color: var(--green); }
.feed-tag.warn { color: var(--amber); }
.feed-row p { margin: 0; font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.feed-row time { font-size: 10.5px; color: var(--faint); white-space: nowrap; }
.feed-list { max-height: 330px; overflow-y: auto; display: grid; gap: 2px; padding-right: 4px; }
.feed-list::-webkit-scrollbar { width: 8px; } .feed-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
.live-title { display: flex; align-items: center; gap: 10px; }
.live-title h2 { margin: 0; }

.inline-link { display: inline-block; margin-top: 14px; color: var(--blue-2); font-size: 13px; font-weight: 600; text-decoration: none; transition: transform .2s var(--ease); }
.inline-link:hover { transform: translateX(3px); }

/* ====== Control plane ====== */
.control-plane { margin: 30px 0; }
.plane-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.plane-head h2 { margin: 0; font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.control-chips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 760px; }
.control-chip {
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  padding: 5px 10px; font-size: 10.5px; color: var(--muted); letter-spacing: .02em;
  transition: border-color .25s, transform .2s var(--ease);
}
.control-chip:hover { border-color: var(--blue); transform: translateY(-1px); }
.control-chip strong { color: var(--text); margin-left: 4px; font-weight: 800; }

.pipeline-frame { border: 1px solid var(--line); border-radius: var(--radius); background: var(--line-soft); overflow: hidden; }
.pipeline-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 1px; }
.pipeline-card {
  appearance: none; border: 0;
  background: var(--panel); color: var(--text); font-family: inherit; cursor: pointer;
  display: grid; gap: 7px; justify-items: center; align-content: center;
  padding: 20px 8px 18px; text-align: center; position: relative; min-width: 0;
  transition: background .25s var(--ease);
}
.pipeline-card span, .pipeline-card small { overflow-wrap: anywhere; max-width: 100%; }
.pipeline-card::before {
  content: ""; position: absolute; top: 0; left: 12%; right: 12%; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--blue), var(--blue-2));
  opacity: 0; transform: scaleX(.4); transition: opacity .3s, transform .3s var(--ease);
}
.pipeline-card:hover { background: var(--blue-soft); }
.pipeline-card:hover::before { opacity: 1; transform: none; }
.pipeline-card span { font-size: 11px; font-weight: 700; color: var(--muted); }
.pipeline-card strong { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.pipeline-card small { font-size: 9.8px; color: var(--faint); }
.pipeline-card.hot strong { color: var(--blue-2); }

.workflow-details, .status-details { margin-top: 18px; }
details summary {
  cursor: pointer; list-style: none; font-weight: 700; font-size: 14px; color: var(--text);
  display: flex; align-items: center; gap: 9px; user-select: none;
}
details summary::before { content: "▸"; color: var(--blue-2); transition: transform .25s var(--ease); }
details[open] summary::before { transform: rotate(90deg); }
details > *:not(summary) { animation: fadeUp .4s var(--ease) both; }
.workflow-layout { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.status-details { padding: 18px 22px; }
.status-details[open] { padding-bottom: 22px; }

.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-title-row h3 { margin: 2px 0 0; font-size: 15px; }
.text-button { border: 0; background: transparent; color: var(--blue-2); font-family: inherit; font-size: 12.5px; font-weight: 700; cursor: pointer; }

.list-stack { display: grid; gap: 8px; }
.list-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm); background: var(--panel);
  padding: 11px 13px; text-align: left; color: var(--text); font-family: inherit; cursor: pointer;
  transition: border-color .25s, transform .2s var(--ease);
}
.list-item:hover { border-color: var(--blue); transform: translateX(3px); }
.list-item h3 { margin: 0 0 2px; font-size: 13px; }
.list-item p { margin: 0; font-size: 11.5px; color: var(--muted); }
.amount { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

.event-list { display: grid; gap: 2px; max-height: 300px; overflow-y: auto; padding-right: 4px; }
.event-row { padding: 8px 6px; border-radius: 9px; transition: background .2s; }
.event-row:hover { background: var(--panel-2); }
.event-row strong { font: 700 10px/1.6 ui-monospace, Menlo, monospace; letter-spacing: .08em; color: var(--blue-2); display: block; }
.event-row p { margin: 1px 0; font-size: 12.5px; }
.event-row time { font-size: 10.5px; color: var(--faint); }

.alerts { display: grid; gap: 8px; margin: 14px 0; }
.alert { border: 1px solid var(--line); border-left: 3px solid var(--blue); border-radius: 10px; background: var(--panel); padding: 10px 13px; font-size: 13px; animation: slideInLeft .35s var(--ease) both; }
.alert strong { font-size: 11px; letter-spacing: .08em; }
.alert.warn { border-left-color: var(--amber); } .alert.warn strong { color: var(--amber); }
.alert.error { border-left-color: var(--red); } .alert.error strong { color: var(--red); }
.alert.info strong { color: var(--blue-2); }

.overview-system { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.fact { border: 1px solid var(--line-soft); border-radius: 10px; background: var(--panel); padding: 9px 12px; }
.fact span { display: block; font-size: 10px; letter-spacing: .09em; text-transform: uppercase; color: var(--faint); }
.fact { min-width: 0; }
.fact strong { font-size: 12.5px; overflow-wrap: anywhere; display: block; }

/* ====== Filters ====== */
.filter-bar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin: 0 0 18px; }
.field-label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); flex: 1; min-width: 220px; }
.filter-bar input[type="search"], .filter-bar select, .form-grid input, .form-grid textarea {
  width: 100%; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: var(--panel); color: var(--text); font-family: inherit; font-size: 14px;
  padding: 11px 14px; outline: none;
  transition: border-color .25s, box-shadow .25s;
}
.filter-bar input:focus, .filter-bar select:focus, .form-grid input:focus, .form-grid textarea:focus {
  border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft);
}
.filter-bar select { max-width: 220px; cursor: pointer; }
.filter-bar .muted { margin-left: auto; padding-bottom: 12px; }

/* ====== Records / Task portfolio ====== */
.record-list { display: grid; gap: 12px; }
.task-list { gap: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.task-row {
  display: grid; grid-template-columns: 1fr auto; gap: 16px;
  padding: 20px 22px; border-bottom: 1px solid var(--line-soft);
  animation: fadeUp .4s var(--ease) both;
  transition: background .25s var(--ease);
}
.task-row:last-child { border-bottom: 0; }
.task-row:hover { background: var(--panel-2); }
.task-row > div { min-width: 0; }
.task-row h2 { margin: 0 0 5px; font-size: 16.5px; font-weight: 700; letter-spacing: -.01em; overflow-wrap: anywhere; }
.task-row .repo-line { margin: 0; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.task-row .reason-text { margin: 8px 0 0; color: var(--faint); font-size: 12.5px; }
.task-side { display: grid; justify-items: end; align-content: start; gap: 5px; min-width: 190px; }
.task-price { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.usdc-big { font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.usdc-cap { font-size: 10px; letter-spacing: .08em; color: var(--faint); text-transform: uppercase; }
.score-line { font-size: 11px; color: var(--muted); }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; justify-content: flex-end; }

.badge {
  display: inline-flex; align-items: center;
  border: 1px solid var(--line); border-radius: 7px; background: var(--panel-2);
  padding: 3px 8px; font: 800 10px/1.5 inherit; letter-spacing: .07em; color: var(--muted);
}
.badge.ok { color: var(--green); border-color: rgba(34,197,94,.4); background: rgba(34,197,94,.08); }
.badge.warn { color: var(--amber); border-color: rgba(245,158,11,.4); background: rgba(245,158,11,.08); }
.badge.bad { color: var(--red); border-color: rgba(239,68,68,.4); background: rgba(239,68,68,.08); }

.record-card {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 18px 20px; animation: fadeUp .4s var(--ease) both;
  transition: border-color .25s, transform .25s var(--ease);
}
@media (hover: hover) {
  .record-card:hover { border-color: color-mix(in srgb, var(--blue) 45%, var(--line)); transform: translateY(-2px); }
}
.record-top { display: flex; justify-content: space-between; gap: 14px; }
.record-top > div { min-width: 0; }
.record-top h2 { margin: 3px 0 4px; font-size: 15.5px; overflow-wrap: anywhere; }
.record-top p { margin: 0; color: var(--muted); font-size: 12.5px; overflow-wrap: anywhere; }
.record-top .eyebrow { overflow-wrap: anywhere; }
.reward { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.record-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.reason-text { color: var(--faint); font-size: 12.5px; margin: 9px 0 0; }
.record-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 13px; align-items: center; }
.record-actions a { color: var(--blue-2); font-size: 12.5px; font-weight: 600; text-decoration: none; }

button.ghost, .record-actions button, .task-actions button {
  appearance: none; font-family: inherit; cursor: pointer;
  border: 1px solid var(--line); border-radius: 9px; background: var(--panel-2); color: var(--text);
  padding: 7px 14px; font-size: 12.5px; font-weight: 700;
  transition: border-color .2s, transform .2s var(--ease), background .2s;
}
button.ghost:hover, .record-actions button:hover, .task-actions button:hover { border-color: var(--blue); transform: translateY(-1px); }
button.ghost:active, .record-actions button:active, .task-actions button:active { transform: scale(.96); }

.primary-button {
  appearance: none; border: 0; cursor: pointer; font-family: inherit;
  padding: 11px 18px; border-radius: var(--radius-sm); color: #fff; font-weight: 700; font-size: 13.5px;
  background: linear-gradient(135deg, var(--blue), #2563eb);
  box-shadow: 0 6px 18px rgba(59,130,246,.3);
  transition: transform .2s var(--ease), box-shadow .25s;
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(59,130,246,.4); }
.secondary-button {
  appearance: none; cursor: pointer; font-family: inherit;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text);
  padding: 10px 16px; font-size: 13px; font-weight: 700;
  transition: border-color .2s, transform .2s var(--ease);
}
.secondary-button:hover { border-color: var(--blue); transform: translateY(-1px); }
.secondary-button.small { padding: 7px 13px; font-size: 12px; }

.empty { border: 1px dashed var(--line); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--text); margin-bottom: 4px; }
.skeleton {
  border-radius: var(--radius-sm); min-height: 54px;
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel-2) 40%, var(--panel) 60%);
  background-size: 800px 100%; animation: shimmer 1.3s linear infinite;
}

/* ====== System grid ====== */
.system-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.system-card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 20px; animation: fadeUp .45s var(--ease) both; }
.system-card h2 { margin: 7px 0 13px; font-size: 17px; }
.fact-list { display: grid; gap: 7px; }
.wide-card { grid-column: 1 / -1; }

/* ====== Modal (Task Replay) ====== */
.modal { border: 0; padding: 0; background: transparent; max-width: min(1060px, calc(100vw - 24px)); width: 100%; max-height: none; }
.modal::backdrop { background: rgba(2,4,9,.72); backdrop-filter: blur(4px); }
dialog { color: var(--text); }
.modal-shell {
  color: var(--text);
  background: var(--bg-soft); border: 1px solid var(--line); border-radius: 22px;
  padding: 26px; max-height: calc(100vh - 56px); overflow-y: auto;
  animation: popIn .35s var(--ease) both; box-shadow: var(--shadow);
}
.modal.small .modal-shell { max-width: 640px; margin: 0 auto; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 12px; }
.modal-head h2 { margin: 4px 0 0; font-size: 20px; }
.modal-close {
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  border-radius: var(--radius-sm); padding: 9px 18px; font-family: inherit; font-weight: 700; cursor: pointer;
  transition: border-color .2s;
}
.modal-close:hover { border-color: var(--blue); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip-row .control-chip { font-size: 10.5px; }
.modal-state {
  border: 1px solid rgba(59,130,246,.45); border-left: 3px solid var(--blue);
  border-radius: 14px; background: linear-gradient(180deg, rgba(59,130,246,.08), transparent);
  padding: 16px 18px; margin-bottom: 14px;
}
.modal-state h3 { margin: 7px 0 9px; font: 800 24px/1 ui-monospace, Menlo, monospace; letter-spacing: .02em; }
.state-reason { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.flow-pills { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 16px; }
.flow-pill {
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel);
  padding: 5px 11px; font-size: 10.5px; font-weight: 700; color: var(--muted);
}
.flow-pill.current { border-color: var(--blue); color: var(--blue-2); box-shadow: 0 0 0 3px var(--blue-soft); }
.flow-pill.future { opacity: .45; }
.timeline { display: grid; gap: 2px; }
.timeline-row { display: grid; grid-template-columns: 118px 1fr; gap: 12px; padding: 10px 8px; border-radius: 10px; transition: background .2s; }
.timeline-row:hover { background: var(--panel); }
.timeline-row time { font-size: 11px; color: var(--faint); }
.timeline-row strong { font: 700 10.5px/1.7 ui-monospace, Menlo, monospace; letter-spacing: .07em; color: var(--blue-2); display: block; }
.timeline-row p { margin: 1px 0 0; font-size: 12.5px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid label { display: grid; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.form-grid .wide { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.site-foot { display: flex; justify-content: space-between; color: var(--faint); font-size: 12px; margin-top: 44px; padding: 18px 4px 0; border-top: 1px solid var(--line-soft); }

/* ====== Login ====== */
.login-page { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.login-shell { width: min(430px, 100%); display: grid; gap: 18px; animation: fadeUp .55s var(--ease) both; }
.login-brand { display: flex; align-items: center; gap: 13px; }
.login-brand h1 { margin: 0; font-size: 21px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 13px; }
.brand-mark {
  width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--blue); color: var(--blue-2); font-weight: 800; font-size: 14px;
  background: radial-gradient(circle at 30% 28%, rgba(96,165,250,.3), rgba(59,130,246,.06));
  animation: none;
}
.login-card {
  display: grid; gap: 14px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 22px; padding: 26px; box-shadow: var(--shadow);
}
.login-card h2 { margin: 7px 0 4px; font-size: 24px; }
.login-card p { margin: 0; color: var(--muted); font-size: 13px; }
.login-card label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.login-card input {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--bg-soft);
  color: var(--text); font-family: inherit; font-size: 14.5px; padding: 12px 14px; outline: none;
  transition: border-color .25s, box-shadow .25s;
}
.login-card input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.login-card button {
  appearance: none; border: 0; cursor: pointer; font-family: inherit; margin-top: 4px;
  padding: 13px; border-radius: var(--radius-sm); color: #fff; font-weight: 800; font-size: 14px;
  background: linear-gradient(135deg, var(--blue), #2563eb);
  transition: transform .2s var(--ease), box-shadow .25s; box-shadow: 0 8px 22px rgba(59,130,246,.35);
}
.login-card button:hover { transform: translateY(-1px); }
.login-error { border: 1px solid rgba(239,68,68,.5); background: rgba(239,68,68,.08); color: #fca5a5; border-radius: 10px; padding: 10px 13px; font-size: 13px; }
.login-foot { text-align: center; color: var(--faint); font-size: 12px; }

/* ====== Responsive ====== */
@media (max-width: 1020px) {
  .pipeline-grid { grid-template-columns: repeat(3, 1fr); }
  .trio-grid { grid-template-columns: 1fr; }
  .workflow-layout { grid-template-columns: 1fr; }
  .overview-system { grid-template-columns: 1fr 1fr; }
  .top-nav { display: none; }
  .plane-head { flex-direction: column; align-items: flex-start; }
  .control-chips { justify-content: flex-start; max-width: none; }
  .system-grid { grid-template-columns: 1fr; }
}
@media (max-width: 680px) {
  .topbar-wrap { padding: 10px 0 8px; }
  .topbar { gap: 10px; padding: 7px 8px 7px 10px; width: calc(100% - 20px); }
  .brand { gap: 8px; }
  .brand-orbit { width: 32px; height: 32px; }
  .brand-name em { display: none; }
  .theme-toggle { display: none; }
  .drawer-foot-actions .text-button { display: inline-block; }
  .bar-actions { gap: 6px; }
  .bar-button { width: 34px; height: 34px; }
  .health-pill { padding: 6px 10px; font-size: 10px; }
  .scan-button { padding: 8px 13px; font-size: 12px; }
  .scan-full { display: none; }
  .scan-short { display: inline; }
  .page-shell { width: calc(100% - 20px); padding: 14px 0 32px; }
  .hero { padding: 12px 2px 4px; }
  .hero-title { font-size: clamp(30px, 9.2vw, 38px); margin: 10px 0 6px; }
  .trio-grid { gap: 12px; margin: 18px 0; }
  .panel { padding: 18px; }
  .panel h2 { font-size: 17px; margin: 8px 0 10px; }
  .metric-row { padding: 10px 0; }
  .metric-row strong { font-size: 18px; }
  .metric-row .usdc { font-size: 15.5px; }
  .feed-row { grid-template-columns: 48px 1fr; gap: 6px 10px; }
  .feed-row time { grid-column: 2; font-size: 10px; }
  .control-plane { margin: 22px 0; }
  .plane-head h2 { font-size: 21px; }
  .control-chip { font-size: 10px; padding: 4px 9px; }
  .pipeline-grid { grid-template-columns: repeat(3, 1fr); }
  .pipeline-card { padding: 14px 6px 12px; gap: 5px; }
  .pipeline-card span { font-size: 10px; line-height: 1.25; }
  .pipeline-card strong { font-size: 24px; }
  .pipeline-card small { font-size: 9px; line-height: 1.2; }
  .status-details { padding: 16px 18px; }
  .page-head { flex-direction: column; align-items: flex-start; margin: 10px 2px 16px; }
  .page-head .primary-button { width: 100%; }
  .page-title { font-size: 28px; }
  .filter-bar { gap: 10px; }
  .field-label { min-width: 0; flex-basis: 100%; }
  .filter-bar select { max-width: none; }
  .filter-bar .muted { margin-left: 0; padding-bottom: 0; }
  .task-row { grid-template-columns: 1fr; gap: 12px; padding: 16px; }
  .task-row h2 { font-size: 15.5px; }
  .task-side { justify-items: start; min-width: 0; }
  .task-price { justify-content: flex-start; }
  .task-actions { justify-content: flex-start; }
  .usdc-big { font-size: 19px; }
  .record-card { padding: 16px; }
  .record-top { flex-direction: column; gap: 6px; }
  .reward { font-size: 17px; }
  .overview-system { grid-template-columns: 1fr; }
  .timeline-row { grid-template-columns: 1fr; gap: 2px; }
  .modal { max-width: calc(100vw - 12px); }
  .modal-shell { padding: 18px 16px; border-radius: 18px; max-height: calc(100vh - 24px); }
  .modal-head { flex-direction: column-reverse; align-items: flex-start; gap: 10px; }
  .modal-head h2 { font-size: 17px; }
  .modal-close { padding: 7px 14px; font-size: 12.5px; }
  .modal-state { padding: 14px; }
  .modal-state h3 { font-size: 19px; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-actions { flex-direction: column-reverse; }
  .modal-actions button { width: 100%; }
  .nav-drawer { top: 10px; right: 10px; width: calc(100vw - 20px); }
  .site-foot { flex-direction: column; gap: 4px; margin-top: 30px; }
}
@media (max-width: 400px) {
  .health-pill span { display: none; }
  .health-pill { padding: 6px 7px; }
  .pipeline-card strong { font-size: 22px; }
}

.table-wrap { overflow-x: auto; max-width: 100%; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th, .data-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.data-table th { color: var(--muted, #94a3b8); font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
