/* Vera Backend — buddy-era theme (eyes tile, fun and serious).
   Tokens: Bricolage Grotesque display, Inter UI, JetBrains Mono data.
   Signature Vera purple #5B71E4, buddy teal #279F95.
   Voice: claim first, sentence case, second person, short, specific,
   number-forward, no em dashes, no banned words. */
:root {
  --vera-purple: #5B71E4; --vera-purple-dark: #4459C8; --vera-purple-light: #9D9DED;
  --vera-teal: #279F95; --vera-teal-dark: #1E7F77; --vera-teal-light: #A8F5EE;
  --vera-green: #22B950; --vera-amber: #F59E0B; --vera-red: #DC2626;
  --bg: #F5F8FA;
  --panel: #FFFFFF;
  --text: #33475B;
  --text-2: #5C6B7A;
  --text-3: #8A9BA8;
  --line: #EAF0F6;
  --line-soft: #F0F4F8;
  --shadow: 0 1px 4px rgba(51,71,91,.08);
  --font-display: 'Bricolage Grotesque','Plus Jakarta Sans',system-ui,sans-serif;
  --font-ui: 'Inter',system-ui,-apple-system,'Segoe UI',sans-serif;
  --font-mono: 'JetBrains Mono',ui-monospace,Menlo,monospace;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-ui); background: var(--bg); color: var(--text);
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
.mono, code, td.num, .metric .delta { font-family: var(--font-mono); }
.wrap { max-width: 1220px; margin: 0 auto; padding: 0 24px 80px; }

/* Header */
header.top { display: flex; align-items: center; gap: 16px; padding: 28px 0 4px; }
.tile {
  width: 48px; height: 48px; border-radius: 14px; flex: none;
  background: linear-gradient(135deg, var(--vera-purple) 50%, var(--vera-teal) 50%);
  border: 1px solid var(--line); position: relative;
  box-shadow: var(--shadow);
}
.tile .eyes { position: absolute; inset: 0; }
.tile .eyes span { position: absolute; top: 14px; width: 9px; height: 13px; background: #fff; border-radius: 5px; }
.tile .eyes span:first-child { left: 12px; } .tile .eyes span:last-child { right: 12px; }
.tile .eyes span::after { content: ""; position: absolute; left: 2px; top: 4px; width: 5px; height: 7px; background: #14151A; border-radius: 3px; }
header.top h1 { font-family: var(--font-display); font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
header.top h1 span { color: var(--text-3); font-weight: 500; }
header.top .sub { font-size: 12.5px; color: var(--text-3); }
.stamp { margin-left: auto; text-align: right; font-size: 12px; color: var(--text-3); flex: none; }
.stamp .mono { color: var(--text-2); }

/* Admin sections nav */
nav.tabs {
  position: sticky; top: 0; z-index: 10;
  display: flex; gap: 4px; align-items: center; flex-wrap: wrap;
  background: rgba(245,248,250,.94); backdrop-filter: blur(6px);
  padding: 10px 0; margin: 12px 0 4px;
  border-bottom: 1px solid var(--line);
}
nav.tabs a {
  font-size: 13px; font-weight: 600; color: var(--text-2); text-decoration: none;
  padding: 7px 13px; border-radius: 999px; border: 1px solid transparent;
}
nav.tabs a:hover { color: var(--text); background: #fff; border-color: var(--line); }
.tabs-note { margin-left: auto; font-size: 11.5px; color: var(--text-3); }

/* So-what lead */
.lede {
  margin: 16px 0 20px; padding: 15px 20px;
  background: var(--panel);
  border: 1px solid var(--line); border-left: 3px solid var(--vera-teal);
  border-radius: 0 12px 12px 0; font-size: 15px; box-shadow: var(--shadow);
}
.lede strong { color: var(--text); }

/* Exec strip: big-number stat cards */
.exec { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 20px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px 20px; box-shadow: var(--shadow); }
.metric .v { font-family: var(--font-display); font-size: 34px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.1; color: var(--text); }
.metric .v small { font-size: 15px; color: var(--text-3); font-weight: 500; font-family: var(--font-ui); }
.metric .l { font-size: 13px; color: var(--text-2); margin-top: 2px; }
.metric .delta { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.metric .delta b.ok { color: var(--vera-green); } .metric .delta b.up-bad { color: var(--vera-amber); }

/* Sections: 2-up pairs, cards radius-xl + 24px padding */
.grid-sec { display: grid; gap: 18px; margin-bottom: 18px; }
.grid-sec.cols-2 { grid-template-columns: 1fr 1fr; }
section.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 20px 22px; min-width: 0; box-shadow: var(--shadow);
  scroll-margin-top: 64px;
}
section.panel.full { margin-bottom: 18px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
section.panel h2 { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 2px 0; color: var(--text); }
.sub-h { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 16px 0 6px; }
.verdict { font-size: 14px; color: var(--text-2); margin-bottom: 14px; }
.verdict strong { color: var(--text); }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-3); padding: 9px 10px;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--panel);
}
td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; color: var(--text); }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-size: 12.5px; }
td.model { font-family: var(--font-mono); font-size: 12px; max-width: 230px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tbody tr:hover td { background: #F8FAFC; }
.tbl-note { font-size: 12px; color: var(--text-3); margin-top: 8px; }

/* Pills: dot + tinted surface. Execution-mode mapping. */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 10px 3px 8px; border: 1px solid transparent; white-space: nowrap; }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.ok { color: var(--vera-green); background: #E2F8EA; }
.pill.warn { color: var(--vera-amber); background: #FEF3DC; }
.pill.bad { color: var(--vera-red); background: #FBE5E3; }
.pill.info { color: var(--vera-purple-dark); background: var(--vera-purple-light); }
.pill.mute { color: var(--text-3); background: var(--panel); border-color: var(--line-soft); }

/* Blurb + Vera today/recently boxes */
.vera-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 12px; }
.vbox { background: #F8FAFC; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.vbox-h { font-size: 12px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--vera-teal-dark); margin-bottom: 6px; }
.vbox-b { font-size: 14px; color: var(--text); }
.vbox-b .big { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.01em; color: var(--text); }
.vbox-b .mono { font-size: 12.5px; color: var(--text-3); }

/* Theme rows */
.theme-row { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.theme-row:last-child { border-bottom: none; }
.theme-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.theme-head .t { font-weight: 600; font-size: 14.5px; }
.theme-head .c { margin-left: auto; font-family: var(--font-mono); font-size: 13px; }
.theme-sub { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.theme-sub .mono { color: var(--text); font-size: 12px; }
.bar-track { background: #EDF1F5; border-radius: 4px; height: 8px; margin-top: 7px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--vera-purple), var(--vera-teal)); display: block; }

/* Two-stat row inside activity panel */
.grid-2stat { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.grid-2stat .s2v { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--text); }
.grid-2stat .s2l { font-size: 12.5px; color: var(--text-3); }

/* Sticky table headers */
.tbl-wrap.sticky { max-height: 430px; overflow-y: auto; }
.tbl-wrap.sticky thead th { position: sticky; top: 0; background: var(--panel); z-index: 1; box-shadow: 0 1px 0 var(--line); }

/* Session log */
table.log td.state { font-size: 12.5px; color: var(--text-2); max-width: 240px; }
table.log td .t { font-weight: 500; }
table.log td .m { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); }
table.log td.date { white-space: nowrap; font-size: 12px; }

/* Charts: Inter labels, thin gridlines, no junk, no shadows on data.
   Series: Vera purple, buddy teal, green, then blue/purple/orange. */
.chart { width: 100%; height: auto; display: block; }
.chart .ax { stroke: #D4DCE4; }
.chart .grid { stroke: var(--line); }
.chart .tick { fill: var(--text-3); font-size: 9px; font-family: var(--font-mono); }
.chart .area { fill: url(#areaGrad); opacity: 0.5; }
.chart .line { fill: none; stroke: var(--vera-teal); stroke-width: 2; }
.chart .line2 { fill: none; stroke: var(--vera-purple); stroke-width: 1.5; stroke-dasharray: 4 3; }
.chart .cdot { fill: var(--vera-teal-dark); }
.chart .bar { fill: var(--vera-purple); opacity: 0.8; }
.chart .bar.hot { fill: var(--vera-teal); opacity: 0.95; }
.chart .dot { fill: var(--vera-teal); opacity: 0.8; }
.chart .dot.top { fill: var(--vera-purple); opacity: 0.95; }
.chart .dlab { fill: var(--text-2); font-size: 8.5px; font-family: var(--font-mono); }

/* Shimmer loading state */
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }
.loading {
  border-radius: 8px; min-height: 60px; color: transparent;
  background: linear-gradient(90deg, var(--panel) 25%, var(--vera-purple-light) 50%, var(--panel) 75%);
  background-size: 800px 100%; animation: shimmer 1.4s ease-out infinite;
}

.empty { color: var(--text-3); font-size: 13.5px; }
.empty code { color: var(--text); }

/* Alive signal on the tile while data moves: buddy pulse (teal glow) */
header.top .tile { transition: box-shadow .2s ease-out; }
header.top .tile.working {
  animation: tilePulse 1s ease-out infinite;
}
@keyframes tilePulse {
  0%, 100% { box-shadow: var(--shadow), 0 0 8px rgba(39,159,149,.25); }
  50% { box-shadow: var(--shadow), 0 0 22px rgba(39,159,149,.55); }
}

/* Sortable model table headers: buttons, HubSpot-style */
th.sortable { padding: 0; }
th.sortable button {
  all: unset; display: block; width: 100%; box-sizing: border-box;
  font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit;
  padding: 9px 10px; cursor: pointer; text-align: left; border-radius: 6px;
}
th.sortable.num button { text-align: right; }
th.sortable button:hover { color: var(--text); background: var(--panel); }
th.sortable button:focus-visible { outline: none; box-shadow: 0 0 0 2px #1C6FEE; }
th.sortable .arrow { color: var(--vera-purple); font-size: 10px; }

/* Refresh status line under the button */
.refresh-note { font-size: 12px; color: var(--text-3); margin-top: 8px; min-height: 18px; }
.refresh-note .ok { color: var(--vera-green); font-weight: 600; }
.refresh-note .bad { color: var(--vera-red); font-weight: 600; }

/* Job cards */
.job { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.job:last-child { border-bottom: none; }
.job .jh { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.job .jh .n { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.job .jd { font-size: 12.5px; color: var(--text-3); margin-top: 3px; }

/* Integrations kv + grown panel columns */
.kv { display: flex; gap: 8px; align-items: baseline; padding: 5px 0; font-size: 13px; border-bottom: 1px solid var(--line-soft); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-3); flex: none; min-width: 110px; }
.kv .v { font-family: var(--font-mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
section.panel.grow { grid-column: 1 / -1; }
.integ-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
@media (max-width: 980px) { .integ-cols { grid-template-columns: 1fr; } }

footer img.mark-sm, footer .tile-sm { width: 20px; height: 20px; border-radius: 5px; flex: none; }
footer .tile-sm {
  background: linear-gradient(135deg, var(--vera-purple) 50%, var(--vera-teal) 50%);
  position: relative;
}
footer {
  margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  font-size: 12.5px; color: var(--text-3);
}
button#refresh-btn {
  margin-left: auto; background: var(--vera-purple); color: #fff;
  border: 1px solid var(--vera-purple-dark); border-radius: 8px;
  font: 600 13px var(--font-ui); padding: 9px 18px; cursor: pointer;
}
button#refresh-btn:hover { background: var(--vera-purple-dark); }
button#refresh-btn:disabled { opacity: 0.55; cursor: default; }
button#refresh-btn:focus-visible { outline: none; box-shadow: 0 0 0 2px #1C6FEE; }

@media (max-width: 980px) { .grid-sec.cols-2 { grid-template-columns: 1fr; } .exec { grid-template-columns: 1fr 1fr; } .vera-boxes { grid-template-columns: 1fr; } }
@media (max-width: 560px) {
  .exec { grid-template-columns: 1fr; }
  .wrap { padding: 0 14px 60px; }
  td.model { max-width: 140px; }
  header.top h1 { font-size: 20px; }
  .tabs-note { display: none; }
}
