/* Genexts Generative UI (genui.js): charts, tables, comparisons, steps, stats and sandboxed pages in chat. */
.genui {
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --series-4: #c98500; --series-5: #d55181; --series-6: #008300;
  --g-surface: var(--r-surface, #17181b);
  --g-surface-2: var(--r-surface-2, rgba(255,255,255,0.04));
  --g-text: var(--r-text, #ececee);
  --g-text-2: var(--r-text-2, #a1a1aa);
  --g-text-3: var(--r-text-3, #8b8b94);
  --g-border: var(--r-border, rgba(255,255,255,0.07));
  --g-border-strong: var(--r-border-strong, rgba(255,255,255,0.12));
  --g-accent: var(--r-accent-text, #2ee6b6);
  margin: 14px 0;
  padding: 14px 16px 12px;
  background: var(--g-surface);
  border: 1px solid var(--g-border-strong);
  border-radius: var(--r-radius-lg, 16px);
  color: var(--g-text);
  max-width: 760px;
  font-size: 14px;
  line-height: 1.5;
}
html[data-theme="light"] .genui {
  --series-1: #2a78d6; --series-2: #eb6834; --series-3: #1baf7a; --series-4: #eda100; --series-5: #e87ba4; --series-6: #008300;
  --g-surface: #ffffff;
  --g-surface-2: #f6f6f8;
}
.genui * { box-sizing: border-box; }
.genui-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.genui-title { font-weight: 600; font-size: 15px; color: var(--g-text); }
.genui-sub { font-size: 12.5px; color: var(--g-text-2); margin-top: 2px; }
.genui-note { font-size: 12px; color: var(--g-text-3); margin-top: 8px; }
.genui-tools { display: flex; gap: 6px; flex-shrink: 0; }
.genui-raw { white-space: pre-wrap; font-size: 12px; }

.genui-seg { display: inline-flex; background: var(--g-surface-2); border: 1px solid var(--g-border); border-radius: 9px; padding: 2px; }
.genui-seg button { border: 0; background: none; color: var(--g-text-2); font: inherit; font-size: 12.5px; padding: 4px 10px; border-radius: 7px; cursor: pointer; min-height: 28px; }
.genui-seg button.on { background: var(--g-surface); color: var(--g-text); box-shadow: 0 1px 2px rgba(0,0,0,0.15); }
.genui-btn { border: 1px solid var(--g-border-strong); background: var(--g-surface-2); color: var(--g-text); font: inherit; font-size: 12.5px; padding: 5px 12px; border-radius: 9px; cursor: pointer; min-height: 30px; }
.genui-btn.primary { background: var(--r-accent, #2ee6b6); color: var(--r-accent-ink, #052e25); border-color: transparent; font-weight: 600; }
.genui-btn:disabled { opacity: 0.4; cursor: default; }
.genui-btn:focus-visible, .genui-seg button:focus-visible, .genui-steps-dots button:focus-visible { outline: 2px solid var(--g-accent); outline-offset: 2px; }

/* charts */
.genui-plot { width: 100%; }
.genui-chart { width: 100%; height: auto; display: block; overflow: visible; }
.genui-chart .gx-grid { stroke: var(--g-border); stroke-width: 1; }
.genui-chart .gx-grid.zero { stroke: var(--g-border-strong); }
.genui-chart .gx-tick { fill: var(--g-text-3); font-size: 11px; font-family: inherit; }
.genui-chart .gx-val { fill: var(--g-text-2); font-size: 11px; font-weight: 500; font-family: inherit; }
.genui-chart .gx-bar { stroke: var(--g-surface); stroke-width: 0; }
.genui-chart .gx-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.genui-chart .gx-area { opacity: 0.12; }
.genui-chart .gx-dot { stroke: var(--g-surface); stroke-width: 2; }
.genui-chart .gx-hit { fill: transparent; cursor: crosshair; }
.genui-chart .gx-cross { stroke: var(--g-text-3); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; pointer-events: none; }
.genui-chart .gx-cross.on { opacity: 0.7; }
.genui-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--g-text-2); margin: 0 0 6px; }
.genui-legend span { display: inline-flex; align-items: center; gap: 6px; }
.genui-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.genui-tip { position: fixed; z-index: 9999; pointer-events: none; display: none; max-width: 260px; padding: 8px 10px; border-radius: 10px;
  background: var(--r-surface, #17181b); color: var(--r-text, #ececee); border: 1px solid var(--r-border-strong, rgba(255,255,255,0.12));
  box-shadow: var(--r-shadow-pop, 0 12px 32px rgba(0,0,0,0.45)); font-size: 12.5px; line-height: 1.6; }
.genui-tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* tables */
.genui-table-wrap { overflow-x: auto; margin: 4px 0 0; }
.genui-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.genui-table th, .genui-table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--g-border) !important; vertical-align: top; }
.genui-table th { color: var(--g-text-2); font-weight: 600; font-size: 12.5px; white-space: nowrap; }
.genui-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.genui-table tbody tr:hover td { background: var(--g-surface-2); }

/* compare */
.genui-opts { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
@media (max-width: 640px) { .genui-opts { grid-template-columns: 1fr; } }
.genui-opt { background: var(--g-surface-2); border: 1px solid var(--g-border); border-radius: 12px; padding: 12px; }
.genui-opt-name { font-weight: 600; font-size: 14.5px; }
.genui-opt ul { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.genui-opt li { display: flex; gap: 8px; padding: 2px 0; color: var(--g-text-2); }
.genui-opt li span { width: 12px; flex-shrink: 0; font-weight: 700; color: var(--g-text); }
.genui-best { margin-top: 8px; font-size: 12.5px; color: var(--g-text-2); }
.genui-best span { color: var(--g-text-3); text-transform: uppercase; font-size: 10.5px; letter-spacing: 0.04em; margin-right: 4px; }
.genui-verdict { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: var(--r-accent-soft, rgba(46,230,182,0.12)); font-size: 13.5px; }
.genui-verdict b { margin-right: 6px; }

/* steps */
.genui-steps-dots { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.genui-steps-dots button { width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--g-border-strong); background: var(--g-surface-2);
  color: var(--g-text-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.genui-steps-dots button.done { color: var(--g-text); }
.genui-steps-dots button.on { background: var(--r-accent, #2ee6b6); color: var(--r-accent-ink, #052e25); border-color: transparent; font-weight: 700; }
.genui-step { min-height: 90px; }
.genui-step-n { font-size: 11.5px; color: var(--g-text-3); text-transform: uppercase; letter-spacing: 0.04em; }
.genui-step p { margin: 6px 0 0; color: var(--g-text-2); }
.genui-step-nav { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* stats */
.genui-stats { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); gap: 10px; }
@media (max-width: 560px) { .genui-stats { grid-template-columns: 1fr 1fr; } .genui-stat-value { font-size: 19px; } }
.genui-stat { background: var(--g-surface-2); border: 1px solid var(--g-border); border-radius: 12px; padding: 12px; }
.genui-stat-label { font-size: 12px; color: var(--g-text-2); }
.genui-stat-value { font-size: 24px; font-weight: 650; letter-spacing: -0.01em; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* sandboxed pages */
.genui-page { padding-bottom: 10px; }
.genui-frame { display: block; width: 100%; border: 0; border-radius: 10px; background: var(--g-surface); transition: height 0.15s ease; }
.genui-page.genui-max { position: fixed; inset: 24px; z-index: 9000; max-width: none; margin: 0; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,0.5); }
.genui-page.genui-max .genui-frame { height: calc(100vh - 140px) !important; }
body.genui-noscroll { overflow: hidden; }

/* while a block streams in */
.genui-pending { display: flex; align-items: center; gap: 10px; color: var(--g-text-3, #8b8b94); font-size: 13px; }
.genui.genui-pending { padding: 14px 16px; }
.genui-shimmer { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--g-border-strong, rgba(255,255,255,0.12));
  border-top-color: var(--r-accent, #2ee6b6); animation: genui-spin 0.9s linear infinite; }
@keyframes genui-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .genui-shimmer { animation: none; } .genui-frame { transition: none; } }
@media (forced-colors: active) { .genui-chart .gx-bar, .genui-legend i { forced-color-adjust: none; } }
