/* ServerMind — warm dark dashboard, matched to the marketing site.
   Same identity as servermind.dev: warm near-black canvas, hairline borders,
   amber/gold accent, the Mindy daemon as the mark, sharp radii, restrained glow.
   Amber is a light hue — text and glyphs sitting ON it use --on-accent, never white.
   All colors are CSS custom properties for easy theming. */

:root {
  /* canvas + surfaces — warm-tinted, lifted straight from the landing page */
  --bg:           #0B0A07;   /* warm near-black */
  --sidebar-bg:   #100D09;
  --surface:      #120F0A;   /* cards */
  --surface-elev: #17130D;   /* hover / active */
  --surface-active: #1C1710; /* active nav row */
  /* borders — hairline, almost invisible */
  --border:        rgba(255, 255, 255, 0.07);
  --border-faint:  rgba(255, 255, 255, 0.06);
  --border-strong: rgba(255, 255, 255, 0.11);
  --track:         rgba(255, 255, 255, 0.06);
  /* text */
  --text:         #EDEEF2;   /* primary */
  --text-dim:     #A0A4AD;   /* values, buttons */
  --text-muted:   #6B7280;   /* muted */
  --text-faint:   #565C66;   /* labels, timestamps */
  /* accent + semantics — ServerMind amber */
  --accent:        #F5A524;  /* ServerMind gold */
  --accent-2:      #FBBF24;  /* brighter gold — emphasis text, glints */
  --accent-hover:  #FFBC3E;
  --accent-soft:   rgba(245, 165, 36, 0.12);
  --accent-border: rgba(245, 165, 36, 0.30);
  --on-accent:     #231905;  /* dark text/icons that sit on an amber fill */
  --green:         #4ADE80;
  --red:           #F87171;
  --amber:         #FBBF24;
  --green-soft:    rgba(74, 222, 128, 0.10);
  --green-border:  rgba(74, 222, 128, 0.20);
  --red-soft:      rgba(248, 113, 113, 0.10);
  --user-msg-bg:   #241B0C;  /* warm amber-tinted user bubble */
  /* type + shape — Geist (premium variable) with system / Inter fallbacks */
  --font-sans: "Geist Variable", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono Variable", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --radius:    8px;   /* never above this */
  --radius-sm: 6px;
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.5;
  letter-spacing: -0.011em;          /* subtle premium tightening, à la Linear */
  height: 100dvh;
  overflow: hidden;
  font-optical-sizing: auto;
  font-feature-settings: "cv11", "ss01";  /* refined glyphs on Inter fallback; ignored by Geist */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; letter-spacing: 0; }
.hidden { display: none !important; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-elev); border-radius: 999px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }
svg { display: block; }
button { font-family: inherit; }

/* small-caps label used everywhere (services / pm2 headers) */
.section-title {
  font-size: 11px; font-weight: 500; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-faint);
  margin: 28px 2px 12px;
}

/* ─── Server Memory panel ───────────────────────────────────────────────── */
.section-title.profile-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title.profile-title .set-hint { text-transform: none; letter-spacing: 0; }
.section-title.profile-title .btn { text-transform: none; letter-spacing: 0; padding: 5px 12px; font-size: 12px; }
.profile-body { padding: 4px 2px; font-size: 13px; }
.profile-empty, .pmuted { color: var(--text-faint); }
.profile-meta { color: var(--text-faint); font-size: 12px; padding: 6px 12px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.prow { display: flex; gap: 12px; padding: 7px 12px; align-items: baseline; }
.prow .pk { flex: 0 0 110px; color: var(--text-faint); font-size: 12px; }
.prow .pv { flex: 1; display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.ptag { display: inline-flex; align-items: baseline; gap: 4px; padding: 2px 8px; border-radius: var(--radius-sm); background: var(--surface-elev); border: 1px solid var(--border); font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.ptag.ok { background: var(--green-soft); border-color: var(--green-border); color: var(--green); }
.ptag.warn { background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.22); color: var(--amber); }
.ptag.bad { background: var(--red-soft); border-color: rgba(248,113,113,0.22); color: var(--red); }
.ptag .pmuted { font-size: 11px; }
.dok { color: var(--green); } .dbad { color: var(--red); }
.profile-notes { margin: 8px 12px 4px; display: flex; flex-direction: column; gap: 4px; }
.pnote { font-size: 12px; color: var(--amber); }

/* ─── Fleet Memory matrix (see all at once) ─────────────────────────────── */
.fm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.fm-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); padding: 8px 12px; border-bottom: 1px solid var(--border); font-weight: 500; }
.fm-table th.r, .fm-table td.r { text-align: right; }
.fm-table td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text-dim); }
.fm-table td.mono { font-family: var(--font-mono); font-size: 12px; }
.fm-table tr:last-child td { border-bottom: none; }
.fm-row { cursor: pointer; transition: background 120ms ease; }
.fm-row:hover { background: var(--surface-elev); }
.fm-row.sel { background: var(--accent-soft); }
.fm-row td.ok { color: var(--green); } .fm-row td.warn { color: var(--amber); } .fm-row td.bad { color: var(--red); }
.fm-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px; background: var(--text-faint); vertical-align: middle; }
.fm-dot.ok { background: var(--green); } .fm-dot.off { background: var(--red); } .fm-dot.self { background: var(--accent); }
.fm-tag { font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-faint); margin-left: 4px; }
.fm-bad { color: var(--red); font-weight: 600; }
.fm-detail { margin-top: 4px; }
.fm-detail:empty { display: none; }
.fm-detail-title { padding: 12px 12px 4px; font-weight: 600; color: var(--accent); border-top: 1px solid var(--border); }

/* ─── shell ─────────────────────────────────────────────────────────────── */
.app { display: flex; height: 100dvh; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border-faint);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  z-index: 40;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; }
.brand-logo {
  width: 28px; height: 28px; flex-shrink: 0;
  display: grid; place-items: center;
  filter: drop-shadow(0 2px 10px rgba(245, 165, 36, 0.28));
}
.brand-logo svg { width: 28px; height: 28px; }
.brand-name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.1; }
.brand-env { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.nav { display: flex; flex-direction: column; gap: 2px; margin-top: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 32px; padding: 0 12px; border-radius: var(--radius);
  color: var(--text-dim); font-size: 13px; font-weight: 500;
  cursor: pointer; border-left: 2px solid transparent;
  transition: background 120ms ease, color 120ms ease;
}
.nav-item svg { width: 16px; height: 16px; opacity: .8; }
.nav-item:hover { background: #16120C; color: var(--text); }
.nav-item.active {
  background: var(--surface-active); color: #fff;
  border-left-color: var(--accent);
}
.nav-item.active svg { opacity: 1; }

.side-status { margin-top: auto; padding: 12px 10px 4px; }
.side-status-row { display: flex; align-items: center; gap: 8px; }
.side-status-dot {
  width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0;
  background: var(--green); box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}
.side-status-dot.bad { background: var(--red); box-shadow: 0 0 6px rgba(248, 113, 113, 0.4); }
.side-status-text { font-size: 12px; color: var(--text-dim); }
.side-status-text.bad { color: var(--red); }
.side-status-time { font-size: 11px; color: var(--text-faint); margin-top: 6px; padding-left: 14px; }

.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.55); z-index: 30; }

/* ─── main ──────────────────────────────────────────────────────────────── */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 16px; flex-shrink: 0;
  border-bottom: 1px solid var(--border-faint);
}
.topbar-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.page-title { font-size: 14px; font-weight: 500; letter-spacing: -0.01em; }
.env-badge {
  font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint);
}
.spacer { flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border-radius: var(--radius-sm);
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--text-dim); font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text); }
.btn svg { width: 14px; height: 14px; }
.hamburger { display: none; padding: 0 7px; }

/* mutations — pill toggle switch */
.arm {
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 10px 0 8px; border-radius: 999px;
  background: transparent; border: 1px solid var(--border-strong);
  color: var(--text-dim); font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.arm:hover { background: rgba(255, 255, 255, 0.05); }
.arm .toggle-track {
  width: 28px; height: 16px; border-radius: 999px; flex-shrink: 0;
  background: var(--surface-elev); position: relative; transition: background 150ms ease;
}
.arm .toggle-knob {
  position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--text-muted); transition: transform 150ms ease, background 150ms ease;
}
.arm.on { color: var(--amber); border-color: rgba(251, 191, 36, 0.35); }
.arm.on .toggle-track { background: var(--amber); }
.arm.on .toggle-knob { transform: translateX(12px); background: #1a1206; }
.arm:disabled { opacity: .6; cursor: default; }

/* ─── overview ──────────────────────────────────────────────────────────── */
[data-view] { flex: 1 1 auto; min-height: 0; }
[data-view="overview"], [data-view="settings"], [data-view="fleet"], [data-view="tools"] { display: block; overflow-y: auto; }
[data-view="assistant"] { display: flex; flex-direction: column; }

.overview { padding: 20px 20px 40px; max-width: 1240px; }

/* ── system status hero — the page's anchor: is my server OK? ── */
.status-hero {
  display: flex; align-items: center; gap: 14px;
  padding: 15px 18px; margin-bottom: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-left: 3px solid var(--green); border-radius: var(--radius);
}
.status-hero[data-state="warn"] { border-left-color: var(--amber); }
.status-hero[data-state="down"] {
  border-left-color: var(--red);
  background: linear-gradient(90deg, rgba(248,113,113,.06), transparent 38%), var(--surface);
}
.sh-dot {
  position: relative; flex-shrink: 0; width: 9px; height: 9px; border-radius: 50%;
  background: var(--green); box-shadow: 0 0 0 4px rgba(74,222,128,.12);
}
.status-hero[data-state="warn"] .sh-dot { background: var(--amber); box-shadow: 0 0 0 4px rgba(251,191,36,.12); }
.status-hero[data-state="down"] .sh-dot { background: var(--red);   box-shadow: 0 0 0 4px rgba(248,113,113,.14); }
.sh-dot::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: inherit; animation: sh-pulse 2.8s ease-out infinite; }
@keyframes sh-pulse { 0% { transform: scale(1); opacity: .55; } 70% { transform: scale(2.6); opacity: 0; } 100% { opacity: 0; } }
.sh-text { min-width: 0; }
.sh-title { font-size: 14.5px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.status-hero[data-state="down"] .sh-title { color: var(--red); }
.sh-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sh-side { margin-left: auto; display: flex; align-items: center; gap: 22px; flex-shrink: 0; }
.sh-stat { font-size: 12px; color: var(--text-faint); }
.sh-stat b { font-family: var(--font-mono); font-weight: 600; color: var(--text-dim); }
.sh-updated { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }

/* ── metric cards — mini-charts (sparkline = trend, gauge = state) ── */
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-card {
  display: flex; flex-direction: column; min-height: 150px; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px 16px;
  transition: border-color 120ms ease, background 120ms ease;
}
.metric-card:hover { border-color: var(--border-strong); }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.metric-label { font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-faint); }
.metric-icon { color: var(--text-faint); transition: color 120ms ease; }
.metric-icon svg { width: 15px; height: 15px; }
.metric-card:hover .metric-icon { color: var(--text-muted); }
.metric-value { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 30px; font-weight: 600; letter-spacing: -0.03em; color: var(--text); margin-top: 12px; line-height: 1; }
.metric-sub { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); margin-top: 7px; }
.metric-chart { margin-top: 14px; flex: 1; display: flex; align-items: flex-end; }
/* area sparkline — bleeds to the card's bottom + side edges */
.metric-spark { position: relative; width: calc(100% + 32px); margin: 0 -16px -16px; height: 52px; color: var(--accent); }
.metric-spark .spark-svg { width: 100%; height: 100%; display: block; }
.metric-card[data-tone="warn"] .metric-spark { color: var(--amber); }
.metric-card[data-tone="bad"]  .metric-spark { color: var(--red); }
/* usage gauge — disk fill / uptime "up" bar */
.metric-gauge { width: 100%; height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; margin-bottom: 4px; }
.metric-gauge i { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width 600ms cubic-bezier(.22,1,.36,1); }
.metric-card[data-tone="warn"] .metric-gauge i { background: var(--amber); }
.metric-card[data-tone="bad"]  .metric-gauge i { background: var(--red); }
.metric-gauge.up i { background: var(--green); }

/* service health grid */
.services { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.service-card {
  display: flex; align-items: center; gap: 10px;
  height: 40px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 120ms ease;
}
.service-card.down { background: #1A1010; border-color: rgba(248, 113, 113, 0.15); }
.service-glow { position: relative; flex-shrink: 0; display: grid; place-items: center; }
.service-dot { width: 6px; height: 6px; border-radius: 50%; position: relative; z-index: 1; }
.service-dot.up   { background: var(--green); box-shadow: 0 0 6px rgba(74, 222, 128, 0.4); }
.service-dot.warn { background: var(--amber); box-shadow: 0 0 6px rgba(251, 191, 36, 0.4); }
.service-dot.down { background: var(--red);   box-shadow: 0 0 6px rgba(248, 113, 113, 0.4); }
/* subtle pulse only on down dots, to draw attention */
.service-dot.down::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--red); animation: dot-pulse 3s ease-in-out infinite;
}
@keyframes dot-pulse {
  0%, 100% { transform: scale(1); opacity: .55; }
  50%      { transform: scale(1.3); opacity: 0; }
}
.service-info { min-width: 0; flex: 1; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.service-name { font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.service-status { font-size: 11px; color: var(--text-muted); white-space: nowrap; flex-shrink: 0; }
.service-card.down .service-status { color: var(--red); }

/* pm2 table — borderless, sits on the page */
.panel { background: transparent; border: none; border-radius: 0; overflow: visible; }
.table-scroll { overflow-x: auto; }
.pm2-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.pm2-table thead th {
  text-align: left; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-faint); padding: 6px 12px; border-bottom: 1px solid var(--border-faint); white-space: nowrap;
}
.pm2-table thead th.r, .pm2-table td.r { text-align: right; }
.pm2-table tbody tr { height: 36px; border-bottom: 1px solid rgba(255, 255, 255, 0.04); transition: background 120ms ease; }
.pm2-table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.pm2-table td { padding: 0 12px; color: var(--text-dim); white-space: nowrap; }
.pm2-table td.name { color: var(--text); font-weight: 500; }
.pm2-table td.num { font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.restart-warn { color: var(--amber) !important; }
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px; border-radius: 100px; font-size: 11px; font-weight: 500;
}
.status-pill .pd { width: 5px; height: 5px; border-radius: 50%; }
.status-pill.online  { background: var(--green-soft); color: var(--green); border: 1px solid var(--green-border); }
.status-pill.online .pd  { background: var(--green); box-shadow: 0 0 4px rgba(74, 222, 128, 0.5); }
.status-pill.offline { background: var(--red-soft); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.2); }
.status-pill.offline .pd { background: var(--red); }
.empty { padding: 24px 12px; text-align: center; color: var(--text-muted); font-size: 13px; }

/* ─── assistant / chat ──────────────────────────────────────────────────── */
.chat-log { flex: 1; overflow-y: auto; padding: 24px 20px 8px; }
.chat-wrap { max-width: 680px; margin: 0 auto; }
.msg { margin-bottom: 24px; display: flex; flex-direction: column; }
.msg.user { align-items: flex-end; }
.msg .who { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.08em; font-family: var(--font-mono); color: var(--text-faint); margin-bottom: 4px; }
.msg .body { font-size: 13px; line-height: 1.6; color: var(--text); max-width: 100%; }
/* user — right-aligned indigo-tinted bubble */
.msg.user .body {
  background: var(--user-msg-bg); border: 1px solid var(--accent-border);
  border-radius: var(--radius); padding: 10px 14px; max-width: 85%;
}
/* assistant — no bubble, just text */
.msg.assistant .body { background: transparent; border: none; padding: 0; }
.body p { margin: 0 0 11px; } .body p:last-child { margin-bottom: 0; }
/* bullets use a thin indigo left border instead of dots */
.body ul { margin: 10px 0; padding: 0; list-style: none; }
.body li { margin: 6px 0; padding-left: 12px; border-left: 2px solid var(--accent); }
.body code { font-family: var(--font-mono); font-size: 12px; background: var(--surface-elev); padding: 1px 6px; border-radius: 5px; color: var(--accent); }
.body pre { background: #0C0A06; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 13px 15px; overflow-x: auto; margin: 11px 0; }
.body pre code { background: none; padding: 0; color: var(--text-dim); font-size: 12px; line-height: 1.6; }
.body h1, .body h2, .body h3 { font-size: 14px; font-weight: 600; margin: 16px 0 8px; color: var(--text); }
.body strong { color: var(--accent); font-weight: 600; }
.body em { color: var(--text); }
.msg.user .body strong { color: var(--text); }

.cursor::after { content: "▍"; color: var(--accent); animation: blink 1.1s steps(2) infinite; }
.thinking { display: flex; align-items: center; gap: 9px; padding: 2px 0; }
.thinking .dots { display: flex; align-items: center; gap: 6px; }
.thinking .dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: tdot 1.3s infinite ease-in-out both; }
.thinking .dots span:nth-child(2) { animation-delay: .16s; }
.thinking .dots span:nth-child(3) { animation-delay: .32s; }

/* ─── Mindy mascot ──────────────────────────────────────────────────────────
   Animations live on inner groups so the wrapper can be freely sized/placed.
   transform-box: fill-box keeps each group's origin local to its own geometry. */
.mindy { display: block; overflow: visible; }
.mindy .m-bob, .mindy .m-orb, .mindy .m-eyes, .mindy .m-aura, .mindy .m-shadow,
.mindy .m-sparks circle { transform-box: fill-box; transform-origin: 50% 50%; }
.mindy .m-bob    { animation: m-bob 4s ease-in-out infinite; }
.mindy .m-orb    { animation: m-orb 2.8s ease-in-out infinite; }
.mindy .m-eyes   { animation: m-blink 5.6s ease-in-out infinite; }
.mindy .m-aura   { animation: m-orb 4s ease-in-out infinite; }
.mindy .m-shadow { animation: m-shadow 4s ease-in-out infinite; opacity: .42; }
.mindy .m-blush  { opacity: .35; transition: opacity .3s; }
.mindy .m-sparks { opacity: 0; transition: opacity .25s; }
/* thinking pose — Mindy tilts, the mind pulses faster, sparks rise */
.mindy.thinking { animation: m-ponder 2.2s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 92%; }
.mindy.thinking .m-orb { animation-duration: 1.1s; }
.mindy.thinking .m-blush { opacity: .6; }
.mindy.thinking .m-sparks { opacity: 1; }
.mindy.thinking .m-sparks circle { animation: m-spark 1.3s ease-in-out infinite; }
.mindy.thinking .m-sparks circle:nth-child(2) { animation-delay: .25s; }
.mindy.thinking .m-sparks circle:nth-child(3) { animation-delay: .5s; }
@keyframes m-bob    { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes m-orb    { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: .9; transform: scale(1.08); } }
@keyframes m-blink  { 0%, 93%, 100% { transform: scaleY(1); } 96%, 98% { transform: scaleY(.08); } }
@keyframes m-shadow { 0%, 100% { transform: scaleX(1); opacity: .42; } 50% { transform: scaleX(.87); opacity: .28; } }
@keyframes m-ponder { 0%, 100% { transform: rotate(-2deg); } 50% { transform: rotate(2deg); } }
@keyframes m-spark  { 0% { opacity: 0; transform: translateY(5px) scale(.5); } 50% { opacity: 1; transform: translateY(-1px) scale(1); } 100% { opacity: 0; transform: translateY(-7px) scale(.5); } }

/* chat empty state — Mindy greets you when there are no messages yet */
.chat-empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 32px 16px 12px; animation: ce-in .4s ease both; }
.chat-empty .mindy { filter: drop-shadow(0 10px 30px rgba(245, 165, 36, 0.16)); }
.ce-title { margin-top: 8px; font-size: 17px; font-weight: 600; letter-spacing: -0.01em; color: var(--text); }
.ce-sub { margin-top: 8px; max-width: 380px; font-size: 13px; line-height: 1.6; color: var(--text-muted); }
.ce-sub b { color: var(--accent-2); font-weight: 600; }
@keyframes ce-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg-error { margin-top: 8px; color: var(--red); font-size: 13px; }
.msg-note { margin-top: 8px; color: var(--text-muted); font-size: 13px; }

/* tool cards */
.tool { margin: 9px 0; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; font-size: 12px; }
.tool .head { display: flex; align-items: center; gap: 9px; padding: 8px 12px; cursor: pointer; color: var(--text-dim); transition: background 120ms ease; }
.tool .head:hover { background: var(--surface-elev); }
.tool .head .name { font-family: var(--font-mono); font-weight: 500; color: var(--accent); }
.tool.mutating .head .name { color: var(--amber); }
.tool.error .head .name { color: var(--red); }
.tool .head .badge { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; padding: 2px 7px; border-radius: var(--radius-sm); background: var(--accent-soft); color: var(--accent); }
.tool.mutating .head .badge { background: rgba(251, 191, 36, 0.12); color: var(--amber); }
.tool.error .head .badge { background: var(--red-soft); color: var(--red); }
.tool .head .arrow { margin-left: auto; color: var(--text-faint); transition: transform 120ms ease; }
.tool.open .head .arrow { transform: rotate(90deg); }
.tool .detail { display: none; border-top: 1px solid var(--border); }
.tool.open .detail { display: block; }
.tool pre { margin: 0; padding: 11px 13px; background: #0C0A06; overflow-x: auto; white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.tool .res { border-top: 1px dashed var(--border); }

/* "ServerMind needs a tool" card — the in-chat capability-request handoff */
.tool-req { margin: 12px 0; border: 1px solid var(--accent); border-radius: var(--radius-sm); background: var(--accent-soft); padding: 13px 14px; font-size: 13px; }
.tool-req .tr-head { font-weight: 600; color: var(--accent); }
.tool-req .tr-sub { margin: 4px 0 10px; color: var(--text-dim); font-size: 12px; }
.tool-req .tr-json { margin: 0 0 11px; padding: 11px 13px; background: #0C0A06; border-radius: var(--radius-sm); overflow-x: auto; white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: 12px; color: var(--text-dim); }
.tool-req .tr-warn { margin: 0 0 10px; padding: 8px 11px; border-radius: var(--radius-sm); background: rgba(251, 191, 36, 0.12); color: var(--amber); font-size: 12px; }
.tool-req .tr-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.tool-req .tr-bar .modal-btn { width: auto; margin-top: 0; padding: 8px 16px; font-size: 12px; }
.tool-req .tr-msg { font-size: 12px; display: inline-flex; align-items: center; gap: 6px; }
.tool-req .tr-rerun { padding: 5px 12px; font-size: 12px; }

/* composer — fixed-feel bottom bar */
.composer { flex-shrink: 0; padding: 8px 20px calc(18px + env(safe-area-inset-bottom)); }
.composer-inner { max-width: 680px; margin: 0 auto; }
.hint { display: flex; flex-wrap: wrap; margin-bottom: 10px; }
.hint span {
  margin: 0 8px 8px 0; padding: 6px 12px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 12px; color: var(--text-dim); background: var(--surface); border: 1px solid var(--border);
  transition: border-color 120ms ease, color 120ms ease;
}
.hint span:hover { border-color: var(--accent-border); color: var(--text); }
.input-pill {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 6px 6px 6px 16px;
  transition: border-color 120ms ease;
}
.input-pill:focus-within { border-color: var(--accent-border); }
#input {
  flex: 1; resize: none; background: transparent; border: none; outline: none;
  color: var(--text); font-family: var(--font-sans); font-size: 13px; line-height: 1.5;
  max-height: 180px; padding: 6px 0;
}
#input::placeholder { color: var(--text-faint); }
.send-btn {
  width: 32px; height: 32px; flex-shrink: 0; border: none; cursor: pointer;
  border-radius: 50%; display: grid; place-items: center; color: var(--on-accent);
  background: var(--accent); transition: background 120ms ease, transform 100ms ease;
}
.send-btn:hover { background: var(--accent-hover); }
.send-btn:active { transform: scale(.94); }
.send-btn svg { width: 14px; height: 14px; }
.send-btn.stop { background: var(--surface-elev); color: var(--text); }
.send-btn.stop:hover { background: #231D14; }

/* ─── login modal ───────────────────────────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(5, 5, 9, 0.7); }
.modal-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 26px; }
.modal-head { display: flex; align-items: center; gap: 11px; margin-bottom: 6px; }
.modal-logo { width: 32px; height: 32px; display: grid; place-items: center; filter: drop-shadow(0 2px 12px rgba(245, 165, 36, 0.3)); }
.modal-logo svg { width: 32px; height: 32px; }
.modal-title { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.modal-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; }
.field { width: 100%; background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 10px 14px; color: var(--text); font-size: 13px; outline: none; transition: border-color 120ms ease; margin-bottom: 10px; }
.field:focus { border-color: var(--accent-border); }
.field::placeholder { color: var(--text-faint); }
.field.code { text-align: center; letter-spacing: .5em; font-family: var(--font-mono); }
.modal-btn { width: 100%; margin-top: 6px; padding: 10px; border: none; border-radius: var(--radius-sm); background: var(--accent); color: var(--on-accent); font-size: 13px; font-weight: 600; cursor: pointer; transition: background 120ms ease; }
.modal-btn:hover { background: var(--accent-hover); }
.modal-err { min-height: 16px; margin-top: 10px; text-align: center; font-size: 12px; color: var(--red); }

/* Login is a full-screen page (opaque), not a dim overlay floating on the dashboard. */
#gate { background: radial-gradient(900px 520px at 50% -12%, rgba(245, 165, 36, 0.10), transparent 70%), var(--bg); }
#gate .modal-card { box-shadow: 0 30px 90px -40px rgba(245, 165, 36, 0.25); }

@keyframes blink  { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes tdot   { 0%, 80%, 100% { transform: scale(.5); opacity: .35; } 40% { transform: scale(1); opacity: 1; } }

/* ─── skeleton loading ──────────────────────────────────────────────────────
   Opacity pulse (no gradient sweep) — matches Linear's placeholder style.
   Dimensions mirror the real content to avoid layout shift on swap. */
.sk { display: block; background: var(--surface-elev); border-radius: 4px; animation: sk-pulse 1.6s ease-in-out infinite; }
.sk-label { width: 64px;  height: 11px; }
.sk-icon  { width: 15px;  height: 15px; border-radius: 4px; }
.sk-value { width: 84px;  height: 30px; margin-top: 12px; }
.sk-sub   { width: 112px; height: 11px; margin-top: 9px; }
.sk-chart { width: 100%;  height: 28px; margin-top: auto; border-radius: 4px; }
.sk-dot   { width: 9px;   height: 9px;  border-radius: 50%; flex-shrink: 0; }
.sk-line  { flex: 1; height: 12px; max-width: 120px; }
.sk-pill  { display: inline-block; width: 62px; height: 18px; border-radius: 100px; }
.sk-num   { display: inline-block; width: 38px; height: 12px; }
.skeleton-card:hover { border-color: var(--border); }   /* no hover lift while loading */
.status-hero.skeleton-card { border-left-color: var(--border); }
@keyframes sk-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }

/* ─── responsive ────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .sidebar { position: fixed; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform 200ms ease; }
  .sidebar.open { transform: translateX(0); }
  .hamburger { display: inline-flex; }
  .env-badge { display: none; }
  .sh-side { display: none; }
}
@media (max-width: 560px) {
  .metrics { grid-template-columns: 1fr 1fr; gap: 10px; }
  .overview { padding: 16px 14px 36px; }
  .metric-value { font-size: 24px; }
  .topbar { padding: 0 14px; }
}

/* ─── reduced motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .service-dot.down::after { animation: none; opacity: 0; }
  .sh-dot::after { animation: none; opacity: 0; }
  .sk { animation: none; opacity: .6; }
  .thinking .dots span { animation: none; opacity: .7; }
  .mindy .m-bob, .mindy .m-orb, .mindy .m-eyes, .mindy .m-aura, .mindy .m-shadow,
  .mindy.thinking, .mindy.thinking .m-sparks circle { animation: none !important; }
  .mindy.thinking .m-sparks { opacity: 1; }
  .cursor::after { animation: none; }
  * { transition-duration: 0.01ms !important; }
}

/* ─── settings panel ─── */
.settings { max-width: 920px; padding: 20px 20px 40px; }
.set-intro { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; line-height: 1.6; }
.set-intro code { font-family: var(--font-mono); font-size: 12px; color: var(--accent-2); background: var(--surface); padding: 1px 5px; border-radius: 4px; }
.set-panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 22px; }
.set-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 16px; }
.set-field { display: flex; flex-direction: column; min-width: 0; }
.set-field > span { font-size: 12px; color: var(--text-dim); margin-bottom: 6px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.set-hint { font-size: 11px; color: var(--text-faint); font-weight: 400; }
.set-field .field { margin-bottom: 14px; min-width: 0; max-width: 100%; }
select.field { appearance: none; -webkit-appearance: none; cursor: pointer; }
.set-toggle { display: inline-flex; align-items: center; gap: 10px; font-size: 13px; color: var(--text); margin-bottom: 16px; cursor: pointer; }
.set-toggle input { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.set-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.btn.ghost { height: auto; border: 1px solid var(--border-strong); padding: 8px 14px; border-radius: var(--radius-sm); font-size: 13px; background: transparent; color: var(--text-dim); }
.btn.ghost:hover { background: var(--surface-elev); color: var(--text); border-color: var(--accent-border); }
.set-bar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.set-bar .modal-btn { width: auto; margin-top: 0; padding: 10px 22px; }
.set-msg { font-size: 13px; color: var(--text-muted); }
.set-msg.good { color: var(--green); }
.set-msg.bad { color: var(--red); }
@media (max-width: 760px) { .set-grid { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .settings { padding: 16px 14px 36px; } .set-panel { padding: 16px 14px; } .set-actions, .set-bar { flex-direction: column; align-items: stretch; } .set-bar .modal-btn { width: 100%; } }

/* ─── fleet view ─── */
.fleet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(244px, 1fr)); gap: 12px; }
.fleet-empty { color: var(--text-muted); font-size: 14px; line-height: 1.6; padding: 22px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }
.fleet-empty code { font-family: var(--font-mono); font-size: 12px; color: var(--accent-2); }
.fleet-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px 16px; }
.fleet-card.off { opacity: .6; }
.fc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; }
.fc-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.fc-dot.ok { background: var(--green); box-shadow: 0 0 6px var(--green); }
.fc-dot.down { background: var(--text-faint); }
.fc-name { font-size: 14px; font-weight: 600; color: var(--text); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-state { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .07em; }
.fc-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.fc-m { display: flex; flex-direction: column; gap: 3px; }
.fc-k { font-size: 11px; color: var(--text-faint); }
.fc-v { font-family: var(--font-mono); font-size: 16px; font-weight: 600; color: var(--text); }
.fc-v.warn { color: var(--amber); }
.fc-v.bad { color: var(--red); }
.fc-foot { margin-top: 13px; font-size: 12px; color: var(--text-muted); }

/* ─── fleet: manage button + chat context chip (Phase 2b) ─── */
.fc-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fc-manage { border: 1px solid var(--border-strong); background: transparent; color: var(--text-dim); font-size: 11.5px; font-weight: 500; padding: 4px 9px; border-radius: var(--radius-sm); cursor: pointer; transition: background 120ms ease, color 120ms ease, border-color 120ms ease; }
.fc-manage:hover { background: var(--accent-soft); color: var(--accent-2); border-color: var(--accent-border); }
.chat-context { display: flex; align-items: center; gap: 8px; padding: 8px 16px; border-bottom: 1px solid var(--border-faint); background: var(--accent-soft); color: var(--text); font-size: 12.5px; flex-shrink: 0; }
.chat-context b { color: var(--accent-2); font-weight: 600; }
.chat-context .cc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 6px var(--accent); flex-shrink: 0; }
.chat-context .cc-clear { margin-left: auto; border: none; background: transparent; color: var(--text-muted); cursor: pointer; font-size: 14px; line-height: 1; padding: 2px 6px; border-radius: 5px; }
.chat-context .cc-clear:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.fc-remove { border: 1px solid var(--border-strong); background: transparent; color: var(--text-faint); font-size: 11.5px; padding: 4px 9px; border-radius: var(--radius-sm); cursor: pointer; transition: color 120ms ease, border-color 120ms ease; }
.fc-remove:hover { color: var(--red); border-color: var(--red); }
.fc-svcs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.fc-badge { font-size: 11px; padding: 2px 9px; border-radius: 999px; border: 1px solid var(--border); color: var(--text-faint); font-family: var(--font-mono); }
.fc-badge.ok { color: var(--green); border-color: var(--green-border); background: var(--green-soft); }

/* ── Fleet: Add-server panel + enroll command ──────────────────────────────── */
.fleet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.btn-add-server {
  background: var(--accent); color: var(--on-accent); border: none;
  border-radius: var(--radius-sm); padding: 7px 13px; font-weight: 600;
  font-size: 13px; cursor: pointer;
}
.btn-add-server:hover { background: var(--accent-hover); }
.add-server-panel {
  background: var(--sidebar-bg); border: 1px solid var(--border-strong);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
}
.add-server-panel p { margin: 0 0 8px; color: var(--text-dim); font-size: 13px; }
.enroll-cmd {
  background: #07060400; background: rgba(0,0,0,0.30); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 13px; margin: 0 0 10px;
  overflow-x: auto; white-space: pre; font-size: 12.5px; line-height: 1.5;
}
.enroll-cmd code { color: var(--accent-2); font-family: var(--mono, ui-monospace, monospace); }
.add-server-actions { display: flex; align-items: center; gap: 12px; }
.btn-copy {
  background: transparent; color: var(--text-dim); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 6px 12px; font-size: 12.5px; cursor: pointer;
}
.btn-copy:hover { border-color: var(--accent-border); color: var(--text); }
.enroll-note { color: var(--text-muted); font-size: 12px; }

/* ─── custom tools panel ─── */
.tools-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.tool-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.ct-card {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px;
}
.ct-main { min-width: 0; }
.ct-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ct-kind { font-size: 11px; color: var(--text-muted); font-weight: 500; border: 1px solid var(--border-strong); border-radius: 6px; padding: 1px 7px; }
.ct-tag { font-size: 11px; font-weight: 600; border-radius: 6px; padding: 1px 7px; color: var(--green); background: rgba(0,0,0,0.18); }
.ct-tag.mut { color: var(--accent-2); }
.ct-desc { color: var(--text-dim); font-size: 13px; margin-top: 4px; }
.ct-detail { color: var(--text-muted); font-size: 12px; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ct-actions { display: flex; gap: 8px; flex-shrink: 0; }
.tf-group { display: flex; flex-direction: column; gap: 12px; margin-top: 4px; }
.tf-note { margin: 0; padding: 11px 13px; font-size: 13px; line-height: 1.55; color: var(--text-dim); background: rgba(0,0,0,0.18); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.tf-note code { font-family: var(--font-mono); font-size: 12px; color: var(--accent-2); }
textarea.field.mono { resize: vertical; min-height: 56px; line-height: 1.5; }
@media (max-width: 560px) { .ct-card { flex-direction: column; } .ct-detail { white-space: normal; } }
