/* ==========================================================================
   Antix Portal — Global Stylesheet
   Extracted from redesign.html + additional styles for keys, team, usage pages
   ========================================================================== */

/* ==========================================================================
   RESET & BOX MODEL
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ==========================================================================
   DESIGN TOKENS (CSS Custom Properties)
   ========================================================================== */
:root {
  --dashboard-bg: #0c0d12;
  --dashboard-fg: #e4e4e7;
  --dashboard-sidebar: #0f1017;
  --dashboard-border: #1e1f2a;
  --dashboard-muted: #6b6b80;
  --dashboard-secondary: #9b9bb0;
  --dashboard-accent: #6366f1;
  --dashboard-card: #141520;
  --dashboard-hover: #1a1b28;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Extended tokens for tables, forms, modals */
  --dashboard-danger: #ef4444;
  --dashboard-danger-hover: #dc2626;
  --dashboard-success: #22c55e;
  --dashboard-warning: #f59e0b;
  --dashboard-input-bg: #0f1017;
  --dashboard-input-focus: rgba(99, 102, 241, 0.35);
  --dashboard-overlay: rgba(0, 0, 0, 0.6);
}

/* ==========================================================================
   BASE / BODY
   ========================================================================== */
body {
  font-family: var(--font-sans);
  background: var(--dashboard-bg);
  color: var(--dashboard-fg);
  min-height: 100vh;
  display: flex;
}

/* ==========================================================================
   SIDEBAR
   ========================================================================== */
.sidebar {
  width: 220px;
  min-height: 100vh;
  background: var(--dashboard-sidebar);
  border-right: 1px solid var(--dashboard-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
}

.sidebar-header {
  padding: 20px 16px 16px;
  border-bottom: 1px solid var(--dashboard-border);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.sidebar-logo img { width: 20px; height: 20px; }

.sidebar-logo span {
  font-size: 14px;
  font-weight: 600;
  color: var(--dashboard-fg);
}

.sidebar-email {
  font-size: 11px;
  color: var(--dashboard-muted);
  font-family: var(--font-mono);
  padding-left: 28px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---- Sidebar Navigation ---- */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 8px;
}

.nav-group { margin-bottom: 24px; }

.nav-group-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--dashboard-muted);
  padding: 0 12px;
  margin-bottom: 4px;
}

.nav-group-line {
  width: 32px;
  height: 1px;
  background: var(--dashboard-border);
  margin-left: 12px;
  margin-bottom: 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--dashboard-muted);
  background: none;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
  position: relative;
}

.nav-item:hover { background: var(--dashboard-hover); color: var(--dashboard-fg); }

.nav-item.active {
  background: rgba(99, 102, 241, 0.15);
  color: var(--dashboard-accent);
  font-weight: 500;
}

.nav-item.disabled { cursor: not-allowed; opacity: 0.6; }
.nav-item.disabled:hover { background: none; color: var(--dashboard-muted); }

.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; }

.nav-item .soon-badge {
  margin-left: auto;
  font-size: 9px;
  font-weight: 500;
  color: var(--dashboard-accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ---- Sidebar Footer ---- */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--dashboard-border);
}

.signout-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--dashboard-secondary);
  background: none;
  border: 1px solid var(--dashboard-border);
  cursor: pointer;
  transition: all 0.15s;
}

.signout-btn:hover { background: var(--dashboard-hover); color: var(--dashboard-fg); }
.signout-btn svg { width: 16px; height: 16px; }

/* ==========================================================================
   MAIN LAYOUT
   ========================================================================== */
.main {
  flex: 1;
  margin-left: 220px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 56px;
  border-bottom: 1px solid var(--dashboard-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.topbar-title { font-size: 18px; font-weight: 600; }

.topbar-right { display: flex; align-items: center; gap: 12px; }

/* ==========================================================================
   BADGE & UTILITY
   ========================================================================== */
.badge-public, .badge-standard, .badge-admin {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 4px;
  padding: 2px 8px;
}
.badge-public {
  color: var(--dashboard-muted);
  background: var(--dashboard-hover);
  border: 1px solid var(--dashboard-border);
}
.badge-standard {
  color: #86efac;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
}
.badge-admin {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.docs-link {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--dashboard-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.docs-link:hover { color: var(--dashboard-fg); }
.docs-link svg { width: 14px; height: 14px; }

/* ==========================================================================
   CONTENT AREA
   ========================================================================== */
.content { flex: 1; padding: 32px; }
.content-inner { max-width: 896px; }

/* ---- Welcome Section ---- */
.welcome-section { margin-bottom: 20px; }
.welcome-title { font-size: 16px; font-weight: 600; color: var(--dashboard-fg); }
.welcome-sub { font-size: 14px; color: var(--dashboard-muted); margin-top: 2px; }

/* ==========================================================================
   CTA BUTTONS
   ========================================================================== */
.cta-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }

.btn-primary {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 500; font-family: var(--font-sans);
  background: var(--dashboard-accent); color: #fff;
  border: none; cursor: pointer; transition: all 0.15s; text-decoration: none;
}

.btn-primary:hover { background: rgba(99, 102, 241, 0.85); }
.btn-primary svg { width: 16px; height: 16px; }

.btn-outline {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 500; font-family: var(--font-sans);
  background: none; color: var(--dashboard-secondary);
  border: 1px solid var(--dashboard-border);
  cursor: pointer; transition: all 0.15s; text-decoration: none;
}

.btn-outline:hover { background: var(--dashboard-hover); color: var(--dashboard-fg); }
.btn-outline svg { width: 16px; height: 16px; }

.btn-danger {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 14px; font-weight: 500; font-family: var(--font-sans);
  background: var(--dashboard-danger); color: #fff;
  border: none; cursor: pointer; transition: all 0.15s; text-decoration: none;
}

.btn-danger:hover { background: var(--dashboard-danger-hover); }

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* Inline-flex variants for buttons used inside tables / form-rows where the
 * button must sit alongside text rather than break onto its own line.
 * `.btn-primary` etc. use `display: flex` (block-level), which is right for
 * card footers but produces the "weird" full-width look in row contexts. */
.btn-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  font-size: 14px; font-weight: 500; font-family: var(--font-sans);
  background: var(--dashboard-card); color: var(--dashboard-fg);
  border: 1px solid var(--dashboard-border);
  cursor: pointer; transition: all 0.15s; text-decoration: none;
  white-space: nowrap;
}
.btn-secondary:hover { background: var(--dashboard-hover); }
.btn-secondary svg { width: 16px; height: 16px; }

.table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-danger-outline {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  font-size: 14px; font-weight: 500; font-family: var(--font-sans);
  background: none; color: var(--dashboard-danger);
  border: 1px solid var(--dashboard-danger);
  cursor: pointer; transition: all 0.15s; text-decoration: none;
  white-space: nowrap;
}
.btn-danger-outline:hover {
  background: var(--dashboard-danger);
  color: #fff;
}

/* ==========================================================================
   INSTALL CARD
   ========================================================================== */
.install-card {
  background: var(--dashboard-card);
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 12px;
}

.install-header { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.install-header svg { width: 16px; height: 16px; color: var(--dashboard-accent); }
.install-header span { font-size: 14px; font-weight: 600; }

.install-command {
  display: flex; align-items: center; gap: 8px;
  background: var(--dashboard-bg);
  border: 1px solid var(--dashboard-border);
  border-radius: 8px;
  padding: 12px 16px;
}

.install-command code {
  flex: 1; font-size: 14px; font-family: var(--font-mono); color: var(--dashboard-fg);
}

.copy-btn {
  flex-shrink: 0; padding: 6px; border-radius: 4px;
  background: none; border: none; color: var(--dashboard-muted);
  cursor: pointer; transition: all 0.15s;
}

.copy-btn:hover { color: var(--dashboard-fg); background: var(--dashboard-hover); }
.copy-btn svg { width: 16px; height: 16px; }

.install-hint { font-size: 12px; color: var(--dashboard-muted); margin-top: 8px; }
.install-hint code { font-family: var(--font-mono); color: var(--dashboard-secondary); }

/* ==========================================================================
   FEATURE CARDS GRID
   ========================================================================== */
.cards-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

.feature-card {
  background: var(--dashboard-card);
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s;
  text-decoration: none;
  display: block;
}

.feature-card:hover { border-color: rgba(99, 102, 241, 0.4); }

.feature-card.disabled { opacity: 0.6; cursor: default; }
.feature-card.disabled:hover { border-color: var(--dashboard-border); }

.feature-card-icon { width: 20px; height: 20px; margin-bottom: 10px; color: var(--dashboard-accent); }
.feature-card.disabled .feature-card-icon { color: var(--dashboard-muted); }

.feature-card-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.feature-card-top svg:last-child { width: 12px; height: 12px; color: var(--dashboard-muted); transition: color 0.15s; }
.feature-card:hover .feature-card-top svg:last-child { color: var(--dashboard-secondary); }

.feature-card h4 { font-size: 14px; font-weight: 600; color: var(--dashboard-fg); margin-bottom: 4px; }
.feature-card p { font-size: 12px; color: var(--dashboard-muted); line-height: 1.6; }

/* ==========================================================================
   ANTE AGENT PAGE
   ========================================================================== */
.ante-card {
  background: var(--dashboard-card);
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
  padding: 20px 32px;
}

.ante-card h2 { font-size: 18px; font-weight: 600; color: var(--dashboard-fg); margin-bottom: 24px; }

.ante-section { margin-bottom: 32px; }
.ante-section:last-child { margin-bottom: 0; }
.ante-section h3 { font-size: 16px; font-weight: 600; color: var(--dashboard-accent); margin-bottom: 12px; }
.ante-section p { font-size: 14px; color: var(--dashboard-secondary); margin-bottom: 12px; }

.ante-section .cmd-block {
  background: var(--dashboard-bg);
  border: 1px solid var(--dashboard-border);
  border-radius: 8px;
  padding: 12px 16px;
}

.ante-section .cmd-block code { font-size: 14px; font-family: var(--font-mono); color: var(--dashboard-fg); }

.ante-cmd-list { display: flex; flex-direction: column; gap: 12px; }

.ante-cmd-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; }
.ante-cmd-row span { color: var(--dashboard-secondary); }

.ante-cmd-row code,
.ante-cmd-row-code {
  background: var(--dashboard-bg);
  border: 1px solid var(--dashboard-border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 14px;
  font-family: var(--font-mono);
  color: var(--dashboard-fg);
}

/* ==========================================================================
   LOGIN PAGE
   ========================================================================== */
.login-wrapper {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; width: 100%; background: var(--dashboard-bg);
}

.login-card {
  background: var(--dashboard-card);
  border: 1px solid var(--dashboard-border);
  border-radius: 16px;
  padding: 40px;
  width: 100%; max-width: 400px;
  text-align: center;
}

.login-logo { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 8px; }
.login-logo img { width: 32px; height: 32px; }
.login-logo span { font-size: 20px; font-weight: 700; }

.login-sub { font-size: 14px; color: var(--dashboard-muted); margin-bottom: 32px; }

.oauth-btn {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 12px; border-radius: 8px;
  font-size: 14px; font-weight: 500; font-family: var(--font-sans);
  background: var(--dashboard-hover);
  border: 1px solid var(--dashboard-border);
  color: var(--dashboard-fg);
  cursor: pointer; transition: all 0.15s; margin-bottom: 12px;
}

.oauth-btn:hover { background: var(--dashboard-border); }
.oauth-btn svg { width: 18px; height: 18px; }

/* ==========================================================================
   GENERIC CARD (reusable — matches .ante-card visual language)
   ========================================================================== */
.card {
  background: var(--dashboard-card);
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
  padding: 20px 32px;
}

.card h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--dashboard-fg);
  margin-bottom: 24px;
}

.card h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--dashboard-accent);
  margin-bottom: 12px;
}

.card p {
  font-size: 14px;
  color: var(--dashboard-secondary);
  margin-bottom: 12px;
}

.card + .card {
  margin-top: 16px;
}

/* ==========================================================================
   TABLE STYLES (keys, team, usage pages)
   ========================================================================== */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead {
  background: var(--dashboard-sidebar);
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dashboard-muted);
  border-bottom: 1px solid var(--dashboard-border);
  white-space: nowrap;
}

tbody tr {
  border-bottom: 1px solid var(--dashboard-border);
  transition: background 0.1s;
}

tbody tr:last-child {
  border-bottom: none;
}

tbody tr:hover {
  background: var(--dashboard-hover);
}

tbody td {
  padding: 12px 16px;
  color: var(--dashboard-fg);
  vertical-align: middle;
}

tbody td code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--dashboard-bg);
  border: 1px solid var(--dashboard-border);
  border-radius: 4px;
  padding: 2px 8px;
  color: var(--dashboard-fg);
}

.table-empty {
  text-align: center;
  padding: 40px 16px;
  color: var(--dashboard-muted);
  font-size: 14px;
}

/* ==========================================================================
   FORM / INPUT STYLES (dark theme)
   ========================================================================== */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--dashboard-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--dashboard-fg);
  background: var(--dashboard-input-bg);
  border: 1px solid var(--dashboard-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
select:focus,
textarea:focus {
  border-color: var(--dashboard-accent);
  box-shadow: 0 0 0 3px var(--dashboard-input-focus);
}

input::placeholder,
textarea::placeholder {
  color: var(--dashboard-muted);
}

select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b6b80' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

textarea {
  min-height: 80px;
  resize: vertical;
}

.form-group {
  margin-bottom: 16px;
}

.form-hint {
  font-size: 12px;
  color: var(--dashboard-muted);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}

.form-row > * {
  flex: 1;
}

/* ==========================================================================
   MODAL STYLES
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--dashboard-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--dashboard-card);
  border: 1px solid var(--dashboard-border);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: var(--dashboard-fg);
}

.modal-close {
  padding: 6px;
  border-radius: 6px;
  background: none;
  border: none;
  color: var(--dashboard-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.modal-close:hover {
  color: var(--dashboard-fg);
  background: var(--dashboard-hover);
}

.modal-close svg {
  width: 18px;
  height: 18px;
}

.modal-body {
  margin-bottom: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==========================================================================
   SUMMARY GRID / STAT BOXES (usage page)
   ========================================================================== */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.stat-box {
  background: var(--dashboard-card);
  border: 1px solid var(--dashboard-border);
  border-radius: 12px;
  padding: 16px 20px;
}

.stat-box-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--dashboard-muted);
  margin-bottom: 6px;
}

.stat-box-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--dashboard-fg);
  font-variant-numeric: tabular-nums;
}

.stat-box-value.accent {
  color: var(--dashboard-accent);
}

.stat-box-sub {
  font-size: 12px;
  color: var(--dashboard-muted);
  margin-top: 2px;
}

/* ==========================================================================
   STATUS BADGES (for key status, team roles, etc.)
   ========================================================================== */
.badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 4px;
}

.badge-active {
  color: var(--dashboard-success);
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.badge-revoked {
  color: var(--dashboard-danger);
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.badge-warning {
  color: var(--dashboard-warning);
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.badge-muted {
  color: var(--dashboard-muted);
  background: var(--dashboard-hover);
  border: 1px solid var(--dashboard-border);
}

.badge-oauth {
  background: rgba(34, 197, 94, 0.12);
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

/* ==========================================================================
   UTILITY CLASSES
   ========================================================================== */
.text-muted { color: var(--dashboard-muted); }
.text-secondary { color: var(--dashboard-secondary); }
.text-accent { color: var(--dashboard-accent); }
.text-danger { color: var(--dashboard-danger); }
.text-success { color: var(--dashboard-success); }
.text-mono { font-family: var(--font-mono); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 10px; }

.mt-0 { margin-top: 0; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

.flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }

.hidden { display: none; }

/* ---------------------------------------------------------------------------
 * Observation drawer (Traces -> request detail).
 *
 * Right-side sheet; full-screen on mobile. Renders the body of a single
 * inference. Lives in portal/ only — the sessions branch's Gantt can
 * import from here once it lands.
 * ------------------------------------------------------------------------ */

.obs-drawer-overlay {
  position: fixed;
  inset: 0;
  background: var(--dashboard-overlay);
  z-index: 998;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease-out;
}
.obs-drawer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.obs-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 480px;
  max-width: 100vw;
  background: var(--dashboard-card);
  border-left: 1px solid var(--dashboard-border);
  z-index: 999;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 180ms ease-out;
}
.obs-drawer.active {
  transform: translateX(0);
}
@media (max-width: 720px) {
  .obs-drawer { width: 100vw; border-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .obs-drawer, .obs-drawer-overlay { transition: none; }
}

.obs-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--dashboard-border);
  position: sticky;
  top: 0;
  background: var(--dashboard-card);
  z-index: 1;
}
.obs-drawer-head h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.obs-drawer-close {
  background: none;
  border: 0;
  color: var(--dashboard-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.obs-drawer-close:hover { color: var(--dashboard-fg); }

.obs-drawer-body { padding: 14px 16px 24px; }

.obs-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 8px 0 16px;
}
.obs-meta div { margin: 0; }
.obs-meta dt {
  font-size: 11px;
  color: var(--dashboard-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}
.obs-meta dd {
  margin: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.obs-meta-id { grid-column: 1 / -1; }
.obs-meta-id code {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--dashboard-secondary);
}

.obs-section {
  border: 1px solid var(--dashboard-border);
  border-radius: 6px;
  margin-top: 10px;
  background: var(--dashboard-bg);
}
.obs-section > summary {
  cursor: pointer;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 500;
  user-select: none;
}
.obs-section[open] > summary { border-bottom: 1px solid var(--dashboard-border); }
.obs-section-body { padding: 10px 12px; }
.obs-section-hint {
  font-size: 11px;
  color: var(--dashboard-secondary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.obs-json-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.obs-json {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--dashboard-input-bg);
  border: 1px solid var(--dashboard-border);
  border-radius: 4px;
  padding: 8px 10px;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 360px;
  overflow: auto;
}

.redacted-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border-radius: 10px;
  background: var(--dashboard-hover);
  color: var(--dashboard-secondary);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.redacted-chip-icon {
  flex: 0 0 auto;
  /* SVG path uses currentColor; the chip's `color:` is the icon tint. */
}
/* Item 4: distinguish POLICY-HIDDEN ("the gateway refuses to serve this")
 * from NOT-RECORDED ("this row simply doesn't have a value"). The two
 * variants land on the same base `.redacted-chip` so legacy callers
 * that don't pass a kind still render reasonably.
 *
 *   .redacted-chip-policy      — solid fill, lock icon, label "redacted"
 *   .redacted-chip-unavailable — outlined, dashed border, em-dash glyph
 */
.redacted-chip-policy {
  background: var(--dashboard-hover);
  color: var(--dashboard-fg);
  border: 1px solid var(--dashboard-border);
}
.redacted-chip-unavailable {
  background: transparent;
  color: var(--dashboard-secondary);
  border: 1px dashed var(--dashboard-border);
}
/* The unavailable variant uses an em-dash *prefix* glyph (the ::before
 * pseudo-element) so the chip reads as "— unavailable" without the
 * label text needing to encode the glyph. */
.redacted-chip-unavailable::before {
  content: '\2014'; /* em-dash */
  margin-right: 2px;
  color: var(--dashboard-muted);
}

.privacy-banner {
  border: 1px solid var(--dashboard-border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12px;
  margin-bottom: 12px;
  line-height: 1.4;
}
.privacy-banner-warn {
  border-color: rgba(245, 158, 11, 0.4);
  background: rgba(245, 158, 11, 0.08);
  color: var(--dashboard-warning);
}
.privacy-banner-muted {
  background: var(--dashboard-hover);
  color: var(--dashboard-secondary);
}

/* Trace row affordances. Whole row is the click target; the trailing
 * glyph is a sighted-user hint. tabindex=0 + role=button on the <tr>
 * gives keyboard + AT users the same affordance. */
.trace-row { cursor: pointer; }
.trace-row:hover { background: var(--dashboard-hover); }
.trace-row:focus { outline: 2px solid var(--dashboard-input-focus); outline-offset: -2px; }
.trace-row-glyph {
  color: var(--dashboard-secondary);
  font-size: 12px;
  margin-left: 4px;
}
/* 429 cool-down: dim the table and block pointer events for ~5s so a
 * user who hit the per-user obs budget doesn't keep firing requests. */
.obs-rows-disabled { opacity: 0.5; pointer-events: none; }

/* ─── Item 6: shared JSON-highlight palette ──────────────────────────
 * The shared highlighter (ui/web/shared/json_highlight.js) emits two
 * class names per token — the legacy short form (.key, .string, ...)
 * for the admin observations page, and the prefixed form
 * (.json-key, .json-string, ...) we scope under `.obs-json` here so
 * we don't trample on any other page that happens to use one of the
 * short names. */
.obs-json .json-key     { color: var(--dashboard-accent); }
.obs-json .json-string  { color: var(--dashboard-fg); }
.obs-json .json-number  { color: var(--dashboard-warning); }
.obs-json .json-boolean { color: var(--dashboard-warning); }
.obs-json .json-null    { color: var(--dashboard-secondary); }

/* ─── Item 7: mobile bottom-sheet (static, no drag-to-dismiss) ──────
 * On narrow viewports the right-side drawer becomes a bottom sheet —
 * the same control surface but anchored to the bottom edge so the
 * thumb-zone reaches the close button. Drag-to-dismiss is
 * intentionally deferred (the static sheet is already a step-up over
 * the v1 fullscreen takeover); backdrop-tap and the close button still
 * dismiss. The 500px breakpoint is narrower than the 720px breakpoint
 * above on purpose: phones get the sheet, small tablets keep the
 * full-screen drawer. */
@media (max-width: 500px) {
  .obs-drawer {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100vw;
    height: 80vh;
    transform: translateY(100%);
    border-left: 0;
    border-top: 1px solid var(--dashboard-border);
    border-radius: 12px 12px 0 0;
  }
  .obs-drawer.active {
    /* Sheet rests at 20vh from the top → 80vh visible height (matches
     * the `height: 80vh` rule above). */
    transform: translateY(20vh);
  }
}

/* (Removed) The previous prefers-reduced-motion @media rule for the
 * bottom-sheet was a no-op: it duplicated the active-state transform
 * already declared above. The earlier global `prefers-reduced-motion`
 * block neutralises `transition` (not `transform`), so the bottom sheet
 * already snaps into place at translateY(20vh) without animation. */

/* ── Trace-list filter strip (Next-2b) ─────────────────────────────── */
#traceFilterStrip {
  margin-bottom: 12px;
  padding: 10px 12px;
}
.trace-filter-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  padding: 4px 0;
  font: inherit;
}
.trace-filter-pill {
  font-size: 13px;
  color: var(--dashboard-text-muted, #9aa);
}
.trace-filter-grid {
  display: none;
  margin-top: 12px;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
#traceFilterStrip.expanded .trace-filter-grid,
#usageFilterStrip.expanded .trace-filter-grid {
  display: grid;
}
.trace-filter-toggle .toggle-glyph {
  display: inline-block;
  transition: transform 120ms ease;
}
#traceFilterStrip.expanded .trace-filter-toggle .toggle-glyph,
#usageFilterStrip.expanded .trace-filter-toggle .toggle-glyph {
  transform: rotate(180deg);
}
.trace-filter-search {
  display: flex;
  align-items: center;
  gap: 6px;
}
.trace-filter-search input {
  flex: 1;
}
/* Banner for deep-link rows that fall outside the current filter view. */
.banner {
  padding: 10px 14px;
  border-radius: 6px;
  margin: 8px 0;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.banner-info {
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.3);
  color: #cfe1ff;
}
.banner code {
  font-family: ui-monospace, SFMono-Regular, monospace;
}
@media (max-width: 720px) {
  .trace-filter-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==========================================================================
   Activity tab — Gantt session viewer (Next-2.5)
   ========================================================================== */
.activity-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: stretch;
  min-height: 400px;
}
.activity-sessions {
  border: 1px solid var(--dashboard-border);
  border-radius: 6px;
  overflow-y: auto;
  max-height: 600px;
  background: var(--dashboard-card);
}
.activity-session-card {
  padding: 10px 12px;
  border-bottom: 1px solid var(--dashboard-border);
  cursor: pointer;
  outline: none;
}
.activity-session-card:hover,
.activity-session-card:focus-visible {
  background: var(--dashboard-hover);
}
.activity-session-card.active {
  background: rgba(99, 102, 241, 0.10);
  border-left: 3px solid var(--dashboard-accent);
}
.activity-session-id {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 12px;
  font-weight: 500;
  color: var(--dashboard-fg);
  display: flex;
  gap: 6px;
  align-items: center;
}
.activity-session-meta {
  display: flex;
  gap: 10px;
  margin-top: 4px;
  font-size: 11px;
  color: var(--dashboard-secondary);
  flex-wrap: wrap;
}
.activity-gantt {
  border: 1px solid var(--dashboard-border);
  border-radius: 6px;
  background: var(--dashboard-card);
  padding: 12px 14px;
  overflow-x: auto;
}
.activity-gantt-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--dashboard-border);
  margin-bottom: 10px;
}
.activity-gantt-title {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 13px;
  color: var(--dashboard-fg);
}
.activity-gantt-axis {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--dashboard-secondary);
  gap: 16px;
}
.activity-gantt-tracks {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.activity-track {
  display: grid;
  grid-template-columns: 28px 1fr 220px;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  cursor: pointer;
  outline: none;
  border-radius: 4px;
}
.activity-track:hover,
.activity-track:focus-visible {
  background: var(--dashboard-hover);
}
.activity-track-num {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 11px;
  color: var(--dashboard-muted);
  text-align: right;
}
.activity-track-rail {
  position: relative;
  height: 14px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 3px;
}
.activity-track-bar {
  position: absolute;
  top: 1px;
  bottom: 1px;
  border-radius: 2px;
  min-width: 2px;
}
.activity-track-label {
  font-size: 11px;
  color: var(--dashboard-secondary);
  font-family: ui-monospace, SFMono-Regular, monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.activity-empty,
.activity-skeleton,
.activity-error,
.activity-truncated {
  padding: 16px;
  font-size: 12px;
  color: var(--dashboard-secondary);
}
.activity-error {
  color: var(--dashboard-danger);
}
.activity-truncated {
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  margin-bottom: 10px;
  border-radius: 0 4px 4px 0;
}
/* Mobile fallback list — hidden on desktop, shown <900px in place of
   the two-column Gantt. The desktop layout is unreadable below 900px
   (Gantt bars become too narrow), and a card list is the ergonomic
   shape for touch. */
.activity-mobile-list { display: none; }
@media (max-width: 899px) {
  .activity-layout { display: none; }
  .activity-mobile-list {
    display: block;
    border: 1px solid var(--dashboard-border);
    border-radius: 6px;
    background: var(--dashboard-card);
  }
}

/* ==========================================================================
   Group-by-session buckets on Traces tab (Next-2.5)
   ========================================================================== */
.trace-groupby-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.trace-bucket-header {
  background: rgba(99, 102, 241, 0.06);
  cursor: pointer;
  outline: none;
}
.trace-bucket-header:hover,
.trace-bucket-header:focus-visible {
  background: rgba(99, 102, 241, 0.12);
}
.trace-bucket-header td {
  padding: 8px 10px;
  font-size: 12px;
  border-top: 1px solid var(--dashboard-border);
}
.trace-bucket-label {
  font-weight: 500;
}
.trace-bucket-chev {
  display: inline-block;
  width: 1em;
  text-align: center;
  color: var(--dashboard-secondary);
}
