/* ============================================================================
   FF Go Service — Observability Dashboard
   shadcn-style design system · light theme · neutral zinc
   Hand-authored, no build step. Served from the Go embed at /static/app.css.
   ========================================================================== */

/* ---- Design tokens (shadcn "zinc", light) -------------------------------- */
:root {
  --background: 0 0% 100%;
  --foreground: 240 10% 3.9%;

  --card: 0 0% 100%;
  --card-foreground: 240 10% 3.9%;

  --primary: 240 5.9% 10%;
  --primary-foreground: 0 0% 98%;

  --secondary: 240 4.8% 95.9%;
  --secondary-foreground: 240 5.9% 10%;

  --muted: 240 4.8% 95.9%;
  --muted-foreground: 240 3.8% 46.1%;

  --accent: 240 4.8% 95.9%;
  --accent-foreground: 240 5.9% 10%;

  --destructive: 0 72% 51%;
  --destructive-foreground: 0 0% 98%;

  --success: 142 71% 45%;
  --success-ink: 142 64% 28%;
  --warning: 38 92% 50%;
  --warning-ink: 30 80% 36%;

  --border: 240 5.9% 90%;
  --input: 240 5.9% 90%;
  --ring: 240 5.9% 10%;

  --radius: 0.5rem;

  --sidebar-width: 252px;
  --topbar-height: 56px;
  --content-max: 1160px;

  --font-sans: "Geist Variable", "Geist", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", sans-serif;
  --font-mono: "Geist Mono Variable", "Geist Mono", ui-monospace, "SF Mono",
    "JetBrains Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --shadow-sm: 0 1px 2px 0 hsl(240 6% 10% / 0.04);
  --shadow: 0 1px 3px 0 hsl(240 6% 10% / 0.07), 0 1px 2px -1px hsl(240 6% 10% / 0.05);
  --shadow-md: 0 8px 24px -6px hsl(240 6% 10% / 0.12), 0 2px 6px -2px hsl(240 6% 10% / 0.06);
}

/* ---- Reset --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: hsl(var(--foreground));
  background-color: hsl(var(--background));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
table { border-collapse: collapse; width: 100%; }
:focus-visible { outline: none; }
::selection { background: hsl(var(--foreground) / 0.12); }
h1, h2, h3, h4 { font-weight: 600; letter-spacing: -0.015em; }

/* ---- App shell ----------------------------------------------------------- */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: hsl(var(--background));
  border-right: 1px solid hsl(var(--border));
  z-index: 40;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  height: var(--topbar-height);
  padding: 0 1.25rem;
  border-bottom: 1px solid hsl(var(--border));
  flex-shrink: 0;
}
.sidebar__logo {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: hsl(var(--primary));
  color: hsl(var(--primary-foreground));
  font-weight: 700;
  font-size: 12px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.sidebar__name { font-weight: 600; font-size: 14px; letter-spacing: -0.01em; line-height: 1.15; }
.sidebar__name small { display: block; font-weight: 400; font-size: 11px; color: hsl(var(--muted-foreground)); letter-spacing: 0; }

.nav { display: flex; flex-direction: column; gap: 2px; padding: 0.75rem; flex: 1; overflow-y: auto; }
.nav__section {
  padding: 0.75rem 0.5rem 0.375rem;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: hsl(var(--muted-foreground));
}
.nav__link {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.5rem 0.625rem;
  border-radius: calc(var(--radius) - 2px);
  color: hsl(var(--muted-foreground));
  font-size: 13.5px;
  font-weight: 500;
  transition: background-color 0.15s ease, color 0.15s ease;
}
.nav__link:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.nav__link--active { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); font-weight: 600; }
.nav__link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.nav__link--active svg { opacity: 1; }

.sidebar__foot { padding: 0.75rem; border-top: 1px solid hsl(var(--border)); flex-shrink: 0; }
.sidebar__user { display: flex; align-items: center; gap: 0.625rem; padding: 0.25rem 0.5rem 0.625rem; }
.sidebar__avatar {
  display: grid; place-items: center;
  width: 28px; height: 28px; border-radius: 9999px;
  background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground));
  font-size: 11px; font-weight: 600; flex-shrink: 0;
}
.sidebar__user small { display: block; color: hsl(var(--muted-foreground)); font-size: 11px; }

/* main column */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid hsl(var(--border));
  background: hsl(var(--background) / 0.7);
  backdrop-filter: saturate(180%) blur(8px);
  -webkit-backdrop-filter: saturate(180%) blur(8px);
  z-index: 30;
}
.topbar__title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.topbar__spacer { flex: 1; }
.topbar__menu { display: none; }
.status-dot {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 12px; color: hsl(var(--muted-foreground));
}
.status-dot::before {
  content: ""; width: 7px; height: 7px; border-radius: 9999px;
  background: hsl(var(--success)); box-shadow: 0 0 0 3px hsl(var(--success) / 0.16);
}

.container { width: 100%; max-width: var(--content-max); padding: 1.5rem; margin: 0 auto; }
@media (prefers-reduced-motion: no-preference) {
  .container > * { animation: rise 0.34s cubic-bezier(0.16, 1, 0.3, 1) both; }
  .container > *:nth-child(2) { animation-delay: 0.04s; }
  .container > *:nth-child(3) { animation-delay: 0.08s; }
  .container > *:nth-child(4) { animation-delay: 0.12s; }
  @keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

.scrim { display: none; }

/* ---- Page intro / toolbar ------------------------------------------------ */
.page-intro { color: hsl(var(--muted-foreground)); font-size: 13px; margin-bottom: 1.25rem; }
.toolbar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1.25rem; }
.toolbar .input, .toolbar .select { height: 36px; }
.section-gap { margin-top: 1.25rem; }

/* ---- Card ---------------------------------------------------------------- */
.card {
  background: hsl(var(--card));
  color: hsl(var(--card-foreground));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card--table { overflow: hidden; }
.card__header { padding: 1.125rem 1.25rem; border-bottom: 1px solid hsl(var(--border)); }
.card__header--flush { border-bottom: 0; padding-bottom: 0.5rem; }
.card__title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 0.5rem; }
.card__desc { font-size: 12.5px; color: hsl(var(--muted-foreground)); margin-top: 0.2rem; }
.card__content { padding: 1.25rem; }

/* ---- Stat (KPI) cards ---------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.stat {
  background: hsl(var(--card));
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1.125rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.stat__label {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12.5px; font-weight: 500; color: hsl(var(--muted-foreground));
}
.stat__label svg { width: 16px; height: 16px; opacity: 0.7; }
.stat__value {
  margin-top: 0.5rem;
  font-size: 28px; font-weight: 650; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.stat__hint { margin-top: 0.25rem; font-size: 12px; color: hsl(var(--muted-foreground)); }
.stat__hint strong { color: hsl(var(--foreground)); font-weight: 600; }

/* ---- Table --------------------------------------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; font-size: 13px; }
.table thead th {
  height: 40px;
  padding: 0 1rem;
  text-align: left;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  color: hsl(var(--muted-foreground));
  background: hsl(var(--muted) / 0.4);
  border-bottom: 1px solid hsl(var(--border));
}
.table tbody td {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid hsl(var(--border));
  vertical-align: middle;
}
.table tbody tr { transition: background-color 0.12s ease; }
.table tbody tr:hover { background: hsl(var(--muted) / 0.45); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--font-mono); font-size: 12.5px; }
.table th.num { text-align: right; }

/* ---- Pagination ---------------------------------------------------------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border-top: 1px solid hsl(var(--border));
  background: hsl(var(--background));
}
.pagination__summary {
  color: hsl(var(--muted-foreground));
  font-size: 12.5px;
}
.pagination__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.pagination__page {
  color: hsl(var(--muted-foreground));
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pagination__disabled {
  cursor: default;
  opacity: 0.48;
  pointer-events: none;
}
.cell-strong { font-weight: 500; }

/* ---- Badge --------------------------------------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge--secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.badge--outline { background: transparent; border-color: hsl(var(--border)); color: hsl(var(--foreground)); }
.badge--muted { background: hsl(var(--muted)); color: hsl(var(--muted-foreground)); }
.badge--secondary::before, .badge--outline::before, .badge--muted::before { display: none; }
.badge--success { background: hsl(var(--success) / 0.12); color: hsl(var(--success-ink)); }
.badge--destructive { background: hsl(var(--destructive) / 0.1); color: hsl(var(--destructive)); }
.badge--warning, .badge--running { background: hsl(var(--warning) / 0.16); color: hsl(var(--warning-ink)); }
.badge--running::before { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

/* ---- Button -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  height: 36px;
  padding: 0 0.875rem;
  border: 1px solid transparent;
  border-radius: calc(var(--radius) - 2px);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, transform 0.04s ease;
}
.btn:focus-visible { box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--ring) / 0.55); }
.btn:active { transform: translateY(0.5px); }
.btn:disabled { opacity: 0.5; pointer-events: none; }
.btn svg { width: 15px; height: 15px; }
.btn--default { background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); }
.btn--default:hover { background: hsl(var(--primary) / 0.9); }
.btn--secondary { background: hsl(var(--secondary)); color: hsl(var(--secondary-foreground)); }
.btn--secondary:hover { background: hsl(var(--secondary) / 0.7); }
.btn--outline { background: hsl(var(--background)); border-color: hsl(var(--border)); }
.btn--outline:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn--ghost { background: transparent; }
.btn--ghost:hover { background: hsl(var(--accent)); color: hsl(var(--accent-foreground)); }
.btn--destructive { background: hsl(var(--destructive)); color: hsl(var(--destructive-foreground)); }
.btn--destructive:hover { background: hsl(var(--destructive) / 0.9); }
.btn--sm { height: 32px; padding: 0 0.625rem; font-size: 12.5px; gap: 0.3rem; }
.btn--icon { width: 36px; padding: 0; }
.btn--icon.btn--sm { width: 32px; }
.btn--block { width: 100%; }

/* ---- Form controls ------------------------------------------------------- */
.input, .select {
  display: block;
  width: 100%;
  height: 36px;
  padding: 0 0.75rem;
  font-size: 13px;
  color: hsl(var(--foreground));
  background: hsl(var(--background));
  border: 1px solid hsl(var(--input));
  border-radius: calc(var(--radius) - 2px);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.select { appearance: none; -webkit-appearance: none; padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.6rem center;
}
.input::placeholder { color: hsl(var(--muted-foreground)); }
.input:focus, .select:focus {
  outline: none;
  border-color: hsl(var(--ring));
  box-shadow: 0 0 0 3px hsl(var(--ring) / 0.12);
}
.input--mono { font-family: var(--font-mono); font-size: 12.5px; }
.input--sm, .select--sm { height: 32px; font-size: 12.5px; }
.label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 0.4rem; }
.field + .field { margin-top: 0.875rem; }
.form-inline { display: flex; align-items: center; gap: 0.4rem; margin: 0; }

/* ---- Alert --------------------------------------------------------------- */
.alert {
  display: flex; gap: 0.625rem; align-items: flex-start;
  padding: 0.75rem 1rem;
  font-size: 13px;
  border: 1px solid; border-radius: var(--radius);
}
.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }
.alert--destructive { background: hsl(var(--destructive) / 0.07); border-color: hsl(var(--destructive) / 0.3); color: hsl(var(--destructive)); }

/* ---- Definition list (detail) ------------------------------------------- */
.detail__row {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 1rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid hsl(var(--border));
  font-size: 13px;
  align-items: baseline;
}
.detail__row:last-child { border-bottom: 0; }
.detail__key { color: hsl(var(--muted-foreground)); font-weight: 500; }
.detail__val { min-width: 0; word-break: break-word; }

/* ---- Code / pre ---------------------------------------------------------- */
code, .code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  background: hsl(var(--muted));
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.pre {
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: hsl(var(--foreground));
  background: hsl(var(--muted) / 0.55);
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

/* ---- Empty state --------------------------------------------------------- */
.empty { padding: 2.5rem 1rem; text-align: center; color: hsl(var(--muted-foreground)); font-size: 13px; }

/* ---- Auth (login) -------------------------------------------------------- */
.auth {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(70% 55% at 50% -8%, hsl(240 5% 96%), transparent 70%),
    hsl(var(--background));
}
.auth__card { width: 100%; max-width: 380px; }
.auth__brand { display: flex; flex-direction: column; align-items: center; gap: 0.875rem; margin-bottom: 1.5rem; }
.auth__brand .sidebar__logo { width: 42px; height: 42px; border-radius: 11px; font-size: 16px; }
.auth__title { font-weight: 600; font-size: 17px; letter-spacing: -0.01em; }
.auth__sub { color: hsl(var(--muted-foreground)); font-size: 13px; margin-top: 2px; text-align: center; }
.auth__foot { text-align: center; font-size: 12px; color: hsl(var(--muted-foreground)); margin-top: 1.25rem; }

/* ---- Utilities ----------------------------------------------------------- */
.muted { color: hsl(var(--muted-foreground)); }
.mono { font-family: var(--font-mono); }
.text-xs { font-size: 12px; }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.truncate { display: inline-block; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---- Responsive: off-canvas sidebar ------------------------------------- */
@media (max-width: 1024px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-width);
    transform: translateX(-100%);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-md);
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .topbar__menu { display: inline-flex; }
  .scrim {
    display: block;
    position: fixed; inset: 0;
    background: hsl(240 10% 3.9% / 0.45);
    opacity: 0; pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 35;
  }
  .app.nav-open .scrim { opacity: 1; pointer-events: auto; }
}
@media (max-width: 560px) {
  .container { padding: 1rem; }
  .topbar { padding: 0 1rem; }
}
