/* ZARVIS MOBILE web client — "Jarvis Cyber-Luxury" theme: deep midnight background, neon
   cyan/electric-blue accents, glassmorphism. Tokens mirror the intent of
   android/core/core-ui/theme/Color.kt so the browser client and the Android app read as the
   same product (MASTER_SPEC.md §22: "futuristic, premium, minimal, trustworthy"). */
:root {
  --zarvis-space-black: #030712;
  --zarvis-bg-soft: #090d16;
  --zarvis-surface: #0d1220;
  --zarvis-surface-elevated: #0d1220d9;
  --zarvis-surface-strong: #10182bf0;
  --zarvis-accent-cyan: #00f0ff;
  --zarvis-accent-blue: #0a84ff;
  --zarvis-accent-indigo: #0a84ff;
  --zarvis-accent-violet: #6c6bff;
  --zarvis-text-primary: #f5f7fb;
  --zarvis-text-secondary: #8b93a8;
  --zarvis-border: #2a2e3daa;
  --zarvis-border-soft: #ffffff17;
  --zarvis-error: #ff5c72;
  --zarvis-warning: #ffc46b;
  --zarvis-success: #22e6b0;
  --glow-cyan: #00f0ffb0;
  --glow-cyan-soft: #00f0ff40;
  --radius: 18px;
  --radius-lg: 26px;
  --font-display: "Space Grotesk", "Noto Sans Devanagari", system-ui, sans-serif;
  --font-body: "Inter", "Noto Sans Devanagari", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  overscroll-behavior: none;
}

body {
  margin: 0;
  /* `position: fixed` locks the page itself from ever scrolling — on mobile browsers a
     plain `100vh` app can end up taller than the actually-visible viewport (the address
     bar collapsing/expanding changes it), which pushes the composer below the fold and
     forces a page-level scroll just to reach "Send". Only `.stage` below scrolls; the
     shell (topbar/orb/composer) stays pinned to the real visible viewport. */
  position: fixed;
  inset: 0;
  background: var(--zarvis-space-black);
  color: var(--zarvis-text-primary);
  font-family: var(--font-body);
  overflow: hidden;
  overflow-x: hidden;
}

/* Above phone width the shell reads as a floating device frame — a `max-w-md`-style
   centered container — instead of stretching a mobile layout edge-to-edge across a
   desktop browser window; below it (real phones, and narrow WebViews) .app already
   fills the viewport exactly as before, so nothing changes there. */
@media (min-width: 640px) {
  body {
    display: flex;
    align-items: center;
    justify-content: center;
  }
}

/* Ambient background glow — subtle, never decorative-only per MASTER_SPEC §22 motion rule,
   here it just sets the "futuristic/premium" tone behind flat black. */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 40% at 18% -5%, #0a84ff3d, transparent 60%),
    radial-gradient(50% 35% at 100% 10%, #00f0ff2e, transparent 60%),
    radial-gradient(70% 50% at 50% 120%, #0a84ff26, transparent 60%);
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  height: 100vh; /* fallback for browsers without dvh support */
  height: 100dvh; /* the real visible viewport height on mobile, address bar and all */
  width: 100%;
  max-width: 480px; /* mimics a clean mobile viewport ("max-w-md") even on wide desktop browsers */
  margin: 0 auto;
  overflow-x: hidden;
}

@media (min-width: 640px) {
  .app {
    height: min(100dvh, 900px);
    margin: 24px auto;
    border-radius: 32px;
    border: 1px solid var(--zarvis-border-soft);
    box-shadow: 0 40px 120px -30px #000000cc, 0 0 60px -12px #00f0ff26;
    overflow: hidden;
  }
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* pt-safe: pads under Android's edge-to-edge status bar/cutouts; a no-op fallback of 0px
     when env() isn't supported or there's no inset (desktop browsers, non-notched phones). */
  padding: calc(16px + env(safe-area-inset-top, 0px)) 20px 16px;
  border-bottom: 1px solid var(--zarvis-border-soft);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: #030712b8;
  flex-shrink: 0;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-name {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.brand-name b {
  background: linear-gradient(120deg, var(--zarvis-accent-cyan), var(--zarvis-accent-indigo));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-mark {
  width: 12px; height: 12px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--zarvis-accent-cyan), var(--zarvis-accent-blue));
  box-shadow: 0 0 16px 2px var(--glow-cyan);
  flex-shrink: 0;
}

.topbar-actions { display: flex; gap: 8px; align-items: center; }

.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--zarvis-surface-elevated);
  border: 1px solid var(--zarvis-border-soft);
  color: var(--zarvis-text-primary);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.15s ease, background 0.2s ease;
}
.chip-btn:hover { border-color: #00f0ff88; transform: translateY(-1px); }
.chip-btn:active { transform: translateY(0); }
.icon-btn { padding: 7px; width: 32px; height: 32px; justify-content: center; position: relative; }
.chip-static { cursor: default; color: var(--zarvis-text-secondary); }
.chip-static:hover { transform: none; border-color: var(--zarvis-border-soft); }
.chip-btn[aria-pressed="false"] { opacity: 0.4; }

/* Small unread/active indicator dot on an icon button (e.g. active-task count) — a corner
   badge rather than a number, so it stays legible at 32px without needing to truncate. */
.chip-badge {
  position: absolute;
  top: 3px; right: 3px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--zarvis-accent-cyan);
  box-shadow: 0 0 6px 1px var(--glow-cyan-soft);
  border: 1.5px solid var(--zarvis-space-black);
}
.chip-badge[hidden] { display: none; }

.install-btn {
  background: linear-gradient(135deg, var(--zarvis-accent-cyan), var(--zarvis-accent-blue));
  color: #041016;
  border: none;
  font-weight: 600;
}
.install-btn:hover { box-shadow: 0 4px 16px -6px #00f0ff70; }
/* `.chip-btn`'s own `display` would otherwise beat the browser's default `[hidden]` rule
   (same specificity, and .chip-btn comes later in the cascade) — this wins on specificity
   instead of relying on source order, so the button reliably disappears again once
   installed or dismissed. */
.install-btn[hidden] { display: none; }

.voice-select {
  max-width: 84px;
  color-scheme: dark;
  padding: 7px 8px;
  font-size: 11px;
}
.voice-select[hidden] { display: none; }

.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--zarvis-text-secondary);
  box-shadow: 0 0 6px 1px currentColor;
  flex-shrink: 0;
}
.status-dot.live { background: var(--zarvis-success); color: var(--zarvis-success); }
.status-dot.mock { background: var(--zarvis-warning); color: var(--zarvis-warning); }

.stage {
  flex: 1;
  min-height: 0; /* without this, a flex child won't shrink below its content size, so it
                    overflows .app instead of scrolling internally — the actual cause of
                    needing to scroll the whole page to reach the composer */
  overflow-y: auto;
  padding: 8px 20px 8px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

.hero { text-align: center; padding: 26px 0 6px; flex-shrink: 0; }

.orb-wrap {
  position: relative;
  width: 108px; height: 108px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid #00f0ff33;
  animation: ring-pulse 3.5s ease-in-out infinite;
}
.orb {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: conic-gradient(from 180deg, var(--zarvis-accent-cyan), var(--zarvis-accent-blue), var(--zarvis-accent-violet), var(--zarvis-accent-cyan));
  box-shadow: 0 0 46px 4px #00f0ff59, inset 0 0 24px #ffffff33;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  position: relative;
  cursor: pointer;
}
.orb:focus-visible { outline: 2px solid var(--zarvis-accent-cyan); outline-offset: 6px; }
/* Hands-free ("say Zarvis") mode armed — a persistent cyan ring distinct from the default
   idle indigo one, so it's visible even while the orb itself isn't actively LISTENING. */
.orb-wrap.auto-listen .orb-ring {
  border-color: var(--zarvis-accent-cyan);
  animation: ring-pulse 1.6s ease-in-out infinite;
}
.orb::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffffffcc, transparent 55%);
  mix-blend-mode: overlay;
}
.orb[data-state="LISTENING"] { animation: pulse 1s ease-in-out infinite; }
.orb[data-state="UNDERSTANDING"], .orb[data-state="PLANNING"] { animation: spin 2.4s linear infinite; }
.orb[data-state="EXECUTING"] { animation: pulse 0.55s ease-in-out infinite; box-shadow: 0 0 56px 6px #00f0ff8c, inset 0 0 24px #ffffff33; }
.orb[data-state="SPEAKING"] { animation: pulse 0.85s ease-in-out infinite; }
.orb[data-state="ERROR"] {
  background: conic-gradient(from 180deg, var(--zarvis-warning), var(--zarvis-error), #ff9a6b, var(--zarvis-warning));
  box-shadow: 0 0 46px 4px #ff6b6b59, inset 0 0 24px #ffffff33;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
@keyframes ring-pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.18); opacity: 0.15; }
}

.hero-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 6px;
  color: var(--zarvis-text-primary);
}
.hero-status {
  margin: 0; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--zarvis-text-secondary);
  font-weight: 500;
}

.conversation {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
}

.bubble {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  animation: rise 0.25s ease;
  box-shadow: 0 4px 18px -8px #00000080;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--zarvis-accent-blue), #0850c4);
  color: #fff;
  border-bottom-right-radius: 6px;
}
.bubble.assistant {
  align-self: flex-start;
  background: var(--zarvis-surface-elevated);
  backdrop-filter: blur(12px);
  border: 1px solid var(--zarvis-border-soft);
  border-bottom-left-radius: 6px;
}
.bubble.system {
  align-self: center;
  background: #ff6b6b14;
  color: #ffb3b3;
  font-size: 12.5px;
  border: 1px solid #ff6b6b33;
  border-radius: 14px;
  max-width: 92%;
}

/* ---- Dynamic result widgets — a skill execution renders as a shape/purpose-matched card
   instead of one generic chat bubble: wide prose panels for report-style content
   (research/business/creative/docs), a compact pill for quick automation confirmations, and
   a monospace card for the Developer Agent. The border glow reports the real outcome
   (success/failure) rather than a decorative color, per Product Principle #4 — there is no
   fake "in progress" widget state; a widget only ever renders once the backend has actually
   finished. ---- */
.result-widget {
  align-self: stretch;
  border-radius: var(--radius-lg);
  border: 1px solid var(--zarvis-border-soft);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: var(--zarvis-surface-elevated);
  animation: widget-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}
@keyframes widget-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.result-widget[data-status="success"] {
  border-color: #22e6b055;
  box-shadow: 0 0 0 1px #22e6b022, 0 0 26px -6px #22e6b070;
}
.result-widget[data-status="error"] {
  border-color: #ffc46b55;
  box-shadow: 0 0 0 1px #ffc46b22, 0 0 26px -6px #ffc46b70;
}

.widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--zarvis-border-soft);
}
.widget-title {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--zarvis-text-secondary);
  display: flex;
  align-items: center;
  gap: 7px;
}
.widget-status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px 1px currentColor;
  flex-shrink: 0;
}
.result-widget[data-status="success"] .widget-status-dot { color: var(--zarvis-success); }
.result-widget[data-status="error"] .widget-status-dot { color: var(--zarvis-warning); }

/* Panel — wide, prose-first: research/report/business/creative/document content. */
.result-widget[data-kind="panel"] .widget-body {
  padding: 15px 18px 18px;
  font-size: 14.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--zarvis-text-primary);
}

/* Pill — compact, quick-action confirmation card (automation workflows). */
.result-widget[data-kind="pill"] {
  align-self: flex-start;
  max-width: 82%;
  border-radius: var(--radius-lg);
}
.result-widget[data-kind="pill"] .widget-header { border-bottom: none; padding: 10px 15px 4px; }
.result-widget[data-kind="pill"] .widget-body {
  padding: 0 15px 12px;
  font-size: 13.5px;
  line-height: 1.45;
}

/* Code — Developer Agent, monospace terminal card. */
.result-widget[data-kind="code"] { background: #02040ac9; }
.result-widget[data-kind="code"] .widget-body {
  padding: 14px 16px 16px;
  font-family: "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: #b7f5e0;
}
.widget-copy-btn {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px;
  font-family: var(--font-body);
  background: transparent;
  border: 1px solid var(--zarvis-border-soft);
  color: var(--zarvis-text-secondary);
  border-radius: 999px;
  padding: 4px 11px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.widget-copy-btn:hover { color: var(--zarvis-accent-cyan); border-color: #00f0ff55; }
.widget-copy-btn.copied { color: var(--zarvis-success); border-color: #22e6b055; }

/* ---- Live playback waveform — attached to whichever assistant message is actually being
   spoken right now (real Gemini audio or the browser's speechSynthesis), removed the moment
   playback ends; never a static decoration. ---- */
.waveform-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px 12px;
}
.waveform { display: flex; align-items: center; gap: 2px; height: 16px; }
.waveform span {
  width: 3px;
  border-radius: 2px;
  background: var(--zarvis-accent-cyan);
  animation: waveform-bounce 0.9s ease-in-out infinite;
}
.waveform span:nth-child(2) { animation-delay: 0.1s; }
.waveform span:nth-child(3) { animation-delay: 0.2s; }
.waveform span:nth-child(4) { animation-delay: 0.3s; }
.waveform span:nth-child(5) { animation-delay: 0.4s; }
@keyframes waveform-bounce {
  0%, 100% { height: 4px; opacity: 0.5; }
  50% { height: 16px; opacity: 1; }
}
.waveform-stop {
  display: flex; align-items: center; justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 1px solid var(--zarvis-border-soft);
  background: transparent;
  color: var(--zarvis-accent-cyan);
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}
.waveform-stop:hover { border-color: #00f0ff88; }

.categories {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 6px 0 16px;
  flex-shrink: 0;
}
.category-chip {
  background: var(--zarvis-surface);
  border: 1px solid var(--zarvis-border-soft);
  color: var(--zarvis-text-secondary);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.2s ease;
}
.category-chip:hover {
  color: var(--zarvis-text-primary);
  border-color: var(--zarvis-accent-cyan);
  background: #00f0ff1a;
  transform: translateY(-1px);
}
.category-chip.locked::after { content: " 🔒"; }

/* ---- AI Command Bar — the Jarvis core input, one seamless glass pill instead of three
   separate bordered controls (mic/input/send used to each draw their own box). ---- */
.composer {
  padding: 10px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  background: linear-gradient(to top, var(--zarvis-space-black) 55%, transparent);
}

.command-bar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 5px 5px 18px;
  border-radius: 999px;
  background: var(--zarvis-surface-strong);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--zarvis-border-soft);
  box-shadow: 0 10px 34px -16px #000000cc;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.command-bar:focus-within {
  border-color: #00f0ff66;
  box-shadow: 0 10px 34px -16px #000000cc, 0 0 26px 2px var(--glow-cyan-soft);
}

.mic-btn, .send-btn {
  border: none;
  background: transparent;
  color: var(--zarvis-text-primary);
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.mic-btn {
  width: 40px; height: 40px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.mic-btn[aria-pressed="true"] {
  background: linear-gradient(135deg, var(--zarvis-accent-cyan), var(--zarvis-accent-blue));
  box-shadow: 0 0 16px 2px var(--glow-cyan-soft);
  color: #041016;
}
.mic-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.mic-btn:hover:not(:disabled) { color: var(--zarvis-accent-cyan); }
.mic-btn[aria-pressed="true"]:hover:not(:disabled) { color: #041016; }

.text-input {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--zarvis-text-primary);
  padding: 0 4px;
  height: 40px;
  font-size: 14.5px;
  font-family: var(--font-body);
}
.text-input::placeholder { color: var(--zarvis-text-secondary); }
.text-input:focus { outline: none; }

.send-btn {
  display: flex; align-items: center; gap: 7px;
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  flex-shrink: 0;
  background: linear-gradient(135deg, var(--zarvis-accent-cyan), var(--zarvis-accent-blue));
  color: #041016;
}
.send-btn:hover { box-shadow: 0 0 20px 2px var(--glow-cyan-soft); }
.send-btn:active { transform: scale(0.97); }

@media (max-width: 420px) {
  .send-label { display: none; }
  .send-btn { padding: 0 16px; }
}

/* ---- Micro-interaction: a glowing pulse border for anything actively "live" (a running
   workflow card, an armed connection) — subtler than the orb's own pulse, meant to read at
   a glance without demanding attention the way the orb's animation does. ---- */
@keyframes glow-pulse-border {
  0%, 100% { box-shadow: 0 0 0 0 transparent, 0 0 16px 1px var(--glow-cyan-soft); }
  50% { box-shadow: 0 0 0 3px #00f0ff14, 0 0 26px 4px var(--glow-cyan); }
}
.glow-active { animation: glow-pulse-border 2.4s ease-in-out infinite; }

/* ---- Status & Tasks drawer — a bottom sheet that keeps the live-status/execution-log
   surface out of the main conversation viewport (per the "minimalist, uncluttered" brief)
   while staying one tap away via the topbar's tasks-toggle chip. ---- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #030712a3;
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 21;
  margin: 0 auto;
  max-width: 720px;
  max-height: min(78dvh, 640px);
  display: flex;
  flex-direction: column;
  background: var(--zarvis-surface-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--zarvis-border-soft);
  border-bottom: none;
  border-radius: 26px 26px 0 0;
  box-shadow: 0 -12px 50px -18px #000000e0;
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}
.drawer.open { transform: translateY(0); }

.drawer-handle {
  width: 36px; height: 4px;
  border-radius: 4px;
  background: var(--zarvis-border-soft);
  margin: 10px auto 2px;
  flex-shrink: 0;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px 14px;
  border-bottom: 1px solid var(--zarvis-border-soft);
  flex-shrink: 0;
}
.drawer-header h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.drawer-close {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--zarvis-border-soft);
  background: var(--zarvis-surface-elevated);
  color: var(--zarvis-text-secondary);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}
.drawer-close:hover { color: var(--zarvis-text-primary); border-color: #00f0ff55; }

.drawer-body {
  overflow-y: auto;
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.section-label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--zarvis-text-secondary);
}

/* ---- Status dashboard: small glass stat tiles, no borders touching/overlapping — each a
   self-contained unit rather than one dense bordered table. ---- */
.status-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.stat-tile {
  background: var(--zarvis-surface-elevated);
  border: 1px solid var(--zarvis-border-soft);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0; /* let long values ellipsize instead of forcing the grid wider */
}
.stat-tile-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--zarvis-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.stat-tile-value {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Active task / workflow cards. ---- */
.task-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.task-empty {
  padding: 22px 16px;
  text-align: center;
  color: var(--zarvis-text-secondary);
  font-size: 13px;
  background: var(--zarvis-surface-elevated);
  border: 1px dashed var(--zarvis-border-soft);
  border-radius: var(--radius);
}
.task-card {
  background: var(--zarvis-surface-elevated);
  border: 1px solid var(--zarvis-border-soft);
  border-radius: var(--radius);
  padding: 14px 16px;
  animation: rise 0.25s ease;
}
.task-card[data-status="RUNNING"] { border-color: #00f0ff40; }
.task-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.task-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--zarvis-border-soft);
  color: var(--zarvis-text-secondary);
}
.task-status-badge::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px 1px currentColor;
}
.task-status-badge[data-status="RUNNING"] { color: var(--zarvis-accent-cyan); border-color: #00f0ff40; }
.task-status-badge[data-status="PENDING"] { color: var(--zarvis-warning); border-color: #ffc46b40; }
.task-status-badge[data-status="PAUSED"] { color: var(--zarvis-warning); border-color: #ffc46b40; }
.task-status-badge[data-status="DONE"] { color: var(--zarvis-success); border-color: #22e6b040; }
.task-status-badge[data-status="FAILED"] { color: var(--zarvis-error); border-color: #ff5c7240; }
.task-status-badge[data-status="CANCELLED"] { color: var(--zarvis-text-secondary); }

.task-time { font-size: 11px; color: var(--zarvis-text-secondary); flex-shrink: 0; }

.task-goal {
  margin: 0 0 12px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--zarvis-text-primary);
}

.task-progress {
  height: 4px;
  border-radius: 4px;
  background: #ffffff14;
  overflow: hidden;
  margin-bottom: 12px;
}
.task-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--zarvis-accent-cyan), var(--zarvis-accent-blue));
  transition: width 0.4s ease;
}

.task-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 12px;
  padding: 10px 12px;
  background: #ffffff08;
  border-radius: 12px;
}
.task-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--zarvis-text-secondary);
}
.task-step-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--zarvis-text-secondary); flex-shrink: 0; }
.task-step[data-status="DONE"] .task-step-dot { background: var(--zarvis-success); }
.task-step[data-status="RUNNING"] .task-step-dot { background: var(--zarvis-accent-cyan); box-shadow: 0 0 5px 1px var(--glow-cyan-soft); }
.task-step[data-status="FAILED"] .task-step-dot { background: var(--zarvis-error); }

.task-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.task-action-btn {
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-body);
  padding: 6px 13px;
  border-radius: 999px;
  border: 1px solid var(--zarvis-border-soft);
  background: transparent;
  color: var(--zarvis-text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}
.task-action-btn:hover { border-color: #00f0ff55; color: var(--zarvis-accent-cyan); }
.task-action-btn.primary {
  background: linear-gradient(135deg, var(--zarvis-accent-cyan), var(--zarvis-accent-blue));
  border-color: transparent;
  color: #041016;
  font-weight: 600;
}
.task-action-btn.primary:hover { box-shadow: 0 0 16px 1px var(--glow-cyan-soft); color: #041016; }
.task-action-btn.danger:hover { border-color: #ff5c7255; color: var(--zarvis-error); }

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: #ffffff1f; border-radius: 8px; }
