/* Trading Monitor UI Figma V1 baseline extension stylesheet. */

.workflow-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: var(--space-5);
}

.workflow-nav a {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.workflow-nav a:hover {
  background: var(--panel-2);
  color: var(--fg);
}

.workflow-nav a.active {
  background: var(--accent-light);
  color: var(--accent);
}

.workflow-nav .wf-sep {
  color: var(--muted-fg);
  font-size: var(--text-sm);
  margin: 0 var(--space-1);
}

@media (max-width: 768px) {
  .workflow-nav {
    flex-wrap: wrap;
  }
}

/* Dashboard */
.action-table {
  font-size: var(--text-sm);
  table-layout: fixed;
  width: 100%;
}

.action-table th,
.action-table td {
  padding: 3px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid var(--border);
}

.action-table thead th {
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 4px 5px;
  background: var(--panel-2);
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  position: sticky;
  top: 0;
}

.action-table tbody tr {
  height: 28px;
  transition: background 0.12s;
}

.action-table tbody tr:hover {
  background: var(--panel-2);
}

.action-table .at-name {
  max-width: 180px;
}

.action-table .at-sym {
  max-width: 72px;
  font-weight: 600;
}

.action-table td[data-num] {
  font-variant-numeric: tabular-nums;
}

.action-table .cbadge {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  line-height: 18px;
  border-width: 1px;
  border-style: solid;
}

.action-table .action-tag {
  padding: 1px 6px;
  font-size: 10px;
}

.sf-pill {
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--border) 72%, transparent);
  background: color-mix(in srgb, var(--panel-2) 88%, transparent);
  color: var(--fg);
  transition: all 0.15s;
  user-select: none;
}

.sf-pill:hover {
  background: color-mix(in srgb, var(--panel-2) 96%, transparent);
}

.sf-pill.active {
  background: color-mix(in srgb, var(--accent-light) 84%, var(--panel));
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
  color: var(--accent);
}

#liveTable {
  font-size: var(--text-sm);
  table-layout: fixed;
  width: 100%;
}

#liveTable th,
#liveTable td {
  padding: 3px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid var(--border);
}

#liveTable thead th {
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 4px 5px;
  background: var(--panel-2);
}

#liveTable th.sortable {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 14px;
}

#liveTable th.sortable::after {
  content: '⇅';
  position: absolute;
  right: 1px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.3;
  font-size: 9px;
}

#liveTable th.sortable.asc::after {
  content: '▲';
  opacity: 0.85;
}

#liveTable th.sortable.desc::after {
  content: '▼';
  opacity: 0.85;
}

#liveTable tbody tr {
  height: 28px;
  transition: background 0.12s;
}

#liveTable tbody tr:hover {
  background: var(--panel-2);
}

#liveTable .lt-name {
  max-width: 120px;
}

#liveTable .lt-sym {
  max-width: 72px;
  font-weight: 600;
}

#liveTable .lt-isin {
  max-width: 100px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
}

#liveTable .lt-asof {
  max-width: 70px;
  font-size: 10px;
  color: var(--muted);
}

#liveTable .lt-act {
  max-width: 110px;
}

#liveTable .cbadge {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
  line-height: 18px;
  border-width: 1px;
  border-style: solid;
}

.col-toggle-item {
  display: block;
  font-size: var(--text-sm);
  padding: 2px 0;
  cursor: pointer;
  user-select: none;
}

.col-toggle-item input {
  margin-right: 5px;
  vertical-align: middle;
}

#liveTable.hide-col-name .col-name,
#liveTable.hide-col-sym .col-sym,
#liveTable.hide-col-isin .col-isin,
#liveTable.hide-col-fnd .col-fnd,
#liveTable.hide-col-pf .col-pf,
#liveTable.hide-col-rsi .col-rsi,
#liveTable.hide-col-enter .col-enter,
#liveTable.hide-col-exit .col-exit,
#liveTable.hide-col-price .col-price,
#liveTable.hide-col-asof .col-asof,
#liveTable.hide-col-act .col-act,
#liveTable.hide-col-trd .col-trd,
#liveTable.hide-col-rgm .col-rgm,
#liveTable.hide-col-scr .col-scr,
#liveTable.hide-col-v2act .col-v2act,
#liveTable.hide-col-conv .col-conv,
#liveTable.hide-col-pnl .col-pnl,
#liveTable.hide-col-mktval .col-mktval,
#liveTable.hide-col-perf .col-perf {
  display: none;
}

.rgm-pill {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 10px;
  line-height: 16px;
  border: 1px solid;
}

.rgm-trend {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
  border-color: rgba(59, 130, 246, 0.3);
}

.rgm-range {
  background: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
  border-color: rgba(148, 163, 184, 0.3);
}

.rgm-highvol {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

#liveTable tbody tr.row-actionable {
  border-left: 3px solid #22c55e;
}

@keyframes pulse-fresh {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.signal-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  margin-right: 3px;
  vertical-align: middle;
}

.signal-fresh .signal-dot {
  background: #22c55e;
  animation: pulse-fresh 1.5s ease-in-out infinite;
}

.signal-fresh .signal-micro {
  font-size: 8px;
  font-weight: 700;
  color: #22c55e;
  letter-spacing: 0.03em;
  vertical-align: middle;
}

.signal-recent .signal-dot {
  background: #eab308;
}

.signal-aging {
  opacity: 0.7;
}

.signal-stale {
  opacity: 0.5;
}

.signal-age {
  font-size: 9px;
  color: var(--muted);
  margin-left: 2px;
}

.detail-row td {
  padding: 0 !important;
  border: none !important;
  background: var(--panel);
}

.detail-panel {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease-out;
  padding: 0 12px;
}

.detail-panel.open {
  max-height: 600px;
  padding: 12px;
}

.detail-grid {
  display: grid;
  grid-template-columns: 200px 1fr 1fr 1fr;
  gap: 14px;
  font-size: var(--text-sm);
}

@media (max-width: 900px) {
  .detail-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.detail-section {
  background: color-mix(in srgb, var(--panel-2) 72%, var(--panel));
  border-radius: var(--radius-sm);
  padding: 10px;
  border: 1px solid color-mix(in srgb, var(--border) 84%, transparent);
}

.detail-section h4 {
  margin: 0 0 8px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.detail-kv {
  display: flex;
  justify-content: space-between;
  padding: 2px 0;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
}

.detail-kv .dk {
  color: var(--muted);
}

.detail-kv .dv {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.detail-actions .btn-sm {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid color-mix(in srgb, var(--border) 85%, transparent);
  background: color-mix(in srgb, var(--panel-2) 88%, transparent);
  color: var(--fg);
  transition: background 0.2s;
}

.detail-actions .btn-sm:hover {
  background: color-mix(in srgb, var(--panel-2) 96%, transparent);
}

.detail-actions .btn-sm.primary {
  background: color-mix(in srgb, var(--accent-light) 80%, var(--panel));
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  color: var(--accent);
}

.spark-canvas {
  width: 100%;
  height: 60px;
  display: block;
  border-radius: 4px;
}

.score-bar-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin: 3px 0;
}

.score-bar-label {
  width: 50px;
  font-size: 10px;
  color: var(--muted);
  text-align: right;
}

.score-bar-track {
  flex: 1;
  height: 8px;
  background: color-mix(in srgb, var(--panel-2) 92%, transparent);
  border-radius: 4px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.3s;
}

.score-bar-val {
  width: 26px;
  font-size: 10px;
  font-weight: 600;
  text-align: right;
}

tr.row-expanded {
  border-left: 3px solid #60a5fa !important;
  background: color-mix(in srgb, #60a5fa 6%, var(--panel)) !important;
}

.settings-sym-table-compact {
  font-size: var(--text-sm);
  table-layout: fixed;
}

.settings-sym-table-compact th,
.settings-sym-table-compact td {
  padding: 3px 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.settings-sym-table-compact thead th {
  font-size: 10px;
  padding: 4px 5px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.settings-sym-table-compact tbody tr {
  height: 28px;
  transition: background 0.12s;
}

.settings-sym-table-compact tbody tr:hover {
  background: var(--panel-2);
}

.settings-sym-table-compact input[type="text"] {
  font-size: var(--text-sm);
  padding: 2px 5px;
  height: 22px;
  box-sizing: border-box;
  width: 100%;
}

/* Monitor */
.mono {
  font-family: var(--font-mono);
}

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stream {
  white-space: pre-wrap;
  max-height: 46vh;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  border-radius: var(--radius-md);
}

.tag {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: var(--text-sm);
}

.tag.ok {
  border-color: rgba(34, 197, 94, 0.5);
}

.tag.bad {
  border-color: rgba(239, 68, 68, 0.5);
}

.log-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.log-panel {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
}

.log-view {
  white-space: pre-wrap;
  font-family: var(--font-mono);
  max-height: 60vh;
  overflow: auto;
  padding: 10px;
}

.hl-buy {
  color: #22c55e;
  font-weight: 600;
}

.hl-exit {
  color: #f59e0b;
  font-weight: 600;
}

.hl-stop {
  color: #ef4444;
  font-weight: 600;
}

.hl-take {
  color: #8b5cf6;
  font-weight: 600;
}

.hl-err {
  color: #ef4444;
  font-weight: 600;
  text-decoration: underline;
}

.ts {
  color: var(--muted);
}

details.monitor-acc {
  margin-top: 14px;
}

details.monitor-acc > summary {
  cursor: pointer;
  font-weight: 700;
  margin: 0 0 10px;
}

details.monitor-acc[open] > summary {
  margin-bottom: 12px;
}

@media (max-width: 900px) {
  .grid2 {
    grid-template-columns: 1fr;
  }
}
