:root {
  --bg: #070a13;
  --panel: rgba(255, 255, 255, 0.06);
  --panel-2: rgba(255, 255, 255, 0.09);
  --text: rgba(255, 255, 255, 0.92);
  --muted: rgba(255, 255, 255, 0.72);
  --muted-2: rgba(255, 255, 255, 0.55);
  --border: rgba(255, 255, 255, 0.14);
  --primary: #79a6ff;
  --danger: #ff5f6d;
  --success: #4bd37b;
  --shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  --radius: 16px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 25% -10%, rgba(121,166,255,0.22), transparent 55%),
    radial-gradient(1100px 700px at 85% 10%, rgba(75,211,123,0.12), transparent 55%),
    linear-gradient(180deg, #070a13, #05060e 60%, #05060e);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

a { color: inherit; text-decoration: none; }

.af-container { max-width: 1120px; margin: 0 auto; padding: 28px 18px 64px; }
.af-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  position: sticky;
  top: 12px;
  backdrop-filter: blur(12px);
  z-index: 5;
}

.af-brand { font-weight: 700; letter-spacing: 0.2px; }
.af-nav { display: flex; gap: 10px; align-items: center; }
.af-admin-panel {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(255, 95, 109, 0.28);
  background: rgba(255, 95, 109, 0.06);
}
.af-admin-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  font-weight: 650;
}
.af-pill {
  padding: 9px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
}
.af-pill:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.af-pill-primary { border-color: rgba(121, 166, 255, 0.35); color: var(--text); background: rgba(121, 166, 255, 0.12); }
.af-pill-danger { border-color: rgba(255, 95, 109, 0.35); color: var(--text); background: rgba(255, 95, 109, 0.10); }

.af-hero { margin-top: 22px; display: grid; gap: 14px; }
.af-h1 { font-size: 34px; margin: 0; letter-spacing: -0.5px; }
.af-sub { margin: 0; color: var(--muted); line-height: 1.45; }

.af-card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}
.af-card-header { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.af-title { margin: 0; font-size: 16px; line-height: 1.3; }
.af-meta { margin-top: 6px; color: var(--muted-2); font-size: 12px; }
.af-badge {
  font-size: 12px;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  white-space: nowrap;
}

.af-grid { display: grid; gap: 12px; grid-template-columns: repeat(12, 1fr); }
.af-span-12 { grid-column: span 12; }
.af-span-6 { grid-column: span 6; }
@media (max-width: 860px) {
  .af-span-6 { grid-column: span 12; }
  .af-h1 { font-size: 28px; }
}

.af-carousel { position: relative; overflow: hidden; }
.af-carousel-track { display: flex; gap: 12px; transition: transform 320ms ease; }
.af-carousel-item { min-width: min(420px, 86vw); }
.af-carousel-controls { display: flex; gap: 10px; margin-top: 12px; }
.af-btn {
  cursor: pointer;
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}
.af-btn:hover { background: rgba(255, 255, 255, 0.08); }
.af-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.af-btn-primary { border-color: rgba(121, 166, 255, 0.35); background: rgba(121, 166, 255, 0.12); }
.af-btn-danger { border-color: rgba(255, 95, 109, 0.35); background: rgba(255, 95, 109, 0.10); }

.af-input {
  width: 100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
}
.af-input::placeholder { color: rgba(255, 255, 255, 0.38); }

.af-chat { display: grid; gap: 10px; }
.af-chat-msg { padding: 12px 12px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255, 255, 255, 0.04); }
.af-chat-msg-user { background: rgba(121, 166, 255, 0.11); border-color: rgba(121, 166, 255, 0.25); }
.af-chat-msg-assistant { background: rgba(255, 255, 255, 0.04); }
.af-chat-role { font-size: 12px; color: var(--muted-2); margin-bottom: 6px; }

.af-row { display: flex; gap: 10px; align-items: center; }
.af-row-wrap { flex-wrap: wrap; }
.af-grow { flex: 1; }

.af-spinner {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(121, 166, 255, 0.85);
  animation: af-spin 900ms linear infinite;
}
@keyframes af-spin { to { transform: rotate(360deg); } }

.af-error { color: rgba(255, 95, 109, 0.95); }
.af-muted { color: var(--muted); }
.af-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12px; }

.af-chart {
  position: relative;
  width: 100%;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: radial-gradient(800px 260px at 40% -20%, rgba(121, 166, 255, 0.18), transparent 52%),
    radial-gradient(800px 260px at 85% 20%, rgba(75, 211, 123, 0.10), transparent 50%),
    rgba(255, 255, 255, 0.03);
  overflow: hidden;
}
.af-chart::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255,255,255,0.08), transparent 42%, rgba(0,0,0,0.10));
  opacity: 0.55;
}
.af-chart svg { display: block; }
.af-chart-axis { fill: rgba(255,255,255,0.70); font-size: 11px; }
.af-chart-axis-muted { fill: rgba(255,255,255,0.45); font-size: 11px; }
.af-chart-grid { stroke: rgba(255,255,255,0.10); stroke-width: 1; shape-rendering: crispEdges; }
.af-chart-grid-soft { stroke: rgba(255,255,255,0.06); stroke-width: 1; }
.af-chart-line { stroke: rgba(121,166,255,0.95); stroke-width: 2.2; fill: none; }
.af-chart-area { fill: rgba(121,166,255,0.14); }
.af-chart-bar { fill: rgba(121,166,255,0.60); }
.af-chart-bar-muted { fill: rgba(255,255,255,0.10); }
.af-chart-marker { stroke: rgba(255,255,255,0.75); stroke-width: 1; }
.af-chart-dot { fill: rgba(255,255,255,0.95); stroke: rgba(121,166,255,0.95); stroke-width: 2; }

.af-chart-tooltip {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(5, 6, 14, 0.82);
  box-shadow: 0 14px 40px rgba(0,0,0,0.55);
  backdrop-filter: blur(10px);
  min-width: 140px;
  max-width: 260px;
}
.af-chart-tooltip-title { font-size: 12px; color: rgba(255,255,255,0.92); margin: 0 0 2px; }
.af-chart-tooltip-body { font-size: 12px; color: rgba(255,255,255,0.70); margin: 0; white-space: pre-wrap; }

.af-stat-row { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.af-stat { padding: 6px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,0.14); background: rgba(255,255,255,0.04); color: rgba(255,255,255,0.75); font-size: 12px; }
.af-stat strong { color: rgba(255,255,255,0.92); font-weight: 650; }

.af-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.af-legend-item {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.72);
  font-size: 12px;
  line-height: 1;
}
.af-legend-item::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--legend-color, rgba(255,255,255,0.55));
  box-shadow: 0 0 0 2px rgba(0,0,0,0.22);
}
.af-legend-item[aria-pressed="false"] { opacity: 0.55; }
.af-legend-item[aria-pressed="true"] { color: rgba(255,255,255,0.92); border-color: rgba(255,255,255,0.18); background: rgba(255,255,255,0.06); }
.af-legend-item[aria-disabled="true"] { cursor: default; pointer-events: none; opacity: 0.85; }
.af-legend-item:hover { background: rgba(255,255,255,0.08); color: rgba(255,255,255,0.92); }

.af-chart-button {
  appearance: none;
  display: block;
  width: 100%;
  border: none;
  padding: 0;
  background: none;
  text-align: inherit;
  cursor: pointer;
}
.af-chart-button:focus-visible {
  outline: 2px solid rgba(121,166,255,0.65);
  outline-offset: 5px;
  border-radius: 16px;
}

.af-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.62);
  backdrop-filter: blur(6px);
}
.af-modal {
  width: min(980px, 96vw);
  max-height: 92vh;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(5, 6, 14, 0.92);
  box-shadow: var(--shadow);
}
.af-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
}
.af-modal-title { font-size: 14px; font-weight: 650; letter-spacing: -0.2px; color: rgba(255, 255, 255, 0.92); }
.af-modal-body {
  padding: 16px;
  overflow: auto;
  max-height: calc(92vh - 64px);
}
