/* ============================================================
   Hermes HQ — Bloom Manager-inspired layout
   Top nav bar + centered two-column dashboard. Dark, green/mint.
   ============================================================ */
:root {
  --bg: #0a0d0b;
  --bg-2: #0e1311;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-3: rgba(255, 255, 255, 0.09);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef6f2;
  --text-2: #b9c6c0;
  --muted: #7d8b85;
  --mint: #4ce1a6;
  --mint-soft: #aeffd4;
  --green-deep: #0a281a;
  --green: #00bb7f;
  --red: #ff5c5c;
  --amber: #f0b400;
  --cyan: #5eead4;
  --up: #4ce1a6;
  --down: #ff5c5c;
  --grad: linear-gradient(120deg, #0f2e20, #0a281a);
  --mono: "SFMono-Regular", ui-monospace, "JetBrains Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html { font-size: 14px; scrollbar-color: #2a3a33 #0c1211; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
a { color: var(--mint); text-decoration: none; }

/* ambient glow */
.orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orbs i { position: absolute; border-radius: 50%; filter: blur(100px); }
.orbs .o1 { width: 42vw; height: 42vw; left: -14vw; top: -16vw; opacity: 0.13;
  background: radial-gradient(circle, var(--green), transparent 65%); animation: drift1 30s ease-in-out infinite; }
.orbs .o2 { width: 38vw; height: 38vw; right: -12vw; top: 6vw; opacity: 0.10;
  background: radial-gradient(circle, var(--cyan), transparent 65%); animation: drift2 36s ease-in-out infinite; }
.orbs .o3 { width: 34vw; height: 34vw; left: 28vw; bottom: -18vw; opacity: 0.08;
  background: radial-gradient(circle, var(--green), transparent 65%); animation: drift3 42s ease-in-out infinite; }
@keyframes drift1 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(6vw,4vw) scale(1.08)} }
@keyframes drift2 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(-5vw,6vw) scale(1.06)} }
@keyframes drift3 { 0%,100%{transform:translate(0,0) scale(1)} 50%{transform:translate(4vw,-4vw) scale(1.1)} }

/* ============ top bar (h-14) ============ */
.topbar { position: sticky; top: 0; z-index: 40; height: 56px; display: flex; align-items: center;
  gap: 10px; padding: 0 14px; background: rgba(10,13,11,0.82); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: 0.01em;
  font-size: 1.02rem; padding-right: 6px; }
.brand .logo { width: 30px; height: 30px; border-radius: 9px; background: var(--grad);
  display: grid; place-items: center; color: var(--mint-soft); font-size: 1rem; font-weight: 800;
  border: 1px solid rgba(76,225,166,0.3); box-shadow: 0 0 20px rgba(76,225,166,0.2); }
.brand .accent { color: var(--mint); }

.nav { display: flex; align-items: center; gap: 2px; height: 100%; overflow-x: auto; }
.navitem { position: relative; display: flex; align-items: center; gap: 7px; padding: 0 12px; height: 56px;
  color: var(--muted); font-size: 0.85rem; font-weight: 600; background: none; border: none; cursor: pointer;
  font-family: inherit; white-space: nowrap; transition: color .16s; }
.navitem:hover { color: var(--text-2); }
.navitem.active { color: var(--mint); }
.navitem.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 2px;
  border-radius: 2px; background: var(--mint); box-shadow: 0 0 10px rgba(76,225,166,0.6); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.who { font-size: 0.8rem; color: var(--muted); }
.who b { color: var(--text-2); font-weight: 600; }
.btn-ghost { background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
  border-radius: 9px; padding: 7px 13px; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  font-family: inherit; transition: all .16s; }
.btn-ghost:hover { border-color: var(--border-strong); color: var(--text); }
.btn-ghost.logout { color: var(--red); }
.btn-ghost.logout:hover { border-color: var(--red); }
.clock { font-family: var(--mono); font-size: 0.78rem; color: var(--muted); }

/* ============ layout ============ */
.wrap { position: relative; z-index: 1; max-width: 1200px; margin: 0 auto; padding: 0 18px 60px; }
.view { display: none; }
.view.active { display: block; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* home header */
.home-head { padding: 30px 2px 4px; display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.home-head h1 { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; margin: 0; }
.home-head .handle { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }
.home-head .handle b { color: var(--mint); font-weight: 650; }
.home-head .last { color: var(--muted); font-size: 0.78rem; }

/* main two-column grid (12 col) */
.grid12 { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px; margin-top: 18px; }
.col-left { grid-column: span 12; }
.col-right { grid-column: span 12; }
@media (min-width: 1024px) {
  .col-left { grid-column: span 5; }
  .col-right { grid-column: span 7; }
}

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  padding: 18px 20px; backdrop-filter: blur(10px); }
.card h4 { margin: 0 0 2px; font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); font-weight: 700; }
.card .desc { font-size: 0.74rem; color: var(--muted); margin-bottom: 14px; }
.card + .card { margin-top: 14px; }

/* ============ stat tiles ============ */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; }
.tile h5 { margin: 0; font-size: 0.7rem; color: var(--muted); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; }
.tile .val { font-size: 1.45rem; font-weight: 800; margin-top: 5px; font-variant-numeric: tabular-nums; }
.tile .val small { font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.tile .val.green { color: var(--mint); }
.tile .val.red { color: var(--red); }
.tile .sub { font-size: 0.72rem; color: var(--muted); margin-top: 3px; }

/* ============ heatmap ============ */
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 3px;
  overflow-x: auto; padding-bottom: 4px; }
.hm-cell { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-3); }
.hm-cell.l1 { background: rgba(76,225,166,0.22); }
.hm-cell.l2 { background: rgba(76,225,166,0.45); }
.hm-cell.l3 { background: rgba(76,225,166,0.72); }
.hm-cell.l4 { background: var(--mint); box-shadow: 0 0 6px rgba(76,225,166,0.4); }
.hm-cell.today { outline: 1px solid var(--mint); }
.hm-legend { display: flex; align-items: center; gap: 4px; margin-top: 10px; font-size: 0.68rem; color: var(--muted); }
.hm-legend i { width: 10px; height: 10px; border-radius: 2px; }

/* ============ area chart ============ */
.chart-box { position: relative; }
.chart-box svg { width: 100%; height: 180px; display: block; }
.area-fill { fill: rgba(76,225,166,0.14); }
.area-line { fill: none; stroke: var(--mint); stroke-width: 2; filter: drop-shadow(0 0 5px rgba(76,225,166,0.4)); }
.pills { display: flex; gap: 6px; margin-bottom: 12px; }
.pill { background: var(--surface-2); border: 1px solid var(--border); color: var(--muted);
  padding: 5px 12px; border-radius: 999px; font-size: 0.74rem; font-weight: 650; cursor: pointer;
  font-family: inherit; transition: all .15s; }
.pill:hover { color: var(--text-2); }
.pill.active { background: rgba(76,225,166,0.12); border-color: rgba(76,225,166,0.35); color: var(--mint); }

/* ============ table ============ */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); font-weight: 700; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.tbl td { padding: 10px 12px; font-size: 0.82rem; border-bottom: 1px solid var(--border);
  color: var(--text-2); font-variant-numeric: tabular-nums; vertical-align: top; }
.tbl tr:last-child td { border-bottom: none; }
.tbl td b { color: var(--text); font-weight: 600; }
.tbl .up { color: var(--up); }
.tbl .down { color: var(--down); }
.tbl .mut { color: var(--muted); }
.role-chip { font-size: 0.66rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.03em; }
.role-chip.user { color: var(--mint); background: rgba(76,225,166,0.12); }
.role-chip.assistant { color: var(--cyan); background: rgba(94,234,212,0.12); }
.role-chip.tool { color: var(--red); background: rgba(255,92,92,0.12); }

/* ============ agents / grids ============ */
.grid3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.agent { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 18px;
  transition: transform .2s, border-color .2s; }
.agent:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.agent .row { display: flex; align-items: center; gap: 12px; }
.agent .avatar { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-weight: 800; font-size: 1rem; color: #052018; flex-shrink: 0; }
.agent .name { font-weight: 700; font-size: 0.98rem; }
.agent .role { color: var(--muted); font-size: 0.78rem; margin-top: 2px; line-height: 1.35; }
.agent .meta { display: flex; align-items: center; gap: 8px; margin-top: 13px; flex-wrap: wrap; }
.badge { font-size: 0.68rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.badge.model { color: var(--cyan); background: rgba(94,234,212,0.10); border: 1px solid rgba(94,234,212,0.22); }
.badge.online { color: var(--mint); background: rgba(76,225,166,0.10); border: 1px solid rgba(76,225,166,0.25); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.online { background: var(--mint); box-shadow: 0 0 8px rgba(76,225,166,0.7); animation: pulse 2s infinite; }
.dot.active { background: var(--mint); }
.dot.inactive, .dot.failed { background: var(--red); }
.dot.activating, .dot.deactivating { background: var(--amber); }
.dot.unknown { background: var(--muted); }
@keyframes pulse { 0%,100%{box-shadow:0 0 6px rgba(76,225,166,0.4)} 50%{box-shadow:0 0 14px rgba(76,225,166,0.9)} }

/* services */
.svc { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.svc:last-child { border-bottom: none; }
.svc-name { font-weight: 600; font-size: 0.9rem; }
.svc-unit { font-family: var(--mono); font-size: 0.7rem; color: var(--muted); }
.svc-state { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 0.74rem;
  color: var(--text-2); text-transform: capitalize; }

/* feed */
.feed-item { display: flex; gap: 13px; padding: 11px 2px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.feed-item:last-child { border-bottom: none; }
.feed-ico { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: grid; place-items: center; font-size: 0.85rem; }
.feed-ico.user { background: rgba(76,225,166,0.12); color: var(--mint); }
.feed-ico.assistant { background: rgba(94,234,212,0.12); color: var(--cyan); }
.feed-ico.tool { background: rgba(255,92,92,0.12); color: var(--red); }
.feed-text { font-size: 0.84rem; color: var(--text-2); margin-top: 3px; line-height: 1.45; }
.feed-top { font-size: 0.7rem; color: var(--muted); }
.feed-session { font-family: var(--mono); font-size: 0.66rem; color: var(--muted); }

/* sessions */
.sess-item { padding: 11px 14px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; margin-bottom: 8px; }
.sess-title { font-weight: 600; font-size: 0.88rem; }
.sess-meta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 0.7rem; color: var(--muted); font-family: var(--mono); }
.sess-meta b { color: var(--text-2); font-weight: 600; }

/* crypto deck */
.deck { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.coin { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 16px 18px; }
.coin .head { display: flex; align-items: center; justify-content: space-between; }
.coin .sym { font-weight: 750; font-size: 0.92rem; }
.coin .chg { font-family: var(--mono); font-weight: 700; font-size: 0.8rem; padding: 3px 9px; border-radius: 999px; }
.coin .chg.up { color: var(--up); background: rgba(76,225,166,0.10); }
.coin .chg.down { color: var(--down); background: rgba(255,92,92,0.10); }
.coin .px { font-size: 1.6rem; font-weight: 800; margin-top: 8px; font-variant-numeric: tabular-nums; }
.coin .sparkwrap { margin: 10px 0 6px; height: 40px; }
.coin .hl { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--muted); font-family: var(--mono); }
.coin .hl b { color: var(--text-2); }
.spark-line { stroke: var(--mint); stroke-width: 1.6; filter: drop-shadow(0 0 4px rgba(76,225,166,0.35)); }
.spark-area { opacity: 0.9; }

/* status pills / empty */
.status-pill { font-size: 0.68rem; font-weight: 700; padding: 3px 10px; border-radius: 999px; text-transform: capitalize; }
.status-pill.completed, .status-pill.success, .status-pill.done, .status-pill.active { color: var(--mint); background: rgba(76,225,166,0.10); }
.status-pill.running { color: var(--cyan); background: rgba(94,234,212,0.10); }
.status-pill.failed, .status-pill.error { color: var(--red); background: rgba(255,92,92,0.12); }
.status-pill.queued, .status-pill.pending { color: var(--amber); background: rgba(240,180,0,0.10); }
.empty { text-align: center; padding: 36px 18px; color: var(--muted); }
.empty .big { font-size: 2rem; margin-bottom: 8px; }
.empty p { margin: 0 0 4px; color: var(--text-2); font-size: 0.92rem; }

/* memory */
.mem { padding: 14px 16px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; }
.mem .m-name { font-weight: 700; font-size: 0.9rem; }
.mem .m-src { font-size: 0.7rem; color: var(--muted); margin-top: 2px; }
.mem pre { font-family: var(--mono); font-size: 0.7rem; color: var(--text-2); white-space: pre-wrap; word-break: break-word;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px; margin: 10px 0 0;
  max-height: 110px; overflow: hidden; }

.section-title { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted);
  margin: 26px 0 12px; font-weight: 700; }
.foot { text-align: center; color: var(--muted); font-size: 0.72rem; margin-top: 46px; padding-bottom: 54px; }
.foot .live { display: inline-flex; align-items: center; gap: 6px; }
.foot .live .dot { width: 6px; height: 6px; }

/* auth */
.auth-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.auth-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border);
  border-radius: 20px; padding: 34px 30px; backdrop-filter: blur(18px); }
.auth-logo { width: 46px; height: 46px; border-radius: 13px; background: var(--grad); display: grid;
  place-items: center; color: var(--mint-soft); font-weight: 800; font-size: 1.3rem; margin-bottom: 18px;
  border: 1px solid rgba(76,225,166,0.3); box-shadow: 0 0 26px rgba(76,225,166,0.2); }
.auth-card h1 { font-size: 1.35rem; margin: 0 0 4px; font-weight: 800; letter-spacing: -0.01em; }
.auth-card .sub { color: var(--muted); font-size: 0.85rem; margin: 0 0 24px; }
.auth-card label { display: block; font-size: 0.74rem; color: var(--muted); margin: 16px 0 7px; font-weight: 600; }
.auth-card input[type="text"], .auth-card input[type="password"] { width: 100%; padding: 12px 14px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: 11px; color: var(--text);
  font-size: 0.95rem; font-family: inherit; outline: none; transition: border-color .16s; }
.auth-card input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(0,187,127,0.12); }
.auth-card .btn { width: 100%; margin-top: 24px; padding: 13px; border: none; border-radius: 11px;
  background: linear-gradient(120deg, var(--green), var(--mint)); color: #04150e; font-weight: 750;
  font-size: 0.95rem; font-family: inherit; cursor: pointer; transition: filter .16s; }
.auth-card .btn:hover { filter: brightness(1.08); }
.auth-card .totp-input { letter-spacing: 0.5em; font-family: var(--mono); text-align: center; font-size: 1.3rem !important; }
.auth-card .err { background: rgba(255,92,92,0.10); border: 1px solid rgba(255,92,92,0.3); color: var(--red);
  font-size: 0.8rem; padding: 11px 13px; border-radius: 11px; margin-top: 18px; }

@media (max-width: 720px) {
  .nav { order: 2; width: 100%; height: 44px; }
  .topbar { flex-wrap: wrap; height: auto; padding: 6px 12px; }
  .topbar-right { margin-left: auto; }
}
