/* =============================================================================
   SOVEREIGN HUD TACTICAL MICRO-CHART & VISUAL WIDGET ENGINE (MODULAR)
   Co-authored-by: Flowork OS <agent@floworkos.com>
   Widgets: KPI Deck, Trading Candlestick, Line Chart, Bar Chart, Donut Chart,
            Radar Chart, Gauge Meter, Pipeline Tracker, Data Grid,
            Architecture Diagram, Log Streamer
   Doctrine: 100% Frameless, Organic Chat Fusion, Deep Elegant Shadow
   ============================================================================= */

/* =============================================================================
   LIVE EXECUTION HUD: ZERO-CORNER HOLOGRAPHIC VISUAL SYNTHESIZER DOME
   (.fl-live-render-visual)
   ============================================================================= */
.fl-live-render-visual {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 8px 0;
  padding: 14px 18px;
  border-radius: 34px;
  background: radial-gradient(120% 140% at 15% 10%, rgba(0, 240, 255, 0.14) 0%, rgba(168, 85, 247, 0.1) 45%, rgba(9, 14, 28, 0.95) 100%);
  border: 1px solid rgba(0, 240, 255, 0.32);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), inset 0 0 22px rgba(0, 240, 255, 0.08);
  overflow: hidden;
  font-family: var(--font-mono, 'JetBrains Mono', monospace);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.fl-live-render-visual.is-locked {
  border-color: rgba(16, 185, 129, 0.48);
  background: radial-gradient(120% 140% at 15% 10%, rgba(16, 185, 129, 0.16) 0%, rgba(6, 182, 212, 0.08) 50%, rgba(9, 14, 28, 0.95) 100%);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55), 0 0 20px rgba(16, 185, 129, 0.18);
}

.fl-live-render-visual.is-finished {
  opacity: 0;
  transform: translateY(-6px) scale(0.97);
}

.fl-rv-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.fl-rv-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1;
}

.fl-rv-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, rgba(0, 240, 255, 0.22), rgba(168, 85, 247, 0.22));
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: #00f0ff;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  white-space: nowrap;
  flex-shrink: 0;
}

.fl-rv-type-chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.18);
  border: 1px solid rgba(168, 85, 247, 0.38);
  color: #e9d5ff;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.fl-rv-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(0, 240, 255, 0.12);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: #38bdf8;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.05em;
  white-space: nowrap;
  flex-shrink: 0;
}

.fl-live-render-visual.is-locked .fl-rv-badge {
  background: rgba(16, 185, 129, 0.18);
  border-color: rgba(16, 185, 129, 0.45);
  color: #34d399;
}

.fl-rv-body {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-width: 0;
}

.fl-rv-orb-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle, rgba(0, 240, 255, 0.22) 0%, rgba(15, 23, 42, 0.9) 75%);
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.25), inset 0 0 12px rgba(168, 85, 247, 0.25);
}

.fl-rv-orb-ring {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #00f0ff, #a855f7, #10b981, #38bdf8, #00f0ff);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  animation: fl-rv-spin 2.2s linear infinite;
}

.fl-live-render-visual.is-locked .fl-rv-orb-ring {
  animation-duration: 6s;
  background: conic-gradient(from 0deg, #10b981, #00f0ff, #10b981);
}

.fl-rv-orb-core {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(8, 13, 26, 0.92);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  padding-bottom: 10px;
  box-sizing: border-box;
}

.fl-rv-mini-bar {
  width: 4px;
  border-radius: 999px;
  background: linear-gradient(180deg, #00f0ff, #a855f7);
  animation: fl-rv-bar-pulse 0.85s ease-in-out infinite alternate;
}

.fl-rv-mini-bar:nth-child(1) { height: 10px; animation-delay: 0s; }
.fl-rv-mini-bar:nth-child(2) { height: 18px; animation-delay: 0.15s; }
.fl-rv-mini-bar:nth-child(3) { height: 13px; animation-delay: 0.3s; }
.fl-rv-mini-bar:nth-child(4) { height: 22px; animation-delay: 0.45s; }

.fl-rv-stream-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.fl-rv-title-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.18);
  min-width: 0;
}

.fl-rv-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #00f0ff;
  box-shadow: 0 0 8px #00f0ff;
  flex-shrink: 0;
}

.fl-rv-title-txt {
  color: #f8fafc;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  min-width: 0;
}

.fl-rv-meta-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.fl-rv-meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(0, 240, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.2);
  color: #94a3b8;
  font-size: 9.5px;
  font-weight: 600;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fl-rv-wave-pills {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(168, 85, 247, 0.1);
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.fl-rv-wave-seg {
  width: 12px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #00f0ff, #a855f7);
  animation: fl-rv-seg-glow 1s ease-in-out infinite alternate;
}

.fl-rv-wave-seg:nth-child(2) { animation-delay: 0.2s; }
.fl-rv-wave-seg:nth-child(3) { animation-delay: 0.4s; }
.fl-rv-wave-seg:nth-child(4) { animation-delay: 0.6s; }

@keyframes fl-rv-spin {
  to { transform: rotate(360deg); }
}

@keyframes fl-rv-bar-pulse {
  0% { transform: scaleY(0.45); opacity: 0.65; }
  100% { transform: scaleY(1.1); opacity: 1; }
}

@keyframes fl-rv-seg-glow {
  0% { opacity: 0.35; transform: scaleX(0.75); }
  100% { opacity: 1; transform: scaleX(1.08); }
}

/* --- Primary Widget Card Container --- */
.chat-chart-card {
  background: rgba(13, 22, 42, 0.45) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: none !important;
  outline: none !important;
  border-radius: 26px;
  margin: 14px 0;
  overflow: hidden;
  box-shadow: 0 14px 36px -4px rgba(0, 0, 0, 0.55), 0 4px 16px -2px rgba(0, 0, 0, 0.4) !important;
  transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  background: rgba(0, 240, 255, 0.04);
  border: none !important;
  outline: none !important;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
}

.chart-card-title {
  color: #00f0ff;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-shadow: 0 0 6px rgba(0, 240, 255, 0.4);
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-card-subtitle {
  font-size: 10px;
  color: #94a3b8;
  font-weight: 400;
  margin-left: 4px;
}

.chart-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chart-action-btn {
  background: rgba(0, 240, 255, 0.08);
  border: none !important;
  outline: none !important;
  color: #00f0ff;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 10px;
  font-family: monospace;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.chart-action-btn:hover {
  background: rgba(0, 240, 255, 0.22);
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.45);
  color: #ffffff;
}

.chart-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  box-sizing: border-box;
  border: none !important;
  outline: none !important;
}

.chart-raw-box {
  display: none;
  width: 100%;
  padding: 12px;
  background: rgba(4, 8, 18, 0.6);
  border: none !important;
  outline: none !important;
  font-family: monospace;
  font-size: 10.5px;
  color: #94a3b8;
  max-height: 180px;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 0 0 12px 12px;
}

/* =============================================================================
   1. DONUT CHART LAYOUT
   ============================================================================= */
.tactical-donut-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  width: 100%;
  flex-wrap: wrap;
}

.tactical-donut-graphic {
  display: flex;
  align-items: center;
  justify-content: center;
}

.tactical-donut-svg {
  width: 170px;
  height: 170px;
  filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.2));
}

.chart-donut-slice {
  transition: transform 0.2s, opacity 0.2s;
  cursor: pointer;
}

.chart-donut-slice:hover {
  opacity: 0.85;
}

.tactical-donut-legend {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 180px;
  font-family: monospace;
  font-size: 11px;
}

.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.03);
  border: none !important;
  outline: none !important;
}

.legend-color-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.legend-label {
  color: #e2e8f0;
  flex: 1;
}

.legend-val {
  color: #ffffff;
  font-weight: 700;
}

.legend-pct {
  color: #38bdf8;
  font-size: 10px;
  margin-left: 4px;
}

/* =============================================================================
   2. TRADING CANDLESTICK LAYOUT
   ============================================================================= */
.tactical-trading-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trading-ticker-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: rgba(0, 0, 0, 0.35);
  border: none !important;
  outline: none !important;
  border-radius: 6px;
  font-family: monospace;
}

.ticker-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticker-symbol {
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.ticker-tf {
  color: #38bdf8;
  font-size: 10px;
  padding: 1px 6px;
  background: rgba(56, 189, 248, 0.15);
  border: none !important;
  outline: none !important;
  border-radius: 3px;
}

.ticker-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ticker-price {
  font-size: 14px;
  font-weight: 800;
  font-family: monospace;
}

.ticker-change-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  border: none !important;
  outline: none !important;
}

.change-bull {
  color: #10b981;
  background: rgba(16, 185, 129, 0.18);
  border: none !important;
}

.change-bear {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.18);
  border: none !important;
}

.trading-svg-wrap {
  width: 100%;
  overflow-x: auto;
}

.tactical-trading-svg, .tactical-bar-svg, .tactical-line-svg {
  display: block;
  max-width: 100%;
}

.tactical-bar-container, .tactical-line-container {
  width: 100%;
}

/* =============================================================================
   3. TACTICAL CYBERPUNK KPI DECK (LEVEL 99 NENDANG HUD)
   ============================================================================= */
.chat-chart-kpi .chart-card-body {
  padding: 16px !important;
  align-items: stretch !important;
  width: 100% !important;
}

.tactical-kpi-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)) !important;
  gap: 14px !important;
  width: 100% !important;
  align-self: stretch !important;
  box-sizing: border-box !important;
}

.tactical-kpi-card {
  position: relative;
  background: rgba(13, 22, 42, 0.45) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: none !important;
  outline: none !important;
  border-radius: 8px;
  padding: 14px 16px 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 10px 28px -4px rgba(0, 0, 0, 0.5), 0 2px 8px -2px rgba(0, 0, 0, 0.3) !important;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s;
  overflow: hidden;
}

.tactical-kpi-card:hover {
  transform: translateY(-2px);
  border: none !important;
  outline: none !important;
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.65), 0 0 16px rgba(0, 240, 255, 0.2) !important;
}

/* Cyber Corner Accents */
.kpi-corner-tr {
  position: absolute;
  top: 0; right: 0;
  width: 8px; height: 8px;
  border-top: 2px solid var(--kpi-accent, #00f0ff);
  border-right: 2px solid var(--kpi-accent, #00f0ff);
  opacity: 0.85;
}

.kpi-corner-bl {
  position: absolute;
  bottom: 0; left: 0;
  width: 8px; height: 8px;
  border-bottom: 2px solid var(--kpi-accent, #00f0ff);
  border-left: 2px solid var(--kpi-accent, #00f0ff);
  opacity: 0.85;
}

.kpi-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.kpi-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-glyph {
  font-size: 13px;
  line-height: 1;
}

.kpi-card-label {
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.kpi-head-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-tag-chip {
  font-family: var(--font-mono, monospace);
  font-size: 9px;
  color: var(--kpi-accent, #00f0ff);
  opacity: 0.85;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.kpi-status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.kpi-card-main {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}

.kpi-card-val {
  font-family: var(--font-mono, monospace);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.1;
  background: linear-gradient(135deg, #ffffff 40%, var(--kpi-accent, #00f0ff) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.35));
}

.tactical-kpi-badge {
  font-family: var(--font-mono, monospace);
  font-size: 10.5px;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  border: none !important;
  outline: none !important;
}

.kpi-badge-up {
  color: #10b981;
  background: rgba(16, 185, 129, 0.15);
  border: none !important;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.2);
}

.kpi-badge-down {
  color: #f43f5e;
  background: rgba(244, 63, 94, 0.15);
  border: none !important;
  box-shadow: 0 0 8px rgba(244, 63, 94, 0.2);
}

.kpi-badge-neutral {
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: none !important;
}

.kpi-sparkline-wrap {
  width: 100%;
  height: 22px;
  margin-top: 4px;
  overflow: hidden;
}

.kpi-sparkline-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.kpi-card-desc {
  font-size: 10.5px;
  color: #64748b;
  margin-top: 2px;
}

/* =============================================================================
   4. PIPELINE TRACKER LAYOUT
   ============================================================================= */
.tactical-pipeline-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  overflow-x: auto;
  padding: 8px 4px;
}

.tactical-pipeline-stage {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  background: rgba(8, 14, 30, 0.65);
  border: none !important;
  outline: none !important;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  font-family: monospace;
  white-space: nowrap;
}

.stage-done {
  border: none !important;
  color: #10b981;
}

.stage-running {
  border: none !important;
  color: #00f0ff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.25) !important;
}

.stage-failed {
  border: none !important;
  color: #f43f5e;
}

.stage-pending {
  color: #64748b;
}

.pipeline-stage-icon {
  font-size: 12px;
  font-weight: bold;
}

.pipeline-stage-info {
  display: flex;
  flex-direction: column;
}

.pipeline-stage-name {
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
}

.pipeline-stage-status {
  font-size: 9px;
  opacity: 0.8;
}

.pipeline-stage-arrow {
  color: #475569;
  font-weight: bold;
  font-size: 14px;
}

/* =============================================================================
   5. DATA GRID WIDGET LAYOUT
   ============================================================================= */
.tactical-grid-container {
  width: 100%;
  overflow-x: auto;
}

.tactical-grid-table {
  width: 100%;
  border-collapse: collapse;
  font-family: monospace;
  font-size: 11px;
  border: none !important;
  outline: none !important;
}

.tactical-grid-table th {
  text-align: left;
  padding: 8px 12px;
  background: rgba(0, 240, 255, 0.06);
  color: #00f0ff;
  border: none !important;
  border-bottom: 1px solid rgba(0, 240, 255, 0.12) !important;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.tactical-grid-table td {
  padding: 8px 12px;
  border: none !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04) !important;
  color: #e2e8f0;
}

.tactical-grid-table tr:hover td {
  background: rgba(0, 240, 255, 0.04);
}

.grid-status-badge {
  padding: 2px 7px;
  border-radius: 3px;
  border: none !important;
  outline: none !important;
  background: rgba(0, 240, 255, 0.12);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
}

/* =============================================================================
   6. GAUGE METER LAYOUT
   ============================================================================= */
.tactical-gauge-container {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
}

.tactical-gauge-svg {
  width: 220px;
  height: 130px;
}

/* =============================================================================
   7. LOG STREAMER LAYOUT
   ============================================================================= */
.tactical-log-streamer {
  width: 100%;
  background: rgba(13, 22, 42, 0.45) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border: none !important;
  outline: none !important;
  border-radius: 8px;
  box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.5) !important;
  overflow: hidden;
  font-family: monospace;
}

.log-streamer-head {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(0, 240, 255, 0.06);
  border: none !important;
  outline: none !important;
  font-size: 10px;
  color: #38bdf8;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.log-streamer-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px #10b981;
}

.log-streamer-body {
  padding: 8px 12px;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.tactical-log-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  line-height: 1.4;
}

.log-time {
  color: #64748b;
  font-size: 9.5px;
}

.log-lvl-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 2px;
  border: none !important;
  outline: none !important;
}

.log-msg-text {
  color: #cbd5e1;
}

/* =============================================================================
   8. ARCHITECTURE DIAGRAM & RADAR CONTAINERS
   ============================================================================= */
.tactical-diagram-container, .tactical-radar-container {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tactical-diagram-svg, .tactical-radar-svg {
  display: block;
  max-width: 100%;
}
